/* ==========================================================================
   Site stylesheet — juansidberry.com
   --------------------------------------------------------------------------
   From-scratch stylesheet for the site. Customize via the design tokens in :root below — the
   rest of the file consumes them.

   AESTHETIC: Axiom-inspired editorial layout wearing the "Amber walnut
   morning" palette (Figma resource library, scheme 13): mist #EBEFEE,
   sand #CCB499, terracotta #C8906D, amber #BB6C43, walnut #4A413C.
   Serif display type (Georgia stack, no webfonts), 680px reading measure,
   hairline borders, soft shadows. Amber is the interactive accent — the
   true #BB6C43 appears only on non-text UI (focus rings, 3:1 rule);
   text links use a darkened amber. All pairs meet WCAG AA.

   Sections:
     1. Design tokens        5. Hero (homepage)
     2. Reset + base         6. Page headers + prose content
     3. Accessibility        7. Video cards + watch page
     4. Header + nav         8. Footer
                             9. Calendar
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* Palette — "Amber walnut morning"; AA-checked on --bg/--surface */
  --bg: #ffffff;                  /* page background */
  --surface: #ffffff;             /* header, footer, cards */
  --ink: #4a413c;                 /* walnut — display text / headings (≈ 9.9:1) */
  --ink-soft: #5b4f47;            /* body text (≈ 7.5:1) */
  --ink-faint: #756a62;           /* meta text (≈ 5.3:1, AA) */
  --accent: #9c5228;              /* darkened amber — text links (≈ 5.8:1) */
  --hover: #295799;               /* link hover — blue, same saturation/lightness as --accent (≈ 7.2:1) */
  --accent-ui: #bb6c43;           /* TRUE amber — non-text UI only (≈ 3.9:1 ≥ 3:1) */
  --accent-ink: #ffffff;          /* text on accent/walnut */
  --sand: #ccb499;                /* band background, warm edges */
  --terracotta: #c8906d;          /* selection highlight */
  --mist: #ebefee;                /* inline-code background */
  --border: #e0d5c5;              /* hairlines — softened sand */

  /* Header/hero band — dark AI artwork (static/images/bg-ai.png) with mist
     text. --band-bg is the fallback color shown while the image loads.
     NOTE: the image is referenced RELATIVE to this CSS file
     ("../images/bg-ai.png") so it resolves wherever the site is served. */
  --band-bg: #1f1b18;
  --band-ink: #ebefee;
  /* Semi-transparent overlay between the artwork and the text: mutes the
     image so the mist text pops. Raise toward 0.7 for calmer, lower toward
     0.3 for more visible artwork. */
  --band-scrim: rgba(0, 0, 0, 0.65);

  /* Typography — system sans for UI, Georgia-stack serif for display/prose.
     Matches Axiom's shipped fallbacks; no webfont downloads. */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Axiom's bespoke steps: 13 / 15 / 21 / 26 / 34 / 40 px */
  --fs-xs: 0.8125rem;   /* 13px — small labels */
  --fs-sm: 0.9375rem;   /* 15px — nav, meta */
  --fs-base: 1rem;      /* 16px — UI text */
  --fs-prose: 1.1875rem;/* 19px — reading text */
  --fs-lg: 1.3125rem;   /* 21px */
  --fs-xl: 1.625rem;    /* 26px */
  --fs-2xl: 2.125rem;   /* 34px */
  --fs-hero: clamp(2.125rem, 5vw, 2.5rem); /* 34 → 40px */
  --leading: 1.7;
  --tracking-snug: -0.015em; /* Axiom title letter-spacing */

  /* Rhythm & shape — squarer, quieter than before */
  --wrap: 72rem;             /* max page width */
  --measure: 42.5rem;        /* 680px reading measure (Axiom/Medium) */
  --radius: 4px;
  --space: 1rem;
  --space-2: 2rem;
  --space-3: 3rem;
  --space-4: 5rem;
  --shadow-sm: 0 4px 12px 0 rgba(0, 0, 0, 0.05);  /* Axiom's "shadow-b" */
  --shadow-lg: 0 6px 16px rgba(0, 0, 0, 0.10);
}

/* --------------------------------------------------------------------------
   2. Reset + base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-soft);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--leading);
  text-rendering: optimizelegibility;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: var(--accent); }
a:hover { color: var(--hover); }

::selection { background: var(--terracotta); color: var(--accent-ink); }

/* Shared centered container */
.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

/* --------------------------------------------------------------------------
   3. Accessibility
   -------------------------------------------------------------------------- */
