:root {
  /* Brand Estonia palette (brand.estonia.ee), tuned for depth */
  --blue: #0030de;        /* Estonian blue */
  --blue-deep: #000766;   /* Liivi, deepened */
  --blue-mid: #0062f5;    /* Paldiski */
  --cyan: #00c3ff;        /* Narva */
  --pale: #cee2fd;        /* Pärnu */
  --sand: #fceec8;        /* Haapsalu */
  --ink: #0a0f1e;         /* near-black navy */
  --ink-2: #4a5468;
  --paper: #f7f8fb;
  --paper-2: #eef1f7;
  --line: rgba(10, 15, 30, 0.12);
  --line-2: rgba(10, 15, 30, 0.06);
  --on-blue-line: rgba(255, 255, 255, 0.22);

  --font: "Figtree", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { background: var(--paper); color: var(--ink); font-family: var(--font); overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
em { font-style: normal; }
::selection { background: var(--blue); color: #fff; }

/* grain overlay */
.grain {
  position: fixed; inset: 0; z-index: 9998; pointer-events: none; opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

/* ---------- PRELOADER ---------- */
.loader {
  position: fixed; inset: 0; z-index: 10002; background: var(--blue); color: #fff;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: clamp(1.5rem, 5vw, 3.5rem);
  background-image: radial-gradient(90% 90% at 80% 10%, rgba(0,195,255,0.3), transparent 55%);
}
.loader__id { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--pale); line-height: 1.7; }
.loader__count { font-weight: 800; font-size: clamp(4rem, 20vw, 16rem); line-height: 0.8; letter-spacing: -0.04em; }
.loader__count sup { font-size: 0.28em; vertical-align: super; font-weight: 600; color: var(--cyan); }

/* ---------- CURSOR ---------- */
.cursor { position: fixed; top: 0; left: 0; z-index: 10000; pointer-events: none; transform: translate(-50%, -50%); opacity: 0; }
.cursor__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.cursor__label {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0);
  background: var(--blue); color: #fff; font-family: var(--mono); font-size: 0.62rem;
  letter-spacing: 0.08em; text-transform: uppercase; padding: 0.5rem 0.85rem; border-radius: 100px; white-space: nowrap;
}
@media (pointer: coarse) { .cursor { display: none; } }

/* ---------- scroll progress ---------- */
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 100%; background: var(--blue); transform: scaleX(0); transform-origin: 0 50%; z-index: 10001; }

/* ---------- NAV ---------- */
.nav {
  position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 100;
  width: min(1180px, calc(100% - 1.6rem)); display: flex; justify-content: space-between; align-items: center;
  padding: 0.65rem 0.8rem 0.65rem 1.3rem; background: rgba(247, 248, 251, 0.7);
  backdrop-filter: saturate(1.5) blur(16px); border: 1px solid var(--line); border-radius: 100px;
  box-shadow: 0 10px 40px rgba(0, 48, 222, 0.06);
}
.nav__brand { font-weight: 800; font-size: 1rem; letter-spacing: -0.01em; }
.nav__brand span { color: var(--blue); }
.nav__links { display: flex; gap: 0.2rem; align-items: center; }
.nav__links a { font-size: 0.86rem; font-weight: 600; padding: 0.5rem 0.9rem; border-radius: 100px; transition: background 0.25s, color 0.25s; }
.nav__links a:hover { background: var(--blue); color: #fff; }
.nav__cta { background: var(--ink); color: #fff !important; }
.nav__cta:hover { background: var(--blue) !important; }
@media (max-width: 620px) { .nav__links a:not(.nav__cta) { display: none; } }

section { padding: clamp(5rem, 12vh, 9rem) clamp(1.4rem, 6vw, 6rem); }
.eyebrow { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--blue); }

/* ---------- HERO ---------- */
.hero { min-height: 100vh; position: relative; background: var(--blue); color: #fff; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding-top: 7rem; }
.hero__glow { position: absolute; width: 60vw; height: 60vw; border-radius: 50%; filter: blur(80px); background: radial-gradient(circle, rgba(0,195,255,0.55), transparent 65%); top: -10%; right: -8%; z-index: 0; will-change: transform; }
.hero__glow--2 { background: radial-gradient(circle, rgba(0,7,102,0.8), transparent 65%); bottom: -20%; left: -10%; top: auto; right: auto; }
.hero__inner { position: relative; z-index: 2; }
.hero__top { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--pale); margin-bottom: clamp(1.5rem, 5vh, 3rem); flex-wrap: wrap; gap: 0.6rem; }
.hero__name { font-weight: 800; line-height: 0.84; letter-spacing: -0.04em; font-size: clamp(3rem, 13.5vw, 12.5rem); text-transform: uppercase; }
.hero__name .line { display: block; overflow: hidden; }
.hero__name .line:last-child { color: transparent; -webkit-text-stroke: 1.5px rgba(255,255,255,0.85); }
.hero__meta { margin-top: clamp(1.6rem, 5vh, 3rem); display: flex; gap: clamp(1.5rem, 5vw, 4rem); flex-wrap: wrap; }
.hero__meta div { display: flex; flex-direction: column; gap: 0.3rem; }
.hero__meta dt { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,0.55); }
.hero__meta dd { font-size: 1.02rem; font-weight: 600; color: #fff; }
.hero__meta dd em { color: var(--cyan); }
.hero__scroll { position: absolute; bottom: 2rem; left: clamp(1.4rem, 6vw, 6rem); font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.14em; color: rgba(255,255,255,0.7); z-index: 2; display: flex; align-items: center; gap: 0.6rem; }
.hero__scroll::before { content: ""; width: 34px; height: 1px; background: currentColor; }

/* ---------- STATEMENT ---------- */
.statement { max-width: 1180px; margin-inline: auto; }
.statement .eyebrow { display: block; margin-bottom: 1.6rem; }
.statement__text { font-size: clamp(1.7rem, 4.6vw, 3.5rem); font-weight: 600; line-height: 1.16; letter-spacing: -0.025em; max-width: 22ch; }
.statement__text em { color: var(--blue); }

/* ---------- HUD (fixed chapter index) ---------- */
.hud { position: fixed; right: clamp(1rem, 2.5vw, 2.2rem); top: 50%; transform: translateY(-50%); z-index: 90; pointer-events: none; }
.hud ol { list-style: none; display: flex; flex-direction: column; gap: 0.85rem; }
.hud li { display: flex; align-items: center; gap: 0.7rem; justify-content: flex-end; opacity: 0.4; transition: opacity 0.4s var(--ease); }
.hud__lbl { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.06em; color: var(--ink); max-width: 0; overflow: hidden; white-space: nowrap; opacity: 0; transition: max-width 0.5s var(--ease), opacity 0.4s; text-align: right; }
.hud__yr { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.hud__tick { width: 14px; height: 2px; background: var(--ink); transition: width 0.4s var(--ease), background 0.4s; }
.hud li.is-active { opacity: 1; }
.hud li.is-active .hud__tick { width: 30px; background: var(--blue); }
.hud li.is-active .hud__yr { color: var(--blue); }
.hud li.is-active .hud__lbl { max-width: 200px; opacity: 1; }
@media (max-width: 900px) { .hud { display: none; } }

/* ---------- TIMELINE ---------- */
.timeline { position: relative; padding-block: clamp(2rem, 5vh, 4rem); }
.tl-spine { position: absolute; top: 0; bottom: 0; left: clamp(1.4rem, 6vw, 6rem); width: 1px; background: var(--line); }
.tl-spine__fill { position: absolute; inset: 0; background: var(--blue); transform: scaleY(0); transform-origin: top; will-change: transform; }

.chapter {
  position: relative; min-height: 92vh; display: grid; align-content: center;
  grid-template-columns: 1.05fr 0.95fr; gap: clamp(2rem, 5vw, 5rem); align-items: center;
  padding-left: clamp(3rem, 9vw, 8.5rem); padding-right: clamp(1.4rem, 4vw, 4rem);
  padding-block: clamp(3rem, 7vh, 5rem);
  opacity: 0.72; transition: opacity 0.5s var(--ease);
}
.chapter.is-active { opacity: 1; }
.chapter__node { position: absolute; left: clamp(1.4rem, 6vw, 6rem); top: 50%; width: 11px; height: 11px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--line); transform: translate(-50%, -50%); z-index: 3; transition: background 0.4s, border-color 0.4s, box-shadow 0.4s, transform 0.4s; }
.chapter.is-active .chapter__node { background: var(--blue); border-color: var(--blue); box-shadow: 0 0 0 6px rgba(0,48,222,0.13); transform: translate(-50%, -50%) scale(1.2); }
.chapter__idx { position: absolute; left: clamp(3rem, 9vw, 8.5rem); top: clamp(2rem, 6vh, 3.5rem); font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.16em; color: var(--ink-2); }
.chapter__lead {}
.chapter__tag { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--blue); margin-bottom: 1.1rem; }
.chapter__year { display: block; font-weight: 800; font-size: clamp(3rem, 8vw, 6rem); letter-spacing: -0.04em; line-height: 0.9; color: var(--ink); }
.chapter__title { font-size: clamp(1.6rem, 3.6vw, 2.8rem); font-weight: 800; letter-spacing: -0.02em; margin: 0.5rem 0 1.1rem; }
.chapter__text { color: var(--ink-2); font-size: clamp(1rem, 1.4vw, 1.12rem); line-height: 1.65; max-width: 46ch; }
.chapter__text strong { color: var(--ink); font-weight: 700; }

/* right column: spec panel + visual */
.spec { border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,0.6); backdrop-filter: blur(6px); overflow: hidden; box-shadow: 0 30px 60px -30px rgba(0,48,222,0.2); }
.spec__viz { position: relative; height: 200px; background: var(--paper-2); border-bottom: 1px solid var(--line); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.spec__viz svg { width: 100%; height: 100%; display: block; }
.spec__rows { padding: 1.2rem 1.4rem; display: grid; gap: 0.7rem; }
.spec__row { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; font-family: var(--mono); font-size: 0.78rem; }
.spec__row dt { color: var(--ink-2); letter-spacing: 0.04em; }
.spec__row dd { color: var(--ink); font-weight: 500; text-align: right; }
.spec__row dd.hl { color: var(--blue); font-weight: 700; font-size: 0.92rem; }

/* featured (military) chapter */
.chapter--feature .spec { background: var(--blue); border-color: transparent; color: #fff; box-shadow: 0 40px 80px -30px rgba(0,48,222,0.5); }
.chapter--feature .spec__viz { background: var(--blue-deep); border-color: var(--on-blue-line); }
.chapter--feature .spec__row dt { color: var(--pale); }
.chapter--feature .spec__row dd { color: #fff; }
.chapter--feature .spec__row dd.hl { color: var(--cyan); }
.chapter--feature .rankchip { margin: 0 1.4rem 1.3rem; display: inline-flex; align-items: center; gap: 0.55rem; font-family: var(--mono); font-size: 0.72rem; color: var(--blue-deep); background: var(--sand); padding: 0.45rem 0.9rem 0.45rem 0.55rem; border-radius: 100px; font-weight: 600; }
.rankchip__emblem { height: 34px; width: auto; display: block; flex: none; }

/* photo as a section's visual (drop a real photo into any .spec__viz) */
.spec__viz--photo { height: 250px; padding: 0; }
.spec__viz--photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 38%; transition: transform 0.8s var(--ease); }
.spec:hover .spec__viz--photo img { transform: scale(1.05); }
.spec__viz-cap { position: absolute; left: 0.9rem; bottom: 0.8rem; z-index: 2; font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.08em; color: #fff; background: rgba(10,15,30,0.5); padding: 0.4rem 0.7rem; border-radius: 100px; backdrop-filter: blur(4px); }

/* portrait chapter */
.portrait { position: relative; aspect-ratio: 4/5; border-radius: 18px; overflow: hidden; background: var(--blue); box-shadow: 0 40px 80px -30px rgba(0,48,222,0.4); clip-path: inset(0 0 0 0); }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; }
.portrait img.is-missing { display: none; }
.portrait__cap { position: absolute; left: 1rem; bottom: 1rem; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; color: #fff; background: rgba(10,15,30,0.4); padding: 0.4rem 0.7rem; border-radius: 100px; backdrop-filter: blur(4px); }

@media (max-width: 820px) {
  .chapter { grid-template-columns: 1fr; gap: 2rem; min-height: auto; padding-block: 4rem; }
  .chapter__idx { position: static; margin-bottom: 0.6rem; }
}

/* ---------- CONTACT ---------- */
.contact { background: var(--blue); color: #fff; min-height: auto; padding-block: clamp(5rem, 12vh, 8rem) clamp(2.5rem, 6vh, 4rem); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2rem; text-align: center; overflow: hidden; position: relative; }
.contact__glow { position: absolute; width: 70vw; height: 70vw; border-radius: 50%; filter: blur(90px); background: radial-gradient(circle, rgba(0,195,255,0.4), transparent 65%); top: -20%; left: 10%; z-index: 0; }
.contact__inner { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 1.8rem; }
.contact .eyebrow { color: var(--cyan); }
.contact__big { font-size: clamp(3.2rem, 13vw, 11rem); font-weight: 800; letter-spacing: -0.045em; line-height: 0.88; }
.contact__mail { font-size: clamp(1.15rem, 3vw, 1.9rem); color: var(--cyan); font-weight: 600; }
.contact__socials { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; }
.contact__socials a { font-family: var(--mono); font-size: 0.82rem; color: #fff; border: 1px solid var(--on-blue-line); padding: 0.55rem 1.1rem; border-radius: 100px; transition: background 0.25s, color 0.25s; }
.contact__socials a:hover { background: #fff; color: var(--blue); }
.footer { position: relative; z-index: 2; margin-top: 3rem; width: min(1180px, 100%); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-family: var(--mono); font-size: 0.72rem; color: var(--pale); border-top: 1px solid var(--on-blue-line); padding-top: 1.4rem; }
[data-magnetic] { display: inline-block; will-change: transform; }

/* ---------- AD PLATFORM LOGOS ---------- */
.adlogos { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.6rem; }
.adlogos__label { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); }
.adlogos__set { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.adlogo { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.9rem; border: 1px solid var(--line); border-radius: 100px; background: var(--paper); transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease); }
.adlogo:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -18px rgba(0,48,222,0.5); }
.adlogo__mark { height: 22px; width: auto; display: block; }
.adlogo__mark--g { height: 20px; }
.adlogo__mark--sq { height: 20px; width: 20px; }
.adlogo__name { font-weight: 700; font-size: 0.95rem; letter-spacing: -0.01em; color: var(--ink); }
.adlogos--stack { margin-top: 2rem; }

/* ---------- AI AUTOMATIONS ---------- */
.autos { background: linear-gradient(180deg, var(--paper), var(--paper-2)); border-top: 1px solid var(--line); overflow: hidden; }
.autos__head { max-width: 1180px; margin: 0 auto 2.4rem; }
.autos__head h2 { font-weight: 800; font-size: clamp(2rem, 5.5vw, 3.8rem); letter-spacing: -0.03em; line-height: 1.02; margin-top: 1.2rem; }
.autos__head p { margin-top: 1.1rem; color: var(--ink-2); font-size: clamp(1rem, 1.5vw, 1.18rem); line-height: 1.6; max-width: 62ch; }
.autos__head p strong { color: var(--ink); font-weight: 700; }

.autos__scroller { max-width: 1180px; margin: 0 auto; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none; cursor: grab; padding-bottom: 0.5rem; }
.autos__scroller::-webkit-scrollbar { display: none; }
.autos__scroller.is-drag { cursor: grabbing; scroll-snap-type: none; }
.autos__scroller.is-drag .auto-card { pointer-events: none; }
.autos__track { display: flex; gap: 1.2rem; width: max-content; padding: 0.6rem 0.4rem 0.4rem; }

.auto-card { scroll-snap-align: start; flex: 0 0 300px; width: 300px; min-height: 268px; display: flex; flex-direction: column; padding: 1.6rem; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 30px 70px -50px rgba(0,48,222,0.35); transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), border-color 0.4s var(--ease); }
.auto-card:hover { transform: translateY(-6px); border-color: rgba(0,48,222,0.35); box-shadow: 0 44px 84px -44px rgba(0,48,222,0.42); }
.auto-card__icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--paper-2); border: 1px solid var(--line); margin-bottom: 1.2rem; }
.auto-card__icon svg { width: 28px; height: 28px; }
.auto-card__title { font-size: 1.14rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.auto-card__desc { margin-top: 0.6rem; color: var(--ink-2); font-size: 0.9rem; line-height: 1.55; flex: 1; }
.auto-card__meta { margin-top: 1.1rem; font-family: var(--mono); font-size: 0.68rem; color: var(--blue); letter-spacing: 0.08em; }

.autos__hint { max-width: 1180px; margin: 1.1rem auto 0; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); display: flex; align-items: center; gap: 0.5rem; }
.autos__hint span { position: relative; }
@media (max-width: 560px) { .auto-card { flex-basis: 78vw; width: 78vw; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .cursor, .progress, .grain { display: none; }
  .loader { display: none; }
  .chapter { opacity: 1; filter: none; }
  .tl-spine__fill { transform: scaleY(1); }
}
