/* ============================================================
   PERSEID PIXELS CO. — Observatory / Pip-Boy Green Theme
   css/theme.css  —  shared design system

   TOKEN SUMMARY (for other agents building work/about/articles):

     Background:   --bg        #060B07
     Body text:    --ink       #9FD8A8
     Display text: --ink-bright #D6FFDE  (use --bloom shadow)
     Accent:       --accent    #3BF08A  (borders, labels, CTA, lines)
     Muted/dim:    --dim       #5E8A66

   FONT STACK:
     'Marcellus'       display headings — wide letterspacing
     'IBM Plex Serif'  body 17-18px / line-height 1.75
     'IBM Plex Mono'   labels / data 11-12px, letterspaced small-caps

   INTERACTION CURVES (game-feel reference binding):
     --ease-enter  cubic-bezier(0,0,0.2,1)   300ms  enter/appear
     --ease-exit   cubic-bezier(0.4,0,1,1)   150ms  exit/disappear
     --dur-fast    150ms
     --dur-normal  300ms
     Hover ON: transition-duration 0ms (instant)
     Hover OFF: var(--dur-fast) var(--ease-exit)
     Press:  scale(0.97) transition 0ms

   FURNITURE CLASSES (use freely on any page):
     .double-rule       — hairline double border panel
     .corner-mark.*     — registration tick at tl/tr/bl/br corners
     .plate-label       — mono archival "PLATE No. 001" label
     .deco-divider      — Art Deco line-diamond-line SVG wrapper
     .phosphor-bloom    — display text glow (as class or text-shadow var)
     [data-reveal]      — scroll-reveal (observatory.js handles IO)

   CRT OVERLAY (#crt-overlay):
     Scanlines ≤4% opacity. Vignette. Phosphor flicker 0.985–1.0.
     pointer-events: none. z-index: 800.
     Never remove or block this element on any page.

   z-index layers:
     #sky-canvas       0     background starfield
     .site-main        1     page content
     .site-nav         700   sticky nav
     #crt-overlay      800   CRT effects
     #overture         900   welcome sequence (self-removes)
   ============================================================ */

/* ── Tokens ── */
:root {
  --bg:         #060B07;
  --ink:        #9FD8A8;
  --ink-bright: #D6FFDE;
  --accent:     #3BF08A;
  --dim:        #5E8A66;

  /* Phosphor bloom text-shadow — apply to display headings */
  --bloom: 0 0 12px rgba(80,255,150,.25), 0 0 2px rgba(120,255,170,.4);

  /* Interaction curves (from ios-interactions + game-feel refs) */
  --ease-enter: cubic-bezier(0, 0, 0.2, 1);
  --ease-exit:  cubic-bezier(0.4, 0, 1, 1);
  --dur-fast:   150ms;
  --dur-normal: 300ms;

  /* Layout */
  --max-w:   1080px;
  --gutter:  clamp(1.25rem, 5vw, 3rem);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 17px;
  /* smooth scroll for anchor links only; JS handles overture */
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'IBM Plex Serif', Georgia, serif;
  font-size: 1rem;
  line-height: 1.75;
  min-height: 100dvh;
  /* Prevent rubber-band on root; containers may opt in */
  overscroll-behavior: none;
}

a            { color: var(--accent); text-decoration: none; }
img, svg     { display: block; max-width: 100%; }
button       { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
details > summary               { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* ── prefers-reduced-motion: FULL BLOCK ──
   Per ios-interactions §0 — not just slow, fully disabled.
   --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration:       0.01ms !important;
    animation-iteration-count: 1     !important;
    transition-duration:       0.01ms !important;
  }
}

/* ── Typography helpers ── */
.f-marcellus { font-family: 'Marcellus',     Georgia,      serif; }
.f-mono      { font-family: 'IBM Plex Mono', 'Courier New', monospace; }
.f-serif     { font-family: 'IBM Plex Serif', Georgia,      serif; }

/* Display heading with phosphor bloom */
.display-heading {
  font-family: 'Marcellus', Georgia, serif;
  letter-spacing: 0.06em;
  color: var(--ink-bright);
  text-shadow: var(--bloom);
  line-height: 1.18;
}

/* Archival mono label — small-caps, letterspaced */
.mono-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-variant: small-caps;
  color: var(--dim);
}

/* ── Background starfield canvas ──
   Always behind all content. observatory.js drives this.
   Do not resize or hide; it draws at 0 opacity if hidden.
   ------------------------------------------------------- */
