/* ==========================================================
   Site content inside the browser window (index.html).
   Miserabledolly-style boxes, but tidy. Semantic tokens only.
   Layout responds to the WINDOW width (container queries on .os-browser__page).
   ========================================================== */

/* ---- Layout values (home page + window width). FINAL: don't change unless Nick asks ---- */
:root {
  --win-max: 1470px;                         /* browser window max width */
  --banner-h: 102px;                         /* home banner height on desktop (phones stay shorter) */
  --banner-w: 68%;                           /* home banner width, % of the page's content area (centered over the main column) */
  --sidebar-w: clamp(220px, 20cqi, 260px);   /* home left sidebar */
  --panel-max: 920px;                        /* max width of the home main-column panels */
  --gap: 39px;                               /* home grid gutters (phones cap this at 16px) */
  --logo-scale: 0.75;                        /* home logo + its blue plate (1 = original size; phones always 1) */
}

/* ---- Shell: the swappable content region (components/site-nav.js) + skip link ---- */
.site-content:focus { outline: none; } /* focused after each page swap for keyboard/screen readers; no ring needed */
.site-content.is-entering { animation: site-content-in 0.16s ease-out; }
@keyframes site-content-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .site-content.is-entering { animation: none; } }

.skip-link {
  position: fixed;
  top: -60px;
  left: var(--space-3);
  z-index: calc(var(--z-taskbar-btn) + 1); /* above the menu bar, the toggles and the CRT overlay */
  padding: 6px 12px;
  background: var(--os-content);
  color: var(--os-text);
  border: 1px solid var(--os-outline);
  box-shadow: var(--os-win-shadow);
  font-family: var(--font-chrome);
  font-size: var(--os-size);
  text-decoration: none;
}
.skip-link:focus { top: calc(var(--menubar-h) + 6px); }

.site-page {
  max-width: 74rem;
  margin: 0 auto;
  padding: var(--space-6) clamp(var(--space-4), 4cqi, var(--space-7)) var(--space-6);
}

/* ---- Home: banner on top, then sidebar + fluid main (2 columns) ----
   Tighter than other pages: the star pattern shows only as a thin frame. */
.site-page.home {
  --home-pad: clamp(var(--space-2), 1.5cqi, var(--space-5)); /* side padding = the thin star frame */
  max-width: none;
  padding: var(--space-3) var(--home-pad) var(--space-4);
}

.home-banner {
  position: relative;
  width: var(--banner-w); /* % of the page's content area */
  /* Center over the main column (the "Welcome" panel): its center is
     sidebar + gap + half the panel width, using the same values as .home-grid.
     Clamped so the banner never crosses the window's edges (the 2px shadow included). */
  margin-left: clamp(
    calc(0px - var(--home-pad)),
    calc(var(--sidebar-w) + var(--gap) + min(var(--panel-max), 100% - var(--sidebar-w) - var(--gap)) / 2 - var(--banner-w) / 2),
    calc(100% - var(--banner-w) + var(--home-pad) - 2px)
  );
  margin-bottom: var(--space-7); /* room for the logo plate overlapping the bottom edge */
  border: 1px solid var(--os-outline);
  box-shadow: 2px 2px 0 var(--os-lo);
}

.home-banner__img {
  display: block;
  width: 100%;
  height: var(--banner-h);
  object-fit: cover;
  object-position: center;
}

/* Logo on a solid blue beveled plate, stuck over the banner's calmer right side */
.home-banner__plate {
  --plate-bottom: -34px;
  position: absolute;
  right: clamp(var(--space-3), 3cqi, var(--space-7)); /* bottom-right anchor: scaling keeps this corner put */
  bottom: var(--plate-bottom);
  padding: calc(var(--space-3) * var(--logo-scale)) calc(var(--space-4) * var(--logo-scale));
  background: var(--fill);
  border: 1px solid var(--os-outline);
  box-shadow:
    inset max(1px, calc(2px * var(--logo-scale))) max(1px, calc(2px * var(--logo-scale))) 0 var(--fill-highlight),
    max(2px, calc(3px * var(--logo-scale))) max(2px, calc(3px * var(--logo-scale))) 0 var(--shadow-small);
  transform: rotate(-2deg);
}

.home-banner__plate img {
  display: block;
  width: calc(clamp(150px, 22cqi, 300px) * var(--logo-scale));
  height: auto;
  aspect-ratio: 1752 / 268;
}

.home-grid {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, var(--panel-max));
  grid-template-areas: "side main";
  justify-content: start; /* main column hugs the sidebar; leftover width stays calm background */
  gap: var(--gap);
  align-items: start;
}

.home-main {
  grid-area: main;
  position: relative;
  z-index: 2; /* the tilted player's corners tuck BEHIND the main panels, never over them */
  display: grid;
  gap: var(--gap);
  container-type: inline-size;
}

.home-side {
  grid-area: side;
  position: relative;
  z-index: 1;
}

