/* ============================================================
   BASE — design tokens, reset, typography, shared primitives
   Port of the Tailwind theme used by the original React app.
   ============================================================ */

/* Font files are linked from <head> in index.html, not @import-ed here. */

:root {
  /* Fonts.
     Google Sans carries Latin for both body and display — its `opsz` axis
     (17..18) does the display differentiation that a separate headline face
     used to, given `font-optical-sizing: auto` below.

     Neither Google Sans nor JetBrains Mono ships Georgian glyphs, so Noto Sans
     Georgian sits behind both. Its @font-face is unicode-range scoped to
     U+10A0-10FF etc., so Latin still renders in the primary face and only
     Georgian text falls through to Noto. */
  --font-sans: "Google Sans", "Noto Sans Georgian", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-display: "Google Sans", "Noto Sans Georgian", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Noto Sans Georgian", ui-monospace, SFMono-Regular, Menlo, monospace;
  /* Georgian-first stacks. Using these means the digits come from the Georgian
     face too, so a mixed string like "... 2030 ..." renders in one typeface
     rather than borrowing digits from JetBrains Mono or Google Sans. */
  --font-georgian: "Noto Sans Georgian", ui-sans-serif, system-ui, sans-serif;
  /* Loaded and ready, but not applied anywhere yet. */
  --font-georgian-serif: "Noto Serif Georgian", Georgia, serif;

  /* Surfaces */
  --bg: #0a0a0a;
  --bg-deep: #050505;
  --surface: #121212;
  --surface-2: #161616;

  /* Accents */
  --orange-400: #fb923c;
  --orange-500: #f97316;
  --orange-600: #ea580c;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --green-500: #22c55e;
  --emerald-400: #34d399;

  /* Neutrals */
  --zinc-100: #f4f4f5;
  --zinc-200: #e4e4e7;
  --zinc-300: #d4d4d8;
  --zinc-400: #a1a1aa;
  --zinc-500: #71717a;
  --zinc-700: #3f3f46;
  --zinc-800: #27272a;
  --zinc-900: #18181b;
  --zinc-950: #09090b;

  /* Hairlines */
  --line: rgba(255, 255, 255, 0.05);
  --line-strong: rgba(255, 255, 255, 0.1);

  /* Layout.
     --nav-h is the full fixed-chrome height. It is declared here (not on
     body) so that collapsing --announce-h on `html.is-scrolled` re-resolves
     it for scroll-padding, section clearance and the toast offset. */
  --announce-h: 2.5rem;
  --header-h: 5rem;
  --nav-h: calc(var(--announce-h) + var(--header-h));
  --container: 80rem;
  --chamfer: 18px;
  --radius-sm: 0.5rem;
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset ---------- */

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

* { margin: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

/* The utility bar folds away once the page starts scrolling. */
html.is-scrolled { --announce-h: 0rem; }

@media (max-width: 639px) {
  :root { --announce-h: 2.25rem; --header-h: 4rem; }
}

body.is-locked { overflow: hidden; }

body {
  background: var(--bg);
  color: var(--zinc-100);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* Variable-axis defaults, inherited by everything. `wdth` is a no-op on the
     faces that lack the axis; it pins the Noto Georgian faces to normal width. */
  font-optical-sizing: auto;
  font-variation-settings: "wdth" 100;
}

img, svg, video { display: block; max-width: 100%; }
img, video { height: auto; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { background: none; border: none; cursor: pointer; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.15; }

[hidden] { display: none !important; }

::selection {
  background: var(--orange-600);
  color: #fff;
}

/* ---------- Scrollbar ---------- */

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb { background: #27272a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #ea580c; }

/* ---------- Layout primitives ---------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1rem;
}

@media (min-width: 640px) { .container { padding-inline: 1.5rem; } }
@media (min-width: 1024px) { .container { padding-inline: 2rem; } }

.section {
  position: relative;
  z-index: 10;
  padding-block: 6rem;
}

.section--banded {
  padding-block: 5rem;
  background: rgba(0, 0, 0, 0.4);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section__head {
  text-align: center;
  max-width: 42rem;
  margin: 0 auto 4rem;
}

.section--banded .section__head { margin-bottom: 3rem; }

.section__head h2 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #fff;
  font-size: 1.875rem;
  margin-top: 0.75rem;
}

@media (min-width: 640px) {
  .section__head h2 { font-size: 3rem; }
}

.section__head p {
  font-size: 0.75rem;
  color: var(--zinc-400);
  line-height: 1.7;
  margin-top: 0.75rem;
}

@media (min-width: 640px) {
  .section__head p { font-size: 0.875rem; }
}

/* ---------- Shared bits ---------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--orange-500);
}

.eyebrow--left { justify-content: flex-start; font-size: 0.625rem; letter-spacing: 0.08em; }

.accent { color: var(--orange-500); }

.text-gradient {
  background: linear-gradient(90deg, var(--orange-500), var(--red-600));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.icon--xs { width: 0.875rem; height: 0.875rem; }
.icon--sm { width: 1rem; height: 1rem; }


.ping-dot {
  position: relative;
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 999px;
  background: var(--orange-500);
  flex-shrink: 0;
}

.ping-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  animation: ping 1.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius-sm);
  /* Transparent by default so bordered and unbordered variants line up. */
  border: 1px solid transparent;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 0.2s var(--ease-out), background 0.25s, border-color 0.25s,
              color 0.25s, box-shadow 0.25s;
}

.btn:active { transform: scale(0.98); }

.btn--sm {
  padding: 0.625rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

/* Georgian is unicameral, so the tracking that suits uppercase Latin runs
   too loose for it. Pull it back wherever Georgian text is marked up.

   `text-transform: none` opts Georgian out of the uppercase runs (nav,
   eyebrows, labels). CSS would otherwise map Mkhedruli to Mtavruli caps
   (U+1C90-1CBA) — valid Georgian, and Noto covers it, but it reads shouty
   and Georgian navs conventionally stay in Mkhedruli. Drop this line if you
   want the all-caps look to carry across. */
[lang="ka"] { letter-spacing: 0.02em; text-transform: none; }

.btn--lg {
  padding: 1rem 2rem;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  border-radius: var(--radius);
}

.btn--primary {
  background: linear-gradient(90deg, var(--orange-600), var(--orange-500));
  color: #fff;
  box-shadow: 0 10px 15px -3px rgba(234, 88, 12, 0.3);
}

.btn--primary:hover {
  background: linear-gradient(90deg, var(--orange-500), var(--orange-400));
  transform: scale(1.02);
}

.btn--ghost {
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn--ghost:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: rgba(249, 115, 22, 0.3);
}

.btn--line {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.btn--line:hover {
  border-color: var(--orange-500);
  color: var(--orange-500);
  background: rgba(234, 88, 12, 0.06);
}

.btn--outline {
  padding: 0.875rem 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Same specificity fight as .crux-logo__tagline[lang="ka"]: this rule sits
   later than the generic [lang="ka"] reset above, so it wins on source
   order and needs its own explicit override for Georgian labels. */
.btn--outline[lang="ka"] { text-transform: none; letter-spacing: 0.02em; }

.btn--outline:hover {
  border-color: var(--orange-500);
  color: var(--orange-500);
  background: rgba(234, 88, 12, 0.05);
}

/* ---------- Panels ---------- */

.panel {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

@media (min-width: 1024px) { .panel { padding: 2rem; } }

.panel__dots {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.1;
  background-image: radial-gradient(#ff5500 0.6px, transparent 0.6px);
  background-size: 20px 20px;
}

.panel__dots--faint { opacity: 0.05; background-size: 16px 16px; }

/* ---------- Brand mark ---------- */

.crux-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  user-select: none;
}

.crux-logo__word {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.2em;
  font-size: 1.5rem;
  line-height: 1;
  color: #fff;
}

@media (min-width: 640px) {
  .crux-logo__word { font-size: 1.875rem; }
}

.crux-logo--sm .crux-logo__word { font-size: 1.5rem; }

.crux-logo__x { color: var(--orange-500); }

.crux-logo__tagline {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--zinc-400);
  border-left: 1px solid var(--zinc-800);
  padding-left: 0.75rem;
  line-height: 1;
}

/* The generic [lang="ka"] reset below loses this cascade on source order
   alone (equal specificity, declared earlier in the file) since uppercase
   is set directly on this element rather than inherited — so it needs an
   explicit override here, not just the attribute selector. */
.crux-logo__tagline[lang="ka"] {
  font-family: var(--font-georgian);
  text-transform: none;
  letter-spacing: 0.02em;
}

@media (min-width: 640px) { .crux-logo__tagline { display: inline-block; } }

.brand-link {
  display: inline-flex;
  padding-block: 0.25rem;
  transition: transform 0.2s var(--ease-out);
}

.brand-link:hover { transform: scale(1.05); }
.brand-link:active { transform: scale(0.95); }

/* ---------- Animations ---------- */

@keyframes ping {
  75%, 100% { transform: scale(2.2); opacity: 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes bounce {
  0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
  50% { transform: none; animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
}

@keyframes fade-in-right {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: none; }
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translate(-50%, 0); }
  to { opacity: 0; transform: translate(-50%, -20px); }
}

.pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.bounce { animation: bounce 1s infinite; }

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