/* ============================================================
   Instagram Widget by Luck — design system
   Ported directly from the ~/repos/app token architecture:
   committed single-hue identity, OKLCH semantic tokens,
   warm-dark coal bands, opt-in dark theme.
   The committed hue is the design system's signature amber/honey;
   the warm near-black ink ramp and coal bands come with it.
   NOTE: `--ocean` / `--ocean-strong` are retained as token *names*
   for backward compatibility, but now carry the app's `--ember`
   amber-family text color (amber text on white / lifted on dark).
   ============================================================ */

:root {
  /* color tokens stored as `L C H` triplets for oklch(... / <alpha>) */
  --bg:        1 0 0;            /* pure white page background          */
  --surface:   0.974 0.007 80;  /* warm off-white — alternating bands  */
  --surface-2: 0.945 0.011 80;  /* deeper warm surface — insets, code  */
  --line:      0.905 0.008 78;  /* hairline borders                    */

  --ink:       0.220 0.016 58;  /* body + headings, warm near-black ~15:1 */
  --ink-soft:  0.440 0.018 58;  /* secondary text ~5:1                 */
  --ink-mute:  0.580 0.016 60;  /* de-emphasized labels (large only)   */

  --brand:        0.700 0.168 58; /* signature amber — FILLS/underlines/graphics only */
  --brand-strong: 0.620 0.175 52; /* amber hover / pressed             */
  --ocean:        0.450 0.140 48; /* ember — amber-family TEXT/links on white ~5:1 */
  --ocean-strong: 0.400 0.135 46; /* ember hover                       */

  --coal:    0.190 0.012 60;    /* warm near-black band background      */
  --coal-2:  0.255 0.014 60;    /* raised surface on coal              */
  --ink-rev: 0.965 0.006 82;    /* text on coal                        */

  --live: 0.66 0.15 150;        /* "live feed" status dot only          */

  /* text on a saturated amber fill — always dark, both themes */
  --on-brand: 0.200 0.020 60;
  /* text on a solid ink button — inverts with the theme */
  --on-solid: 0.965 0.006 82;

  --container: 75rem; /* 1200px */

  color-scheme: light;
}

.dark {
  --bg:        0.155 0.008 60;
  --surface:   0.198 0.009 60;
  --surface-2: 0.238 0.010 60;
  --line:      0.300 0.010 60;

  --ink:       0.940 0.006 85;
  --ink-soft:  0.745 0.010 75;
  --ink-mute:  0.580 0.010 68;

  --brand:        0.760 0.155 67;
  --brand-strong: 0.820 0.140 70;
  --ocean:        0.800 0.130 72; /* ember lifted so amber text reads on the dark ground */
  --ocean-strong: 0.850 0.120 74;

  --coal:    0.225 0.012 60;    /* coal becomes a gently elevated panel */
  --coal-2:  0.290 0.014 60;
  --ink-rev: 0.950 0.006 85;

  --live: 0.72 0.15 152;

  --on-brand: 0.180 0.020 60;
  --on-solid: 0.150 0.010 60;

  color-scheme: dark;
}

/* ------------------------------------------------------------ base */

* { border-color: oklch(var(--line)); }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background-color: oklch(var(--bg));
}

body {
  background-color: oklch(var(--bg));
  color: oklch(var(--ink));
  font-family: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-wrap: balance;
  color: oklch(var(--ink));
}

p { text-wrap: pretty; }

::selection {
  background-color: oklch(var(--brand) / 0.28);
  color: oklch(var(--ink));
}

:focus-visible {
  outline: 2px solid oklch(var(--ocean));
  outline-offset: 3px;
  border-radius: 3px;
}

/* code / monospace is literal here — real API snippets, endpoints, tags */
code, pre, .mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace; }

/* ------------------------------------------------------------ z-index scale */
/* dropdown 100 · sticky 200 · backdrop 300 · modal 400 · toast 500 */

/* ------------------------------------------------------------ components */

.wrap { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 1.5rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  line-height: 1;
  border-radius: 0.75rem;
  padding: 0.875rem 1.5rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .2s cubic-bezier(.16,1,.3,1),
              color .2s ease,
              border-color .2s ease,
              transform .2s cubic-bezier(.16,1,.3,1),
              box-shadow .25s ease;
}
.btn:active { transform: translateY(1px); }

/* primary = signature azure fill + dark ink (mirrors the app's amber+ink button) */
.btn-primary {
  background-color: oklch(var(--brand));
  color: oklch(var(--on-brand));
  box-shadow: 0 1px 2px oklch(var(--coal) / .18);
}
.btn-primary:hover {
  background-color: oklch(var(--brand-strong));
  box-shadow: 0 10px 24px -8px oklch(var(--brand) / .55);
}

