/* effortless.run — critical + component styles
 *
 * Split of responsibility (deliberate, see docs/tasks/website.md decision 5 + FOUC note):
 *   - THIS FILE owns everything above the fold (nav, hero) and every component that appears
 *     above the fold (buttons, code panels, terminal, syntax colors). It is render-blocking,
 *     so first paint is already correct.
 *   - MINGLED owns layout, spacing, and typography for sections below the fold, via utility
 *     classes in the markup. mingled scans on DOMContentLoaded, so anything it styles can
 *     flash unstyled — which is invisible below the fold and unacceptable above it.
 *
 * Do not put mingled utility classes on .nav or .hero elements: this file already styles them,
 * and mingled's Preflight-based reset is injected at runtime, which would fight them.
 */

/* ---------------------------------------------------------------- tokens */

:root {
  /* mingled resolves `c:ink` -> var(--color-ink), `ff:mono` -> var(--font-mono)
   *
   * THE PALETTE (5 given colors, used verbatim):
   *   #ED6A5A Vibrant Coral · #F4F1BB Lemon Chiffon · #9BC1BC Ash Grey
   *   #5D576B Taupe Grey    · #E6EBE0 Soft Linen
   *
   * Five colors can't cover a full UI at accessible contrast, so everything else here is a
   * tint or shade DERIVED from them, marked below. Contrast ratios are against --color-paper.
   */

  /* — palette, verbatim — */
  --color-accent: #ed6a5a;      /* Vibrant Coral  — fills, dots, decorative only (2.5:1 as text) */
  --color-lemon: #f4f1bb;       /* Lemon Chiffon  — eyebrow pill, syntax numbers */
  --color-teal: #9bc1bc;        /* Ash Grey       — secondary accent, syntax strings */
  --color-muted: #5d576b;       /* Taupe Grey     — secondary text, 6.4:1 */
  --color-tint: #e6ebe0;        /* Soft Linen     — the honesty band (too heavy full-page) */

  /* — derived shades — */
  --color-ink: #322e3d;         /* deepened taupe — headings, 12.2:1 */
  --color-body: #4a4556;        /* deepened taupe — body copy, 8.6:1 */
  --color-paper: #f5f7f3;       /* lifted linen   — page background */
  --color-surface: #ffffff;     /* white          — cards, alternating sections */
  --color-hairline: #d0d8c9;    /* deepened linen — rules */
  --color-faint: #bcc5b3;       /* deepened linen — borders */
  --color-term: #3a3545;        /* deepened taupe — code + terminal panels */
  --color-term-line: #4e475c;   /* deepened taupe — panel bar divider */

  /* Coral is a mid-tone, so it needs three variants to stay legible.
   * Using the raw #ED6A5A for text or for white-on-coral buttons fails WCAG AA. */
  --color-accent-hl: #d45744;   /* headline highlight — large text only, 3.7:1 */
  --color-accent-text: #a8402f; /* links + small coral text, 5.7:1 */
  --color-accent-btn-hover: #e2543f;
  /* Buttons keep the raw Vibrant Coral and take DARK text: white on coral is only 3.1:1
   * and ink is 4.3:1, both under AA. #2b1512 on coral is 5.6:1, and 4.6:1 on hover. */
  --color-on-accent: #2b1512;

  --font-sans: Geist, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --radius: 14px;
  --shell: 1120px;
}

/* ---------------------------------------------------------------- reset
 * Minimal, and compatible with mingled's own Preflight-based reset, which is
 * injected later at runtime. Keep this list short. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-body);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

/* width/height attributes are set on <img> to reserve layout space (no CLS);
 * without height:auto the attribute wins over max-width and squashes the image. */
img {
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

code,
pre,
kbd {
  font-family: var(--font-mono);
  font-size: inherit;
}

pre {
  margin: 0;
}

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

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

/* Utility that mingled cannot express, used in both halves of the page. */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 24px;
}

.mono {
  font-family: var(--font-mono);
}

/* mingled has no text-wrap utility; headlines need it to avoid orphan words. */
.balance {
  text-wrap: balance;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- nav */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--color-paper) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.nav[data-scrolled="true"] {
  border-bottom-color: var(--color-hairline);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--color-ink);
}

.brand-mark {
  width: 22px;
  height: 22px;
  flex: none;
}

