/* ============================================================
   styles.css
   Reset + typography defaults + component styles.
   Consumes tokens.css; layouts.css handles structural composition.
   ============================================================ */


/* ----- Minimal reset ----- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  /* Keep hash-link targets clear of the floating navbar. */
  scroll-padding-block-start: 5rem;
}

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd,
ul, ol {
  margin: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

img,
picture,
svg,
video {
  max-inline-size: 100%;
  display: block;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}


/* ----- Document defaults ----- */
html {
  font-family: var(--font-body);
  font-size: 100%;
  line-height: var(--line-height-normal);
  color: var(--color-ink);
  background-color: var(--color-bg);
  /* Switches to Inter Display cut at larger sizes automatically. */
  font-optical-sizing: auto;
}

body {
  font-size: var(--font-size-1);
  min-block-size: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Two ultra-subtle monochrome blobs give backdrop-filter:blur something
     to render on glass surfaces — without breaking the monochrome palette.
     Fixed so the gradient stays put while content scrolls over it. */
  background-image:
    radial-gradient(ellipse at 12% 8%,  var(--color-bg-blob) 0%, transparent 55%),
    radial-gradient(ellipse at 88% 96%, var(--color-bg-blob) 0%, transparent 55%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}


/* ----- Typography -----
   Hierarchy is established in size and weight first; color reinforces.
   Larger sizes get tighter leading and tighter tracking; small uppercase
   labels get looser tracking. */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: var(--font-weight-semibold);
  color: var(--color-ink);
  text-wrap: balance;
}

h1 {
  font-size: var(--font-size-5);
  line-height: var(--line-height-tight);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--font-size-4);
  line-height: var(--line-height-tight);
  letter-spacing: -0.015em;
}

h3 {
  font-size: var(--font-size-3);
  line-height: var(--line-height-snug);
  letter-spacing: -0.01em;
}

h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
}

h4 { font-size: var(--font-size-2); }
h5 { font-size: var(--font-size-1); text-transform: uppercase; letter-spacing: 0.05em; }
h6 { font-size: var(--font-size-0); text-transform: uppercase; letter-spacing: 0.05em; }

p {
  max-inline-size: var(--measure);
  text-wrap: pretty;
}

.lead {
  font-size: var(--font-size-2);
  line-height: var(--line-height-snug);
  font-weight: var(--font-weight-medium);
  color: var(--color-ink);
  letter-spacing: -0.005em;
}

.meta {
  font-size: var(--font-size-0);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-ink-muted);
  font-weight: var(--font-weight-medium);
}

blockquote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--font-size-3);
  line-height: var(--line-height-snug);
  border-inline-start: 3px solid var(--color-accent);
  padding-inline-start: var(--space-m);
  color: var(--color-ink);
  max-inline-size: var(--measure);
  text-wrap: balance;
}


/* ----- Links ----- */
a {
  color: var(--color-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--color-ink-muted);
  transition: text-decoration-color var(--transition-fast),
              text-decoration-thickness var(--transition-fast);
}

a:hover {
  text-decoration-color: var(--color-ink);
  text-decoration-thickness: 2px;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-focus);
  outline-offset: 3px;
}

.link-bare {
  text-decoration: none;
}


/* ----- Site header — floating sticky pill -----
   Centered inside the cover gutter, backdrop-blurred so content
   scrolls visibly underneath. */
.site-header {
  position: sticky;
  top: var(--space-s);
  z-index: 50;
  align-self: center;
  /* Match the outer width of the .center.center--wide main container
     (max --measure × 1.4, with --measure = 70ch on every page). */
  inline-size: min(100%, 98ch);
  margin-block-start: var(--space-s);
  margin-block-end: var(--space-xl);
  padding-block: var(--space-xs);
  padding-inline: var(--space-m);
  border: 1px solid color-mix(in srgb, var(--color-ink) 10%, transparent);
  border-radius: 999px;
  background-color: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  /* Outer drop + full-perimeter white inset rim + brighter top
     highlight — the Yablonski glass move at navbar intensity. */
  box-shadow:
    0 8px 32px -16px color-mix(in srgb, var(--color-ink) 12%, transparent),
    inset 0 0 0 1px color-mix(in srgb, white 22%, transparent),
    inset 0 1px 0 color-mix(in srgb, white 55%, transparent);
  /* Establish a query container so we can hide the name when the
     pill itself gets narrow — viewport-agnostic, no @media query. */
  container-type: inline-size;
  container-name: navbar;
}