#sky-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── CRT Overlay ──
   Fixed, pointer-events:none, z-index:800.
   Scanlines via repeating-gradient (≤4% opacity).
   Vignette via ::after pseudo-element.
   Phosphor flicker via CSS animation.
   Never block this layer. Other agents: leave as-is.
   -------------------------------------------------- */
#crt-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.038) 2px,
    rgba(0, 0, 0, 0.038) 4px
  );
  animation: crt-flicker 4.7s linear infinite;
}

/* Vignette darkens edges */
#crt-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 85% 75% at 50% 50%,
    transparent 35%,
    rgba(0, 0, 0, 0.42) 100%
  );
}

@keyframes crt-flicker {
  0%,  100% { opacity: 1.000; }
  17%        { opacity: 0.990; }
  33%        { opacity: 0.998; }
  50%        { opacity: 0.985; }
  67%        { opacity: 0.993; }
  83%        { opacity: 0.987; }
}

/* ── Layout ── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.site-main { position: relative; z-index: 1; }

.section { padding-block: clamp(4rem, 10vh, 7rem); }

.section + .section {
  border-top: 1px solid rgba(63, 240, 138, 0.1);
}

/* Section heading group */
.section-header {
  margin-bottom: clamp(2.5rem, 5vh, 3.5rem);
}

.section-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.64rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 0.85rem;
}

/* ── Navigation ──
   Wordmark left, links right. 56px height for comfortable tap.
   Touch targets: each nav-link ≥44px via min-height + flex.
   ------------------------------------------------------------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 700;
  height: 56px;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  background: rgba(6, 11, 7, 0.90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(63, 240, 138, 0.12);
}

.nav-wordmark {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-bright);
  text-shadow: var(--bloom);
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2.5vw, 1.75rem);
}

/* Default (off): exit curve, 150ms */
.nav-link {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  min-height: 44px;
  display: flex;
  align-items: center;
  padding-inline: 0.25rem;
  transition: color var(--dur-fast) var(--ease-exit);
  -webkit-tap-highlight-color: transparent;
}
/* Hover ON: instant (0ms) */
.nav-link:hover { color: var(--ink-bright); transition-duration: 0ms; }
/* Press: scale 0.97 instant */
.nav-link:active { transform: scale(0.97); transition: transform 0ms; }

/* ── Art Deco Divider ──
   SVG wrapper class. Usage:
     <svg class="deco-divider" viewBox="0 0 280 14" width="280" height="14">
       <line x1="0" y1="4" x2="122" y2="4" stroke="#3BF08A" stroke-width="0.75" opacity="0.45"/>
       <line x1="0" y1="8" x2="122" y2="8" stroke="#3BF08A" stroke-width="0.75" opacity="0.2"/>
       <polygon points="140,1 146,7 140,13 134,7" fill="none" stroke="#3BF08A" stroke-width="0.8" opacity="0.65"/>
       <line x1="158" y1="4" x2="280" y2="4" stroke="#3BF08A" stroke-width="0.75" opacity="0.45"/>
       <line x1="158" y1="8" x2="280" y2="8" stroke="#3BF08A" stroke-width="0.75" opacity="0.2"/>
     </svg>
   ---------------------------------------------------------------- */
.deco-divider { display: block; overflow: visible; }

/* ── Furniture: Double-Rule Panel ──
   Hairline double border via border + outline.
   ⚠ WARNING: ancestor overflow:hidden clips outline. Avoid on framed parents.

   corner-mark children provide registration ticks.
   Usage:
     <div class="double-rule">
       <span class="corner-mark tl"></span>
       <span class="corner-mark tr"></span>
       <span class="corner-mark bl"></span>
       <span class="corner-mark br"></span>
       content…
     </div>
   ------------------------------------------------------------- */
.double-rule {
  border:         1px solid rgba(63, 240, 138, 0.32);
  outline:        1px solid rgba(63, 240, 138, 0.13);
  outline-offset: 4px;
  position: relative;
}

.corner-mark {
  position: absolute;
  width: 12px;
  height: 12px;
  z-index: 1;
}
.corner-mark.tl { top:-6px;    left:-6px;   border-top:   1px solid var(--accent); border-left:   1px solid var(--accent); }
.corner-mark.tr { top:-6px;    right:-6px;  border-top:   1px solid var(--accent); border-right:  1px solid var(--accent); }
.corner-mark.bl { bottom:-6px; left:-6px;   border-bottom:1px solid var(--accent); border-left:   1px solid var(--accent); }
.corner-mark.br { bottom:-6px; right:-6px;  border-bottom:1px solid var(--accent); border-right:  1px solid var(--accent); }

/* Archival plate label above framed panels */
.plate-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.60rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
  display: block;
  margin-bottom: 0.7rem;
}