.nav-links {
  display: none;
  align-items: center;
  gap: 28px;
}

.nav-links a {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-body);
  transition: color 0.15s ease;
}

.nav-links a:hover {
  color: var(--color-ink);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-muted);
  border: 1px solid var(--color-hairline);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-right: -8px;
  border-radius: 8px;
  color: var(--color-ink);
}

.nav-toggle:hover {
  background: var(--color-tint);
}

.nav-panel {
  border-top: 1px solid var(--color-hairline);
  background: var(--color-paper);
  padding: 12px 0 20px;
}

.nav-panel a {
  display: block;
  padding: 10px 0;
  font-size: 18px;
  font-weight: 500;
  color: var(--color-ink);
}

@media (min-width: 820px) {
  .nav-links {
    display: flex;
  }

  .nav-toggle,
  .nav-panel {
    display: none !important;
  }
}

/* ---------------------------------------------------------------- hero */

.hero {
  padding: 72px 0 8px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-text);
  background: var(--color-lemon);
  border-radius: 999px;
  padding: 6px 14px;
}

.eyebrow::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 999px;
  background: var(--color-accent);
  /* When the pill wraps to two lines, keep the dot on the first one. */
  align-self: flex-start;
  margin-top: 0.62em;
}

@media (max-width: 420px) {
  .eyebrow {
    font-size: 11px;
    padding: 5px 12px;
  }
}

.hero h1 {
  max-width: 17ch;
  margin: 28px 0 0;
  font-size: clamp(38px, 7.4vw, 78px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--color-ink);
  text-wrap: balance;
}

.hero h1 em {
  font-style: normal;
  color: var(--color-accent-hl);
}

.hero-sub {
  max-width: 60ch;
  margin: 26px 0 0;
  font-size: clamp(17px, 2.2vw, 20px);
  line-height: 1.6;
  color: var(--color-body);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 36px 0 0;
}

.hero-trust {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 28px 0 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-muted);
}

.hero-trust span[aria-hidden] {
  color: var(--color-faint);
}

.hero-panel {
  margin: 44px 0 0;
  max-width: 900px;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 550;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-on-accent);
  box-shadow: 0 1px 2px rgba(50, 46, 61, 0.18);
}

.btn-primary:hover {
  background: var(--color-accent-btn-hover);
}

.btn-ghost {
  color: var(--color-ink);
  border: 1px solid var(--color-faint);
  background: var(--color-surface);
}

.btn-ghost:hover {
  border-color: var(--color-muted);
}

.btn svg {
  flex: none;
  opacity: 0.75;
}

/* ---------------------------------------------------------------- code + terminal panels */

.panel {
  background: var(--color-term);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow:
    0 1px 2px rgba(50, 46, 61, 0.08),
    0 18px 40px -20px rgba(50, 46, 61, 0.32);
}

.panel-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-bottom: 1px solid var(--color-term-line);
}

.panel-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #55506a;
  flex: none;
}

.panel-name {
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #a29bb0;
}

.panel-body {
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.75;
  color: #e6ebe0;
  tab-size: 2;
}

.panel-body code {
  font-size: inherit;
}

/* Terminal output wraps, because a real terminal wraps. Code panels must NOT wrap:
 * a wrapped Lua sample misrepresents its line count, and "11 lines of Lua" is a
 * claim on this page. */
.panel-body.term {
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* The "what you'd write otherwise" panel: deliberately flat and grey next to the
 * live-coloured EQL panel. Verbose and tired vs short and alive. */
.panel-light {
  background: var(--color-surface);
  border: 1px solid var(--color-hairline);
  box-shadow: none;
}

.panel-light .panel-bar {
  border-bottom-color: var(--color-hairline);
}

.panel-light .panel-name {
  color: var(--color-muted);
}

.panel-light .panel-body {
  color: #6f6982;
}

.panel-light .panel-body .t-com {
  color: #a09ab0;
}

/* Comparison panels sit in a half-column, so they get a slightly tighter size.
 * Every sample in them is written to fit without clipping at 1280. */
.cmp-pair .panel-body {
  font-size: 12.5px;
  line-height: 1.7;
}

/* Label above each half of a comparison. */
.cmp-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 10px;
}

.cmp-label.win {
  color: var(--color-accent-text);
}

/* Tabs (impetus-driven) */

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-muted);
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.tab:hover {
  color: var(--color-ink);
}

