/* ==========================================================================
   SOLID CONSTRUCTIONS · "BLUEPRINT" (ნახაზი)
   base.css: tokens, reset, typography, the sheet grid, drafting primitives
   Palette: only the three logo colours (gold / deep green / plaster stone)
   and their tints and shades.
   ========================================================================== */

:root {
  /* brand ramps (from the kit) */
  --stone-50:#F5F0EA; --stone-100:#EDE5DB; --stone-200:#E2D8CC; --stone-300:#D6CABC;
  --stone-400:#C4B4A5; --stone-500:#A89787; --stone-600:#857567; --stone-700:#63564B;
  --gold-200:#FBE0B4; --gold-300:#F8CF8E; --gold-400:#F5C578; --gold-500:#E5B062;
  --gold-600:#C9954A; --gold-700:#A1742F; --gold-800:#6E4D1B;
  --green-400:#3F7D5E; --green-500:#2A6147; --green-600:#1A4A34; --green-700:#103D29;
  --green-800:#0A3320; --green-900:#072818; --green-950:#051C11;

  /* type */
  --font-display: "Archivo", "Noto Sans Georgian", system-ui, sans-serif;
  --font-body: "Noto Sans Georgian", "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "Noto Sans Georgian", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --fs-hero: clamp(3.6rem, 1.15rem + 10.6vw, 11.25rem);
  --fs-h2: clamp(1.875rem, .9rem + 3.9vw, 4.75rem);
  --fs-lead: clamp(1.0625rem, .98rem + .38vw, 1.3125rem);
  --fs-body: clamp(1rem, .97rem + .14vw, 1.0625rem);
  --fs-small: .875rem;
  --fs-ann: .75rem;                     /* annotation lettering: never under 12 px */

  /* layout */
  --gutter: max(clamp(16px, 4vw, 64px), env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --maxw: 1408px;                       /* 22 × 64: the frame sits on the major grid */
  --gap: clamp(16px, 2vw, 32px);
  --pad: 0px;
  --hdr: 56px;
  --abar: 0px;
  --sec-y: clamp(72px, 9vw, 152px);

  /* motion */
  --ease: cubic-bezier(.2, .7, .15, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);

  /* ---- light: tracing paper ---- */
  --bg: #E2D8CC;
  --bg-2: #EBE3D8;
  --bg-3: #D7CBBD;
  --ink: #0A3320;
  --ink-2: rgba(10, 51, 32, .76);
  --ink-3: rgba(10, 51, 32, .5);
  --line: rgba(10, 51, 32, .17);
  --line-2: rgba(10, 51, 32, .38);
  --line-3: rgba(10, 51, 32, .09);
  --grid-1: rgba(10, 51, 32, .038);
  --grid-2: rgba(10, 51, 32, .07);
  --gold: #F5C578;
  --gold-deep: #E5B062;
  --gold-line: #A1742F;
  --gold-text: #6E4D1B;
  --slab-shadow: rgba(99, 86, 75, .45);
  --pri-bg: #0A3320;
  --pri-fg: #EDE5DB;
  --pri-hover-bg: #F5C578;
  --pri-hover-fg: #072818;
  --inv-bg: #0A3320;
  --inv-fg: #EDE5DB;
  --inv-fg-2: rgba(237, 229, 219, .7);
  --inv-line: rgba(237, 229, 219, .18);
  --focus: #0A3320;
  --sb-thumb: #857567;
  --sb-track: #D7CBBD;
  --scrim: rgba(7, 40, 24, .58);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .39 0 0 0 0 .33 0 0 0 0 .28 .26 0 0 0 -.1'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  --mk-out: #0A3320;                    /* outline of the gold slabs */
  --sheet-a: transparent;               /* each sheet: (dark only) a touch lighter at its head … */
  --sheet-b: rgba(168, 151, 135, .14);  /* … and deeper at its foot */
  --glow: transparent;
  --bar-pri-bg: #0A3320; --bar-pri-fg: #EDE5DB; --bar-pri-rule: transparent;   /* the always-visible contact buttons (header, sticky bar) */
  color-scheme: light;
}

/* ---- dark: the blueprint, in the brand's deep green ----
   [data-vt] holds the outgoing look for one frame so the sheet-swap
   view transition can capture it (data-theme itself changes synchronously). */
:root[data-theme="dark"]:not([data-vt="light"]),
:root[data-vt="dark"] {
  --bg: #051C11;
  --bg-2: #0A2A1C;
  --bg-3: #03150C;
  --ink: #EDE5DB;
  --ink-2: rgba(237, 229, 219, .72);
  --ink-3: rgba(237, 229, 219, .46);
  --line: rgba(237, 229, 219, .14);
  --line-2: rgba(237, 229, 219, .32);
  --line-3: rgba(237, 229, 219, .07);
  --grid-1: rgba(237, 229, 219, .026);
  --grid-2: rgba(237, 229, 219, .052);
  --gold: #F5C578;
  --gold-deep: #E5B062;
  --gold-line: #F5C578;
  --gold-text: #F5C578;
  --slab-shadow: rgba(3, 14, 9, .7);
  --pri-bg: #F5C578;
  --pri-fg: #051C11;
  --pri-hover-bg: #EDE5DB;
  --pri-hover-fg: #051C11;
  --inv-bg: #0A2A1C;
  --inv-fg: #EDE5DB;
  --inv-fg-2: rgba(237, 229, 219, .7);
  --inv-line: rgba(237, 229, 219, .16);
  --focus: #F5C578;
  --sb-thumb: #2A6147;
  --sb-track: #03150C;
  --scrim: rgba(3, 14, 9, .72);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .93 0 0 0 0 .9 0 0 0 0 .86 .15 0 0 0 -.06'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  --mk-out: rgba(237, 229, 219, .5);
  --sheet-a: rgba(16, 61, 41, .34);
  --sheet-b: rgba(3, 14, 9, .5);
  --glow: rgba(245, 197, 120, .14);     /* low, static gold glow (dark only) */
  --bar-pri-bg: #0A2A1C; --bar-pri-fg: #F5C578; --bar-pri-rule: #F5C578;
  color-scheme: dark;
}

@media (min-width: 900px) {
  :root { --hdr: 64px; --pad: clamp(20px, 2.2vw, 32px); }
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: var(--hdr); scrollbar-color: var(--sb-thumb) var(--sb-track); overflow-x: clip; -webkit-tap-highlight-color: transparent; }
body, h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, iframe { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 0; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
::selection { background: var(--gold); color: var(--green-900); }

/* ---------- the sheet ---------- */
body {
  min-height: 100vh;
  font: 400 var(--fs-body)/1.62 var(--font-body);
  color: var(--ink);
  background-color: var(--bg);
  /* drafting grid: 64 px major / 8 px minor, anchored to the frame's left edge */
  background-image:
    linear-gradient(to right, var(--grid-2) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-2) 1px, transparent 1px),
    linear-gradient(to right, var(--grid-1) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-1) 1px, transparent 1px),
    var(--grain);                       /* plaster grain: one small cached tile, never animated */
  background-size: 64px 64px, 64px 64px, 8px 8px, 8px 8px, 180px 180px;
  background-origin: content-box;
  background-position:
    max(var(--gutter), calc(50% - var(--maxw) / 2 + 32px)) 0, 0 0,
    max(var(--gutter), calc(50% - var(--maxw) / 2 + 4px)) 0, 0 0, 0 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
html[lang="en"] body { font-family: "Archivo", "Noto Sans Georgian", system-ui, sans-serif; }
/* Georgian pages set their few Latin words (WhatsApp, Solid …) in the Georgian family too: one family to draw,
   and Archivo is then not downloaded at all (it is the English face) */
html[lang="ka"] { --font-display: "Noto Sans Georgian", "Archivo", system-ui, sans-serif; }
/* scroll lock (dialog / menu): the scrollbar's width is handed back as padding so nothing shifts */
html.sc-lock { overflow: hidden; }
html.sc-lock body { padding-right: var(--sbw, 0px); }
html.sc-lock .hdr, html.sc-lock .abar { right: var(--sbw, 0px); }

.wrap { position: relative; width: min(100% - 2 * var(--gutter), var(--maxw)); margin-inline: auto; }
@media (min-width: 900px) {
  .wrap { border-inline: 1px solid var(--line); }
}
.pad { padding-inline: var(--pad); }
.sheet > .wrap { padding-bottom: var(--sec-y); }
/* every section is a sheet of its own: a soft falloff from head to foot (over the grid, under the ink) …
   (a deep link such as …/#materials lands right under the header: html's scroll-padding-top reserves it) */
.sheet { background-image: linear-gradient(to bottom, var(--sheet-a), transparent 34%, transparent 62%, var(--sheet-b)); }
/* … with crop marks at its four corners */
.sheet > .wrap::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  --cm: linear-gradient(var(--line-2), var(--line-2));
  background:
    var(--cm) 0 0 / 14px 1px no-repeat, var(--cm) 0 0 / 1px 14px no-repeat,
    var(--cm) 100% 0 / 14px 1px no-repeat, var(--cm) 100% 0 / 1px 14px no-repeat,
    var(--cm) 0 100% / 14px 1px no-repeat, var(--cm) 0 100% / 1px 14px no-repeat,
    var(--cm) 100% 100% / 14px 1px no-repeat, var(--cm) 100% 100% / 1px 14px no-repeat;
}

