/* =========================================================================
   ASROMA.GE — base                                               base.css
   reset · typography · focus · icons · utilities · state gating · motion
   Mobile-first. Breakpoints: 600 / 900 / 1200 (min-width).
   ========================================================================= */

/* ---------------------------------------------------------------- responsive layout tokens */
@media (min-width: 600px) { :root { --gutter: 24px; } }
@media (min-width: 900px) { :root { --header-h: 64px; } }
@media (min-width: 1200px) { :root { --gutter: 32px; } }

/* ---------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--sp-4));
  hanging-punctuation: first last;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, video, canvas { display: block; max-width: 100%; }
svg { flex: none; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
button:disabled, [aria-disabled="true"] { cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
b, strong { font-weight: var(--fw-semibold); }
small { font-size: var(--fs-sm); }
hr { height: 0; margin: 0; border: 0; border-top: var(--bw) solid var(--border-subtle); }
table { border-collapse: collapse; border-spacing: 0; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }
dialog { color: inherit; }
output { display: inline-block; }
[hidden] { display: none !important; }
::placeholder { color: var(--text-faint); opacity: 1; }

/* ---------------------------------------------------------------- typography */
h1, h2, h3, h4, .h1, .h2, .h3, .h4 {
  font-family: var(--font-display);
  font-stretch: var(--stretch-xc);
  font-weight: var(--fw-black);
  line-height: 1.02;
  letter-spacing: var(--tracking-display);
  color: var(--text-strong);
  text-wrap: balance;
}
h1, .h1 { font-size: var(--fs-3xl); text-transform: uppercase; }
h2, .h2 { font-size: var(--fs-2xl); text-transform: uppercase; }
h3, .h3 { font-size: var(--fs-xl); text-transform: uppercase; font-weight: var(--fw-bold); }
h4, .h4 { font-size: var(--fs-lg); text-transform: uppercase; font-weight: var(--fw-bold); letter-spacing: .02em; }
p { max-width: var(--reading-max); }
/* Georgian islands inside an English page (e.g. the "ქართული" switch) */
:root:not(:lang(ka)) [lang="ka"], .ka { font-family: "Noto Sans Georgian", var(--font-body); letter-spacing: 0; }
/* Georgian pages (<html lang="ka">, html/ka/). Georgian has no letter case: CSS uppercase must not touch it (some engines map
   Mkhedruli to Mtavruli), tracking makes it gappy, and its tall ascenders/descenders need more line-height than Latin caps.
   Short labels keep the condensed display stack: Archivo for digits/Latin, Noto Sans Georgian (wdth axis) for Georgian. */
:root:lang(ka) {
  --font-body: "Noto Sans Georgian", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Archivo", "Noto Sans Georgian", "Arial Narrow", system-ui, sans-serif;
  --tracking-label: 0; --tracking-btn: 0; --tracking-display: 0;
  --lh-tight: 1.15;
  --fs-2xs: 12px;
}
:lang(ka) { text-transform: none !important; letter-spacing: normal !important; }
:lang(ka) :is(h1, h2, h3, h4, .h1, .h2, .h3, .h4) { line-height: 1.18; }

/* display type helpers */
.display { font-family: var(--font-display); font-stretch: var(--stretch-xc); font-weight: var(--fw-black); line-height: 1; letter-spacing: var(--tracking-display); text-transform: uppercase; font-variant-numeric: tabular-nums lining-nums; }
.label {
  font-family: var(--font-display);
  font-stretch: var(--stretch-c);
  font-weight: var(--fw-bold);
  font-size: var(--fs-xs);
  line-height: 1.2;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-muted);
}
/* headline = long titles (news, threads, articles): sentence case, body font, semibold — use on h2/h3 too */
.headline, h1.headline, h2.headline, h3.headline, h4.headline {
  font-family: var(--font-body); font-stretch: var(--stretch-n); font-weight: var(--fw-semibold);
  font-size: var(--fs-lg); line-height: 1.3; letter-spacing: -.005em; text-transform: none;
  color: var(--text-strong); text-wrap: pretty;
}
.headline--sm, h2.headline--sm, h3.headline--sm { font-size: var(--fs-base); line-height: 1.35; }
.headline--lg, h1.headline--lg, h2.headline--lg { font-size: var(--fs-xl); line-height: 1.2; letter-spacing: -.01em; font-weight: var(--fw-bold); }
a:hover .headline, a.headline:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.lead { font-size: var(--fs-lg); line-height: var(--lh-normal); color: var(--text); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-3); font-size: var(--fs-xs); line-height: 1.35; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.meta > * { display: inline-flex; align-items: center; gap: var(--sp-1); }
.meta .icon { width: 14px; height: 14px; }
.num { font-variant-numeric: tabular-nums lining-nums; }
.username { font-weight: var(--fw-semibold); color: var(--text-strong); text-transform: none; letter-spacing: 0; overflow-wrap: anywhere; }
.text-strong { color: var(--text-strong); }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-red { color: var(--red-text); }
.text-yellow { color: var(--yellow-text); }
.text-highlight { color: var(--highlight); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

/* inline text link (prose, notes) */
.link {
  color: var(--text-strong);
  font-weight: var(--fw-semibold);
  text-decoration: underline;
  text-decoration-color: var(--red-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur-fast);
}
.link:hover { color: var(--red-text); }
/* condensed "All news →" style link */
.more-link {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  min-height: 32px;
  font-family: var(--font-display); font-stretch: var(--stretch-c); font-weight: var(--fw-bold);
  font-size: var(--fs-sm); letter-spacing: var(--tracking-label); text-transform: uppercase;
  color: var(--text-muted); white-space: nowrap;
  transition: color var(--dur-fast);
}
.more-link .icon { width: 16px; height: 16px; transition: transform var(--dur) var(--ease-out); }
.more-link:hover { color: var(--text-strong); }
.more-link:hover .icon { transform: translateX(2px); }

/* ---------------------------------------------------------------- focus & selection */
:focus { outline: none; }
:focus-visible {
  outline: var(--bw-2) solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--focus-halo);
  border-radius: var(--r-xs);
}
::selection { background: var(--yellow); color: var(--on-yellow); }