.tab[aria-selected="true"] {
  background: var(--color-ink);
  color: var(--color-paper);
}

.copy-btn {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #a29bb0;
  transition: color 0.15s ease;
}

.copy-btn:hover {
  color: #e6ebe0;
}

/* ---------------------------------------------------------------- syntax colors
 * Hand-authored spans. No highlighter runs on this page: zero JS, zero flash,
 * and the samples are short enough to mark up by hand. */

.t-com { color: #a49cb2; font-style: italic; }  /* comment — light taupe */
.t-key { color: #f4816f; }                      /* keyword — lifted coral */
.t-str { color: #9bc1bc; }                      /* string — Ash Grey */
.t-num { color: #f4f1bb; }                      /* number, boolean, nil — Lemon Chiffon */
.t-fn  { color: #bcd9d5; }                      /* function / module — lifted Ash Grey */
.t-pun { color: #9a92a8; }                      /* punctuation — light taupe */
.t-tag { color: #f4816f; }                      /* template tag, html tag — lifted coral */
.t-atr { color: #bcd9d5; }                      /* html attribute — lifted Ash Grey */
.t-var { color: #e6ebe0; }                      /* plain identifier — Soft Linen */

/* EQL inside a Lua string: the samples' centrepiece, so it gets its own tones.
 * Nests inside .t-str, which is why these override rather than restate. */
.e-k { color: #f4f1bb; }                        /* select / where / insert — Lemon Chiffon */
.e-c { color: #9bc1bc; }                        /* .column reference — Ash Grey */
.e-p { color: #f4816f; }                        /* $form.title, $auth.id — lifted coral */

/* terminal */
.c-pro { color: #7a7288; }                      /* $ prompt — taupe */
.c-cmd { color: #e6ebe0; }                      /* typed command — Soft Linen */
.c-ok  { color: #9bc1bc; }                      /* ✓ — Ash Grey */
.c-add { color: #f4f1bb; }                      /* + — Lemon Chiffon */
.c-err { color: #f4816f; }                      /* ✗ — lifted coral */
.c-dim { color: #b3aec0; }                      /* plain output — light taupe */

/* ---------------------------------------------------------------- below-the-fold helpers
 * Everything else is mingled utilities in the markup. These are the few things
 * mingled cannot express. */

.rule {
  height: 1px;
  background: var(--color-hairline);
  border: 0;
}

.card-hover {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card-hover:hover {
  border-color: var(--color-faint);
  box-shadow: 0 1px 2px rgba(50, 46, 61, 0.05), 0 12px 28px -18px rgba(50, 46, 61, 0.24);
}

.cmp {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 13.5px;
}

.cmp th {
  text-align: left;
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  padding: 0 0 12px;
  border-bottom: 1px solid var(--color-hairline);
}

.cmp td {
  padding: 14px 0;
  border-bottom: 1px solid var(--color-hairline);
  vertical-align: top;
  line-height: 1.6;
}

.cmp tr:last-child td {
  border-bottom: 0;
}

.cmp .from {
  color: var(--color-muted);
  padding-right: 32px;
  width: 46%;
}

.cmp .to {
  color: var(--color-ink);
}

@media (max-width: 700px) {
  .cmp,
  .cmp tbody,
  .cmp tr,
  .cmp td {
    display: block;
    width: 100%;
  }

  .cmp thead {
    display: none;
  }

  .cmp tr {
    padding: 14px 0;
    border-bottom: 1px solid var(--color-hairline);
  }

  .cmp td {
    border: 0;
    padding: 0;
  }

  .cmp .from {
    width: 100%;
    padding: 0 0 6px;
  }

  .cmp .from::after {
    content: " ↓";
    color: var(--color-accent);
  }
}

.browser {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-hairline);
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgba(50, 46, 61, 0.06), 0 24px 48px -28px rgba(50, 46, 61, 0.28);
}

.browser-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  background: var(--color-tint);
  border-bottom: 1px solid var(--color-hairline);
}

.browser-bar .panel-dot {
  background: var(--color-faint);
}

.browser-url {
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--color-muted);
}

.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  padding: 32px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-muted);
  background:
    repeating-linear-gradient(
      45deg,
      var(--color-tint) 0 10px,
      #dfe6da 10px 20px
    );
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
