/* ==========================================================================
   Zivanor — shared site styles
   Used by every page under /site. Tokens, type, nav, footer and the reusable
   components (app cards, feature cards, chips, buttons). Light + dark via
   prefers-color-scheme. No third-party requests: fonts are self-hosted.
   ========================================================================== */

/* ---- Fonts (SIL Open Font License, self-hosted) ------------------------ */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/assets/fonts/bricolage-grotesque.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/instrument-sans.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/instrument-sans-italic.woff2') format('woff2');
}

/* ---- Tokens ------------------------------------------------------------ */
:root {
  --ink: #16171B;
  --ink-soft: #2A2C33;
  --bg: #F6F5F1;
  --surface: #FFFFFF;
  --surface-2: #EEEDE8;
  --muted: #5B6070;
  --line: rgba(22, 23, 27, 0.10);
  --line-strong: rgba(22, 23, 27, 0.18);

  --sky: #A9E1F8;
  --mint: #A8EFD0;
  --pink: #FBB8E2;
  --lilac: #D3C8FB;
  --peach: #FFCDAE;
  --lemon: #FBE594;

  --accent: var(--sky);
  --on-accent: #16171B;

  --font-display: 'Bricolage Grotesque', 'Avenir Next', 'Segoe UI Variable Display', system-ui, sans-serif;
  --font-body: 'Instrument Sans', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;

  --radius-s: 12px;
  --radius-m: 20px;
  --radius-l: 28px;
  --shadow-card: 0 1px 2px rgba(22, 23, 27, 0.04), 0 12px 32px -16px rgba(22, 23, 27, 0.18);
  --shadow-float: 0 24px 60px -24px rgba(22, 23, 27, 0.35);

  --wrap: 1120px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #F4F5F7;
    --ink-soft: #D6D8DE;
    --bg: #0E0F12;
    --surface: #17191E;
    --surface-2: #1F2228;
    --muted: #A5AAB6;
    --line: rgba(244, 245, 247, 0.10);
    --line-strong: rgba(244, 245, 247, 0.20);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -16px rgba(0, 0, 0, 0.6);
    --shadow-float: 0 24px 60px -24px rgba(0, 0, 0, 0.8);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; }

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

.wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---- Background texture ------------------------------------------------ */
.bg-dots {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1.2px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 70%);
}

/* ---- Nav --------------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--bg);
  display: grid;
  place-items: center;
  flex: none;
}
.brand-mark svg { width: 20px; height: 20px; }
.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  display: inline-block;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.nav-links a:hover, .nav-links a[aria-current="page"] {
  color: var(--ink);
  background: var(--surface-2);
}
@media (max-width: 560px) {
  .nav-links a { padding: 0.45rem 0.6rem; font-size: 0.9rem; }
}

/* ---- Sections ---------------------------------------------------------- */
.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}
.section-head h2 { font-size: clamp(1.9rem, 4vw, 2.75rem); }
.section-head p { color: var(--muted); max-width: 44ch; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.9rem;
}
.eyebrow::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 3px;
  background: var(--accent);
}

/* ---- Buttons & chips --------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(.2,.8,.2,1), box-shadow 0.18s, background 0.18s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -12px rgba(0,0,0,0.5); }
.btn:active { transform: translateY(0); }
.btn svg { width: 18px; height: 18px; }
.btn.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn.secondary:hover { background: var(--surface); box-shadow: var(--shadow-card); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.chip::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}
.chip.live { background: var(--mint); color: #0E3B2A; }
.chip.live::before { background: #1F9F6A; opacity: 1; }
.chip.soon { background: var(--lemon); color: #4A3A00; }
.chip.soon::before { background: #C99A00; opacity: 1; }

/* ---- App cards (one per Zivanor app) ----------------------------------- */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 1.25rem;
}
.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1.6rem;
  border-radius: var(--radius-l);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.25s cubic-bezier(.2,.8,.2,1), box-shadow 0.25s, border-color 0.25s;
}
.app-card::after {
  /* colour wash in the corner, uses the card's --tint */
  content: '';
  position: absolute;
  inset-inline-end: -30%;
  top: -40%;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--tint, var(--sky)), transparent 72%);
  opacity: 0.55;
  z-index: -1;
  transition: opacity 0.3s, transform 0.4s cubic-bezier(.2,.8,.2,1);
}
.app-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-float);
  border-color: var(--line-strong);
}
.app-card:hover::after { opacity: 0.85; transform: scale(1.12); }
.app-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.app-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  flex: none;
  box-shadow: 0 6px 16px -8px rgba(0,0,0,0.45);
}
.app-card h3 {
  font-size: 1.45rem;
  font-weight: 700;
}
.app-card .app-sub {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--muted);
  font-size: 0.98rem;
  margin-top: 0.15rem;
}
.app-card p.desc { color: var(--ink-soft); font-size: 0.98rem; }
.app-card .app-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
}
.app-card .app-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 0.25rem;
}
.app-card .app-cta svg { width: 16px; height: 16px; transition: transform 0.2s; }
.app-card:hover .app-cta svg { transform: translateX(3px); }
[dir="rtl"] .app-card:hover .app-cta svg { transform: translateX(-3px) scaleX(-1); }

