/* ==========================================================================
   Develly — agentuuristiilis üheleht
   Alus: Develly punane #F04D4B ja disainilaud hero's: pikslid, joonlauad, valikukastid.
   ========================================================================== */

:root {
  --red: #F04D4B;     /* ametliku logo punane */
  --red-deep: #C93A3A;
  --ink: #050708;
  --paper: #FDFDFD;
  --cream: #FDF0EB;
  --navy: #0B1550;     /* tekst nav-klotsidel; heledam sinine ei ole punasel loetav */

  --font: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Space Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --nav-h: 102px;
  --radius: 18px;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --gutter: clamp(16px, 4vw, 48px);
  --wrap: 1320px;
}

/* ---------- Teemad: iga sektsioon valib pinna ---------- */
[data-theme="ink"] {
  --bg: var(--ink);
  --fg: var(--paper);
  --fg-muted: rgba(253, 253, 253, .64);
  --line: rgba(253, 253, 253, .18);
  --line-faint: rgba(253, 253, 253, .06);
  --accent: var(--red);
  --accent-fg: var(--paper);
  --tile-bg: transparent;
  --tile-fg: var(--paper);
  --tile-hover-bg: var(--red);
  --tile-hover-fg: var(--paper);
}
[data-theme="paper"] {
  --bg: var(--paper);
  --fg: var(--ink);
  --fg-muted: rgba(5, 7, 8, .62);
  --line: rgba(5, 7, 8, .14);
  --line-faint: rgba(5, 7, 8, .06);
  --accent: var(--red);
  --accent-fg: var(--paper);
  --tile-bg: transparent;
  --tile-fg: var(--ink);
  --tile-hover-bg: var(--ink);
  --tile-hover-fg: var(--paper);
}
[data-theme="cream"] {
  --bg: var(--cream);
  --fg: var(--ink);
  --fg-muted: rgba(5, 7, 8, .58);
  --line: rgba(5, 7, 8, .14);
  --line-faint: rgba(5, 7, 8, .06);
  --accent: var(--red);
  --accent-fg: var(--ink);
  --tile-bg: transparent;
  --tile-fg: var(--ink);
  --tile-hover-bg: var(--ink);
  --tile-hover-fg: var(--paper);
}
section[data-theme], footer[data-theme] { background: var(--bg); color: var(--fg); }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.menu-open { overflow: hidden; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.skip {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: 8px 12px; border-radius: 8px;
}
.skip:focus { left: 8px; }

/* ---------- Peenjooneline ruudustik (inspiratsioon 2 ja 3) ---------- */
.lines { position: relative; }
.lines::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line-faint) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-faint) 1px, transparent 1px);
  background-size: 96px 96px;
  background-position: 0 0;
  pointer-events: none;
}
.lines > * { position: relative; }

/* ---------- Nupud ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px;
  font-weight: 600; font-size: 14px; line-height: 1;
  white-space: nowrap;
  border: 1.5px solid transparent;
  transition: background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease), transform .25s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn--ghost { border-color: var(--line); color: var(--fg); }
.btn--ghost:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* ==========================================================================
   NAV — klotsid. Viis linki = logo viis klotsi. Üleval rivis, kerides (.is-compact)
   lendavad kokku logomärgiks; --cx --cy --cs arvutab main.js initNav. .is-open avab.
   ========================================================================== */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--nav-h);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
  padding: 14px var(--gutter) 0;
  color: var(--ink);
  pointer-events: none;
}
html.no-js .nav { position: absolute; }
.brand { display: flex; align-items: center; }
.logo { display: block; height: 30px; width: auto; aspect-ratio: 953 / 172; flex: none; }
.nav .brand {
  height: 74px; pointer-events: auto;
  transition: opacity .3s var(--ease), translate .3s var(--ease);
}
.nav.is-past .brand { opacity: 0; translate: -10px 0; pointer-events: none; }
.nav.is-past .brand:focus-visible { opacity: 1; translate: 0 0; }   /* klaviatuuriga nähtav */

