/* ==========================================================================
   ROYESH SABZ — Core design system
   One soil, two lenses: MEASURE (ink) and SAVOR (paper)
   ========================================================================== */

:root {
  /* Land palette — every colour is taken from the Sari plain */
  --ink: #0B130F;        /* Paddy Ink — wet soil at night */
  --ink-2: #111C16;
  --ink-3: #19271F;
  --mist: #E9ECE3;       /* Caspian Mist */
  --paper: #F1ECE2;      /* Rice Paper */
  --paper-2: #E7DFD0;
  --shoot: #C3EC6B;      /* Shoot — first green of a rice seedling */
  --leaf: #24503A;       /* Hyrcanian Leaf */
  --moss: #5E7F4E;
  --narenj: #E05A26;     /* Narenj — Sari bitter orange */
  --clay: #A65F3D;       /* Telar roof tile */
  --silt: #CDC3AE;       /* Tajan river silt */
  --caspian: #2C5B5C;

  --f-serif: 'Instrument Serif', 'Times New Roman', serif;
  --f-sans: 'Geist', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --f-fa: 'Vazirmatn', var(--f-sans);

  --ease-grow: cubic-bezier(.16, 1, .3, 1);
  --ease-settle: cubic-bezier(.65, 0, .35, 1);

  --gutter: clamp(16px, 3.2vw, 48px);
  --nav-h: 72px;
  --radius: 14px;
}

