/* ==========================================================================
   Looper design system: tokens, base styles, and core components.
   Source of truth: shared/brand/looper.css
   site/assets/looper.css is a COPY (Cloudflare only serves site/). Edit here,
   then run:  cp shared/brand/looper.css site/assets/looper.css
   Guide: shared/STYLE-GUIDE.md · Specimen page: shared/style-guide.html
   Fonts (put in <head>):
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
   ========================================================================== */

:root {
  /* Brand */
  --red: #EC3013;          /* logo accent, red backgrounds, large text only */
  --red-deep: #AE1800;     /* red text at small sizes, links */
  --ink: #201E1D;          /* logo, text, dark backgrounds */
  --paper: #F3F2F2;        /* light background, reversed logo */

  /* Warm neutrals, stepped between ink and paper */
  --white: #FBFAFA;        /* raised surfaces on paper (cards, frames) */
  --paper-2: #EAE8E7;      /* hover fills, sunken wells */
  --line: #E0DDDB;         /* hairlines */
  --line-strong: #CBC7C4;  /* input and secondary-button borders */
  --ink-2: #4A4644;        /* secondary text */
  --ink-3: #6B6663;        /* muted text (5.1:1 on paper, the lightest allowed for text) */
  --ink-4: #A19C99;        /* placeholders, disabled, decorative only */

  /* Dark surfaces (sections on --ink) */
  --night-2: #2A2826;      /* raised surfaces on ink */
  --night-line: #3A3735;   /* hairlines on ink */
  --night-text-2: #A8A3A0; /* muted text on ink (6.6:1) */

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

  --text-display: clamp(2.75rem, 1.6rem + 5.2vw, 5.5rem);  /* 44 → 88 */
  --text-h1: clamp(2.25rem, 1.5rem + 3.4vw, 4rem);         /* 36 → 64 */
  --text-h2: clamp(2rem, 1.45rem + 2.4vw, 3.5rem);         /* 32 → 56 */
  --text-h3: 1.25rem;                                      /* 20 */
  --text-lead: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);    /* 18 → 22 */
  --text-body: 1rem;                                       /* 16 */
  --text-sm: 0.875rem;                                     /* 14 */
  --text-xs: 0.75rem;                                      /* 12 */

  --track-display: -0.045em;  /* same tightness as the wordmark */
  --track-heading: -0.03em;
  --track-label: 0.08em;

  /* Spacing: 4px base */
  --s-1: 4px;  --s-2: 8px;   --s-3: 12px;  --s-4: 16px;  --s-5: 24px;
  --s-6: 32px; --s-7: 48px;  --s-8: 64px;  --s-9: 96px;  --s-10: 128px; --s-11: 160px;

  --container: 1200px;
  --gutter: clamp(16px, 4vw, 48px);
  --section-y: clamp(80px, 10vw, 144px);

  /* Shape */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-frame: 0 1px 0 rgba(32, 30, 29, 0.04), 0 24px 64px -24px rgba(32, 30, 29, 0.18);

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur: 160ms;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 2px solid var(--red-deep); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--red); color: #fff; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: var(--section-y) 0; }
.section + .section { border-top: 1px solid var(--line); }