/* ---------- type ---------- */
.display, .h2 {
  font-family: var(--font-display);
  font-stretch: 85%;
  text-transform: uppercase;
  text-wrap: balance;
  overflow-wrap: break-word;
}
.display { font-size: var(--fs-hero); font-weight: 800; line-height: .9; letter-spacing: -.01em; }
.h2 { font-size: var(--fs-h2); font-weight: 750; line-height: .98; letter-spacing: -.005em; }
html[lang="ka"] .display { line-height: .96; letter-spacing: 0; }
html[lang="ka"] .h2 { line-height: 1.04; letter-spacing: 0; }
.lead { font-size: var(--fs-lead); line-height: 1.55; color: var(--ink-2); max-width: 44ch; text-wrap: pretty; }
.small { font-size: var(--fs-small); line-height: 1.5; color: var(--ink-2); }

/* annotation lettering: mono for Latin & numerals, Mtavruli for Georgian */
.ann {
  font: 500 var(--fs-ann)/1.35 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
[data-caps] { text-transform: uppercase; }
/* Georgian capitals are written as real Mtavruli code points (see dev/lib.mjs · js/core.js);
   Chrome would fold them back to Mkhedruli under text-transform, so it is switched off here. */
[data-caps="mt"] { text-transform: none !important; }
/* Archivo's ampersand reads like a "6": that one glyph is set in the annotation face */
.amp { font-family: var(--font-mono); font-weight: 500; font-size: .92em; }
.sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; text-transform: none; letter-spacing: 0;
}