[data-theme="ink"] {
  --bg: var(--ink); --bg-2: var(--ink-2); --bg-3: var(--ink-3);
  --fg: var(--mist); --muted: rgba(233, 236, 227, .56); --faint: rgba(233, 236, 227, .32);
  --line: rgba(233, 236, 227, .12); --line-2: rgba(233, 236, 227, .22);
  --accent: var(--shoot); --accent-ink: var(--ink);
}
[data-theme="paper"] {
  --bg: var(--paper); --bg-2: var(--paper-2); --bg-3: #DDD3C1;
  --fg: #18211B; --muted: rgba(24, 33, 27, .6); --faint: rgba(24, 33, 27, .36);
  --line: rgba(24, 33, 27, .13); --line-2: rgba(24, 33, 27, .24);
  --accent: var(--narenj); --accent-ink: #FFF8F0;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--f-sans); font-size: 16px; line-height: 1.5; font-weight: 400;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden; transition: background-color .9s var(--ease-settle), color .9s var(--ease-settle);
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; background: none; border: 0; outline: 0; }
button { cursor: pointer; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- Grain (film / soil texture) ---------- */
.grain {
  pointer-events: none; position: fixed; inset: -50%; z-index: 90; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
[data-theme="paper"] .grain { opacity: .11; mix-blend-mode: multiply; }
@keyframes grain {
  0% { transform: translate(0, 0) } 20% { transform: translate(-3%, 2%) } 40% { transform: translate(2%, -4%) }
  60% { transform: translate(-4%, -1%) } 80% { transform: translate(3%, 3%) } 100% { transform: translate(0, 0) }
}

/* ---------- Typography ---------- */
.display {
  font-family: var(--f-serif); font-weight: 400; letter-spacing: -.02em; line-height: .9;
  font-size: clamp(56px, 11vw, 196px);
}
.display em, .h1 em, .h2 em, .h3 em { font-style: italic; }
.h1 { font-family: var(--f-serif); font-weight: 400; font-size: clamp(44px, 7vw, 112px); line-height: .95; letter-spacing: -.02em; }
.h2 { font-family: var(--f-serif); font-weight: 400; font-size: clamp(36px, 4.8vw, 76px); line-height: 1; letter-spacing: -.015em; }
.h3 { font-family: var(--f-serif); font-weight: 400; font-size: clamp(26px, 2.6vw, 40px); line-height: 1.05; }
.h-sans { font-family: var(--f-sans); font-weight: 500; letter-spacing: -.035em; line-height: .95; }
.eyebrow {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.eyebrow--plain::before { display: none; }
.lede { font-size: clamp(17px, 1.35vw, 21px); line-height: 1.5; color: var(--muted); max-width: 46ch; }
.body-lg { font-size: clamp(16px, 1.15vw, 18px); line-height: 1.6; color: var(--muted); }
.mono { font-family: var(--f-mono); font-size: 12px; letter-spacing: .02em; }
.fa { font-family: var(--f-fa); direction: rtl; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.wrap { padding-inline: var(--gutter); width: 100%; }
.section { position: relative; padding-block: clamp(96px, 14vw, 200px); }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(12px, 1.6vw, 24px); }
.rule { height: 1px; background: var(--line); width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.section-head { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: end; margin-bottom: clamp(48px, 7vw, 96px); }
.section-head .idx { font-family: var(--f-mono); font-size: 12px; color: var(--muted); display: flex; gap: 14px; margin-bottom: 22px; }
.section-head .idx b { color: var(--accent); font-weight: 400; }
@media (max-width: 860px) { .section-head { grid-template-columns: 1fr; } }

/* ---------- Brand mark ---------- */
.mark { width: 34px; height: 34px; flex: none; overflow: visible; }
.mark path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: fill .6s var(--ease-grow); }
[data-side="master"] .mark__leaf { fill: currentColor; }
[data-side="supply"] .mark__leaf--r { fill: currentColor; }
[data-side="estate"] .mark__leaf--l { fill: currentColor; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 60; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding-inline: var(--gutter); transition: transform .7s var(--ease-grow), color .6s;
}
.nav.is-hidden { transform: translateY(-110%); }
.nav::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .5s;
  background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.nav.is-solid::before { opacity: 1; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand__name { display: flex; flex-direction: column; line-height: 1; }
.brand__name strong { font-weight: 500; font-size: 15px; letter-spacing: -.01em; }
.brand__name span { font-family: var(--f-fa); font-size: 11px; color: var(--muted); margin-top: 4px; }
.nav__links { display: flex; gap: 4px; align-items: center; }
.nav__links a {
  position: relative; font-size: 13px; padding: 9px 14px; border-radius: 99px; color: var(--muted); transition: color .3s, background-color .3s;
}
.nav__links a:hover { color: var(--fg); }
.nav__links a[aria-current="page"] { color: var(--fg); background: var(--line); }
.nav__links a .k { font-family: var(--f-mono); font-size: 10px; opacity: .5; margin-right: 6px; }
.nav__meta { display: flex; align-items: center; gap: 18px; }
.nav__clock { font-family: var(--f-mono); font-size: 11px; color: var(--muted); letter-spacing: .06em; white-space: nowrap; }
.nav__clock i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 8px; animation: pulse 2.4s infinite; vertical-align: 1px; }
.lang { display: flex; border: 1px solid var(--line-2); border-radius: 99px; padding: 3px; font-family: var(--f-mono); font-size: 10px; }
.lang button { padding: 5px 9px; border-radius: 99px; color: var(--muted); letter-spacing: .08em; }
.lang button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.nav__burger { display: none; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-2); position: relative; }
.nav__burger span { position: absolute; left: 13px; right: 13px; height: 1.5px; background: currentColor; transition: transform .5s var(--ease-grow); }
.nav__burger span:nth-child(1) { top: 17px; } .nav__burger span:nth-child(2) { top: 23px; }
.menu-open .nav__burger span:nth-child(1) { transform: translateY(3px) rotate(45deg); }
.menu-open .nav__burger span:nth-child(2) { transform: translateY(-3px) rotate(-45deg); }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }

.drawer {
  position: fixed; inset: 0; z-index: 55; background: var(--bg); display: flex; flex-direction: column; justify-content: flex-end;
  padding: calc(var(--nav-h) + 24px) var(--gutter) 32px; clip-path: inset(0 0 100% 0); transition: clip-path .9s var(--ease-grow);
}
.menu-open .drawer { clip-path: inset(0 0 0 0); }
.drawer a { font-family: var(--f-serif); font-size: clamp(48px, 13vw, 88px); line-height: 1.02; display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding-block: 10px; }
.drawer a small { font-family: var(--f-mono); font-size: 11px; color: var(--muted); }

@media (max-width: 1080px) { .nav__clock { display: none; } }
@media (max-width: 860px) { .nav__links, .nav__meta .lang, .nav__meta .btn { display: none; } .nav__burger { display: block; } }

/* ---------- Buttons ---------- */
.btn {
  --b-bg: transparent; --b-fg: var(--fg);
  position: relative; display: inline-flex; align-items: center; gap: 12px; height: 48px; padding: 0 22px;
  border-radius: 99px; border: 1px solid var(--line-2); color: var(--b-fg); background: var(--b-bg);
  font-size: 14px; font-weight: 500; letter-spacing: -.005em; overflow: hidden; isolation: isolate; white-space: nowrap;
  transition: color .5s var(--ease-grow), border-color .5s;
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--fg); border-radius: inherit;
  transform: translateY(101%); transition: transform .6s var(--ease-grow);
}
.btn:hover { color: var(--bg); border-color: var(--fg); }
.btn:hover::before { transform: translateY(0); }
.btn .arr { width: 14px; height: 14px; transition: transform .6s var(--ease-grow); }
.btn:hover .arr { transform: translateX(3px) rotate(-45deg); }
.btn--solid { --b-bg: var(--accent); --b-fg: var(--accent-ink); border-color: var(--accent); }
.btn--solid::before { background: var(--fg); }
.btn--sm { height: 38px; padding: 0 16px; font-size: 13px; }
.btn--lg { height: 60px; padding: 0 30px; font-size: 15px; }
.link-u { position: relative; display: inline-flex; gap: 8px; align-items: center; }
.link-u::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: currentColor; transform-origin: right; transform: scaleX(1); transition: transform .7s var(--ease-grow); }
.link-u:hover::after { transform-origin: left; animation: relink .9s var(--ease-grow); }
@keyframes relink { 0% { transform: scaleX(1); transform-origin: right } 45% { transform: scaleX(0); transform-origin: right } 46% { transform-origin: left } 100% { transform: scaleX(1); transform-origin: left } }

