/* psblx design tokens + base reset — shared by every page on the site.
   Loaded live from Google Fonts. */
@import url('https://fonts.googleapis.com/css2?family=Gloock&family=Jost:wght@300;700&family=Vollkorn:ital,wght@0,400..900;1,400..900&display=swap');

:root {
  /* ---- base palette ---- */
  --grey-950: #1F1F1E;
  --grey-900: #262625;   /* paper-deep, radial vignette */
  --grey-800: #2E2E2D;   /* paper — primary background */
  --grey-600: #4A4A47;
  --grey-400: #6E6E68;
  --grey-200: #A2A29B;   /* ink-soft */
  --grey-050: #EDEDE8;   /* ink */

  --purple-700: #5B45C0;
  --purple-600: #7256F0;  /* accent — psblx.com live value */
  --purple-500: #876FF2;
  --purple-300: #AA9AF6;
  --purple-100: #DCD5FB;

  /* explicitly excluded: no orange anywhere in this system (reads too
     close to a competitor's brand) */

  /* ---- semantic aliases ---- */
  --surface-page: var(--grey-800);
  --surface-page-deep: var(--grey-900);
  --surface-raised: #353533;
  --surface-sunken: var(--grey-950);
  --surface-overlay: rgba(31, 31, 30, 0.72);

  --border-subtle: rgba(237, 237, 232, 0.10);
  --border-default: rgba(237, 237, 232, 0.16);
  --border-strong: rgba(237, 237, 232, 0.28);

  --text-primary: var(--grey-050);
  --text-secondary: var(--grey-200);
  --text-tertiary: var(--grey-400);
  --text-on-accent: var(--grey-050);
  --text-disabled: rgba(162, 162, 155, 0.5);

  --accent: var(--purple-600);
  --accent-hover: var(--purple-500);
  --accent-active: var(--purple-700);
  --accent-soft: var(--purple-100);
  --accent-soft-on-dark: rgba(114, 86, 240, 0.24);

  --focus-ring: var(--purple-500);

  --state-success: #6FBE8C;
  --state-warning: #E3C24D;
  --state-danger: #E35D5D;

  /* ---- type ---- */
  --font-title: 'Gloock', ui-serif, Georgia, serif;
  --font-body: 'Vollkorn', ui-serif, Georgia, serif;
  --font-system: 'Jost', ui-sans-serif, system-ui, sans-serif;

  /* wordmark / signature moments — Gloock. Regular only: Gloock ships a
     single weight with no italic, so these moments are upright, not
     slanted, unlike the old Fraunces italic treatment. */
  --text-wordmark: 400 clamp(1.3rem, 5.5vw, 2.6rem)/1.1 var(--font-title);
  --text-display: 400 clamp(2rem, 6vw, 3.4rem)/1.08 var(--font-title);
  --text-signature: 400 1.25rem/1.4 var(--font-title);

  /* body copy — Vollkorn */
  --text-body: 400 0.95rem/1.7 var(--font-body);

  /* system/UI text — Jost. Light (300) by default; --text-label carries
     interactive chrome (buttons, field labels) at 700 for the same
     legibility contrast the old bold mono labels had. */
  --text-eyebrow: 300 0.72rem/1.4 var(--font-system);   /* letter-spacing .28em, uppercase */
  --text-body-sm: 300 0.82rem/1.6 var(--font-system);
  --text-label: 700 0.78rem/1.4 var(--font-system);      /* buttons, UI labels */
  --text-code: 300 0.85rem/1.5 var(--font-system);

  --tracking-eyebrow: 0.28em;
  --tracking-label: 0.02em;
  --tracking-body: normal;

  /* ---- spacing ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --max-content-width: 640px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
  --shadow-focus: 0 0 0 3px var(--accent-soft-on-dark);

  /* ---- motion ---- */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 1, 1);

  --duration-instant: 100ms;
  --duration-fast: 180ms;
  --duration-base: 320ms;
  --duration-slow: 800ms;

  /* the reference "magic trick" timing from the landing page's typewriter */
  --duration-typewriter: 4750ms;
}

/* ---- base reset — shared by every psblx surface ---- */
* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface-page);
  color: var(--text-primary);
  font: var(--text-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

::selection {
  background: var(--accent);
  color: var(--text-on-accent);
}

:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- entry 000 menu — site-wide nav, replaces the per-page .index-label.
   Shared across every page (see entry-menu.js for the interaction), since
   the markup/behavior is identical everywhere — only the trigger's own
   "entry NNN" text differs page to page. Needs its own @keyframes rise
   (not just relying on a page defining one) since not every page has one. */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.entry-menu {
  position: absolute;
  top: var(--space-6);
  left: var(--space-6);
  z-index: 30;
  opacity: 0;
  animation: rise 0.8s var(--ease-out) 0.1s forwards;
}

.entry-trigger,
.entry-row-label {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  display: block;
  font: var(--text-eyebrow);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
}

.entry-trigger:focus-visible,
.entry-row-label:focus-visible {
  color: var(--accent-hover);
}

/* Hover-only (not focus) and gated to devices that actually support hover —
   on touch, a :hover rule matching a tappable element makes iOS Safari
   treat the first tap as "enter hover" and only fire the real click on a
   second tap. Scoping to (hover: hover) keeps the desktop hover feedback
   without introducing that double-tap requirement on phones. */
@media (hover: hover) {
  .entry-trigger:hover,
  .entry-row-label:hover {
    color: var(--accent-hover);
  }
}

/* Drawn with two bars rather than a literal "+" character — a font's
   glyph ink is never truly centered in its own line box (ascent/descent
   metrics skew it), so rotating text always wobbles a little. Bars
   positioned by hand rotate around an exact, guaranteed center instead. */
.entry-slash {
  position: relative;
  top: -1px;
  display: inline-block;
  width: 0.54rem;
  height: 0.54rem;
  vertical-align: middle;
  transform-origin: 50% 50%;
  transition: transform 480ms ease;
}

.entry-slash::before,
.entry-slash::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
}

