/* ==========================================================================
   viklab design system — base layer
   Tokens, fonts, reset, typography, layout primitives, motion primitives.
   Dark theme is the default; [data-theme="light"] mirrors every token.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Fonts (self-hosted variable fonts, latin + latin-ext for Hungarian)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../assets/fonts/inter-var-latin.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;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../assets/fonts/inter-var-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('../assets/fonts/jetbrainsmono-var-latin.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;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('../assets/fonts/jetbrainsmono-var-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

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

  /* Surfaces */
  --bg: #09090b;
  --bg-elev: #0d0d11;
  --surface: #111116;
  --card: #121218;
  --card-hover: #17171f;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* Text */
  --text: #f4f4f6;
  --text-2: #a7a7b1;
  --text-3: #74747e;

  /* Accent */
  --accent: #6e7bff;
  --accent-2: #22d3ee;
  --accent-3: #a78bfa;
  --accent-soft: rgba(110, 123, 255, 0.14);
  --grad: linear-gradient(135deg, #6e7bff, #a78bfa 50%, #22d3ee);

  /* Semantic */
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;

  /* Effects */
  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 8px 40px rgba(110, 123, 255, 0.25);
  --ring: 0 0 0 3px rgba(110, 123, 255, 0.35);

  /* Shape */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Motion */
  --dur-1: 150ms;
  --dur-2: 250ms;
  --dur-3: 600ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Type */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;

  /* Layout */
  --nav-h: 64px;
  --container: 1120px;
  --container-wide: 1320px;
  --section-pad: clamp(4rem, 10vh, 7.5rem);
}

[data-theme='light'] {
  color-scheme: light;

  --bg: #fafafc;
  --bg-elev: #ffffff;
  --surface: #f1f1f5;
  --card: #ffffff;
  --card-hover: #f6f6fa;
  --border: rgba(9, 9, 11, 0.08);
  --border-strong: rgba(9, 9, 11, 0.16);

  --text: #131316;
  --text-2: #4f4f58;
  --text-3: #73737d;

  --accent: #4f5de8;
  --accent-2: #0891b2;
  --accent-3: #7c5ce0;
  --accent-soft: rgba(79, 93, 232, 0.1);
  --grad: linear-gradient(135deg, #4f5de8, #7c5ce0 50%, #0891b2);

  --shadow-card: 0 12px 32px rgba(9, 9, 11, 0.08);
  --shadow-glow: 0 8px 40px rgba(79, 93, 232, 0.18);
  --ring: 0 0 0 3px rgba(79, 93, 232, 0.3);
}

/* --------------------------------------------------------------------------
   Reset & base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}

main {
  flex: 1 0 auto;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--dur-1) var(--ease);
}

a:hover {
  color: var(--text);
}

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

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Scrollbar (subtle, WebKit + Firefox) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 0.6em;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
}

p {
  margin: 0 0 1em;
}

small {
  font-size: 0.875rem;
}

code,
kbd {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1em 0.4em;
}

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--grad);
}

.section-title {
  font-size: clamp(1.9rem, 4vw, 2.75rem);
  letter-spacing: -0.03em;
  margin-bottom: 0.4em;
}

.section-sub {
  color: var(--text-2);
  font-size: 1.0625rem;
  max-width: 560px;
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */
.container-v {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2rem);
}

.container-wide {
  width: 100%;
  max-width: var(--container-wide);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2rem);
}

.section {
  padding-block: var(--section-pad);
  position: relative;
}

.section-head {
  margin-bottom: clamp(2rem, 5vh, 3.5rem);
}

/* Anchored sections need breathing room under the fixed nav */
[id] {
  scroll-margin-top: calc(var(--nav-h) + 16px);
}

/* Pages that are not the full-bleed home page */
.app-page {
  padding-top: calc(var(--nav-h) + clamp(1.5rem, 5vh, 3rem));
  padding-bottom: var(--section-pad);
  min-height: calc(100vh - var(--nav-h));
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 2000;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  transition: top var(--dur-2) var(--ease);
}

.skip-link:focus-visible {
  top: 16px;
}

.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;
}

/* --------------------------------------------------------------------------
   Motion primitives — scroll reveals
   `html.js` gate keeps content visible when JS is unavailable, and the
   reduced-motion media query keeps it visible for users who opt out.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  html.js .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity var(--dur-3) var(--ease), transform var(--dur-3) var(--ease);
    transition-delay: var(--d, 0ms);
  }

  html.js .reveal--scale {
    transform: scale(0.96);
  }

  html.js .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
}

/* Simple marquee-free pulse for status dots */
@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(52, 211, 153, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
  }
}

@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

@keyframes drift-a {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(4vw, -3vh, 0) scale(1.08);
  }
}

@keyframes drift-b {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-3vw, 4vh, 0) scale(0.94);
  }
}