/* Logomärgi raam: nähtav, kui klotsid on kokku lennanud */
.blocks-frame {
  position: absolute; right: var(--gutter); top: 14px; z-index: 0;
  width: 54px; height: 54px; padding: 0;
  background: var(--paper);
  border: 2.6px solid var(--red); border-radius: 11.4px;   /* logo raami suhted: joon 4,8 %, nurk 21 % */
  box-shadow: 0 3px 14px rgba(5, 7, 8, .22);
  opacity: 0; scale: .8; pointer-events: none;
  transition: opacity .25s var(--ease), scale .35s var(--ease);
}
.nav.is-compact:not(.is-open) .blocks-frame { opacity: 1; scale: 1; pointer-events: auto; transition-delay: .12s; }

.blocks { display: flex; gap: 6px; }
.nav-links { display: contents; }
.blk {
  position: relative; z-index: 1;
  width: 74px; height: 74px; padding: 8px;
  display: flex; align-items: flex-end;
  border-radius: 18%;                /* sama suhe nagu logo klotsidel */
  background: var(--red); color: var(--navy);
  font-size: 12.5px; font-weight: 600; line-height: 1.1;
  box-shadow: 0 0 0 1.5px var(--paper);
  transform-origin: 0 0;
  pointer-events: auto;
  transition:
    transform .55s cubic-bezier(.34, 1.25, .64, 1) calc(var(--i, 0) * 26ms),
    background .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
  animation: blk-in .7s cubic-bezier(.22, 1, .36, 1) calc(var(--i, 0) * 70ms + .15s) backwards;
}
@keyframes blk-in { from { opacity: 0; transform: translateY(-130%) rotate(-10deg); } }
.blk span { transition: opacity .2s var(--ease); }
.blk:hover, .blk:focus-visible { background: var(--paper); color: var(--navy); transform: translateY(-3px); }
.blk.is-active { background: var(--ink); color: var(--paper); }
.nav.is-compact:not(.is-open) .blk {
  transform: translate(var(--cx, 0), var(--cy, 0)) scale(var(--cs, 1));
  box-shadow: none; pointer-events: none;
}
.nav.is-compact:not(.is-open) .blk span { opacity: 0; }

.lang {
  display: flex; flex-direction: column; gap: 6px; width: 34px;
  pointer-events: auto;
  transition: opacity .25s var(--ease);
}
.lang button {
  flex: 1; padding: 0; border-radius: 6px;
  background: var(--paper); color: var(--ink);
  font-family: var(--mono); font-size: 11px; font-weight: 700; line-height: 1;
  box-shadow: inset 0 0 0 1.5px var(--ink);
  transition: background .2s var(--ease), color .2s var(--ease);
}
.lang button.is-on { background: var(--ink); color: var(--paper); box-shadow: 0 0 0 1.5px var(--paper); }
.nav.is-compact:not(.is-open) .lang { opacity: 0; pointer-events: none; }
.nav-scrim { display: none; }

/* ==========================================================================
   HERO — disainilaud. Canvas joonistab pikslid, ruudustiku ja abijooned;
   tekst on päris HTML, valikukastid ehitab main.js initBoard.
   Klassid .s-text .s-select .s-cta lisanduvad ajajoone järgi.
   ========================================================================== */
.hero {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: calc(var(--nav-h) + 28px) var(--gutter) 56px;
  overflow: hidden;
}
.board-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; pointer-events: none;
}
.board { position: relative; z-index: 1; }
.board-title {
  font-family: var(--mono); font-weight: 700;
  font-size: clamp(34px, 5.6vw, 104px);
  line-height: 1.5; letter-spacing: -.02em;
}
.board-title .w, .board-title .sel { display: inline-block; }
.board-title .nb { white-space: nowrap; }
/* Esiletõstetud sõna istub mustas klotsis valge tekstiga. Mõõdud klapivad main.js layoutOverlay kastiga. */
.board-title .sel {
  position: relative;
  transition: color .3s var(--ease) calc(var(--n, 0) * 180ms + .12s);
}
.hero.s-select .board-title .sel, .no-js .board-title .sel { color: var(--paper); }
.board-title .sel::before {
  content: ""; position: absolute; z-index: -1;
  left: -.09em; right: -.09em;
  top: calc(50% - .52em); height: 1.08em;
  background: var(--ink);
  transform: scaleX(0); transform-origin: left;
  transition: transform .5s cubic-bezier(.22, 1, .36, 1) calc(var(--n, 0) * 180ms);
}
.hero.s-select .board-title .sel::before { transform: none; }
.no-js .board-title .sel::before { transform: none; }