.btn-ghost {
  background-color: transparent;
  color: oklch(var(--ink));
  border-color: oklch(var(--line));
}
.btn-ghost:hover {
  background-color: oklch(var(--surface));
  border-color: oklch(var(--ink-mute));
}

/* ghost on a coal band */
.btn-on-coal {
  background-color: oklch(var(--ink-rev) / .07);
  color: oklch(var(--ink-rev));
  border-color: oklch(var(--ink-rev) / .22);
}
.btn-on-coal:hover { background-color: oklch(var(--ink-rev) / .14); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: oklch(var(--ocean));
  background-color: oklch(var(--brand) / 0.10);
  border: 1px solid oklch(var(--brand) / 0.22);
}
.dark .pill { color: oklch(var(--ocean)); background-color: oklch(var(--brand) / 0.16); }

.card {
  background-color: oklch(var(--bg));
  border: 1px solid oklch(var(--line));
  border-radius: 1.25rem;
  transition: transform .25s cubic-bezier(.16,1,.3,1),
              box-shadow .25s ease,
              border-color .25s ease;
}
.card-hover:hover {
  transform: translateY(-4px);
  border-color: oklch(var(--brand) / .45);
  box-shadow: 0 22px 48px -24px oklch(var(--coal) / .35);
}

/* coal band — art-directed dark strip */
.coal {
  background-color: oklch(var(--coal));
  color: oklch(var(--ink-rev));
}
.coal h1, .coal h2, .coal h3, .coal h4 { color: oklch(var(--ink-rev)); }
.coal-grain {
  background-image: radial-gradient(oklch(var(--ink-rev) / 0.035) 1px, transparent 1px);
  background-size: 4px 4px;
}

/* the energetic accent: azure rule that draws in on reveal */
.accent-rule {
  height: 3px;
  width: 100%;
  background-color: oklch(var(--brand));
  border-radius: 2px;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform .8s cubic-bezier(.16,1,.3,1);
}
.in .accent-rule, .accent-rule.in { transform: scaleX(1); }

/* hairline divider */
.rule { height: 1px; background-color: oklch(var(--line)); border: 0; }

/* link styled as ocean text with an underline that grows */
.link {
  color: oklch(var(--ocean));
  font-weight: 600;
  text-decoration: none;
  background-image: linear-gradient(oklch(var(--brand)), oklch(var(--brand)));
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size .25s cubic-bezier(.16,1,.3,1);
  padding-bottom: 1px;
}
.link:hover { background-size: 100% 2px; }

/* sticky header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background-color: oklch(var(--bg) / 0.78);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid oklch(var(--line) / 0.7);
}
.nav-link {
  color: oklch(var(--ink-soft));
  font-weight: 500;
  font-size: 0.9375rem;
  transition: color .18s ease;
}
.nav-link:hover { color: oklch(var(--ink)); }

/* icon button (theme toggle) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.7rem;
  border: 1px solid oklch(var(--line));
  color: oklch(var(--ink-soft));
  background-color: transparent;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background-color .18s ease;
}
.icon-btn:hover { color: oklch(var(--ink)); border-color: oklch(var(--ink-mute)); background-color: oklch(var(--surface)); }
.icon-btn .sun { display: none; }
.icon-btn .moon { display: block; }
.dark .icon-btn .sun { display: block; }
.dark .icon-btn .moon { display: none; }

/* theme-aware wordmark — dark-ink logo on light, warm-white logo on dark */
.logo-on-dark { display: none; }
.dark .logo-on-light { display: none; }
.dark .logo-on-dark { display: inline-block; }

/* hamburger */
.hamburger { position: relative; width: 1.5rem; height: 1rem; }
.hamburger span {
  position: absolute; left: 0; height: 2px; width: 100%;
  background-color: oklch(var(--ink));
  border-radius: 2px;
  transition: transform .3s cubic-bezier(.16,1,.3,1), opacity .2s ease, top .3s ease;
}
.hamburger span:nth-child(1) { top: 0; }
.hamburger span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.hamburger span:nth-child(3) { bottom: 0; }
.is-open .hamburger span:nth-child(1) { top: 50%; transform: translateY(-50%) rotate(45deg); }
.is-open .hamburger span:nth-child(2) { opacity: 0; }
.is-open .hamburger span:nth-child(3) { bottom: auto; top: 50%; transform: translateY(-50%) rotate(-45deg); }