/* ── CTA Button ──
   Accent border. Mono. 44px touch target. 0ms press.
   --------------------------------------------------- */
.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 2.25rem;
  min-height: 48px;
  border: 1px solid var(--accent);
  outline: 1px solid rgba(63, 240, 138, 0.18);
  outline-offset: 3px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.70rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-bright);
  text-shadow: var(--bloom);
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur-fast) var(--ease-exit),
              box-shadow  var(--dur-fast) var(--ease-exit);
}
.cta-btn:hover {
  background: rgba(63, 240, 138, 0.07);
  box-shadow: 0 0 24px rgba(63, 240, 138, 0.18);
  transition-duration: 0ms; /* instant on */
}
.cta-btn:active {
  transform: scale(0.97);
  transition: transform 0ms;
}

/* Small annotation text beneath CTA */
.cta-annotation {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: var(--dim);
  text-align: center;
  margin-top: 0.65rem;
  line-height: 1.7;
}

/* ── Hero ── */
.hero-section {
  padding-block: clamp(4.5rem, 12vh, 8rem) clamp(3.5rem, 8vh, 5.5rem);
}
.hero-headline {
  font-size: clamp(2rem, 5vw, 3.6rem);
  margin-bottom: 0;       /* deco-divider provides spacing via margin-block */
  max-width: 22ch;
}
/* Mono service line beneath hero deco divider */
.hero-mono-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.65rem;
}
.hero-subline {
  font-size: clamp(1rem, 2vw, 1.1rem);
  color: var(--ink);
  max-width: 40ch;
  margin-bottom: 2.5rem;
  line-height: 1.75;
}

/* ── Offerings Grid ── */
.offerings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: clamp(1.5rem, 4vw, 2.5rem);
}

.offering-panel {
  padding: clamp(1.75rem, 4vw, 2.5rem);
}

.offering-series {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.60rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 1rem;
}

.offering-title {
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  margin-bottom: 1rem;
  line-height: 1.3;
}

.offering-body {
  color: var(--ink);
  font-size: 0.97rem;
  line-height: 1.78;
}

/* ── Work Cards ── */
.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: clamp(1.5rem, 4vw, 2.5rem);
}

.work-card {
  padding: clamp(1.5rem, 3.5vw, 2rem);
  display: block;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow var(--dur-fast) var(--ease-exit);
}
.work-card:hover {
  box-shadow: 0 0 28px rgba(63, 240, 138, 0.10);
  transition-duration: 0ms;
}
.work-card:active {
  transform: scale(0.97);
  transition: transform 0ms;
}

.work-card-label {
  margin-bottom: 0.85rem;
}

.work-card-title {
  font-family: 'Marcellus', Georgia, serif;
  font-size: clamp(1rem, 2vw, 1.2rem);
  letter-spacing: 0.04em;
  color: var(--ink-bright);
  text-shadow: var(--bloom);
  margin-bottom: 0.75rem;
  line-height: 1.25;
}

.work-card-body {
  font-size: 0.94rem;
  color: var(--ink);
  line-height: 1.75;
}

/* ── FAQ ──
   .faq-item / .faq-question / .faq-answer.
   JS toggles .open class. No <details>/<summary> — for animation control.
   ----------------------------------------------------------------------- */
.faq-list {
  display: flex;
  flex-direction: column;
}

.faq-item {
  border-bottom: 1px solid rgba(63, 240, 138, 0.10);
}
.faq-item:first-child { border-top: 1px solid rgba(63, 240, 138, 0.10); }

.faq-question {
  width: 100%;
  text-align: left;
  padding-block: 1.3rem;
  font-family: 'IBM Plex Serif', serif;
  font-size: 1rem;
  color: var(--ink-bright);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-fast) var(--ease-exit);
}
.faq-question:hover { color: var(--accent); transition-duration: 0ms; }

/* Plus / times indicator */
.faq-question::after {
  content: '+';
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.15rem;
  color: var(--accent);
  flex-shrink: 0;
  transition: transform var(--dur-fast) var(--ease-exit);
}
.faq-item.open .faq-question::after {
  transform: rotate(45deg);
  transition-duration: 0ms;
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--dur-normal) var(--ease-enter),
              padding-bottom var(--dur-normal) var(--ease-enter);
  color: var(--ink);
  font-size: 0.97rem;
  line-height: 1.8;
  max-width: 65ch;
}
.faq-item.open .faq-answer {
  max-height: 280px;
  padding-bottom: 1.3rem;
}

