/* Design tokens: every color, size, and timing the other stylesheets use. Change a value here and every use follows. */

/* Breakpoints. Media queries cannot read custom properties (custom media
   queries need a build step), so each stylesheet writes its widths as
   literals; this is their one list, and tests/stylesheets.test.js fails on a
   width that is not on it. A min-width one past a listed width starts the
   range after it.
     480px  narrow phones: entry cards stack and center, filters left-align,
            grid marks drop under the tag, and the rail position hides
     620px  the project grid goes to two columns
     700px  touch screens this wide set all three hero lines at full size
     720px  phones: the nav wraps onto two rows, panels start below it, and
            the selection marker shrinks
     900px  the project grid goes to three columns
    1100px  from 721px up to here, Skills sets three boxes to a row
    1200px  the project grid goes to four columns
   Input, not width, decides pointer behavior: (hover: hover) for hover
   feedback, (hover: none) for touch-only rules such as snapping. The hero's
   photo crop follows the aspect ratio (1 / 1). */

:root {
  /* Palette. Tints and fades are mixed from these with color-mix(), so they
     follow any change here. */
  --ink: #111111; /* cards, text on paper */
  --white: #ffffff;
  --paper: #f4f2ec; /* menu ground, logo tiles */
  --muted: #a09b90; /* meta lines */
  --dim: #6d6b65; /* inactive nav words, filters, view toggles, the credit (4.76:1 on paper) */
  --soft: #cfcfcf; /* body copy on ink */
  --bright: #eaeaea; /* emphasized copy on ink: degrees */
  --technical: #6cc7e6; /* technical accent */
  --creative: #e6b34c; /* creative accent */
  --green: #0ddb1b; /* experience bullets */
  --youtube: #ff0000; /* the YouTube mark on watch buttons (brand color) */
  --backdrop: color-mix(
    in srgb,
    var(--ink) 88%,
    var(--white)
  ); /* dark gray behind the 404 dialog */

  /* Lines and tints */
  --hairline: color-mix(in srgb, var(--white) 12%, transparent); /* dividers on ink */
  --scrollbar-on-paper: rgba(0, 0, 0, 0.25);
  --scrollbar-on-ink: color-mix(in srgb, var(--white) 25%, transparent);

  /* Layout */
  /* Side inset of panels and rails. Never less than a notch's safe area, so
     a phone held sideways keeps content out from under it. */
  --gutter: max(6vw, var(--safe-left), var(--safe-right));
  /* The screen's safe area (viewport-fit=cover in the HTML): 0 except on
     phones with a notch, rounded corners, or a home indicator. */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --card-w: 340px; /* collapsed project card */
  --entry-w: 560px; /* an experience or education card */
  --card-w-expanded: min(720px, 82vw); /* open project card in the rail */
  --rail-gap: 1.25rem; /* between rail cards */
  --fade-x: var(--gutter); /* edge fade on a sideways scroller */
  --fade-y: 2.5rem; /* edge fade on a list that scrolls up and down */

  /* Corner radii */
  --radius-surface: 22px; /* cards, skill boxes, the 404 dialog */
  --radius-inset: 16px; /* the logo tile and video slot inside an open card */
  --radius-pill: 999px; /* pills and pill buttons */

  /* Type sizes: six steps in whole pixels, where the pixel font renders
     sharpest. 12px is the floor for any text. */
  --text-xs: 0.75rem; /* 12px: meta lines, tags, pills, roles, stack lists, pill buttons */
  --text-sm: 0.8125rem; /* 13px: descriptions, bullets, filters, group titles, the credit */
  --text-md: 0.9375rem; /* 15px: degrees, the 404 label */
  --text-base: 1rem; /* 16px: nav words, panel base */
  --text-lg: 1.0625rem; /* 17px: card titles */
  --text-xl: 1.375rem; /* 22px: the hero sentence */

  /* Keyboard focus. The ring takes the text color (ink on paper, white on
     ink), so it reads on both surfaces. */
  --focus-ring-width: 2px;
  --focus-ring-offset: 3px;
  --focus-ring-room: 6px; /* how far wiped lines let a ring extend past their box */

  /* Motion: the menu choreography, in the order it plays. Opening a word
     moves the stage; the panel's boxes unfold, logos fade in, text wipes in
     line by line, and skill pills rise. Budget: a panel is fully in place
     within 700 ms of the click, even when switching from another panel
     (tests/browser/motion.test.js). Closing runs faster than opening, so a
     switch spends little time on the panel being left. */
  --stage-move: 0.55s; /* nav to the top, social icons to the bottom */
  --panel-switch-delay: 120ms; /* old panel folds before the new one forms (also read by js/menu.js) */
  --panel-hide-delay: 0.12s; /* a closing panel stays visible while its boxes fold */
  --unfold: 0.2s; /* ink boxes scale open from the center */
  --fold: 0.12s; /* and fold shut */
  --logo-delay: 0.15s;
  --logo-fade-in: 0.25s;
  --logo-fade-out: 0.12s;
  --wipe-start: 0.14s; /* first text line of a card starts its wipe, as its box nears full height */
  --wipe-step: 0.02s; /* each next line starts this much later */
  --bullet-wipe-start: calc(
    var(--wipe-start) + 4 * var(--wipe-step)
  ); /* experience bullets follow the four header lines */
  --wipe-in: 0.2s;
  --wipe-out: 0.12s;
  --pill-delay: 0.2s;
  --pill-rise: 0.3s;
  --pill-fade-in: 0.2s;
  --pill-out: 0.12s;
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1); /* overshoots, then settles */
  --filter-delay: 0.25s; /* project filters arrive after the rail forms */
  --filter-fade-in: 0.25s;
  --filter-fade-out: 0.12s;
  --scroll-up-return-delay: 0.6s; /* the up arrow returns after the stage recenters */
  --card-resize: 0.32s; /* a project card closing, and the rail spacer */
  --card-dim: 0.3s; /* neighbors dimming while a card is open */
  --edge-fade: 0.35s;

  /* Motion: the hero entrance. The caption is readable within 600 ms of load
     (tests/browser/motion.test.js). */
  --intro-delay: 0.15s;
  --intro-fade: 0.45s;
  --cue-delay: 0.9s;
  --cue-fade: 0.6s;
  --bounce-period: 1.8s; /* the up and down scroll cues */

  /* Motion: hover feedback */
  --hover-fast: 0.2s; /* buttons */
  --hover: 0.3s; /* icons, filters, links */
  --card-lift: 0.22s; /* a project card's hover scale */
  --nav-fade: 0.4s; /* nav words graying out when a panel opens */
  --dialog-pop: 0.35s; /* the 404 dialog appearing */
}