.site-header .site-name {
  font-family: "Nothing You Could Do", cursive;
  font-size: var(--font-size-2);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  color: var(--color-ink);
}

/* Two visible forms for the wordmark: the full signature for wider
   navbars, just "BP" for narrow ones. The short form is aria-hidden;
   the full text stays in the accessibility tree at every size. */
.site-name-short { display: none; }

@container navbar (max-width: 30rem) {
  .site-name-full {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .site-name-short { display: inline; }
}

.site-header nav a {
  text-decoration: none;
  font-size: var(--font-size-0);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-ink-muted);
  font-weight: var(--font-weight-medium);
}

.site-header nav a:hover {
  color: var(--color-ink);
}


/* ----- Site footer ----- */
.site-footer {
  padding-block: var(--space-xl);
  border-block-start: 1px solid var(--color-rule);
  color: var(--color-ink-muted);
  font-size: var(--font-size-0);
}

.site-footer a {
  color: var(--color-ink-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--color-ink);
}


/* ----- Theme switcher (dev) -----
   Three small swatches in the footer that flip the <html data-theme>.
   Each swatch previews its palette as a diagonal bicolor pill.
   Currently hidden — flip `display` to `inline-flex` to show it,
   or call `localStorage.setItem('portfolio-theme', 'pastel'|'dark')`
   from devtools to switch palettes without the UI. */
.theme-switch {
  display: none;
  gap: var(--space-3xs);
  align-items: center;
}

.theme-swatch {
  inline-size: 1.25rem;
  block-size: 1.25rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--color-ink) 20%, transparent);
  cursor: pointer;
  transition: transform var(--transition-fast),
              box-shadow var(--transition-fast);
}

.theme-swatch:hover {
  transform: scale(1.12);
}

.theme-swatch:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-focus);
  outline-offset: 2px;
}

.theme-swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--color-bg),
              0 0 0 3px var(--color-ink);
}

.theme-swatch--neutral {
  background: linear-gradient(135deg,
    oklch(98.5% 0 0) 0%, oklch(98.5% 0 0) 50%,
    oklch(14.5% 0 0) 50%, oklch(14.5% 0 0) 100%);
}

.theme-swatch--pastel {
  background: linear-gradient(135deg,
    oklch(96% 0.025 75) 0%, oklch(96% 0.025 75) 50%,
    oklch(65% 0.14 25) 50%, oklch(65% 0.14 25) 100%);
}

.theme-swatch--dark {
  background: linear-gradient(135deg,
    oklch(20% 0.04 260) 0%, oklch(20% 0.04 260) 50%,
    oklch(62% 0.18 30) 50%, oklch(62% 0.18 30) 100%);
}


/* ----- Hero (landing) -----
   Display-sized headline. Tighter leading and tighter tracking than
   the standard h1; fluid sizing between project-page h1 and the
   landing hero ceiling. */
.hero h1 {
  font-size: clamp(var(--font-size-5), 5vw + 1rem, var(--font-size-6));
  line-height: var(--line-height-display);
  letter-spacing: -0.025em;
}


/* ----- Surface elevation family -----
   Every "card-like" surface on the site shares the same shadow recipe:
   an outer soft drop + a 1px white inset rim. Intensity scales by role:
     .box / .frame  → subtle  (info-dense surfaces, image wrappers)
     .site-header   → medium  (sticky pill, defined above)
     .project-card  → strong  (hero cards on the landing)
   This keeps glass and solid surfaces visually aligned — no gap between
   landing-page cards and the boxes on project pages. */
.box {
  /* Flat surface for non-clickable info cards. The tint sits below the
     body's radial-gradient range (94–98.5% lightness) so the card stays
     visibly distinct from the bg no matter where the gradient blobs
     fall behind it. No glass treatment — just a flat tinted surface. */
  background-color: color-mix(in srgb, var(--color-ink) 6%, var(--color-bg));
  border: 0;
}