/* The player + camera's own box (the camera's % placement is relative to it, so it never moves) */
.home-side__player {
  display: flow-root; /* keeps the player's top margin inside, so this box matches the old sidebar exactly */
  position: relative;
  padding-bottom: 20px; /* room for the tilted player's lower corner */
}

/* Two gradient-title boxes under the player: 20px (above) + 16px here clear the tilted corner */
.home-side__boxes { margin-top: var(--space-4); }

/* Say hi (status line + "Email me") and Now hanging (found art + wall label): the two sidebar boxes, same width and
   gaps as before. Source: src/pages/home.html (the art: the "hanging" list in its settings block). */
.say-hi__body,
.now-hanging-box__body { padding: var(--space-3); }

.say-hi__status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.say-hi__dot { /* static status dot, no animation */
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: inset -1px -1px 0 var(--os-lo);
}
.say-hi__sub {
  margin: 2px 0 var(--space-3);
  color: var(--os-text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}
.say-hi__btn { /* full-width beveled button (the shared .os-btn states), a 44px tap target */
  display: flex;
  width: 100%;
  min-height: 44px;
}

.now-hanging {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  margin: 0;
}
.now-hanging picture { display: block; max-width: 100%; }
.now-hanging { --now-hanging-h: 176px; } /* the art's height; its width follows (never wider than the box) */
.now-hanging__img { /* hung straight: no tilt, no sticker border, the same very faint shadow it had in the Welcome inset */
  display: block;
  width: auto;
  max-width: 100%;
  height: var(--now-hanging-h);
  object-fit: contain;
  filter: drop-shadow(1px 2px 0 var(--inset-shadow));
}
.now-hanging__label { /* the wall label: the figure's caption */
  display: grid;
  color: var(--os-text-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.4;
  text-align: center;
}

/* ---- Main column: ONE window ("Hello!") with two nested insets ---- */
.home-window__body {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-3); /* same as the gap between the insets */
  font-size: inherit;
  line-height: inherit;
}

/* Welcome inset: the cloud scene on the left, vertically centered against ONE right-hand column that holds
   the paragraph and the button row (same left/right edges). Column max 800px; the scene + column group
   is centered in the inset. 24px padding above and below, 20px between paragraph and buttons.
   The scene is the shared component (components/cloud-scene.css + .js, template src/blocks/cloud-scene.html);
   only its WIDTH is set here: --home-scene-w (desktop 260px; window under ~1024px: 200px; phones: 220px, above the text). */
:root { --home-scene-w: min(100%, 260px); }

.home-welcome {
  display: grid;
  grid-template-columns: var(--home-scene-w) minmax(0, 800px);
  justify-content: center;
  align-items: center;
  column-gap: 28px;
  padding: 24px var(--space-4);
}

.home-welcome__scene { width: 100%; }

.home-welcome__col {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.home-welcome__copy { --welcome-p-gap: 0.9em; } /* the second paragraph is its own punch line */
.home-welcome__text {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
}

.home-welcome__text strong { font-weight: 700; }
.home-welcome__text + .home-welcome__text { margin-top: var(--welcome-p-gap); }

/* Four equal-width buttons spanning the column, equal gaps */
.home-welcome .web-btns { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.home-welcome .web-btn { width: auto; min-width: 0; }

/* The small "Psst" caption under the buttons: left-aligned with the button row, ~0.8 of the body size, muted */
.home-welcome__note {
  margin: -8px 0 0; /* 12px under the buttons (the column's 20px gap minus 8) */
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Selected work: a gradient-title panel under the Welcome inset, same width (the window body's column), same
   padding as the Welcome inset (24px top/bottom, --space-4 sides). Three link cards in one row (equal widths, 3% gaps,
   tops aligned; phones: one column), then the "A taste of the work" line with the "See all work" button at its right.
   The cards use the page system's card + framed styling (.pg-card, .pg-card__link, .pg-thumb: components/page-system.css);
   the variables below give them the Content page's sizes. */
.home-selected {
  --detail-scale: 1;
  --frame-pad: 3px;
  --sp-3: 12px;
}
.home-selected__body {
  display: grid;
  gap: 20px;
  padding: 24px var(--space-4);
}
.home-selected__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 3%;
  align-items: start;
  margin: 0;
  padding: 0;
  list-style: none;
}
.home-selected__more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}
.home-selected__more p {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.5;
}

/* Decorative sticker cluster around the sidebar box */
.home-stickers {
  position: absolute;
  z-index: 0; /* own stacking context: --s-z orders stickers in here, still behind the player (z-index 1) */
  /* Desktop: the sticker layer shrinks with the player (--player-scale, components/player.css) so its
     stickers keep their spot. Fixed width (260px = player max width + its old margin) so % sizes stay the
     same at every window width; the right edge stays centered on the sidebar as before. */
  top: 0;
  bottom: 0;
  right: calc((100% - min(100%, 260px) * var(--player-scale, 1)) / 2);
  width: calc(260px * var(--player-scale, 1));
  pointer-events: none;
}
/* Placement: --s-x / --s-y = CENTER as % of .home-stickers' width / height (not the player body),
   --s-w = width as % of .home-stickers' width, --s-r = rotation, --s-z = stack order in this layer.
   Values: the "Sticker placement" block in components/player.css */
.home-sticker {
  position: absolute;
  left: var(--s-x, 50%);
  top: var(--s-y, 50%);
  z-index: var(--s-z, auto);
  width: var(--s-w, 30%);
  height: auto;
  transform: translate(-50%, -50%) rotate(var(--s-r, 0deg));
  filter: var(--sticker-filter);
}

/* Main column under ~760px (a window narrower than ~1024px) */
@container (max-width: 47.5rem) {
  /* Welcome: smaller scene; the column is too narrow for four labels, so the buttons go 2x2 */
  .home-welcome { --home-scene-w: min(100%, 200px); }
  .home-welcome .web-btns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Main column narrow: the Welcome scene goes above the text (centered, 220px) */
@container (max-width: 34rem) {
  .home-welcome {
    --home-scene-w: min(100%, 220px);
    grid-template-columns: minmax(0, 1fr);
    row-gap: 20px;
  }
  .home-welcome__scene { width: var(--home-scene-w); justify-self: center; }
  .web-btn { min-height: 44px; } /* tap targets */
}

/* Phones (window under ~700px): the Selected work cards stack in one column of full-width cards */
@container window (max-width: 43.75rem) {
  .home-selected__list { grid-template-columns: minmax(0, 1fr); row-gap: 20px; }
}

/* Phone-width window: banner shrinks, sidebar moves below main, full width */
@container (max-width: 44rem) {
  /* phones: unchanged — full-width banner, original logo size */
  .home-banner { --logo-scale: 1; width: 100%; margin-left: 0; margin-bottom: var(--space-6); }
  .home-grid,
  .home-main { gap: min(var(--gap), 16px); }
  .home-banner__img { height: min(var(--banner-h), clamp(90px, 28cqi, 120px)); }
  .home-banner__plate { --plate-bottom: -26px; padding: var(--space-2) var(--space-3); }
  .home-banner__plate img { width: clamp(130px, 40cqi, 200px); }
  .home-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "side"; }
  .home-side__player { padding-top: var(--space-3); }
  /* full-width sidebar: the camera keeps its fixed phone spot inside the window (the sticker editor is desktop-only) */
  .home-sticker--corner { left: auto; right: 2px; top: -40px; width: 76px; transform: rotate(var(--s-r, 0deg)); }
  .home-stickers { inset: 0; width: auto; } /* phones: player is full size, stickers as before */
}

/* ---- Type ---- */
.site-headline {
  margin: 0 0 var(--space-5);
  font-size: calc(clamp(2.25rem, 1.4rem + 3cqi, 3.75rem) * var(--heading-scale));
  max-width: 18ch;
}

.site-prose {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.75;
}

.site-prose p { margin: 0 0 1.25em; max-width: 40rem; }
.site-prose p:last-child { margin-bottom: 0; }

.site-small {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text-muted);
}

/* ---- Work landing page: run-in intro + 2x2 grid of media-player cards (components/qt-card.css) ---- */
.site-page.work { max-width: 62rem; }

.work-intro {
  max-width: 75ch;
  margin: 0 0 var(--space-6);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
}

/* The intro's bold opener is a heading (heading font); the Welcome opener on Home stays Fira Sans bold */
.work-intro strong {
  font-family: var(--font-heading);
  font-weight: var(--heading-weight);
  font-synthesis: none;
  letter-spacing: var(--heading-tracking);
  line-height: 1; /* the decorative font's tall shapes must not stretch the line (same height in both modes) */
}

/* Card brand titles in the captions */
.work-caption strong {
  font-family: var(--font-heading);
  font-size: calc(1rem * var(--heading-scale));
  font-weight: var(--heading-weight);
  font-synthesis: none;
  letter-spacing: var(--heading-tracking);
  line-height: 1.45rem; /* fixed: same caption height in both heading modes */
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
  max-width: 896px; /* the cards keep their normal-window size in the wider expanded window (Work, Side Quests) */
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.work-caption {
  display: grid;
  gap: 2px;
  margin: var(--space-3) 0 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--text);
}

.work-caption span:last-child:not(:first-child) { color: var(--text-muted); }

@container (max-width: 44rem) {
  .work-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
}

/* ---- Stub pages ---- */
.stub {
  display: grid;
  gap: var(--space-5);
  max-width: 46rem;
  margin: 0 auto;
}

.stub .site-headline { margin: 0; max-width: none; }

.placeholder {
  display: inline-block;
  padding: 2px 8px;
  background: var(--surface-sunken);
  color: var(--text-muted);
  border: 1px dashed var(--os-lo);
  font-family: var(--font-chrome-text);
  font-size: var(--text-base);
}

.coming-soon {
  width: min(26rem, 90%);
  height: auto;
  margin: var(--space-4) auto;
  transform: rotate(-4deg);
  filter: var(--sticker-filter);
}