/* Hidden until focused, then jumps to the top-left as a visible link */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 0 0 var(--radius) 0;
  text-decoration: none;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--accent-ui); /* non-text: 3:1 rule, true amber ok */
  outline-offset: 2px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   4. Header + nav (sticky, white, soft bottom shadow — Axiom header)
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space);
  min-height: 64px;
  flex-wrap: wrap;
  padding-block: 8px;
}

.brand {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: var(--fs-lg);
  letter-spacing: var(--tracking-snug);
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { color: var(--hover); }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.5rem, 2vw, 1.5rem);
}

.site-nav a {
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--hover); }
.site-nav a.is-active {
  color: var(--ink);
  border-bottom-color: var(--ink); /* monochrome state marker */
}

/* --------------------------------------------------------------------------
   5. Hero (homepage) — white editorial masthead, serif title at weight 400
   -------------------------------------------------------------------------- */
.hero {
  background:
    linear-gradient(var(--band-scrim), var(--band-scrim)),
    var(--band-bg) url("../images/bg-ai.png") center / cover no-repeat;
  color: var(--band-ink);
  padding-block: 2rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero-portrait {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--surface); /* white ring pops on the sand band */
}

.hero-eyebrow {
  margin: var(--space-2) 0 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--band-ink);
}

.hero-title {
  margin: 0.25em 0 0;
  font-family: var(--font-serif);
  font-size: var(--fs-hero);
  font-weight: 400; /* Axiom titles are regular weight */
  line-height: 1.2;
  letter-spacing: var(--tracking-snug);
  color: var(--band-ink);
}

.hero-lead {
  margin: 0.75em auto 0;
  max-width: 40ch;
  font-size: var(--fs-lg);
  font-weight: 300;
  color: var(--band-ink);
}
.hero-lead-sep { color: inherit; opacity: 0.6; }

.hero-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space);
  margin-top: var(--space-2);
}