/* Placeholder slot for the next app */
.app-card.placeholder {
  border-style: dashed;
  border-color: var(--line-strong);
  background: transparent;
  box-shadow: none;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--muted);
  min-height: 260px;
}
.app-card.placeholder::after { display: none; }
.app-card.placeholder:hover { transform: none; box-shadow: none; }
.app-card.placeholder .slot-icon {
  width: 64px; height: 64px;
  border-radius: 18px;
  border: 2px dashed var(--line-strong);
  display: grid;
  place-items: center;
  margin-bottom: 0.4rem;
}
.app-card.placeholder .slot-icon svg { width: 24px; height: 24px; }
.app-card.placeholder h3 { font-size: 1.15rem; color: var(--ink); }

/* ---- Feature / principle cards ----------------------------------------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 1rem;
}
.feature {
  padding: 1.4rem 1.5rem;
  border-radius: var(--radius-m);
  background: var(--surface);
  border: 1px solid var(--line);
}
.feature .dot {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--tint, var(--sky));
  display: grid;
  place-items: center;
  margin-bottom: 0.9rem;
  color: #16171B;
}
.feature .dot svg { width: 20px; height: 20px; }
.feature h3 { font-size: 1.08rem; margin-bottom: 0.35rem; }
.feature p { color: var(--muted); font-size: 0.94rem; }

/* ---- Footer ------------------------------------------------------------ */
.footer {
  border-top: 1px solid var(--line);
  padding-block: 2.5rem 3.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  align-items: center;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer a { text-decoration: none; }
.footer a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.footer-company { display: flex; align-items: center; gap: 0.6rem; }

/* ---- Legal pages (privacy, terms) -------------------------------------- */
.legal { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(3rem, 7vw, 5rem); }
.legal .wrap { width: min(100% - 2 * var(--gutter), 760px); }
.legal h1 { font-size: clamp(2rem, 4.5vw, 2.9rem); font-weight: 800; letter-spacing: -0.03em; }
.legal .updated { color: var(--muted); font-size: 0.95rem; margin-top: 0.6rem; }
.legal h2 { font-size: 1.35rem; margin-top: 2.6rem; margin-bottom: 0.6rem; scroll-margin-top: 90px; }
.legal h3 { font-size: 1.05rem; margin-top: 1.6rem; margin-bottom: 0.4rem; }
.legal p { margin-bottom: 0.9rem; text-wrap: pretty; }
.legal ul, .legal ol { margin: 0 0 1rem; padding-inline-start: 1.3rem; }
.legal li { margin-bottom: 0.35rem; }
.legal li::marker { color: var(--muted); }
.legal a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.legal a:hover { text-decoration-color: currentColor; }
.legal code { font-family: ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace; font-size: 0.9em; background: var(--surface-2); padding: 0.1rem 0.4rem; border-radius: 6px; }
.legal table { border-collapse: collapse; width: 100%; margin: 0.75rem 0 1.25rem; font-size: 0.95rem; }
.legal th, .legal td { text-align: start; vertical-align: top; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--line); }
.legal th { color: var(--muted); font-weight: 600; font-size: 0.85rem; letter-spacing: 0.02em; }
.legal tr:last-child td { border-bottom: 0; }
.legal .summary {
  margin: 1.75rem 0 0.5rem;
  padding: 1.25rem 1.4rem;
  border-radius: var(--radius-m);
  background: var(--surface);
  border: 1px solid var(--line);
}
.legal .summary h2 { margin-top: 0; font-size: 1.1rem; }
.legal .summary ul { margin-bottom: 0; }
.legal .toc {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin: 1.5rem 0 0; padding: 0; list-style: none;
}
.legal .toc li { margin: 0; }
.legal .toc a {
  display: inline-block; padding: 0.35rem 0.75rem; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: 0.85rem; font-weight: 500; text-decoration: none;
}
.legal .toc a:hover { color: var(--ink); background: var(--surface); }
.legal address { font-style: normal; line-height: 1.5; margin-bottom: 0.9rem; }
@media (max-width: 600px) {
  .legal table, .legal thead, .legal tbody, .legal tr, .legal th, .legal td { display: block; }
  .legal thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .legal tr { padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
  .legal td { border: 0; padding: 0.15rem 0; }
  .legal td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 0.8rem; font-weight: 600; }
}

/* ---- Reveal animation -------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: reveal 0.7s cubic-bezier(.2,.8,.2,1) forwards;
  animation-delay: var(--d, 0s);
}
@keyframes reveal {
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; animation: none; }
  .app-card, .btn, .app-card::after { transition: none; }
}