.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-2);
  font-size: 13px; color: var(--muted); transition: all .35s var(--ease-grow);
}
.chip:hover { color: var(--fg); border-color: var(--fg); }
.chip[aria-pressed="true"], .chip.is-on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.tag { font-family: var(--f-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; padding: 4px 8px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.tag--accent { border-color: var(--accent); color: var(--accent); }

/* ---------- Cursor ---------- */
.cursor { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; mix-blend-mode: difference; }
.cursor__dot { position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: #fff; }
.cursor__ring {
  position: absolute; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; border: 1px solid rgba(255,255,255,.7);
  transition: width .5s var(--ease-grow), height .5s var(--ease-grow), margin .5s var(--ease-grow), background-color .4s, border-color .4s;
  display: grid; place-items: center;
}
.cursor__ring span { font-family: var(--f-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #000; opacity: 0; transition: opacity .3s; white-space: nowrap; }
.cursor.is-hover .cursor__ring { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
.cursor.is-label .cursor__ring { width: 92px; height: 92px; margin: -46px 0 0 -46px; background: #fff; border-color: #fff; }
.cursor.is-label .cursor__ring span { opacity: 1; }
.cursor.is-label .cursor__dot { opacity: 0; }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }
@media (hover: hover) and (pointer: fine) { html.has-cursor, html.has-cursor a, html.has-cursor button { cursor: none; } }

/* ---------- Loader / veil ---------- */
.loader { position: fixed; inset: 0; z-index: 120; background: var(--ink); color: var(--mist); display: grid; place-items: center; }
.loader__inner { display: flex; flex-direction: column; align-items: center; gap: 28px; }
.loader .mark { width: 72px; height: 72px; }
.loader .mark path { stroke-dasharray: 80; stroke-dashoffset: 80; }
.loader__count { font-family: var(--f-mono); font-size: 11px; letter-spacing: .16em; color: rgba(233,236,227,.55); }
.loader__word { font-family: var(--f-fa); font-size: 15px; color: rgba(233,236,227,.8); }
.veil { position: fixed; inset: 0; z-index: 110; pointer-events: none; background: var(--ink); transform: scaleY(0); transform-origin: bottom; }
.veil::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 1.5px; height: 0; background: var(--shoot); transition: height .6s var(--ease-grow); }
.veil.is-on::after { height: 46%; }

/* ---------- Text reveal ---------- */
.split-line { display: block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; }
.split-word { display: inline-block; will-change: transform; }
[data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity 1.1s var(--ease-grow), transform 1.3s var(--ease-grow); }
[data-reveal].is-in { opacity: 1; transform: none; }
[data-reveal="fade"] { transform: none; }
.no-js [data-reveal] { opacity: 1; transform: none; }

/* ---------- Marquee ---------- */
.marquee { overflow: hidden; white-space: nowrap; border-block: 1px solid var(--line); }
.marquee__track { display: inline-flex; gap: 48px; padding-block: 18px; animation: marquee 40s linear infinite; }
.marquee__track span { font-family: var(--f-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); display: inline-flex; align-items: center; gap: 48px; }
.marquee__track span::after { content: "✳"; color: var(--accent); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Footer ---------- */
.foot { position: relative; padding: clamp(80px, 10vw, 140px) var(--gutter) 28px; border-top: 1px solid var(--line); overflow: hidden; }
.foot__top { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; margin-bottom: clamp(64px, 10vw, 140px); }
.foot__top h4 { font-family: var(--f-mono); font-weight: 400; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 18px; }
.foot__top ul { list-style: none; display: grid; gap: 8px; font-size: 15px; }
.foot__top li a { color: var(--fg); opacity: .86; transition: opacity .3s; }
.foot__top li a:hover { opacity: 1; color: var(--accent); }
.foot__news { display: flex; border-bottom: 1px solid var(--line-2); margin-top: 22px; max-width: 420px; }
.foot__news input { flex: 1; padding: 14px 0; font-size: 15px; }
.foot__news input::placeholder { color: var(--faint); }
.foot__word { font-family: var(--f-serif); font-size: clamp(80px, 21vw, 360px); line-height: .78; letter-spacing: -.04em; white-space: nowrap; display: flex; justify-content: space-between; align-items: flex-end; }
.foot__word .fa { font-family: var(--f-fa); font-weight: 300; font-size: .34em; letter-spacing: 0; line-height: 1; color: var(--muted); }
.foot__base { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); font-family: var(--f-mono); font-size: 11px; color: var(--muted); letter-spacing: .06em; }
@media (max-width: 860px) { .foot__top { grid-template-columns: 1fr 1fr; } .foot__top > :first-child { grid-column: 1 / -1; } }

/* ---------- Forms ---------- */
.field { display: grid; gap: 8px; }
.field label { font-family: var(--f-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; border-bottom: 1px solid var(--line-2); padding: 12px 0; font-size: 16px; transition: border-color .3s; border-radius: 0;
}
.field select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 10px) 52%, calc(100% - 5px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.field select option { color: #111; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 96px; }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(90deg, var(--accent) var(--p, 50%), var(--line-2) var(--p, 50%)); }
input[type="range"]::-moz-range-track { height: 2px; background: var(--line-2); }
input[type="range"]::-moz-range-progress { height: 2px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--fg); border: 4px solid var(--bg); box-shadow: 0 0 0 1px var(--fg); margin-top: -8px; cursor: grab; }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--fg); border: 4px solid var(--bg); box-shadow: 0 0 0 1px var(--fg); cursor: grab; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .2s !important; }
  [data-reveal] { opacity: 1; transform: none; }
}

/* ---------- The Land (shared WebGL stage) ---------- */
.land-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100lvh; z-index: 0; }
.land-tags { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.land-tag { position: absolute; left: 0; top: 0; will-change: transform, opacity; transition: opacity .4s; }
.land-tag i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border: 1px solid var(--shoot); border-radius: 50%; }
.land-tag i::after { content: ""; position: absolute; inset: 2px; background: var(--shoot); border-radius: 50%; animation: pulse 2s infinite; }
.land-tag span {
  position: absolute; left: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 2px; padding: 7px 10px 7px 12px;
  border-left: 1px solid var(--shoot); font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .04em; color: rgba(233,236,227,.86);
  white-space: nowrap; background: linear-gradient(90deg, rgba(11,19,15,.75), rgba(11,19,15,0));
}
.land-tag b { color: var(--shoot); font-weight: 400; letter-spacing: .12em; font-size: 9.5px; }
.land-tag.is-savor i { border-color: #fff; } .land-tag.is-savor i::after { background: var(--narenj); }
.land-tag.is-savor span { border-color: var(--narenj); color: #1b231d; background: linear-gradient(90deg, rgba(241,236,226,.85), rgba(241,236,226,0)); font-family: var(--f-serif); font-size: 17px; letter-spacing: 0; }
.land-tag.is-savor b { color: var(--narenj); font-family: var(--f-mono); }
@media (max-width: 760px) { .land-tag span { font-size: 9.5px; } }
