/* ============================================================
   Mezin Design System — Tokens & Base Styles
   Ported 1:1 from website/app/globals.css (Tailwind v4 @theme).
   This file works WITHOUT Tailwind — drop it into any HTML page.
   ============================================================ */

/* Webfonts: loaded from Google Fonts CDN for portability.
   The production site self-hosts these via next/font (see CAVEATS in README). */
@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  color-scheme: light;
  /* ===========================================================
     COLOR — base
     Warm paper, deep ink, single terracotta accent.
     ===========================================================*/
  --background: #faf8f4;     /* page paper */
  --foreground: #1a1815;     /* deep ink, NOT pure black */
  --muted: #f2eee6;          /* alt section band */
  --muted-foreground: #6b6660; /* supporting text */
  --border: #e8e2d6;         /* hairline */
  --accent: #b0482a;         /* terracotta — WCAG AA on white */
  --accent-foreground: #ffffff;
  --success: #4f6c45;        /* muted olive — Online dot only */
  --success-foreground: #f1f5ee;
  --destructive: oklch(0.55 0.19 27); /* form errors only */
  --destructive-foreground: var(--background);

  /* COLOR — semantic aliases (use these in components when possible) */
  --color-fg-1: var(--foreground);
  --color-fg-2: var(--muted-foreground);
  --color-fg-on-accent: var(--accent-foreground);
  --color-bg-1: var(--background);
  --color-bg-2: var(--muted);
  --color-bg-accent: var(--accent);
  --color-link: var(--accent);
  --color-link-hover: #8e3a22;        /* accent darkened ~10% */
  --color-divider: var(--border);

  /* Accent tinted layers (used for eyebrow pills, soft fills, gradients) */
  --accent-05: rgba(176, 72, 42, 0.05);
  --accent-08: rgba(176, 72, 42, 0.08);
  --accent-10: rgba(176, 72, 42, 0.10);
  --accent-15: rgba(176, 72, 42, 0.15);
  --accent-20: rgba(176, 72, 42, 0.20);
  --accent-30: rgba(176, 72, 42, 0.30);
  --accent-40: rgba(176, 72, 42, 0.40);

  /* ===========================================================
     TYPE — families
     ===========================================================*/
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-display: "Fraunces", ui-serif, "Iowan Old Style", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* TYPE — fluid scale (clamp(min, fluid, max)) */
  --text-xs: 0.8125rem;    /* 13px */
  --text-sm: 0.875rem;     /* 14px */
  --text-base: clamp(1rem, 0.95rem + 0.2vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1.05rem + 0.3vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.15rem + 0.4vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);
  --text-3xl: clamp(1.875rem, 1.6rem + 1.2vw, 2.5rem);
  --text-4xl: clamp(2rem, 1.7rem + 1.5vw, 3rem);
  --text-5xl: clamp(2.5rem, 2rem + 2.5vw, 3.75rem);
  --text-6xl: clamp(3rem, 2.4rem + 3vw, 4.5rem);

  /* TYPE — Fraunces variable axis settings for headings.
     opsz 36 (subhead cut) was chosen over the editorial 144 because the
     Display end of Fraunces has very high stroke contrast — those thin
     horizontals get crushed on phone screens. opsz 36 keeps recognizable
     serif character while making the strokes uniform enough to read. */
  --display-font-variation: "SOFT" 50, "WONK" 0, "opsz" 36;

  /* ===========================================================
     LAYOUT — containers, spacing, radii
     ===========================================================*/
  --container-prose: 55ch;
  --container-reading: 880px;
  --container-page: 1200px;

  --section-y: clamp(4rem, 8vw, 8rem);

  --radius-sm: 0.25rem;     /* focus, tiny pills */
  --radius: 0.375rem;       /* button, input default */
  --radius-md: 0.5rem;      /* small card */
  --radius-lg: 0.75rem;     /* FAQ details */
  --radius-xl: 1rem;        /* medium card */
  --radius-2xl: 1rem;       /* workhorse card radius */
  --radius-full: 9999px;    /* pills, avatars */

  /* ===========================================================
     MOTION
     ===========================================================*/
  --ease-entrance: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-entrance: 500ms;
  --duration-fast: 200ms;
  --duration-medium: 300ms;
  --duration-slow: 800ms;

  /* ===========================================================
     SHADOWS — three tiers
     ===========================================================*/
  --shadow-sm: 0 1px 2px 0 rgba(26, 24, 21, 0.05);
  --shadow-card: 0 30px 60px -30px rgba(26, 24, 21, 0.25); /* signature */
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.20);
}

/* Brand is light-only by design — no dark variant. The `color-scheme`
   declaration on :root tells the UA to render system controls (form
   inputs, scrollbars) with light styling and prevents iOS Safari /
   Android Chrome from auto-tinting the page when the device is in
   dark mode. */