.button {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
/* On the dark band: primary button inverts to mist, ghost outlines in mist */
.button-primary {
  background: var(--band-ink);
  color: var(--ink);
}
.button-primary:hover { background: #ffffff; color: var(--ink); }
.button-ghost {
  border: 1px solid var(--band-ink);
  color: var(--band-ink);
}
.button-ghost:hover { background: rgba(255, 255, 255, 0.15); }

/* --------------------------------------------------------------------------
   6. Page headers + prose content
   -------------------------------------------------------------------------- */
.page-header {
  background:
    linear-gradient(var(--band-scrim), var(--band-scrim)),
    var(--band-bg) url("../images/bg-ai.png") center / cover no-repeat;
  color: var(--band-ink);
  padding-block: var(--space-3);
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.page-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--fs-2xl);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: var(--tracking-snug);
  color: var(--band-ink);
}

.page-subtitle {
  margin: 0.5em 0 0;
  font-size: var(--fs-lg);
  font-weight: 300;
  color: var(--band-ink);
}

/* Markdown body — shared by home/about/resume. Serif reading text at the
   680px measure, Medium-style. */
.prose {
  max-width: var(--measure);
  padding-block: var(--space-3);
  font-family: var(--font-serif);
  font-size: var(--fs-prose);
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  color: var(--ink);
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: var(--tracking-snug);
  line-height: 1.3;
  margin: 1.6em 0 0.6em;
}
.prose h1 { font-size: var(--fs-2xl); }
.prose h2 { font-size: var(--fs-xl); }
.prose h3 { font-size: var(--fs-lg); }

.prose p { margin: 0 0 1em; }
.prose li { margin-bottom: 0.4em; }
.prose strong { color: var(--ink); font-weight: 700; }

.prose a {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prose blockquote {
  margin: 1.5em 0;
  padding-left: 1em;
  border-left: 3px solid var(--ink); /* Medium-style dark quote bar */
  color: var(--ink-faint);
}

/* Axiom's signature fading rule, warmed to walnut */
.prose hr {
  height: 1px;
  border: 0;
  margin: 2em 0;
  background-image: linear-gradient(to left, rgba(74, 65, 60, 0), rgba(74, 65, 60, 0.35), rgba(74, 65, 60, 0));
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--mist);
  padding: 0.1em 0.35em;
  border-radius: var(--radius);
}

.prose img { border-radius: var(--radius); }

/* --------------------------------------------------------------------------
   7. Video cards + watch page
   -------------------------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-2);
  padding-block: var(--space-3);
}

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-media {
  display: block;
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Play triangle overlay so cards read as playable video */
.card-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-play::after {
  content: "";
  border-style: solid;
  border-width: 12px 0 12px 20px;
  border-color: transparent transparent transparent #fff;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.6));
  opacity: 0.9;
}

.card-body {
  display: block;
  padding: 14px 16px 16px;
}
.card-title {
  display: block;
  font-family: var(--font-serif);
  color: var(--ink);
  font-weight: 700;
  font-size: var(--fs-base);
  line-height: 1.4;
  letter-spacing: var(--tracking-snug);
}
.card-meta {
  display: block;
  margin-top: 6px;
  color: var(--ink-faint);
  font-size: var(--fs-xs);
}
.card-note {
  display: block;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-style: italic;
}

/* Watch page */
.watch { max-width: 60rem; padding-block: var(--space-3); }

.watch-player {
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.watch-player iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.watch-title {
  margin: var(--space-2) 0 0;
  font-family: var(--font-serif);
  color: var(--ink);
  font-size: var(--fs-xl);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: var(--tracking-snug);
}
.watch-channel {
  margin: 0.3em 0 0;
  color: var(--ink-faint);
  font-size: var(--fs-sm);
}
.watch-note {
  margin: var(--space) 0 0;
  padding-left: 1em;
  border-left: 3px solid var(--ink);
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink-soft);
}
.watch-links {
  margin-top: var(--space-2);
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.watch-links a {
  font-size: var(--fs-sm);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.watch-links a:hover { border-bottom-color: currentColor; }

/* --------------------------------------------------------------------------
   8. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: var(--space-3);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-block: var(--space-3);
  text-align: center;
}

.footer-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.footer-nav a {
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  text-decoration: none;
}
.footer-nav a:hover { color: var(--hover); }

.footer-social {
  display: flex;
  justify-content: center;
  gap: var(--space);
  margin-top: var(--space-2);
  opacity: 0.7;
}

.footer-copyright {
  margin: var(--space-2) 0 0;
  color: var(--ink-faint);
  font-size: var(--fs-xs);
}

/* --------------------------------------------------------------------------
   9. Calendar  (/calendar/ — built by static/js/calendar.js)
   -------------------------------------------------------------------------- */
.cal-wrap {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  padding-block: var(--space-3) 0;
}
.cal-side { flex: 0 0 9rem; }
.cal-main { flex: 1; min-width: 0; }

.year-block + .year-block { margin-top: 0.25rem; }
.year-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.8rem;
  background: var(--ink);
  color: var(--accent-ink);
  border: 0;
  border-radius: var(--radius);
  font: 400 var(--fs-lg) var(--font-serif);
  cursor: pointer;
}
.year-toggle[aria-expanded="true"] { border-radius: var(--radius) var(--radius) 0 0; }
.year-toggle .caret { font-size: var(--fs-xs); transition: transform 0.2s; }
.year-toggle[aria-expanded="true"] .caret { transform: rotate(180deg); }

.month-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface);
}
.month-list[hidden] { display: none; }
.month-list button {
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.8rem;
  background: none;
  border: 0;
  font: var(--fs-sm) var(--font);
  color: var(--ink-soft);
  cursor: pointer;
}
.month-list button:hover { color: var(--hover); }
.month-list button.active { background: var(--accent-ui); color: var(--accent-ink); }

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space);
}
.cal-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--fs-2xl);
  font-weight: 400;
  letter-spacing: var(--tracking-snug);
  color: var(--ink);
}
.cal-nav {
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-lg);
  line-height: 1;
  cursor: pointer;
}
.cal-nav:hover:not(:disabled) { border-color: var(--accent-ui); color: var(--hover); }
.cal-nav:disabled { opacity: 0.3; cursor: default; }
.year-toggle:focus-visible,
.month-list button:focus-visible,
.cal-nav:focus-visible { outline: 2px solid var(--accent-ui); outline-offset: 2px; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.cal-dow {
  padding: 0.6rem 0;
  text-align: center;
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--mist);
  border-bottom: 1px solid var(--border);
}
.cal-day {
  min-height: 6.5rem;
  padding: 0.5rem;
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.empty { background: #faf8f5; }
.cal-day.weekend { background: #fdfbf8; }
.cal-num { font-size: var(--fs-sm); color: var(--ink-soft); }
.cal-day.today .cal-num {
  display: inline-block;
  min-width: 1.7rem;
  line-height: 1.7rem;
  text-align: center;
  border-radius: 50%;
  background: var(--accent-ui);
  color: var(--accent-ink);
}

@media (max-width: 700px) {
  .cal-wrap { flex-direction: column; gap: var(--space); }
  .cal-side { flex: none; width: 100%; }
  .cal-day { min-height: 3.5rem; padding: 0.25rem; }
  .cal-title { font-size: var(--fs-xl); }
  .cal-dow { font-size: 0.6875rem; letter-spacing: 0.02em; }
}