/* Reduced motion: every movement and fade becomes instant, so content
   appears at once (WCAG 2.3.3). */
/* Narrow phones: a narrower gutter, so cards use more of the screen. At 6vw
   a 360px phone kept only about three quarters of its width for them. */
@media (max-width: 480px) {
  :root {
    --gutter: max(16px, 4vw, var(--safe-left), var(--safe-right));
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --stage-move: 0s;
    --panel-switch-delay: 0ms;
    --panel-hide-delay: 0s;
    --unfold: 0s;
    --fold: 0s;
    --logo-delay: 0s;
    --logo-fade-in: 0s;
    --logo-fade-out: 0s;
    --wipe-start: 0s;
    --bullet-wipe-start: 0s;
    --wipe-step: 0s;
    --wipe-in: 0s;
    --wipe-out: 0s;
    --pill-delay: 0s;
    --pill-rise: 0s;
    --pill-fade-in: 0s;
    --pill-out: 0s;
    --filter-delay: 0s;
    --filter-fade-in: 0s;
    --filter-fade-out: 0s;
    --scroll-up-return-delay: 0s;
    --card-resize: 0s;
    --card-dim: 0s;
    --edge-fade: 0s;
    --intro-delay: 0s;
    --intro-fade: 0s;
    --cue-delay: 0s;
    --cue-fade: 0s;
    --bounce-period: 0s;
    --hover-fast: 0s;
    --hover: 0s;
    --card-lift: 0s;
    --nav-fade: 0s;
    --dialog-pop: 0s;
  }
}