.board-cta {
  display: inline-flex; align-items: center;
  margin-top: clamp(56px, 8vh, 88px);
  padding: 18px 28px; border-radius: 6px;
  background: var(--red); color: var(--ink);
  font-family: var(--mono); font-weight: 700; font-size: 17px; line-height: 1;
  white-space: nowrap;
  transition: opacity .5s var(--ease), translate .5s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
}
.board-cta:hover { transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--ink); }

/* Ajajoone algolek ainult siis, kui JS töötab */
html:not(.no-js) .hero .w {
  opacity: 0; translate: 0 .22em;
  transition:
    opacity .5s var(--ease) calc(var(--i, 0) * 70ms),
    translate .6s cubic-bezier(.22, 1, .36, 1) calc(var(--i, 0) * 70ms),
    color .3s var(--ease) calc(var(--n, 0) * 180ms + .12s);
}
html:not(.no-js) .hero.s-text .w { opacity: 1; translate: 0 0; }
html:not(.no-js) .hero:not(.s-cta) .board-cta { opacity: 0; translate: 0 10px; pointer-events: none; }

/* Valikukastid */
.board-overlay { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.sel-box {
  position: absolute;
  opacity: 0; scale: .97;
  transition:
    opacity .35s var(--ease) calc(var(--n, 0) * 180ms),
    scale .45s cubic-bezier(.22, 1, .36, 1) calc(var(--n, 0) * 180ms);
}
.hero.s-select .sel-box { opacity: 1; scale: 1; }
.sel-box i {
  position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px;
  background: var(--paper); border: 1.5px solid var(--ink);
}
.sel-box i:nth-child(1) { left: 0; top: 0; }
.sel-box i:nth-child(2) { left: 50%; top: 0; }
.sel-box i:nth-child(3) { left: 100%; top: 0; }
.sel-box i:nth-child(4) { left: 100%; top: 50%; }
.sel-box i:nth-child(5) { left: 100%; top: 100%; }
.sel-box i:nth-child(6) { left: 50%; top: 100%; }
.sel-box i:nth-child(7) { left: 0; top: 100%; }
.sel-box i:nth-child(8) { left: 0; top: 50%; }
.tag {
  font-family: var(--mono); font-size: 11px; line-height: 1;
  padding: 4px 6px; border-radius: 2px; white-space: nowrap;
  background: var(--ink); color: var(--paper);
}
.tags-top { position: absolute; left: -1.5px; bottom: calc(100% + 7px); display: flex; gap: 4px; }
.tag--size { position: absolute; top: calc(100% + 7px); left: 50%; translate: -50% 0; }

/* Mõõdik pealkirja ja nupu vahel */
.measure {
  position: absolute; width: 11px;
  border-top: 1.5px solid var(--red); border-bottom: 1.5px solid var(--red);
  opacity: 0; transition: opacity .4s var(--ease);
}
.hero.s-cta .measure { opacity: 1; }
.measure::before { content: ""; position: absolute; left: 4.5px; top: 0; bottom: 0; width: 1.5px; background: var(--red); }
.measure b {
  position: absolute; left: 17px; top: 50%; translate: 0 -50%;
  font-family: var(--mono); font-size: 11px; font-weight: 400; line-height: 1;
  padding: 4px 6px; border-radius: 2px; background: var(--red); color: var(--ink);
}

/* ==========================================================================
   SEKTSIOONID
   ========================================================================== */
.sec {
  position: relative;
  padding: clamp(80px, 10vw, 150px) var(--gutter);
}
.wrap { position: relative; max-width: var(--wrap); margin: 0 auto; }

.sec-head { max-width: 980px; }
h2 {
  font-size: clamp(36px, 5.2vw, 80px);
  line-height: .98; letter-spacing: -.03em; font-weight: 700;
  margin-bottom: 24px; max-width: 15ch;
}
.lead {
  font-size: clamp(17px, 1.45vw, 22px);
  line-height: 1.45; max-width: 58ch;
  color: var(--fg-muted);
}

/* Meist */
.about {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr);
  gap: 24px clamp(32px, 5vw, 80px); align-items: start;
}
.about h2 { margin: 0; }
.statement {
  font-size: clamp(24px, 3.2vw, 46px); font-weight: 500;
  line-height: 1.22; letter-spacing: -.02em;
}