/* ---------- Type ---------- */
.display { font-size: var(--text-display); font-weight: 700; line-height: 1; letter-spacing: var(--track-display); }
.h1 { font-size: var(--text-h1); font-weight: 700; line-height: 1.04; letter-spacing: var(--track-display); }
.h2 { font-size: var(--text-h2); font-weight: 600; line-height: 1.08; letter-spacing: var(--track-heading); }
.h3 { font-size: var(--text-h3); font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.lead { font-size: var(--text-lead); line-height: 1.5; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.small { font-size: var(--text-sm); }
.label {
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 500;
  text-transform: uppercase; letter-spacing: var(--track-label); color: var(--ink-3);
}
/* Two-tone statement: bold claim in ink, the follow-on in muted. */
.statement { font-size: var(--text-h2); font-weight: 600; line-height: 1.15; letter-spacing: var(--track-heading); }
.statement .muted { color: var(--ink-3); }

/* ---------- Logo ---------- */
/* <a class="logo" href="/" aria-label="Looper">L<svg class="logo-oo" ...></svg>per</a>
   Set --logo-gap to the background it sits on (the gap where the rings cross). */
.logo {
  --logo-o: var(--ink); --logo-o2: var(--red); --logo-gap: var(--paper);
  display: inline-flex; align-items: baseline;
  font-family: var(--font); font-weight: 800; letter-spacing: -0.045em; line-height: 1;
  color: var(--ink); text-decoration: none; font-size: 28px;
}
.logo-oo { height: 0.6em; width: auto; margin: 0 0.01em 0 0.02em; align-self: baseline; transform: translateY(0.012em); overflow: visible; }
.logo--on-ink { color: var(--paper); --logo-o: var(--paper); --logo-o2: var(--red); --logo-gap: var(--ink); }
.logo--on-red { color: var(--paper); --logo-o: var(--paper); --logo-o2: var(--ink); --logo-gap: var(--red); }

/* ---------- Buttons ---------- */
.btn {
  --h: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: var(--h); padding: 0 calc(var(--h) * 0.45);
  border: 1px solid transparent; border-radius: var(--radius-pill);
  font: 600 var(--text-body)/1 var(--font); letter-spacing: -0.01em;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn--sm { --h: 36px; font-size: var(--text-sm); }
.btn--lg { --h: 52px; font-size: 1.0625rem; }

.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: #3A3735; }
.btn--secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--secondary:hover { background: var(--paper-2); border-color: var(--ink-4); }
.btn--accent { background: var(--red-deep); color: #fff; }
.btn--accent:hover { background: #951500; }
/* On dark (ink) sections */
.btn--light { background: var(--paper); color: var(--ink); }
.btn--light:hover { background: #fff; }
.btn--ghost-light { background: transparent; color: var(--paper); border-color: var(--night-line); }
.btn--ghost-light:hover { background: var(--night-2); }

.btn .arrow { transition: transform var(--dur) var(--ease); }
.btn:hover .arrow, .link-arrow:hover .arrow { transform: translateX(3px); }

.link-arrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600; color: var(--ink-2); text-decoration: none;
}
.link-arrow:hover { color: var(--ink); }
.link-red { color: var(--red-deep); font-weight: 600; text-decoration: none; }
.link-red:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Pills / tags ---------- */
.pill {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 30px; padding: 0 var(--s-3);
  border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--white);
  font-size: var(--text-sm); font-weight: 500; color: var(--ink-2);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.tag {
  display: inline-flex; align-items: center; height: 24px; padding: 0 var(--s-2);
  border-radius: var(--radius-sm); background: var(--paper-2);
  font-size: var(--text-xs); font-weight: 600; color: var(--ink-2);
}
.tag--red { background: #FBE3DE; color: var(--red-deep); }
.tag--ok { background: #E3EDE4; color: #2E5E36; }

/* ---------- Cards ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s-5); }
.card--flat { background: transparent; }
.card--dark { background: var(--night-2); border-color: var(--night-line); color: var(--paper); }
.card--hover { transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.card--hover:hover { border-color: var(--line-strong); transform: translateY(-2px); }
/* Product frame: the big rounded window used to show the product. */
.frame { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-frame); overflow: hidden; }

/* ---------- Divided grid (columns split by hairlines, no boxes) ---------- */
.divided { display: grid; gap: 0; }
.divided > * { padding: var(--s-6) var(--s-6) var(--s-6) 0; }
@media (min-width: 800px) {
  .divided--3 { grid-template-columns: repeat(3, 1fr); }
  .divided--3 > * + * { border-left: 1px solid var(--line); padding-left: var(--s-6); }
}
@media (max-width: 799px) {
  .divided > * { padding: var(--s-5) 0; }
  .divided > * + * { border-top: 1px solid var(--line); }
}

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.field label { font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 var(--s-3);
  border: 1px solid var(--line-strong); border-radius: 10px; background: #fff;
  font: 400 var(--text-body)/1.4 var(--font); color: var(--ink);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.textarea { height: auto; min-height: 104px; padding: var(--s-3); resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(32, 30, 29, 0.08); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
