/* ============================================================
   MATRIKA STUDIOS — MAIN CSS
   Design token system, typography, base resets
   ============================================================ */

/* ── GOOGLE FONTS ──────────────────────────────────────────── */
/* NOTE: Fonts are loaded via <link> tags in each HTML page's <head>.
   A second @import here would create a redundant blocking request
   inside the CSS parse — removed to prevent deployment rendering issues. */

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  /* Brand Colors */
  --matrika-black: #000000;
  --matrika-white: #ffffff;
  --matrika-red: #c9000f;
  --matrika-crimson: #a81019;
  --matrika-gold: #b69953;
  --matrika-bronze: #5c3a18;

  /* Surface Colors */
  --matrika-dark: #080808;
  --matrika-surface: #111111;
  --matrika-dim: #222222;
  --matrika-muted: #555555;
  --matrika-subtle: #888888;

  /* Typography */
  --font-display: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
  --font-ui: 'Outfit', 'Barlow', system-ui, sans-serif;

  /* Font Weights */
  --fw-light: 300;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;

  /* Letter Spacing */
  --ls-tight: -0.02em;
  --ls-normal: 0;
  --ls-wide: 0.1em;
  --ls-wider: 0.2em;
  --ls-widest: 0.35em;

  /* Spacing */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 40px;
  --sp-2xl: 64px;
  --sp-3xl: 96px;
  --sp-4xl: 128px;

  /* Layout */
  --nav-h: 72px;
  --content-max: 1440px;
  --content-pad: 48px;
  --content-pad-m: 20px;

  /* Easing */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.83, 0, 0.17, 1);
  --ease-cinematic: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Durations */
  --dur-fast: 200ms;
  --dur-mid: 450ms;
  --dur-slow: 750ms;
  --dur-page: 600ms;
  --dur-intro: 3000ms;

  /* Z-Index Layers */
  --z-base: 1;
  --z-content: 10;
  --z-overlay: 100;
  --z-menu: 200;
  --z-intro: 300;
  --z-cursor: 400;

  /* Borders */
  --border-dim: 1px solid rgba(255, 255, 255, 0.08);
  --border-gold: 1px solid rgba(182, 153, 83, 0.3);
}

/* ── RESET + BASE ───────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  background-color: var(--matrika-dark);
  color: var(--matrika-white);
  font-family: var(--font-ui);
  font-weight: var(--fw-regular);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Prevent FOUC — body hidden until JS ready */
body.is-loading {
  overflow: hidden;
}

/* ── SELECTION ──────────────────────────────────────────────── */
::selection {
  background: var(--matrika-red);
  color: var(--matrika-white);
}

/* ── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: var(--matrika-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--matrika-dim);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--matrika-gold);
}

/* ── LINKS ──────────────────────────────────────────────────── */
a {
  color: inherit;
  text-decoration: none;
}

/* ── IMAGES ─────────────────────────────────────────────────── */
img,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
button {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}

/* ── FOCUS STYLES ────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--matrika-red);
  outline-offset: 4px;
}

/* ── TYPOGRAPHY SCALE ─────────────────────────────────────────── */

/* Display — Homepage two-world titles */
.t-display {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  font-size: clamp(3.5rem, 9vw, 11rem);
  line-height: 0.88;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Headline — Page main headings */
.t-headline {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  font-size: clamp(2.5rem, 6vw, 7rem);
  line-height: 0.95;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Section Heading */
.t-section {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  font-size: clamp(1.8rem, 4vw, 4.5rem);
  line-height: 1.0;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Sub Heading */
.t-sub {
  font-family: var(--font-ui);
  font-weight: var(--fw-light);
  font-size: clamp(0.7rem, 1.1vw, 0.9rem);
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--matrika-subtle);
}

/* Body */
.t-body {
  font-family: var(--font-ui);
  font-weight: var(--fw-light);
  font-size: clamp(0.9rem, 1.2vw, 1.05rem);
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.65);
}

/* Label / Meta */
.t-label {
  font-family: var(--font-ui);
  font-weight: var(--fw-medium);
  font-size: 0.65rem;
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--matrika-subtle);
}

/* Nav */
.t-nav {
  font-family: var(--font-ui);
  font-weight: var(--fw-medium);
  font-size: 0.7rem;
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
}

/* ── COLOR UTILITIES ──────────────────────────────────────────── */
.c-white {
  color: var(--matrika-white);
}

.c-red {
  color: var(--matrika-red);
}

.c-gold {
  color: var(--matrika-gold);
}

.c-muted {
  color: var(--matrika-muted);
}

.c-subtle {
  color: var(--matrika-subtle);
}

/* ── LAYOUT UTILITIES ─────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--content-pad);
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-center {
  align-items: center;
  justify-content: center;
}

.flex-between {
  align-items: center;
  justify-content: space-between;
}

/* ── GRAIN OVERLAY ────────────────────────────────────────────── */
/* Applied via .grain-overlay element in HTML — fixed position, no pointer events */
.grain-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  animation: grain-shift 8s steps(10) infinite;
}

/* ── RED ACCENT LINE ──────────────────────────────────────────── */
.accent-line {
  display: block;
  width: 32px;
  height: 1px;
  background: var(--matrika-red);
}

.accent-line--gold {
  background: var(--matrika-gold);
}

/* ── GOLD RULE ────────────────────────────────────────────────── */
.rule-gold {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(182, 153, 83, 0.4), transparent);
  border: none;
  margin: 0;
}

/* ── SECTION PADDING ──────────────────────────────────────────── */
.section {
  padding: var(--sp-4xl) 0;
}

/* ── VISUALLY HIDDEN (Accessibility) ─────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ── PAGE WRAPPER ─────────────────────────────────────────────── */
.page-wrapper {
  position: relative;
  min-height: 100vh;
}

/* ── REDUCED MOTION ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {

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

  .grain-overlay {
    animation: none;
  }
}