/* Marga Concepts — shared by every page. Indigo and saffron, two of India's
   oldest dyes, in flat colour. Fonts are served from fonts/: the site makes no
   requests to anyone but its own host. theme.js can swap in another palette. */

/* Fraunces (SIL Open Font License, fonts/LICENSE-fraunces.txt), for headings. */
/* Archivo ExtraBold, only for Zmarga's wordmark, so it matches zmarga.com. */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('fonts/archivo-latin-800-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/fraunces-latin-wght-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/fraunces-latin-wght-italic.woff2) format('woff2');
}

:root {
  --canvas: #0f1330;
  --panel: #171c40;
  --panel-raised: color-mix(in srgb, #171c40 60%, #2a3060);
  --border: #2a3060;
  --border-bright: color-mix(in srgb, #2a3060 70%, #a3a6c4);
  --text: #ecebf5;
  --text-dim: #a3a6c4;
  --text-faint: color-mix(in srgb, #a3a6c4 70%, #0f1330);
  --accent: #f2a33a;
  --accent-soft: color-mix(in srgb, #f2a33a 14%, transparent);
  --accent-2: #8f9cf2;
  --string: #8f9cf2;
  --todo: #4a3d10;
  /* Zmarga's wordmark: the trail Z and its start dot. */
  --brand-z: #ecebf5;
  --brand-dot: #f2a33a;
  color-scheme: dark;
  --font: ui-sans-serif, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
}

/* Light: chosen with the switch, or the system preference when nothing
   has been chosen. */
:root[data-theme="light"] {
  --canvas: #f4f2ec;
  --panel: #ffffff;
  --panel-raised: color-mix(in srgb, #ffffff 60%, #dcd8ce);
  --border: #dcd8ce;
  --border-bright: color-mix(in srgb, #dcd8ce 70%, #5b6080);
  --text: #1b2147;
  --text-dim: #5b6080;
  --text-faint: color-mix(in srgb, #5b6080 70%, #f4f2ec);
  --accent: #24318a;
  --accent-soft: color-mix(in srgb, #24318a 14%, transparent);
  --accent-2: #e08a1e;
  --string: #e08a1e;
  --todo: #fff3bf;
  --brand-z: #24318a;
  --brand-dot: #e08a1e;
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --canvas: #f4f2ec;
    --panel: #ffffff;
    --panel-raised: color-mix(in srgb, #ffffff 60%, #dcd8ce);
    --border: #dcd8ce;
    --border-bright: color-mix(in srgb, #dcd8ce 70%, #5b6080);
    --text: #1b2147;
    --text-dim: #5b6080;
    --text-faint: color-mix(in srgb, #5b6080 70%, #f4f2ec);
    --accent: #24318a;
    --accent-soft: color-mix(in srgb, #24318a 14%, transparent);
    --accent-2: #e08a1e;
    --string: #e08a1e;
    --todo: #fff3bf;
    --brand-z: #24318a;
    --brand-dot: #e08a1e;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font: 16px/1.6 var(--font);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1.2 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
}

a { color: var(--accent); }

/* ---- header ---- */

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand .mark { width: 30px; height: 30px; }

/* The logo: a flat tile in the accent colour. */
:root { --mark-a: var(--accent); --mark-b: var(--accent); --mark-ink: var(--canvas); }
.brand b { font-size: 17px; letter-spacing: -0.01em; }

header.top nav {
  display: flex;
  gap: 20px;
  font-size: 14px;
}

header.top nav a { color: var(--text-dim); text-decoration: none; }
header.top nav a:hover { color: var(--text); }

.header-end { display: flex; align-items: center; gap: 20px; }

.theme-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border-bright);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-dim);
  cursor: pointer;
}

.theme-switch:hover { color: var(--text); border-color: var(--accent); }
.theme-switch svg { width: 16px; height: 16px; }
/* Show the moon in light mode (switch to dark) and the sun in dark mode. */
.theme-switch .sun { display: block; }
.theme-switch .moon { display: none; }
:root[data-theme="light"] .theme-switch .sun { display: none; }
:root[data-theme="light"] .theme-switch .moon { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-switch .sun { display: none; }
  :root:not([data-theme="dark"]) .theme-switch .moon { display: block; }
}

/* ---- sections ---- */

.eyebrow {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--accent);
}

/* The saffron dot that starts Zmarga's trail Z, as on zmarga.com. */
.eyebrow { display: flex; align-items: center; gap: 9px; }
.eyebrow::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-dot);
}

section { padding: 56px 0; }
section + section { border-top: 1px solid var(--border); }

h1, h2 { font-family: var(--serif); font-weight: 600; }

h1 {
  margin: 0 0 20px;
  font-size: clamp(40px, 8vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.025em;
}

h1 em { font-style: italic; font-weight: 500; }

h1 .grad { color: var(--accent); }

h2 {
  margin: 0 0 24px;
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.015em;
}

.lead {
  margin: 0;
  max-width: 32em;
  font-size: 19px;
  color: var(--text-dim);
}

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

.hero {
  padding: 88px 0 40px;
  border-top: 0;
}

.hero h1 { max-width: 11em; }

.meaning {
  margin: 28px 0 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-faint);
}

.meaning [lang="sa"] { font-family: var(--font); font-size: 16px; color: var(--text-dim); }
.meaning i { font-family: var(--serif); font-size: 16px; color: var(--text-dim); }
.meaning em { font-style: normal; color: var(--accent); }

/* ---- the trail: one path down the home page, drawn by trail.js ---- */

.trail-page { position: relative; }
.trail-page > section { position: relative; border-top: 0; }

.trail {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.trail path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.trail .walked { stroke: var(--accent); stroke-width: 3.5; }
.trail .ahead { stroke: var(--text-faint); stroke-width: 3; stroke-dasharray: 0.5 11; }
.trail.arriving .ahead { animation: arrive 0.8s 1.3s both; }
@keyframes arrive { from { opacity: 0; } }

/* Where the path starts: under the hero, towards the right. */
.trailhead {
  display: block;
  width: 16px;
  height: 16px;
  margin: 36px 0 0 62%;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 7px var(--accent-soft);
}

.stops { padding: 40px 0 24px; }

/* Each stop: a milestone stone beside what is there. */
.leg {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 24px;
  align-items: start;
}

.leg + .leg { margin-top: 150px; }
.leg.flip { grid-template-columns: 1fr 120px; }
.leg.flip .stone { order: 2; }

.stone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
}

.stone svg { width: 64px; height: 80px; overflow: visible; }
.stone .body { fill: var(--panel); stroke: var(--border-bright); stroke-width: 2; }
.stone .cap { fill: var(--accent); }
.stone .num { font-family: var(--serif); font-size: 26px; font-weight: 600; text-anchor: middle; fill: var(--text); }
.stone .env { fill: none; stroke: var(--text-dim); stroke-width: 2.5; stroke-linejoin: round; }
.stone.ahead .body { fill: var(--canvas); stroke-dasharray: 4 5; }
.stone.ahead .num { fill: var(--text-faint); }

.stone span {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--canvas);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
}

.stone:not(.ahead) span { color: var(--accent); }

.say {
  padding: 18px 0;
}

.say h2 { margin-bottom: 10px; }
.say p { margin: 0; font-size: 18px; color: var(--text-dim); }

/* ---- products ---- */

.products {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
}

.product {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 26px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s;
}

a.product:hover { border-color: var(--accent); }

.product-head { display: flex; align-items: center; gap: 14px; }
.product-head b { display: block; font-size: 22px; letter-spacing: -0.01em; }

/* Zmarga's wordmark, drawn as on zmarga.com: the trail Z spans Archivo's cap
   height (0.687em) from the baseline, and the arrow hangs below like the g.
   Its colours are the brand's own, so they hold under any palette. */
.product-head .wordmark {
  display: flex;
  align-items: baseline;
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.wordmark .z {
  height: 0.8925em;
  width: auto;
  margin-right: -0.02em;
  transform: translateY(0.165em);
  color: var(--brand-z);
}
.wordmark .z circle { fill: var(--brand-dot); }
.product-head span { font-size: 14px; color: var(--text-faint); }
.product p { margin: 0; color: var(--text-dim); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chips li {
  padding: 3px 10px;
  border: 1px solid var(--border-bright);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-dim);
}

.product .go { margin-top: auto; font-family: var(--mono); font-size: 14px; color: var(--accent); }

.product.next {
  justify-content: center;
  align-items: flex-start;
  background: var(--canvas);
  border-style: dashed;
}

.product.next { min-height: 180px; }
.product.next h2 { margin: 0; font-size: 26px; }

/* A glimpse of the app itself: Zmarga's completion panel, in miniature.
   In dark mode it takes the app's own surfaces, a calmer navy than the
   site's, so it looks like the app; in light mode it follows the site. */
.glimpse {
  --g-canvas: #151726;
  --g-panel: #1b1e32;
  --g-raised: #23263d;
  --g-border: #2a2d45;
  --g-border-bright: #3b3f5c;

  border: 1px solid var(--g-border);
  border-radius: 10px;
  background: var(--g-canvas);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 21px;
  overflow: hidden;
}

.glimpse .code { padding: 10px 0 4px; white-space: pre; color: var(--text); }
.glimpse .ln { display: inline-block; width: 34px; padding-right: 12px; text-align: right; color: var(--text-faint); }
.glimpse .kw { color: var(--accent-2); }
.glimpse .ty { color: var(--accent); }
.glimpse .caret { border-left: 2px solid var(--accent); margin-left: 1px; }

.glimpse .panel {
  margin: 2px 12px 14px 140px;
  border: 1px solid var(--g-border-bright);
  border-radius: 8px;
  background: var(--g-panel);
  font-family: var(--font);
  font-size: 12px;
  overflow: hidden;
}

.glimpse .ph { padding: 5px 10px; background: var(--g-raised); border-bottom: 1px solid var(--g-border); font-family: var(--mono); color: var(--text); }
.glimpse .grp { padding: 6px 10px 1px; font-size: 9.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.glimpse .row { display: flex; gap: 8px; padding: 0 10px 0 8px; border-left: 3px solid var(--accent); font-family: var(--mono); color: var(--text-dim); line-height: 22px; }
.glimpse .row.sel { background: var(--accent-soft); color: var(--text); }
.glimpse .row.prot { border-left-color: var(--accent-2); }
.glimpse .row b { color: var(--accent); font-weight: 600; }
.glimpse .row .n { margin-left: auto; font-family: var(--font); font-size: 11px; color: var(--text-faint); }
.glimpse .sig { padding: 6px 10px 7px; border-top: 1px solid var(--g-border); background: var(--g-raised); font-family: var(--mono); line-height: 18px; white-space: pre; color: var(--text); }
:root[data-theme="light"] .glimpse {
  --g-canvas: var(--canvas);
  --g-panel: var(--panel);
  --g-raised: var(--panel-raised);
  --g-border: var(--border);
  --g-border-bright: var(--border-bright);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .glimpse {
    --g-canvas: var(--canvas);
    --g-panel: var(--panel);
    --g-raised: var(--panel-raised);
    --g-border: var(--border);
    --g-border-bright: var(--border-bright);
  }
}

/* ---- footer ---- */

footer.foot {
  border-top: 1px solid var(--border);
  padding: 28px 0 44px;
  font-size: 13px;
  color: var(--text-faint);
}

footer.foot nav { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 10px; }
footer.foot p { margin: 6px 0; }
.nowrap { white-space: nowrap; }

/* ---- legal pages ---- */

.doc { max-width: 720px; padding: 32px 0 64px; }
.doc h1 { font-size: clamp(30px, 5vw, 40px); }
.doc h2 { margin: 36px 0 8px; font-size: 19px; letter-spacing: 0; }
.doc .updated { color: var(--text-faint); font-size: 14px; }
.doc li { margin: 4px 0; }
.doc p, .doc li { color: var(--text-dim); }
.doc strong { color: var(--text); }

.acl {
  padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
}

/* Unfilled details: remove every use before publishing. */
mark.todo {
  background: var(--todo);
  color: inherit;
  padding: 0 3px;
  border-radius: 3px;
}

/* ---- narrow screens ---- */

/* Grid items may shrink below their content, so the code glimpse clips
   instead of widening the page. */
.leg > *, .products > * { min-width: 0; }

@media (max-width: 860px) {
  .products { grid-template-columns: 1fr; }
  .hero { padding: 40px 0 24px; }
  .leg, .leg.flip { grid-template-columns: 1fr; gap: 12px; }
  .stone { justify-self: start; width: 120px; }
  .leg.flip .stone { order: 0; justify-self: end; }
  .leg + .leg { margin-top: 110px; }
  .glimpse .panel { margin-left: 46px; }
  header.top nav { display: none; }
}

/* ---- about ---- */

header.top nav a[aria-current="page"] { color: var(--text); }

.about-hero { padding: 72px 0 56px; border-top: 0; }
.about-hero .lead { max-width: 36em; }

.story { display: flex; flex-direction: column; gap: 48px; }

.story-step {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 24px;
  max-width: 820px;
}

.story-step .num {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--accent);
}

.story-step h2 { margin-bottom: 14px; }
.story-step p { margin: 0 0 14px; color: var(--text-dim); font-size: 17px; }

.principles { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; }
.principles li {
  padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  color: var(--text-dim);
}
.principles b { color: var(--text); }


@media (max-width: 860px) {
  .story-step { grid-template-columns: 1fr; gap: 6px; }
  .about-hero { padding: 40px 0 40px; }
}

/* ---- palette menu (theme.js) ---- */

.palette-menu {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-bright);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-dim);
  font: 13px var(--font);
  cursor: pointer;
}