/* Kaardid */
.cards {
  display: grid; gap: 12px;
  margin-top: clamp(44px, 6vw, 88px);
}
.cards--3 { grid-template-columns: repeat(3, 1fr); }
.card {
  position: relative;
  display: flex; flex-direction: column; justify-content: flex-start;
  min-height: clamp(170px, 17vw, 240px);
  padding: clamp(20px, 2.2vw, 30px);
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: background .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease), transform .35s var(--ease), box-shadow .35s var(--ease), opacity .6s var(--ease);
}
.card:hover { background: var(--tile-hover-bg); color: var(--tile-hover-fg); border-color: transparent; transform: translate(-4px, -4px); box-shadow: 10px 10px 0 var(--accent); }
.card h3 { font-size: clamp(19px, 1.7vw, 25px); font-weight: 600; letter-spacing: -.02em; line-height: 1.12; margin-bottom: 10px; }
.card p { font-size: 15px; line-height: 1.5; opacity: .78; }
.card.fill p { opacity: .9; }   /* hoiab väikese teksti punasel loetavana */
.card.fill { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.card.fill:hover { background: var(--tile-hover-bg); color: var(--tile-hover-fg); }
[data-theme="ink"] .card.fill:hover { background: var(--paper); color: var(--ink); }

/* Klotsikujudega kaardid (AI-sektsioon): samad viis klotsi eri kujus, main.js initShapes */
.shapes {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  margin-top: clamp(44px, 6vw, 88px);
}
.shape {
  aspect-ratio: 1; overflow: hidden;
  display: grid; place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--red) 0%, #8E1F22 100%);
  color: rgba(253, 253, 253, .9);
  --line-faint: rgba(253, 253, 253, .12);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.shape svg { width: 46%; overflow: visible; }
.shape rect { transition: x .7s cubic-bezier(.34, 1.56, .64, 1), y .7s cubic-bezier(.34, 1.56, .64, 1); }
.shape-card:hover .shape { transform: translate(-4px, -4px); box-shadow: 10px 10px 0 var(--paper); }
.shape-card h3 { font-size: clamp(18px, 1.5vw, 22px); font-weight: 600; letter-spacing: -.015em; line-height: 1.15; margin: 16px 0 6px; }
.shape-card p { font-size: 14px; line-height: 1.5; color: var(--fg-muted); }

/* Kontakt */
.contact .big {
  display: inline-block; margin-top: 28px;
  font-size: clamp(30px, 6vw, 96px); font-weight: 700;
  letter-spacing: -.035em; line-height: 1;
  text-decoration: underline; text-decoration-color: var(--red);
  text-decoration-thickness: .045em; text-underline-offset: .12em;
  transition: color .25s var(--ease);
  word-break: break-all;
}
.contact .big:hover { color: var(--red); }
.contact-row {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 24px;
  margin-top: clamp(44px, 6vw, 80px); padding-top: 28px;
  border-top: 1px solid var(--line);
}
.badges { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.badges img { height: 60px; width: auto; }

/* ==========================================================================
   FOOTER — hiiglaslik sõnamärk (inspiratsioon 1)
   ========================================================================== */
.footer { padding: clamp(48px, 6vw, 96px) var(--gutter) 24px; overflow: hidden; }
.giant {
  font-size: clamp(60px, 15.4vw, 290px);
  font-weight: 700; letter-spacing: -.055em; line-height: .78;
  text-transform: uppercase; white-space: nowrap;
  margin: 0 0 40px -.03em;
}
.footer-row {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px;
  padding-top: 20px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--fg-muted);
}
.footer .brand { color: var(--paper); }
.footer-links { display: flex; gap: 20px; }
.footer-links a:hover { color: var(--fg); }

/* ---------- Ilmumine ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-in, .no-js .reveal { opacity: 1; transform: none; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 960px) {
  .cards--3 { grid-template-columns: repeat(2, 1fr); }
  .about { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .cards--3 { grid-template-columns: 1fr; }
  .card { min-height: 0; }
  .contact .big { word-break: break-word; }
  .footer-row { flex-direction: column; align-items: flex-start; }
}
/* Telefonis on nav alati logomärk. Avades kasvavad klotsid logo paigutusse:
   2 × 3 ruudustik, kus logos tühjas lahtris on keelevalik. */
@media (max-width: 640px) {
  :root { --nav-h: 80px; }
  .nav { padding-top: 13px; }
  .nav .brand { height: 54px; }
  .nav .logo { height: 24px; }
  .blocks-frame { top: 13px; }
  .blocks {
    position: absolute; top: 80px; right: var(--gutter);
    width: min(calc(100vw - 2 * var(--gutter)), 420px, calc((100vh - 100px) * .66));
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  }
  .blk { width: auto; height: auto; aspect-ratio: 1; padding: 14px; font-size: 19px; }
  .shapes { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .shape { aspect-ratio: 16 / 9; }
  .lang { width: auto; gap: 8px; }
  .lang button { font-size: 15px; border-radius: 16px; }
  .nav-scrim {
    display: block; position: fixed; inset: 0;
    background: rgba(5, 7, 8, .6);
    opacity: 0; pointer-events: none;
    transition: opacity .3s var(--ease);
  }
  .nav.is-open .nav-scrim { opacity: 1; pointer-events: auto; }
}
/* Kitsal ekraanil suurem pealkiri mitmel real, väiksemad sildid */
@media (max-width: 700px) {
  .hero { padding-top: calc(var(--nav-h) + 36px); padding-bottom: 40px; }
  .board-title { font-size: 9.6vw; line-height: 1.6; }
  .board-cta { margin-top: 56px; padding: 16px 22px; font-size: 15px; }
  .tag, .measure b { font-size: 10px; padding: 3px 5px; }
  .tags-top { bottom: calc(100% + 3px); }
  .tag--size { top: calc(100% + 3px); }
  .sel-box i { width: 6px; height: 6px; margin: -3px 0 0 -3px; }
}


/* Ilmumine astmeliselt */
.reveal .card, .reveal .shape-card { opacity: 0; transform: translateY(26px); }
.reveal.is-in .card, .reveal.is-in .shape-card { opacity: 1; transform: none; }
.reveal .shape-card { transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-in .card:hover { transform: translate(-4px, -4px); }
.reveal > :nth-child(1) { transition-delay: 0s; }
.reveal > :nth-child(2) { transition-delay: .08s; }
.reveal > :nth-child(3) { transition-delay: .16s; }
.reveal > :nth-child(4) { transition-delay: .24s; }
.reveal > :nth-child(5) { transition-delay: .32s; }
.reveal > :nth-child(6) { transition-delay: .40s; }
.reveal > :nth-child(7) { transition-delay: .48s; }

/* Kursor: Develly klots, linkide kohal logomärgi raam (main.js initCursor).
   Tavaline kursor peidetakse alles siis, kui päris hiir liigub; puuteekraanil ei muutu midagi. */
html.has-cursor, html.has-cursor * { cursor: none !important; }
.cursor {
  position: fixed; left: 0; top: 0; z-index: 9999;
  width: 0; height: 0; pointer-events: none;
  opacity: 0; transition: opacity .2s var(--ease);
}
.cursor.is-on { opacity: 1; }
.cursor i {
  position: absolute; left: -7px; top: -7px;
  width: 14px; height: 14px; border-radius: 3px;
  background: var(--red);
  box-shadow: 0 0 0 1.5px var(--paper);   /* hoiab klotsi nähtaval ka punasel pinnal */
  transition: transform .18s var(--ease);
}
.cursor b {
  position: absolute; left: -18px; top: -18px;
  width: 36px; height: 36px; border-radius: 9px;
  border: 2px solid var(--red);
  box-shadow: 0 0 0 1px var(--paper), inset 0 0 0 1px var(--paper);
  opacity: 0; transform: scale(.5);
  transition: opacity .18s var(--ease), transform .24s cubic-bezier(.34, 1.56, .64, 1);
}
.cursor.is-link i { transform: scale(.72); }
.cursor.is-link b { opacity: 1; transform: none; }
.cursor.is-down i { transform: scale(.55); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .reveal, .reveal .card, .reveal .shape-card { opacity: 1; transform: none; }
}