.frame {
  box-shadow:
    0 2px 16px color-mix(in srgb, var(--color-ink) 6%, transparent),
    inset 0 0 0 1px color-mix(in srgb, white 18%, transparent),
    inset 0 1px 0 color-mix(in srgb, white 35%, transparent);
}

/* ----- Project card — Yablonski-style glass -----
   Translucent surface + heavy backdrop blur + layered shadow with a
   1px white inset rim. The blur picks up the body's radial gradients,
   so the cards read as actual glass even on a near-white page. */
.project-card {
  --box-padding: var(--space-l);
  /* Translucent glass surface — re-asserted here so the flat .box bg
     above doesn't apply to clickable cards. */
  background-color: color-mix(in srgb, var(--color-surface) 60%, transparent);
  text-decoration: none;
  color: inherit;
  display: block;
  /* Subtle dark outline + full-perimeter inset white rim + brighter
     top highlight. The dark border defines the edge against the light
     body; the inset rim is the "tiny bit of white" that lifts the card. */
  border: 1px solid color-mix(in srgb, var(--color-ink) 8%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow:
    0 4px 24px color-mix(in srgb, var(--color-ink) 10%, transparent),
    inset 0 0 0 1px color-mix(in srgb, white 25%, transparent),
    inset 0 1px 0 color-mix(in srgb, white 60%, transparent);
  transition: transform var(--transition-fast),
              box-shadow var(--transition-fast),
              border-color var(--transition-fast);
}

.project-card:hover {
  transform: translateY(-2px);
  color: inherit;
  border-color: color-mix(in srgb, var(--color-ink) 12%, transparent);
  box-shadow:
    0 12px 36px color-mix(in srgb, var(--color-ink) 16%, transparent),
    inset 0 0 0 1px color-mix(in srgb, white 35%, transparent),
    inset 0 1px 0 color-mix(in srgb, white 75%, transparent);
}

.project-card:focus-visible {
  outline-offset: 6px;
}

.project-card h2 {
  font-size: var(--font-size-3);
}

.project-card .project-meta {
  font-size: var(--font-size-0);
  color: var(--color-ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}


/* ----- Project page ----- */
.back-link {
  font-size: var(--font-size-0);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  color: var(--color-ink-muted);
}

.back-link:hover {
  color: var(--color-ink);
}

.project-title-block h1 {
  font-size: clamp(var(--font-size-4), 4vw + 1rem, var(--font-size-6));
  line-height: var(--line-height-display);
  letter-spacing: -0.025em;
}

.project-section h2 {
  font-size: var(--font-size-4);
}

.project-section h3 {
  font-size: var(--font-size-2);
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.figure-caption {
  font-size: var(--font-size-0);
  color: var(--color-ink-muted);
  margin-block-start: var(--space-2xs);
}

.pull-stat {
  font-family: var(--font-display);
  font-size: clamp(var(--font-size-4), 5vw, var(--font-size-6));
  line-height: var(--line-height-display);
  letter-spacing: -0.02em;
  color: var(--color-ink);
  font-weight: var(--font-weight-medium);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}


/* ----- Tag pill (cluster children, e.g. for role/discipline) -----
   Four harmonized pastels rotate across siblings. Every color shares
   the same lightness (93%) and chroma (0.07) — only the hue varies,
   so the set reads cohesive rather than confetti. */
.tag {
  display: inline-block;
  padding-block: var(--space-3xs);
  padding-inline: var(--space-xs);
  border-radius: 999px;
  font-size: var(--font-size-00);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-ink);
}

.tag:nth-child(4n+1) { background-color: oklch(93% 0.07  55); }  /* peach  */
.tag:nth-child(4n+2) { background-color: oklch(93% 0.07 145); }  /* sage   */
.tag:nth-child(4n+3) { background-color: oklch(93% 0.07 240); }  /* sky    */
.tag:nth-child(4n+4) { background-color: oklch(93% 0.07 290); }  /* lilac  */


/* ----- Prev / next nav at bottom of project pages ----- */
.prev-next {
  border-block-start: 1px solid var(--color-rule);
  padding-block-start: var(--space-l);
}

.prev-next a {
  text-decoration: none;
}

.prev-next .label {
  display: block;
  font-size: var(--font-size-00);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-ink-muted);
  margin-block-end: var(--space-3xs);
}

.prev-next .title {
  font-family: var(--font-display);
  font-size: var(--font-size-2);
}


/* ----- Cursor-following orb (landing page only) -----
   Fixed canvas behind page content but above body bg. z-index: -1
   puts it at the stacking layer above the body bg yet below in-flow
   content. The glass cards' backdrop-filter samples the canvas + body
   gradient as their backdrop, so the orb glows through the glass. */
#orb-canvas {
  position: fixed;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  pointer-events: none;
  z-index: -1;
}