/* ── Scroll Reveals ──
   observatory.js IntersectionObserver adds .revealed.
   Settle: translateY(12px) → 0, fade in. ease-enter, 300ms.
   No bounce (game-feel §3.5: phosphor glass, not rubber).
   --------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity    var(--dur-normal) var(--ease-enter),
              transform  var(--dur-normal) var(--ease-enter);
}
[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children via nth-child delay */
[data-reveal-stagger] > * {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity   var(--dur-normal) var(--ease-enter),
              transform var(--dur-normal) var(--ease-enter);
}
[data-reveal-stagger].revealed > *:nth-child(1) { opacity:1; transform:translateY(0); transition-delay: 0ms; }
[data-reveal-stagger].revealed > *:nth-child(2) { opacity:1; transform:translateY(0); transition-delay: 60ms; }
[data-reveal-stagger].revealed > *:nth-child(3) { opacity:1; transform:translateY(0); transition-delay: 120ms; }
[data-reveal-stagger].revealed > *:nth-child(4) { opacity:1; transform:translateY(0); transition-delay: 180ms; }

/* ── Footer ── */
.site-footer {
  padding-block: 2rem 3.5rem;
  border-top: 1px solid rgba(63, 240, 138, 0.12);
}
.footer-inner {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  text-align: center;
  line-height: 1.8;
}

/* ── Overture Overlay ──
   Full-screen welcome sequence. Self-removes after 2.1s or on skip.
   ALL page content is in DOM beneath this (SEO/crawlers see everything).
   Other agents: do NOT delete or restructure this block.

   z-index: 900 (above CRT overlay at 800, above nav at 700)
   ------------------------------------------------------------------ */
#overture {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  /* Yield transition: opacity 0.5s ease-out */
  transition: opacity 0.48s var(--ease-exit);
}
#overture.yielded {
  opacity: 0;
  pointer-events: none;
}

#overture-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.overture-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
  padding: 1rem;
}

/* Registration marks — four corners of the exposure */
.overture-reg {
  position: fixed;
  width: 18px;
  height: 18px;
  z-index: 2;
}
.overture-reg.tl { top:28px;  left:36px;  border-top:1px solid rgba(63,240,138,0.28); border-left:1px solid rgba(63,240,138,0.28); }
.overture-reg.tr { top:28px;  right:36px; border-top:1px solid rgba(63,240,138,0.28); border-right:1px solid rgba(63,240,138,0.28); }
.overture-reg.bl { bottom:28px; left:36px; border-bottom:1px solid rgba(63,240,138,0.28); border-left:1px solid rgba(63,240,138,0.28); }
.overture-reg.br { bottom:28px; right:36px; border-bottom:1px solid rgba(63,240,138,0.28); border-right:1px solid rgba(63,240,138,0.28); }

.overture-edge-label {
  position: fixed;
  bottom: 28px;
  left: 64px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.52rem;
  letter-spacing: 0.16em;
  color: rgba(94, 138, 102, 0.38);
  text-transform: uppercase;
  z-index: 2;
  pointer-events: none;
}

/* Wordmark — starts blurred, develops sharp via WAAPI animation in observatory.js */
.overture-wordmark {
  font-family: 'Marcellus', Georgia, serif;
  font-size: clamp(1.5rem, 4vw, 3.2rem);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ink-bright);
  /* Initial state: photographic undeveloped */
  filter: blur(16px) brightness(0.3);
  opacity: 0.08;
  /* Committed final state (applied by JS when .developed) */
}
.overture-wordmark.developed {
  filter: none;
  opacity: 1;
  text-shadow: var(--bloom);
}

.overture-deco {
  margin-block: 1.4rem;
  opacity: 0;
  transition: opacity 0.4s var(--ease-enter);
}
.overture-deco.visible { opacity: 1; }

.overture-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  line-height: 1.8;
  opacity: 0;
  transition: opacity 0.4s var(--ease-enter);
}
.overture-sub.visible { opacity: 1; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .nav-wordmark {
    font-size: 0.58rem;
    letter-spacing: 0.14em;
  }
  .nav-links {
    gap: 0.6rem;
  }
  .nav-link {
    font-size: 0.56rem;
    letter-spacing: 0.12em;
  }
  /* Hide 'Work' and 'Articles' on very small screens; keep Home + About + Contact */
  .nav-link.nav-hide-sm {
    display: none;
  }
  .overture-reg.tl,
  .overture-reg.tr,
  .overture-reg.bl,
  .overture-reg.br { display: none; }
  .overture-edge-label { display: none; }
}

@media (max-width: 390px) {
  :root { --gutter: 1rem; }
  .hero-headline { font-size: 1.75rem; }
}
