/* =============================================================================
   HighlightMe — Shared foundation
   Loaded by every page. Contains: design tokens, reset/base, layout helpers,
   and the components shared across pages (header, buttons, footer, corner marks).

   To re-theme the whole site, edit the design tokens in :root below — every
   color, font, and size elsewhere is expressed in terms of these.
   ========================================================================== */

/* -----------------------------------------------------------------------------
   1. Design tokens
   The single source of truth for the visual identity. The palette is pulled
   from the app itself: the coral save button and the yellow recording ring, on
   a warm near-black "viewfinder" ground. Committed dark theme by design.
   -------------------------------------------------------------------------- */
:root {
  /* Surfaces & ink (warm neutrals, biased toward the coral accent) */
  --ground:      #0d0b0b;   /* page background */
  --ground-2:    #120f0e;   /* recessed panels (e.g. the buffer viewport) */
  --surface:     #1a1615;   /* cards */
  --surface-2:   #221d1b;   /* raised card */
  --hairline:    #2c2724;   /* borders / grid lines */
  --hairline-2:  #3a332f;   /* stronger borders / hover */
  --ink:         #f6f1ed;   /* primary text */
  --ink-2:       #cbc2bb;   /* secondary text */
  --muted:       #8f857e;   /* labels, captions */

  /* Accents */
  --accent:      #ef6f5f;   /* coral — the save button */
  --accent-deep: #d63d38;   /* coral, darker (gradient end) */
  --live:        #f6df3f;   /* yellow — the recording ring / "live" state */

  /* Typography */
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  /* Type scale (fluid) */
  --step--1:    .8125rem;
  --step-0:     1.0625rem;
  --step-1:     1.3rem;
  --step-2:     clamp(1.5rem, 3vw, 2rem);
  --step-3:     clamp(2rem, 5vw, 3.1rem);
  --step-hero:  clamp(2.7rem, 8.5vw, 6rem);

  /* Layout */
  --maxw:   1120px;
  --pad:    clamp(1.25rem, 5vw, 3rem);
  --radius: 14px;
}

/* Keep native form controls dark even if the viewer forces a light theme:
   the viewfinder identity is deliberately single-theme (dark). */
:root[data-theme="light"] { color-scheme: dark; }

/* -----------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { max-width: 100%; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--accent); color: #14100f; }

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

/* -----------------------------------------------------------------------------
   3. Layout helpers
   -------------------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* -----------------------------------------------------------------------------
   4. Viewfinder corner marks — the camera-HUD framing around the viewport
   -------------------------------------------------------------------------- */
.hud-corners { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.hud-corners span {
  position: absolute; width: 26px; height: 26px;
  border: 2px solid var(--hairline-2);
}
.hud-corners span:nth-child(1) { top: 14px; left: 14px; border-right: 0; border-bottom: 0; }
.hud-corners span:nth-child(2) { top: 14px; right: 14px; border-left: 0; border-bottom: 0; }
.hud-corners span:nth-child(3) { bottom: 14px; left: 14px; border-right: 0; border-top: 0; }
.hud-corners span:nth-child(4) { bottom: 14px; right: 14px; border-left: 0; border-top: 0; }
@media (max-width: 640px) { .hud-corners { display: none; } }

/* -----------------------------------------------------------------------------
   5. Header + wordmark (shared)
   -------------------------------------------------------------------------- */
header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--ground) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-block: .85rem;
}
.wordmark {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--font-mono); font-size: var(--step--1);
  letter-spacing: .22em; text-transform: uppercase; font-weight: 600;
  color: var(--ink);
}
.recdot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px 1px color-mix(in srgb, var(--accent) 55%, transparent);
  animation: blink 1.8s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1;   box-shadow: 0 0 10px 1px color-mix(in srgb, var(--accent) 55%, transparent); }
  50%      { opacity: .35; box-shadow: 0 0 0 0 transparent; }
}

/* -----------------------------------------------------------------------------
   6. Buttons (shared)
   -------------------------------------------------------------------------- */
.btn {
  font-family: var(--font-mono);
  font-size: var(--step--1); letter-spacing: .06em;
  text-transform: uppercase; font-weight: 600;
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.15rem; border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, border-color .2s ease, color .2s ease;
}
.btn-primary { background: linear-gradient(180deg, var(--accent), var(--accent-deep)); color: #1a0f0e; }
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { border-color: var(--hairline-2); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--accent); color: var(--ink); transform: translateY(-2px); }
header .btn { padding-block: .55rem; }

/* -----------------------------------------------------------------------------
   7. Footer (shared)
   -------------------------------------------------------------------------- */
footer { border-top: 1px solid var(--hairline); padding-block: 2.5rem; }
.foot-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.2rem; align-items: center; }
.foot-links {
  display: flex; flex-wrap: wrap; gap: 1.5rem;
  font-family: var(--font-mono); font-size: var(--step--1);
  letter-spacing: .06em; text-transform: uppercase;
}
.foot-links a { color: var(--muted); transition: color .2s ease; }
.foot-links a:hover { color: var(--ink); }
.foot-fine { color: var(--muted); font-size: .8rem; font-family: var(--font-mono); letter-spacing: .04em; }

/* -----------------------------------------------------------------------------
   8. Reveal-on-scroll utility (JS adds .in when the element enters the viewport)
   -------------------------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* -----------------------------------------------------------------------------
   9. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .recdot { animation: none; }
}