.entry-slash::before {
  width: 100%;
  height: 1.25px;
}

.entry-slash::after {
  width: 1.25px;
  height: 100%;
}

.entry-menu.is-open > .entry-trigger .entry-slash,
.entry-row--experiments.is-open > .entry-row-label .entry-slash {
  /* Rotating a "+" by 90deg looks identical to resting (4-fold symmetry),
     so landing on the "x" look needs a net 45deg — but going the long way
     (135deg = 90 + 45) reads as a real spin instead of a flicker. */
  transform: rotate(135deg);
}

@media (hover: hover) {
  .entry-trigger:hover .entry-slash,
  .entry-row-label:hover .entry-slash {
    transform: rotate(135deg);
  }
}

.entry-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: var(--space-2);
  width: max-content;
  max-width: min(92vw, 440px);
  background: var(--surface-raised);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  z-index: 20;
}

.entry-menu.is-open .entry-dropdown {
  display: block;
}

.entry-row + .entry-row {
  margin-top: var(--space-3);
}

.entry-row--experiments {
  position: relative;
}

.entry-submenu {
  display: none;
  position: absolute;
  top: 0;
  left: 100%;
  margin-left: var(--space-3);
  width: max-content;
  max-width: min(70vw, 340px);
  background: var(--surface-raised);
  padding: var(--space-3) var(--space-4);
}

.entry-row--experiments.is-open .entry-submenu {
  display: block;
}

.entry-link {
  display: block;
  font: var(--text-eyebrow);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-decoration: none;
}

.entry-link + .entry-link {
  margin-top: var(--space-2);
}

.entry-link:focus-visible {
  color: var(--accent-hover);
}

@media (hover: hover) {
  .entry-link:hover {
    color: var(--accent-hover);
  }
}

.entry-link .plus {
  color: var(--accent);
}

/* The dropdown row matching the current page: a plain, non-interactive
   span (not a link — there's nowhere to go) rather than a disabled-looking
   link. Tooltip is hand-drawn (attr(data-tooltip) + ::after) rather than
   the native title attribute, since native tooltips carry the browser's
   own ~1s hover delay with no way to shorten it. On touch devices there's
   no hover at all, so entry-menu.js adds/removes .is-touched on tap as a
   fallback trigger — see the (hover: hover) rule below for the pointer
   equivalent. */
.entry-link.is-current {
  position: relative;
  color: var(--text-tertiary);
  cursor: default;
}

.entry-link.is-current::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 50%;
  left: 100%;
  margin-left: var(--space-3);
  transform: translateY(-50%);
  white-space: nowrap;
  font: var(--text-eyebrow);
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: var(--surface-raised);
  padding: var(--space-1) var(--space-3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 100ms ease;
  z-index: 40;
}

@media (hover: hover) {
  .entry-link.is-current:hover::after {
    opacity: 1;
  }
}

.entry-link.is-current.is-touched::after {
  opacity: 1;
}

/* ---- page frame — carries the page's outer padding/centering that used
   to live directly on <body>. Split into its own wrapper around <main> so
   .site-footer (below) can be a plain, unpadded child of <body> and reach
   the true viewport edges at a flat var(--space-6) inset — matching
   .entry-menu's own top/left offset exactly — without any vw-based
   escape-hatch math. An earlier version tried to break .site-footer out of
   a still-padded <body> via the `width: 100vw; margin-left: calc(50% -
   50vw)` full-bleed trick; vw units don't reliably match the real,
   scrollbar-adjusted content width, so the footer could render past the
   left edge. Giving .site-footer a genuinely unpadded parent sidesteps
   that class of bug entirely — no vw arithmetic near it at all. */
.page-frame {
  width: 100%;
  padding: 8vh 6vw 10vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---- site footer — shared across every page (replaces the old per-page
   duplicated .copyright rules). A plain, unpadded child of <body> (see
   .page-frame above) sized to the real viewport width via `width: 100%`,
   with var(--space-6) as its own fixed left/right padding — the same
   value .entry-menu uses for its top/left corner offset — so the two line
   up exactly. */
.site-footer {
  width: 100%;
  box-sizing: border-box;
  padding: 0 var(--space-6) var(--space-8);
  margin-top: var(--space-9);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-4);
  opacity: 0;
  animation: rise 0.8s var(--ease-out) 0.8s forwards;
}

.copyright {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  font-family: var(--font-system);
}

.copyright .mark {
  font-size: 1em;
  vertical-align: baseline;
  line-height: inherit;
}

.footer-links {
  display: flex;
  gap: var(--space-6);
}

.footer-links a {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  font-family: var(--font-system);
  text-decoration: none;
}

.footer-links a:focus-visible {
  color: var(--accent-hover);
}

@media (hover: hover) {
  .footer-links a:hover {
    color: var(--accent-hover);
  }
}