/* ----- Password gate (project pages) -----
   Soft client-side lock. When body has .is-gated, the page contents
   are hidden and the overlay covers the viewport with a glass card. */
body.is-gated .cover > * {
  visibility: hidden;
}

.gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  place-items: center;
  padding: var(--space-m);
  background-color: color-mix(in srgb, var(--color-bg) 70%, transparent);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
}

/* Show the overlay only when body has .is-gated. The HTML element has
   the `hidden` attribute by default, so without this rule it stays
   display:none. JS unlocks by removing the body class — no DOM
   manipulation needed on the overlay itself. */
body.is-gated .gate-overlay {
  display: grid;
}

.gate-card {
  inline-size: min(100%, 26rem);
  padding: var(--space-l);
  border-radius: var(--box-radius);
  background-color: color-mix(in srgb, var(--color-surface) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-ink) 8%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow:
    0 12px 36px color-mix(in srgb, var(--color-ink) 14%, transparent),
    inset 0 0 0 1px color-mix(in srgb, white 25%, transparent),
    inset 0 1px 0 color-mix(in srgb, white 65%, transparent);
}

.gate-card h1 {
  font-size: var(--font-size-3);
  margin-block-end: var(--space-2xs);
}

.gate-card > p {
  color: var(--color-ink-muted);
  margin-block-end: var(--space-l);
}

.gate-card form {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
}

.gate-card label {
  font-size: var(--font-size-0);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-ink-muted);
  font-weight: var(--font-weight-medium);
}

.gate-card input {
  padding: var(--space-xs) var(--space-s);
  /* --color-rule (oklch 92%) gives ~1.4:1 vs page bg — fails WCAG
     1.4.11. --color-ink-muted (oklch 32%) gives ~8:1. */
  border: 1px solid var(--color-ink-muted);
  border-radius: var(--box-radius);
  background-color: var(--color-surface);
  font-size: var(--font-size-1);
  color: var(--color-ink);
}

.gate-card input:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-focus);
  outline-offset: 2px;
}

.gate-card button {
  padding: var(--space-xs) var(--space-m);
  background-color: var(--color-ink);
  color: var(--color-bg);
  border-radius: var(--box-radius);
  font-size: var(--font-size-1);
  font-weight: var(--font-weight-medium);
  letter-spacing: 0;
}

.gate-card button:hover {
  background-color: color-mix(in srgb, var(--color-ink) 88%, var(--color-bg));
}

.gate-error {
  font-size: var(--font-size-0);
  color: var(--color-ink);
  margin-block-start: var(--space-2xs);
}

.gate-back {
  display: inline-block;
  margin-block-start: var(--space-l);
  font-size: var(--font-size-0);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-ink-muted);
  text-decoration: none;
}

/* ----- Skip link (a11y) ----- */
.skip-link {
  position: absolute;
  inset-inline-start: var(--space-s);
  inset-block-start: var(--space-s);
  background: var(--color-ink);
  color: var(--color-bg);
  padding: var(--space-2xs) var(--space-s);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--transition-fast);
  z-index: 100;
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--color-bg);
}


/* ============================================================
   prefers-reduced-motion (WCAG accessibility)
   ------------------------------------------------------------
   Honors the user's system-level motion preference. We don't
   ban all change — state changes still happen — but durations
   collapse to ~instant and discretionary motion (hover lifts,
   parallax bg, smooth scroll) is removed.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }

  /* Disable the hover lift on project cards. */
  .project-card:hover {
    transform: none;
  }

  /* Disable the swatch hover scale. */
  .theme-swatch:hover {
    transform: none;
  }

  /* Fixed background creates parallax-like motion when scrolling.
     Switch to scroll-with-content for vestibular safety. */
  body {
    background-attachment: scroll;
  }
}