/* ---------- sheet header strip:  [ A-02 ] [ მასალები ] ········ [ მ 1:50 ] ---------- */
.strip {
  position: relative; display: flex; align-items: stretch; height: 40px;
  border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line);
  font: 500 var(--fs-ann)/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2);
}
.strip > span { display: flex; align-items: center; padding-inline: 14px; white-space: nowrap; }
.strip__code { background: var(--ink); color: var(--bg); letter-spacing: .08em; }
.strip__name { color: var(--ink); border-right: 1px solid var(--line); }
.strip__rule { flex: 1; padding: 0 !important; }
.strip__meta { border-left: 1px solid var(--line); gap: .7em; }
/* the top rule overshoots the frame, like ruled lines crossing at a corner */
.strip::before, .strip::after { content: ""; position: absolute; top: -1px; width: 14px; height: 1px; background: var(--line-2); }
.strip::before { right: 100%; }
.strip::after { left: 100%; }
@media (min-width: 900px) {
  .strip::before { right: calc(100% + 1px); }
  .strip::after { left: calc(100% + 1px); }
}

/* section head: title on the left columns, lead text on the right ones */
.shead { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 20px; align-items: end; padding-block: clamp(40px, 6.4vw, 104px) clamp(32px, 4.4vw, 72px); }
.shead > .h2 { grid-column: 1 / -1; }
.shead > .lead { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .shead > .h2 { grid-column: 1 / span 8; }
  .shead > .lead { grid-column: 9 / -1; padding-bottom: .35em; }
}