/* ============================================================
   GLOBAL BASE
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
* { border-color: var(--border); }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01" on, "cv11" on;
  scroll-behavior: smooth;
}

/* Offset anchor targets so the section heading clears the sticky header. */
:where(section[id], [id="top"]) { scroll-margin-top: 88px; }
@media (min-width: 768px) { :where(section[id], [id="top"]) { scroll-margin-top: 96px; } }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
}

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

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

/* ============================================================
   SEMANTIC TYPE
   Headings: Fraunces, tight, weight 500. NEVER bold.
   ============================================================ */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--foreground);
  font-weight: 500;
  font-variation-settings: var(--display-font-variation);
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: var(--text-6xl); line-height: 1.05; }
h2 { font-size: var(--text-4xl); line-height: 1.10; }
h3 { font-size: var(--text-2xl); line-height: 1.20; }
h4 { font-size: var(--text-xl);  line-height: 1.25; }

p {
  margin: 0;
  text-wrap: pretty;
  line-height: 1.6;
}

/* Editorial pull-quote */
.display-quote {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variation-settings: var(--display-font-variation);
}

/* "STEP 01" label — the only mono usage */
.label-mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
}

/* Eyebrow pill — UPPERCASE wide-tracked label inside an accent capsule.
   The brand's signature section-eyebrow. */
.eyebrow {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--accent-10);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
}

/* Body sizes */
.body-lg { font-size: var(--text-lg);  line-height: 1.6; }
.body    { font-size: var(--text-base); line-height: 1.6; }
.body-sm { font-size: var(--text-sm);  line-height: 1.5; color: var(--muted-foreground); }
.caption { font-size: var(--text-xs);  line-height: 1.4; color: var(--muted-foreground); }

/* Link */
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ============================================================
   BACKGROUND UTILITIES
   ============================================================ */

.bg-paper { background: var(--background); }
.bg-paper-muted { background: var(--muted); }
.bg-accent-surface { background: var(--accent); color: var(--accent-foreground); }

/* Mesh gradient — five overlapping accent radials */
.mesh-gradient {
  background-image:
    radial-gradient(at 40% 20%, rgba(176, 72, 42, 0.08) 0px, transparent 50%),
    radial-gradient(at 80% 0%,  rgba(176, 72, 42, 0.05) 0px, transparent 50%),
    radial-gradient(at 0% 50%,  rgba(176, 72, 42, 0.04) 0px, transparent 50%),
    radial-gradient(at 80% 50%, rgba(232, 226, 214, 0.5) 0px, transparent 50%),
    radial-gradient(at 0% 100%, rgba(176, 72, 42, 0.06) 0px, transparent 50%);
}

/* Dot grid — 1px on 24px lattice. Apply with opacity-low. */
.dot-grid {
  background-image: radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0);
  background-size: 24px 24px;
  opacity: 0.02;
}

/* Plus-cross pattern (over light) */
.plus-pattern-dark {
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%231a1815' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.015;
}

/* Plus-cross pattern (over accent / dark surface) */
.plus-pattern-light {
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.03;
}

/* Paper grain — fractal noise overlay */
.paper-grain {
  position: relative;
  isolation: isolate;
}
.paper-grain::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
}

/* Glass — paper at 70% with strong saturation blur */
.glass {
  background: rgba(250, 248, 244, 0.7);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ============================================================
   CARD VOCABULARY
   ============================================================ */
.card {
  position: relative;
  overflow: hidden;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: 1.75rem;
  transition: border-color var(--duration-medium) var(--ease-entrance);
}
@media (min-width: 768px) { .card { padding: 2.25rem; } }
.card:hover { border-color: var(--accent-30); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  height: 2.5rem;
  padding: 0 1.25rem;
  border: 0;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-entrance),
              color var(--duration-fast) var(--ease-entrance);
}
.btn-lg  { height: 3rem;   padding: 0 1.75rem; font-size: var(--text-base); }
.btn-sm  { height: 2.25rem; padding: 0 0.75rem; }

.btn-primary { background: var(--accent); color: var(--accent-foreground); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--color-link-hover); }

.btn-secondary { background: var(--foreground); color: var(--background); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: rgba(26, 24, 21, 0.9); }

.btn-outline { background: transparent; color: var(--foreground); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--muted); }

.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--muted); }

/* ============================================================
   CONTAINERS
   ============================================================ */
.container-page    { width: 100%; max-width: var(--container-page);    margin-inline: auto; padding-inline: 1.25rem; }
.container-reading { width: 100%; max-width: var(--container-reading); margin-inline: auto; padding-inline: 1.25rem; }
.container-prose   { width: 100%; max-width: var(--container-prose);   margin-inline: auto; padding-inline: 1.25rem; }
@media (min-width: 768px) {
  .container-page, .container-reading, .container-prose { padding-inline: 2rem; }
}

.section-y { padding-block: var(--section-y); }

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
