/* ============================================================
   Ziell — Warm Editorial design system
   Shared tokens, base, and components for every page.
   ============================================================ */

:root {
  --paper: #f4efe6;
  --paper-2: #ece4d6;
  --surface: #fefcf8;
  --surface-2: #ffffff;
  --ink: #1b1917;
  --ink-soft: #3b352f;
  --muted: #635c56;
  --soft: #8b8279;
  --line: rgba(27, 25, 23, 0.17);
  --line-strong: rgba(27, 25, 23, 0.34);
  --ember: #2b4c7e;
  --ember-deep: #1f3860;
  --ember-wash: rgba(43, 76, 126, 0.12);
  --pine: #3f6b5a;
  --pine-wash: rgba(63, 107, 90, 0.12);
  --gold: #b98a2f;

  --shadow-xs: 0 1px 2px rgba(27, 25, 23, 0.06);
  --shadow-sm: 0 6px 18px -12px rgba(27, 25, 23, 0.4);
  --shadow: 0 22px 48px -30px rgba(27, 25, 23, 0.5);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --maxw: 1120px;
  --maxw-narrow: 760px;

  --font-display: "Instrument Serif", "Fraunces", Georgia, serif;
  --font-body: "Instrument Sans", "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] {
  --paper: #14110f;
  --paper-2: #0f0d0b;
  --surface: #1d1916;
  --surface-2: #241f1a;
  --ink: #f4efe6;
  --ink-soft: #ddd5ca;
  --muted: #b3a99d;
  --soft: #8a8078;
  --line: rgba(244, 239, 230, 0.18);
  --line-strong: rgba(244, 239, 230, 0.34);
  --ember: #6e96d6;
  --ember-deep: #9bb6e6;
  --ember-wash: rgba(110, 150, 214, 0.16);
  --pine: #7cb096;
  --pine-wash: rgba(124, 176, 150, 0.16);
  --gold: #d8ab57;
  --shadow: 0 22px 48px -30px rgba(0, 0, 0, 0.75);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

::selection {
  background: var(--ember);
  color: #fff;
}

/* ---------- focus & tap highlight ---------- */
*,
*::before,
*::after {
  -webkit-tap-highlight-color: transparent;
}

a,
button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

:focus {
  outline: none;
}

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


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

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

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-optical-sizing: auto;
  letter-spacing: -0.015em;
  line-height: 1.05;
}

p {
  margin: 0;
}

/* ---------- layout ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 48px);
}

.container--narrow {
  max-width: var(--maxw-narrow);
}

.section {
  position: relative;
  z-index: 1;
  padding: clamp(56px, 9vw, 120px) 0;
  scroll-margin-top: 90px;
}

.section + .section {
  border-top: 1px solid var(--line);
}

/* ---------- typography helpers ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ember);
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: clamp(28px, 4vw, 48px);
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: clamp(28px, 4.4vw, 46px);
}

.section-index {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--soft);
  letter-spacing: 0.1em;
}

.lead {
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.7;
  color: var(--muted);
  max-width: 62ch;
}

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

/* ---------- buttons ---------- */
.btn {
  --btn-bg: var(--ink);
  --btn-fg: var(--paper);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: transform 0.2s var(--ease), background 0.2s, box-shadow 0.2s,
    border-color 0.2s, color 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  --btn-bg: var(--ember);
  --btn-fg: #fff;
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  border-color: var(--line-strong);
}

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

.btn--sm {
  padding: 9px 18px;
  font-size: 11px;
}

/* ---------- tags ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s;
}

.card:hover {
  border-color: var(--line-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.site-header .container {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  object-fit: cover;
}

.brand small {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--soft);
  align-self: flex-end;
  margin-bottom: 2px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 8px 13px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--ink);
  background: var(--paper-2);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  transition: background 0.2s, color 0.2s, transform 0.2s, border-color 0.2s;
}

.theme-toggle:hover {
  background: var(--ink);
  color: var(--paper);
  transform: rotate(-12deg);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

.nav-burger {
  display: none;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 40px 0 56px;
}

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 20px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--soft);
  letter-spacing: 0.04em;
}

.site-footer a:hover {
  color: var(--ember);
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 24px);
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  padding: 11px 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  transition: opacity 0.25s, transform 0.25s var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.95s var(--ease), transform 0.95s var(--ease);
  will-change: opacity, transform;
}

.reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- responsive nav ---------- */
@media (max-width: 720px) {
  .nav-links {
    display: none;
  }
  .nav-burger {
    display: grid;
  }
  .site-header .container {
    height: 62px;
  }
}

/* ---------- mobile drawer ---------- */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  flex-direction: column;
  padding: 22px clamp(20px, 6vw, 32px);
  background: var(--paper);
}

.drawer.open {
  display: flex;
}

.drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
}

.drawer-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-links a {
  font-family: var(--font-display);
  font-size: 30px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  transition: color 0.2s, padding-left 0.2s;
}

.drawer-links a:hover {
  color: var(--ember);
  padding-left: 8px;
}

.drawer-foot {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--soft);
  letter-spacing: 0.06em;
}

/* ---------- misc ---------- */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* ---------- blurred aura (shared accent) ---------- */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(90px);
  -webkit-filter: blur(90px);
  opacity: 0.55;
  transition: opacity 0.4s var(--ease);
}

body::before {
  top: -14vw;
  left: -12vw;
  width: 44vw;
  height: 44vw;
  max-width: 680px;
  max-height: 680px;
  background: radial-gradient(circle, var(--ember-wash), transparent 70%);
}

body::after {
  bottom: -16vw;
  right: -14vw;
  width: 48vw;
  height: 48vw;
  max-width: 760px;
  max-height: 760px;
  background: radial-gradient(circle, var(--pine-wash), transparent 70%);
}

html[data-theme="dark"] body::before,
html[data-theme="dark"] body::after {
  opacity: 0.7;
}