/* subtle scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-full); border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background-color: var(--border-strong); }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- icons */
.icon {
  width: 20px; height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.icon--xs { width: 12px; height: 12px; stroke-width: 2.5; }
.icon--sm { width: 16px; height: 16px; }
.icon--md { width: 20px; height: 20px; }
.icon--lg { width: 24px; height: 24px; stroke-width: 1.75; }
.icon--xl { width: 32px; height: 32px; stroke-width: 1.5; }
.icon--fill { fill: currentColor; }

/* ---------------------------------------------------------------- utilities (small, documented set) */
.visually-hidden,
.visually-hidden-focusable:not(:focus):not(:focus-within) {
  position: absolute !important;
  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;
}
.truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2, .clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { -webkit-line-clamp: 2; line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; line-clamp: 3; }

/* stack: vertical rhythm. --stack-gap overrides */
.stack { display: flex; flex-direction: column; gap: var(--stack-gap, var(--sp-4)); min-width: 0; }
.stack > * { min-width: 0; }
.stack--xs { --stack-gap: var(--sp-1); }
.stack--sm { --stack-gap: var(--sp-2); }
.stack--md { --stack-gap: var(--sp-6); }
.stack--lg { --stack-gap: var(--section-gap); }
/* cluster: wrapping row */
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cluster-gap, var(--sp-2)); min-width: 0; }
.cluster--sm { --cluster-gap: var(--sp-1); }
.cluster--lg { --cluster-gap: var(--sp-4); }
.cluster--end { justify-content: flex-end; }
.cluster--nowrap { flex-wrap: nowrap; }
/* split: two ends */
.split-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-width: 0; }
.push { margin-left: auto; }
.grow { flex: 1 1 auto; min-width: 0; }
/* grid: auto-fit cards (--grid-min overrides), or fixed responsive columns */
.grid { display: grid; gap: var(--grid-gap, var(--sp-4)); grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--grid-min, 260px)), 1fr)); }
.grid > * { min-width: 0; }
.grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 600px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.gap-sm { --grid-gap: var(--sp-2); --stack-gap: var(--sp-2); --cluster-gap: var(--sp-2); }
.gap-lg { --grid-gap: var(--sp-6); --stack-gap: var(--sp-6); --cluster-gap: var(--sp-6); }
/* horizontal scroller (chips, cards) — never causes page overflow */
.scroll-x { display: flex; gap: var(--sp-2); overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; scroll-snap-type: x proximity; }
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x > * { flex: none; scroll-snap-align: start; }

/* responsive show / hide
   .only-mobile      < 900px (tab-bar layout)
   .only-desktop     ≥ 900px (top-nav layout)
   .hide-on-sidebar  hidden while the right sidebar is visible (≥1200px, unless body[data-layout="wide"])
   .only-on-sidebar  the inverse */
@media (min-width: 900px) { .only-mobile { display: none !important; } }
@media (max-width: 899.98px) { .only-desktop { display: none !important; } }
@media (min-width: 1200px) {
  body:not([data-layout="wide"]) .hide-on-sidebar { display: none !important; }
  body[data-layout="wide"] .only-on-sidebar { display: none !important; }
}
@media (max-width: 1199.98px) { .only-on-sidebar { display: none !important; } }

/* ---------------------------------------------------------------- prototype state gating
   data-when="pre|live|ft" (space-separated list) → visible only in those match states.
   Default (no attribute on <html>) behaves as "live". */
html[data-match="pre"] [data-when]:not([data-when~="pre"]),
html[data-match="live"] [data-when]:not([data-when~="live"]),
html[data-match="ft"] [data-when]:not([data-when~="ft"]),
html:not([data-match]) [data-when]:not([data-when~="live"]) { display: none !important; }

/* theme-specific content (e.g. sun / moon icon in a theme toggle) */
html[data-theme="dark"] .show-light,
html:not([data-theme="dark"]) .show-dark { display: none !important; }

/* ---------------------------------------------------------------- motion */
@keyframes asr-pulse { 0% { transform: scale(.5); opacity: .9; } 100% { transform: scale(2.4); opacity: 0; } }
@keyframes asr-spin { to { transform: rotate(360deg); } }
@keyframes asr-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes asr-fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes asr-sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes asr-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
