/* KVARNER VILLA: baas ja tüpograafiarollid. Ainult tokenid (tokens.css).
   Sektsioon valib rolli klassi (.t-*), mitte ei sea ise font-size / line-height / letter-spacing väärtusi. */

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

html {
  scrollbar-gutter: stable;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  font-synthesis: none;
  font-kerning: normal;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-body);
  font-weight: var(--w-regular);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  cursor: default;
}

:where(h1, h2, h3, p, figure, dl, dd, ul, ol) { margin: 0; }
:where(ul, ol) { padding: 0; list-style: none; }
:where(h1, h2, h3) { font-weight: var(--w-regular); }
:where(img) { display: block; max-width: 100%; }
:where(button) { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
:where(a) { color: inherit; text-decoration: none; }

/* AI_KULDREEGLID §13: nupul, lingil ja [role=button]-il pole brauseri fookusvisuaali */
button:focus, a:focus, [role="button"]:focus { outline: none; box-shadow: none; }

::selection { background: var(--accent); color: var(--ground); text-shadow: none; }
::-moz-selection { background: var(--accent); color: var(--ground); text-shadow: none; }

/* Üks kerimisriba kõigile kerivatele kihtidele */
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: var(--accent) var(--surface); }
}
::-webkit-scrollbar { width: var(--scrollbar-w); height: var(--scrollbar-w); }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--accent); border: var(--scrollbar-border) solid var(--surface); }
::-webkit-scrollbar-thumb:hover { background: var(--ink); }

/* ---------- Rollid: font, suurus, reavahe, tähevahe koos ---------- */
.t-hero  { font-family: var(--f-display); font-size: var(--t-hero);  line-height: var(--lh-display); letter-spacing: var(--ls-hero);    white-space: nowrap; text-box: trim-both cap alphabetic; }
.t-h2    { font-family: var(--f-display); font-size: var(--t-h2);    line-height: var(--lh-h2);      letter-spacing: var(--ls-display); text-box: trim-both cap alphabetic; }
.t-h3    { font-family: var(--f-display); font-size: var(--t-h3);    line-height: var(--lh-h3);      letter-spacing: var(--ls-display); text-box: trim-both cap alphabetic; }
.t-lead  { font-family: var(--f-body);    font-size: var(--t-lead);  line-height: var(--lh-lead);    letter-spacing: var(--ls-0); }
.t-body  { font-family: var(--f-body);    font-size: var(--t-body);  line-height: var(--lh-body);    letter-spacing: var(--ls-0); }
.t-small { font-family: var(--f-body);    font-size: var(--t-small); line-height: var(--lh-ui);      letter-spacing: var(--ls-0); }
.t-fine  { font-family: var(--f-body);    font-size: var(--t-fine);  line-height: var(--lh-body);    letter-spacing: var(--ls-0); }
.nowrap  { white-space: nowrap; }

/* Lõikude vahe ühe tekstiploki sees */
.prose > * + * { margin-top: var(--stack); }
.measure { max-width: var(--measure); }

/* ---------- Sektsiooniraam ---------- */
.sec { padding-block: var(--sec); padding-inline: var(--pad-x); }
.sec--flush-top { padding-top: 0; }          /* sama tooniga järgmine sektsioon: ainult üks --sec */
.sec--flush-bottom { padding-bottom: 0; }
.sec--surface { background: var(--surface); }
.head-gap { margin-bottom: var(--head-gap); }
.title-lead { margin-top: var(--title-lead); }
.rule-top { border-top: var(--hair) solid var(--rule); }
.rule-bottom { border-bottom: var(--hair) solid var(--rule); }

/* ---------- Fotoraam ---------- */
.photo { position: relative; overflow: clip; background: var(--surface); }
.photo > img, .photo > picture > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---------- Põhinupp (CTA stiil otsustatakse eraldi; praegu ajutine pind) ---------- */
.btn-primary {
  position: relative;
  isolation: isolate;
  display: inline-block;
  padding: var(--btn-py) var(--btn-px);
  padding-block: calc(var(--btn-py) + 1px) calc(var(--btn-py) - 1px);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--f-body);
  font-size: var(--t-body);
  line-height: var(--lh-ui);
  white-space: nowrap;
}
.btn-primary::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--accent-hover); opacity: 0;
  transition: opacity .45s ease-in-out;
}
@media (hover: hover) {
  .btn-primary:hover::before { opacity: 1; transition-duration: .4s; animation: cta-hover-in .4s ease-in-out; }
}
@keyframes cta-hover-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
}
