/* =========================================================
   Visualis 3D — design tokens + shared styles
   ========================================================= */

:root {
  /* type pairings — controlled by [data-type] on <html> */
  --font-display: "Instrument Serif", "Times New Roman", serif;
  --font-sans: "Geist", system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", monospace;

  /* color — light (default) */
  --bg: #f6f5f1;
  --bg-2: #efede7;
  --bg-3: #e6e3da;
  --ink: #111110;
  --ink-2: #2a2926;
  --muted: #7c7a72;
  --line: #d9d5cc;
  --accent: #111110;
  --paper-tint: rgba(17, 17, 16, 0.04);

  /* density */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;
  --section-y: 120px;
  --container-px: 48px;

  --radius-sm: 2px;
  --radius-md: 4px;

  --tx-fast: 180ms cubic-bezier(.2,.6,.2,1);
  --tx: 320ms cubic-bezier(.2,.6,.2,1);
}

html[data-theme="dark"] {
  --bg: #0e0e0d;
  --bg-2: #151513;
  --bg-3: #1c1c19;
  --ink: #f3f1ea;
  --ink-2: #d9d6cd;
  --muted: #87857d;
  --line: #2a2926;
  --accent: #f3f1ea;
  --paper-tint: rgba(243, 241, 234, 0.04);
}

html[data-type="editorial"] {
  --font-display: "Instrument Serif", "Times New Roman", serif;
  --font-sans: "Geist", system-ui, sans-serif;
}
html[data-type="modern"] {
  --font-display: "Newsreader", Georgia, serif;
  --font-sans: "Manrope", system-ui, sans-serif;
}
html[data-type="classic"] {
  --font-display: "Cormorant Garamond", Garamond, serif;
  --font-sans: "Work Sans", system-ui, sans-serif;
}

html[data-density="compact"] {
  --section-y: 72px;
  --container-px: 32px;
}
html[data-density="spacious"] {
  --section-y: 168px;
  --container-px: 64px;
}

/* =========================================================
   reset + base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
  transition: background var(--tx), color var(--tx);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
p { margin: 0; }

/* =========================================================
   typography
   ========================================================= */
.eyebrow {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.display {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(56px, 9vw, 168px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-wrap: balance;
  font-style: normal;
}
.display em {
  font-style: italic;
  color: var(--muted);
}
.h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(44px, 6vw, 96px);
  line-height: 1.0;
  letter-spacing: -0.015em;
}
.h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(22px, 2vw, 28px);
  line-height: 1.2;
}
.lead {
  font-size: clamp(17px, 1.4vw, 20px);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 56ch;
  text-wrap: pretty;
}
.body {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-2);
  max-width: 60ch;
}
.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* =========================================================
   layout
   ========================================================= */
.container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--container-px);
}
.section {
  padding: var(--section-y) 0;
}
.divider {
  height: 1px;
  background: var(--line);
  width: 100%;
}

/* =========================================================
   header / nav
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 68px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  position: relative;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: end center;
}
.brand-mark .bird {
  width: 24px;
  height: 24px;
  object-fit: contain;
  object-position: bottom;
  filter: var(--bird-filter, none);
}
html[data-theme="dark"] .brand-mark .bird {
  filter: invert(1);
}
.brand-mark .nozzle {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.brand-mark .nozzle::before {
  content: "";
  width: 10px;
  height: 5px;
  background: currentColor;
  border-radius: 1px 1px 0 0;
}
.brand-mark .nozzle::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid currentColor;
}
.brand-mark .thread {
  position: absolute;
  top: 12px;
  left: 50%;
  width: 1px;
  height: 6px;
  background: currentColor;
  opacity: 0.6;
  transform: translateX(-50%);
}
.brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1;
}
.brand-name small {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
  margin-left: 6px;
  vertical-align: 4px;
}
.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}
.nav-link {
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  position: relative;
  padding: 6px 0;
  transition: color var(--tx-fast);
}
.nav-link:hover { color: var(--ink); }
.nav-link[aria-current="page"] {
  color: var(--ink);
}
.nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--ink);
}
.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  transition: opacity var(--tx-fast), transform var(--tx-fast);
}
.nav-cta:hover { opacity: 0.85; }
.nav-cta .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #2ecc71;
  box-shadow: 0 0 0 0 rgba(46,204,113,0.6);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46,204,113,0.6); }
  70% { box-shadow: 0 0 0 6px rgba(46,204,113,0); }
  100% { box-shadow: 0 0 0 0 rgba(46,204,113,0); }
}

/* =========================================================
   buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
  border: 1px solid var(--ink);
  transition: all var(--tx-fast);
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover {
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
}
.btn-ghost:hover {
  background: var(--ink);
  color: var(--bg);
}
.btn .arrow {
  display: inline-block;
  transition: transform var(--tx-fast);
}
.btn:hover .arrow { transform: translateX(3px); }

/* =========================================================
   footer
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--line);
  padding: var(--space-8) 0 var(--space-6);
  margin-top: var(--space-9);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 48px;
  align-items: start;
}
.footer-col h4 {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 16px;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 8px; font-size: 14px; color: var(--ink-2); }
.footer-col a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

/* =========================================================
   subtle placeholder (image slot)
   ========================================================= */
.ph {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.ph::before {
  content: "";
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0 16px,
    var(--paper-tint) 16px 17px
  );
}
.ph .ph-label {
  position: relative;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
}

/* =========================================================
   tweaks panel
   ========================================================= */
.tweaks-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  display: none;
  place-items: center;
  font-size: 18px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}
.tweaks-fab.active { display: grid; }
.tweaks-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 101;
  width: 320px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.12);
  font-family: var(--font-sans);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.tweaks-panel.open { display: flex; }
.tweaks-header {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.tweaks-header h3 {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.tweaks-close {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 4px;
  color: var(--muted);
}
.tweaks-close:hover { color: var(--ink); background: var(--bg-2); }
.tweaks-body { padding: 14px 16px; max-height: 70vh; overflow-y: auto; }
.tweaks-section { margin-bottom: 18px; }
.tweaks-section:last-child { margin-bottom: 0; }
.tweaks-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  display: block;
}
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.seg button {
  padding: 9px 8px;
  font-size: 12px;
  color: var(--ink-2);
  background: var(--bg);
  border-right: 1px solid var(--line);
  transition: all var(--tx-fast);
}
.seg button:last-child { border-right: none; }
.seg button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}
.seg button:hover:not([aria-pressed="true"]) {
  background: var(--bg-2);
}

/* =========================================================
   utility
   ========================================================= */
.row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.cluster { display: flex; gap: 12px; flex-wrap: wrap; }
.stack-3 > * + * { margin-top: 12px; }
.stack-5 > * + * { margin-top: 24px; }
.stack-6 > * + * { margin-top: 32px; }
.fade-in { animation: fadeIn 700ms cubic-bezier(.2,.6,.2,1) both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* small */
@media (max-width: 860px) {
  .nav-links { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  :root { --container-px: 24px; --section-y: 72px; }
}