/* numbered step marker (real sequences only) */
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem; height: 2.75rem;
  border-radius: 999px;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700; font-size: 1.05rem;
  color: oklch(var(--on-brand));
  background-color: oklch(var(--brand));
}

/* feature cell hover within the lattice */
.feature-cell { transition: background-color .2s ease; }
.feature-cell:hover { background-color: oklch(var(--surface)); }

/* ------------------------------------------------------------ motion */

/* Reveal-on-scroll. Base state is visible; the hidden offset is only
   applied once JS has confirmed it can also remove it (html.js), so
   no-JS and headless renderers always see content. */
.reveal { will-change: transform, opacity; }
html.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s cubic-bezier(.16,1,.3,1),
              transform .7s cubic-bezier(.16,1,.3,1);
}
html.js .reveal.in { opacity: 1; transform: none; }
html.js .reveal[data-delay="1"] { transition-delay: .07s; }
html.js .reveal[data-delay="2"] { transition-delay: .14s; }
html.js .reveal[data-delay="3"] { transition-delay: .21s; }
html.js .reveal[data-delay="4"] { transition-delay: .28s; }
html.js .reveal[data-delay="5"] { transition-delay: .35s; }

/* hero load choreography */
html.js .hero-line { opacity: 0; transform: translateY(22px); }
html.js .hero-in .hero-line {
  opacity: 1; transform: none;
  transition: opacity .8s cubic-bezier(.16,1,.3,1),
              transform .8s cubic-bezier(.16,1,.3,1);
}
html.js .hero-in .hero-line:nth-child(2) { transition-delay: .08s; }
html.js .hero-in .hero-line:nth-child(3) { transition-delay: .16s; }

@keyframes pulse-ring {
  0%   { transform: scale(1);   opacity: .65; }
  70%  { transform: scale(2.6); opacity: 0;   }
  100% { transform: scale(2.6); opacity: 0;   }
}
.live-ring { animation: pulse-ring 2s cubic-bezier(.16,1,.3,1) infinite; }

@keyframes skeleton {
  0%, 100% { opacity: 1; }
  50%      { opacity: .45; }
}
.skeleton { animation: skeleton 1.4s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  html.js .reveal { opacity: 1 !important; transform: none !important; }
  html.js .hero-line { opacity: 1 !important; transform: none !important; }
  .accent-rule { transform: scaleX(1) !important; }
}

/* smooth theme cross-fade only while toggling (class added by JS) */
.theme-transition,
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
  transition: background-color .35s ease, border-color .35s ease,
              color .35s ease, fill .35s ease !important;
}

/* ------------------------------------------------------------ form fields */
.field-label { display: block; font-size: .875rem; font-weight: 600; color: oklch(var(--ink)); margin-bottom: .4rem; }
.field {
  width: 100%;
  padding: .75rem 1rem;
  border-radius: .75rem;
  border: 1px solid oklch(var(--line));
  background-color: oklch(var(--bg));
  color: oklch(var(--ink));
  font: inherit;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.field::placeholder { color: oklch(var(--ink-mute)); }
.field:focus {
  outline: none;
  border-color: oklch(var(--brand));
  box-shadow: 0 0 0 3px oklch(var(--brand) / .22);
}
.field-prefix {
  padding: .75rem 1rem;
  background-color: oklch(var(--surface-2));
  border: 1px solid oklch(var(--line));
  border-right: 0;
  border-radius: .75rem 0 0 .75rem;
  color: oklch(var(--ink-mute));
  font-size: .9rem;
}

/* ------------------------------------------------------------ long-form prose (legal pages) */
.prose { max-width: 68ch; }
.prose h2 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 1.5rem; font-weight: 700;
  margin-top: 2.25rem; margin-bottom: .75rem;
  letter-spacing: -0.02em; color: oklch(var(--ink));
}
.prose h3 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 1.15rem; font-weight: 600;
  margin-top: 1.75rem; margin-bottom: .5rem; color: oklch(var(--ink));
}
.prose p { margin-bottom: 1rem; color: oklch(var(--ink-soft)); line-height: 1.75; }
.prose strong { color: oklch(var(--ink)); font-weight: 600; }
.prose ul { list-style: disc; padding-left: 1.5rem; margin-bottom: 1rem; color: oklch(var(--ink-soft)); }
.prose ul li { margin-bottom: .375rem; line-height: 1.75; }
.prose a {
  color: oklch(var(--ocean)); font-weight: 600;
  text-decoration: underline; text-underline-offset: 2px;
  text-decoration-color: oklch(var(--brand) / .5);
}
.prose a:hover { text-decoration-color: oklch(var(--brand)); }