/* ---------- buttons: the fill slides in like a slab ---------- */
.btn {
  --b-bg: transparent; --b-fg: var(--ink); --b-bd: var(--ink); --b-slab: var(--ink); --b-hover-fg: var(--bg);
  position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 14px;
  min-height: 52px; padding: 0 24px; border: 1px solid var(--b-bd); background: var(--b-bg); color: var(--b-fg);
  font: 650 .8125rem/1.1 var(--font-display); font-stretch: 92%; letter-spacing: .07em; text-transform: uppercase; text-align: center;
  cursor: pointer; user-select: none;
  transition: color .35s var(--ease), border-color .35s var(--ease);
}
.btn::before {
  content: ""; position: absolute; inset: -1px; z-index: -1; background: var(--b-slab);
  clip-path: inset(100% 0 0 0); transition: clip-path .5s var(--ease);
}
/* selection grips at the four corners */
.btn::after {
  content: ""; position: absolute; inset: -4px; pointer-events: none; opacity: 0; transition: opacity .25s;
  background:
    linear-gradient(var(--gold-line), var(--gold-line)) 0 0 / 5px 5px no-repeat,
    linear-gradient(var(--gold-line), var(--gold-line)) 100% 0 / 5px 5px no-repeat,
    linear-gradient(var(--gold-line), var(--gold-line)) 0 100% / 5px 5px no-repeat,
    linear-gradient(var(--gold-line), var(--gold-line)) 100% 100% / 5px 5px no-repeat;
}
.btn:focus-visible::before { clip-path: inset(0); }
.btn:focus-visible { color: var(--b-hover-fg); }
.btn:focus-visible::after { opacity: 1; }
@media (hover: hover) {
  .btn:hover::before { clip-path: inset(0); }
  .btn:hover { color: var(--b-hover-fg); }
  .btn:hover::after { opacity: 1; }
  .btn:hover .btn__arr { transform: translateX(5px); }
}
.btn:active::before { clip-path: inset(0); }
.btn:active { color: var(--b-hover-fg); }
.btn--pri { --b-bg: var(--pri-bg); --b-fg: var(--pri-fg); --b-bd: var(--pri-bg); --b-slab: var(--pri-hover-bg); --b-hover-fg: var(--pri-hover-fg); }
.btn--lg { min-height: 60px; padding: 0 30px; font-size: .875rem; }
.btn__arr { width: 22px; height: 10px; flex: none; transition: transform .45s var(--ease); }
.btn__ico { width: 18px; height: 18px; flex: none; }

/* text link with a dimension-line underline  |___| */
.lnk {
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 0 9px; min-height: 44px;
  font: 600 .75rem/1.1 var(--font-display); font-stretch: 92%; letter-spacing: .08em; text-transform: uppercase; color: var(--ink);
  background:
    linear-gradient(currentColor, currentColor) 0 calc(100% - 6px) / 100% 1px no-repeat,
    linear-gradient(currentColor, currentColor) 0 calc(100% - 3px) / 1px 7px no-repeat,
    linear-gradient(currentColor, currentColor) 100% calc(100% - 3px) / 1px 7px no-repeat;
  cursor: pointer; transition: color .3s, background-size .45s var(--ease);
}
.lnk:active { color: var(--gold-text); }
@media (hover: hover) {
  .lnk:hover { color: var(--gold-text); }
  .lnk:hover .btn__arr { transform: translateX(5px); }
}

/* chips: small material tags, bullet = a slab */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  display: inline-flex; align-items: center; gap: 9px; padding: 7px 12px 7px 10px; border: 1px solid var(--line-2);
  font-size: .8125rem; line-height: 1.2; color: var(--ink); background: var(--bg);
}
.chips li::before { content: ""; width: 9px; height: 4px; background: var(--gold); outline: 1px solid var(--gold-line); outline-offset: 0; flex: none; }

/* corner grips for hoverable sheets (rows, cards, map) */
.grips { position: relative; }
.grips::after {
  content: ""; position: absolute; inset: -3px; pointer-events: none; opacity: 0; transition: opacity .3s;
  background:
    linear-gradient(var(--gold-line), var(--gold-line)) 0 0 / 5px 5px no-repeat,
    linear-gradient(var(--gold-line), var(--gold-line)) 100% 0 / 5px 5px no-repeat,
    linear-gradient(var(--gold-line), var(--gold-line)) 0 100% / 5px 5px no-repeat,
    linear-gradient(var(--gold-line), var(--gold-line)) 100% 100% / 5px 5px no-repeat;
}

/* level mark  ▽ +0.00, used as a bullet / label device */
.lvl { display: inline-flex; align-items: center; gap: 8px; }
.lvl::before { content: ""; width: 9px; height: 8px; background: currentColor; clip-path: polygon(0 0, 100% 0, 50% 100%); flex: none; }

/* skip link */
.skip { position: fixed; left: 12px; top: 8px; z-index: 100; padding: 12px 16px; background: var(--pri-bg); color: var(--pri-fg); font-weight: 600; transform: translateY(-200%); transition: transform .25s; }
.skip:focus { transform: none; }

/* ---------- scroll reveals (only once the script is really running) ---------- */
@media (prefers-reduced-motion: no-preference) {
  html.js-ready [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: calc(var(--rd, 0) * 90ms); }
  html.js-ready [data-reveal].is-in { opacity: 1; transform: none; }
  html.js-ready.no-anim [data-reveal] { transition: none; }
}

/* ---------- theme change = swapping the sheet ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: sheet-swap .7s var(--ease-io) both; }
@keyframes sheet-swap { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }

/* English first paint: the Georgian markup is not rendered (nor its font fetched) until the copy is swapped */
html.i18n-wait body { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  ::view-transition-new(root) { animation: none; }
}
