/*
  VitiDev base styles: tokens, reset, typography, layout, buttons, cards,
  header, footer, reveal animation and reduced-motion rules.

  Shared by every page. Owned by the Senior Engineer (THR-5).
  Page-specific styles go in home.css / services.css / work.css, not here.
*/

/* ---------- Font (Manrope, SIL OFL 1.1, self-hosted; see ../fonts/OFL.txt) ---------- */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/manrope-cyrillic-wght.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/manrope-latin-wght.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;

  /* Colours */
  --c-bg: #0b0d12;
  --c-bg-raised: #11141b;
  --c-surface: #161a23;
  --c-surface-hover: #1c212c;
  --c-line: rgba(255, 255, 255, 0.08);
  --c-line-strong: rgba(255, 255, 255, 0.16);
  --c-text: #e8eaf0;
  --c-text-muted: #9aa3b5;
  --c-text-faint: #808a9e;
  --c-accent: #6ea8fe;        /* blue, same as the v0.1 page */
  --c-accent-strong: #8fbcff;
  --c-accent-2: #a78bfa;      /* violet, for gradients and glows */
  --c-on-accent: #0b0d12;
  --gradient-accent: linear-gradient(120deg, var(--c-accent) 0%, var(--c-accent-2) 100%);

  /* Type */
  --font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --fs-xl: clamp(1.5rem, 1.2rem + 1.4vw, 2.25rem);
  --fs-2xl: clamp(2rem, 1.4rem + 2.8vw, 3.5rem);
  --fs-3xl: clamp(2.5rem, 1.5rem + 4.6vw, 5rem);
  --lh-tight: 1.1;
  --lh-snug: 1.3;
  --lh-body: 1.6;

  /* Spacing (4 px steps) */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;
  --s-9: 6rem;
  --section-y: clamp(3.5rem, 2rem + 6vw, 7rem);

  /* Shape and depth */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --shadow-lift: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 22px 44px -16px rgba(0, 0, 0, 0.75);

  /* Layout */
  --container: 72rem;
  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2rem);
  --header-h: 4.25rem;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 160ms;
  --dur: 280ms;
  --dur-slow: 700ms;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); }
body, h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul[class], ol[class] { padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; height: auto; }
button, input, textarea, select { font: inherit; color: inherit; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ---------- Base ---------- */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
main { flex: 1 0 auto; }

h1, h2, h3, h4 { line-height: var(--lh-tight); font-weight: 750; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-lg); line-height: var(--lh-snug); letter-spacing: -0.01em; }
p { text-wrap: pretty; }

a { color: var(--c-accent); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--c-accent-strong); }

:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: rgba(110, 168, 254, 0.35); color: #fff; }

/* Text helpers */
.lead { font-size: var(--fs-lg); line-height: var(--lh-snug); color: var(--c-text-muted); max-width: 40rem; }
.eyebrow {
  display: inline-block;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-accent);
}
.muted { color: var(--c-text-muted); }
.text-gradient {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Accessibility helpers */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: 100;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--radius-sm);
  background: var(--c-accent);
  color: var(--c-on-accent);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: var(--s-3); color: var(--c-on-accent); }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-y); }
.section--tight { padding-block: calc(var(--section-y) / 2); }
.section-head { display: grid; gap: var(--s-4); margin-bottom: var(--s-7); max-width: 46rem; }
.stack { display: grid; gap: var(--s-4); }
.stack-lg { display: grid; gap: var(--s-6); }
.grid { display: grid; gap: var(--s-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.grid-2 { display: grid; gap: var(--s-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 2.875rem;
  padding: 0.7rem 1.35rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--fs-base);
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--c-accent); color: var(--c-on-accent); }
.btn--primary:hover { background: var(--c-accent-strong); color: var(--c-on-accent); }
.btn--ghost { background: transparent; border-color: var(--c-line-strong); color: var(--c-text); }
.btn--ghost:hover { background: var(--c-surface); border-color: var(--c-accent); color: var(--c-text); }
.btn--lg { min-height: 3.25rem; padding: 0.85rem 1.75rem; font-size: var(--fs-md); }
.btn--sm { min-height: 2.25rem; padding: 0.45rem 1rem; font-size: var(--fs-sm); }

/* ---------- Cards ---------- */
.card {
  position: relative;
  display: grid;
  align-content: start;
  gap: var(--s-3);
  padding: var(--s-6);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--c-surface) 0%, var(--c-bg-raised) 100%);
  box-shadow: var(--shadow-card);
}
.card p { color: var(--c-text-muted); }
.card__icon {
  display: grid;
  place-items: center;
  width: 2.75rem; height: 2.75rem;
  border-radius: var(--radius);
  background: rgba(110, 168, 254, 0.12);
  color: var(--c-accent);
}
/* Cards that link somewhere lift on hover. Put the link on the title and add .card--link;
   the ::after stretches the click area over the whole card. */
.card--link { transition: transform var(--dur) var(--ease-out), border-color var(--dur), box-shadow var(--dur); }
.card--link:hover, .card--link:focus-within { transform: translateY(-4px); border-color: rgba(110, 168, 254, 0.35); box-shadow: var(--shadow-lift); }
.card--link a { color: inherit; text-decoration: none; }
.card--link a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--c-line);
  background: rgba(11, 13, 18, 0.82);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3) var(--s-5);
  min-height: var(--header-h);
  padding-block: var(--s-2);
}
.logo { display: inline-flex; align-items: center; color: var(--c-text); margin-right: auto; padding-block: var(--s-2); }
.logo:hover { color: var(--c-text); }
.wordmark { width: 7.25rem; height: auto; overflow: visible; }
.wordmark .wm-viti { stroke: currentColor; }
.wordmark .wm-dev { stroke: var(--c-accent); }

.site-nav ul { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); }
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-pill);
  color: var(--c-text-muted);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--dur-fast), background-color var(--dur-fast);
}
.site-nav a:hover { color: var(--c-text); background: var(--c-surface); }
.site-nav a[aria-current="page"] { color: var(--c-text); }
.site-nav .nav-cta { background: var(--c-accent); color: var(--c-on-accent); padding-inline: 1.1rem; }
.site-nav .nav-cta:hover { background: var(--c-accent-strong); color: var(--c-on-accent); }

.header-actions { display: flex; align-items: center; gap: var(--s-2); }
.lang {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--c-text-faint);
}
.lang a, .lang__current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  border-radius: var(--radius-sm);
}
.lang__current { color: var(--c-text); }
.lang a { color: var(--c-text-muted); text-decoration: none; }
.lang a:hover { color: var(--c-text); background: var(--c-surface); }

/* Menu button: only exists for users with JS (site.js adds class "js" to <html>). */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem; height: 2.75rem;
  padding: 0;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}
.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after {
  display: block;
  width: 1.125rem; height: 2px;
  border-radius: 2px;
  background: var(--c-text);
  transition: transform var(--dur) var(--ease-out), opacity var(--dur-fast);
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before, .nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bars::before { transform: translateY(-6px); }
.nav-toggle__bars::after { transform: translateY(6px); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { transform: rotate(-45deg); }

/* Phone layout */
@media (max-width: 47.99rem) {
  /* Without JS: nav wraps onto its own row under the logo, always visible. */
  .site-nav { order: 3; width: 100%; }
  .site-nav ul { gap: var(--s-1); }

  /* With JS: nav collapses behind the menu button. */
  .js .nav-toggle { display: inline-flex; }
  .js .site-nav {
    display: none;
    padding-bottom: var(--s-4);
  }
  .js .site-nav.is-open { display: block; }
  .js .site-nav ul { flex-direction: column; align-items: stretch; }
  .js .site-nav a { width: 100%; min-height: 3rem; padding-inline: var(--s-4); font-size: var(--fs-md); }
  .js .site-nav .nav-cta { justify-content: center; margin-top: var(--s-2); }
}
@media (min-width: 48rem) {
  .header-inner { flex-wrap: nowrap; }
  .site-nav { margin-left: auto; }
  .logo { margin-right: 0; }
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--c-line);
  background: var(--c-bg-raised);
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}
.footer-inner {
  display: grid;
  gap: var(--s-6);
  padding-block: var(--s-7);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}
.footer-brand { display: grid; gap: var(--s-3); align-content: start; max-width: 22rem; }
.footer-brand .wordmark { width: 6.5rem; }
.footer-title { font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-text); margin-bottom: var(--s-3); }
.footer-list { display: grid; gap: var(--s-2); }
.footer-list a { color: var(--c-text-muted); text-decoration: none; overflow-wrap: anywhere; }
.footer-list a:hover { color: var(--c-text); text-decoration: underline; }
.footer-bottom { padding-block: var(--s-5); border-top: 1px solid var(--c-line); color: var(--c-text-faint); }

/* ---------- Call buttons (tap-to-call; name on top, number below) ---------- */
.call-list { display: grid; gap: var(--s-3); width: fit-content; max-width: 100%; }
.call-btn { flex-direction: column; align-items: flex-start; gap: 0.15rem; border-radius: var(--radius); text-align: left; }
.call-btn__number { font-weight: 500; font-size: var(--fs-sm); color: var(--c-text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- 404 ---------- */
.notfound { display: grid; gap: var(--s-7); padding-block: var(--section-y); }
.notfound__code { font-size: var(--fs-3xl); font-weight: 800; line-height: 1; }
.notfound h1, .notfound h2 { font-size: var(--fs-2xl); }

/* ---------- Reveal on scroll ----------
   Usage: <section data-reveal> ... </section>
   Optional stagger: data-reveal-delay="1" .. "4" (each step = 90 ms).
   Elements are only hidden when JS is running (<html class="js">), so with
   JS off everything is visible. site.js adds .is-visible when in view. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
.js [data-reveal].is-visible { opacity: 1; transform: none; }
.js [data-reveal-delay="1"] { transition-delay: 90ms; }
.js [data-reveal-delay="2"] { transition-delay: 180ms; }
.js [data-reveal-delay="3"] { transition-delay: 270ms; }
.js [data-reveal-delay="4"] { transition-delay: 360ms; }

/* ---------- Reduced motion: nothing moves, everything visible ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
  .js [data-reveal] { opacity: 1; transform: none; }
  .btn:hover, .card--link:hover, .card--link:focus-within { transform: none; }
}
