/* ============================================================
   BASE.CSS — Reset, Fonts, Tokens, Typography
   Skymin Design System · skym.in
   ============================================================ */

/* --- CSS Reset (modern) ----------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  min-height: 100dvh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  text-wrap: balance;
}

p {
  overflow-wrap: break-word;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* --- @font-face — Self-hosted .woff2 ---------------------- */
/*
  Strategy:
  - Display: Inter (700/800) — clean Apple-like geometric sans
  - Body: System font stack — SF Pro on Apple, Segoe UI on Windows, Roboto on Android
  - Mono: System mono stack — SF Mono, Menlo, Consolas
  - font-display: swap → system fonts paint instantly, Inter swaps in when ready
  - Blur-to-sharp transition hides the font swap
*/

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/inter-700-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: 800;
  font-display: swap;
  src: url('../assets/fonts/inter-800-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 Loading: blur-to-sharp transition --------------- */
/* html starts with .fonts-loading (set inline), removed when Inter loads */
.fonts-loading h1,
.fonts-loading h2,
.fonts-loading h3,
.fonts-loading .hero__title,
.fonts-loading .section__headline,
.fonts-loading .nav__logo {
  filter: blur(4px);
  opacity: 0.7;
}

.fonts-loaded h1,
.fonts-loaded h2,
.fonts-loaded h3,
.fonts-loaded .hero__title,
.fonts-loaded .section__headline,
.fonts-loaded .nav__logo {
  filter: blur(0);
  opacity: 1;
  transition: filter 400ms ease, opacity 400ms ease;
}

/* --- Design Tokens ---------------------------------------- */
:root {
  /* Base */
  --color-bg:            #080808;
  --color-surface:       #111111;
  --color-surface-2:     #1A1A1A;
  --color-border:        #2A2A2A;

  /* Text */
  --color-text-primary:  #F0EDE6;
  --color-text-secondary:#A09A8F;
  --color-text-tertiary: #5A5550;

  /* Accent — Teal */
  --color-accent:        #14b8a6;
  --color-accent-dim:    #0f766e;
  --color-accent-glow:   rgba(20, 184, 166, 0.12);

  /* Semantic */
  --color-success:       #4CAF72;
  --color-danger:        #E05252;

  /* Gradients */
  --gradient-hero:   linear-gradient(160deg, #0D0D0D 0%, #0A0C10 100%);
  --gradient-accent: linear-gradient(90deg, #14b8a6, #0d9488);

  /* Typography — Apple-style system stack + Inter display */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono:    'SF Mono', SFMono-Regular, ui-monospace, Menlo, Consolas, 'Liberation Mono', monospace;

  /* Type Scale — mobile first */
  --text-xs:   0.75rem;     /* 12px */
  --text-sm:   0.875rem;    /* 14px */
  --text-base: 1rem;        /* 16px */
  --text-lg:   1.125rem;    /* 18px */
  --text-xl:   1.375rem;    /* 22px */
  --text-2xl:  1.75rem;     /* 28px */
  --text-3xl:  2.25rem;     /* 36px */
  --text-4xl:  3rem;        /* 48px */
  --text-5xl:  4rem;        /* 64px */
  --text-6xl:  5.5rem;      /* 88px */

  --leading-tight:   1.1;
  --leading-snug:    1.3;
  --leading-normal:  1.6;
  --leading-loose:   1.8;

  --tracking-tight:  -0.03em;
  --tracking-normal: -0.01em;
  --tracking-wide:   0.08em;
  --tracking-wider:  0.14em;

  /* Spacing */
  --space-1:   0.25rem;   /* 4px  */
  --space-2:   0.5rem;    /* 8px  */
  --space-3:   0.75rem;   /* 12px */
  --space-4:   1rem;      /* 16px */
  --space-5:   1.25rem;   /* 20px */
  --space-6:   1.5rem;    /* 24px */
  --space-8:   2rem;      /* 32px */
  --space-10:  2.5rem;    /* 40px */
  --space-12:  3rem;      /* 48px */
  --space-16:  4rem;      /* 64px */
  --space-20:  5rem;      /* 80px */
  --space-24:  6rem;      /* 96px */
  --space-32:  8rem;      /* 128px */

  /* Containers */
  --container-sm:  640px;
  --container-md:  768px;
  --container-lg:  1024px;
  --container-xl:  1280px;

  /* Radii */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-pill: 999px;

  /* Motion */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:   cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast:   150ms;
  --duration-base:   250ms;
  --duration-slow:   450ms;
  --duration-reveal:  700ms;
}

/* --- Base Element Styles ---------------------------------- */

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-primary);
}

h1 {
  font-size: var(--text-4xl);
}

h2 {
  font-size: var(--text-2xl);
}

h3 {
  font-size: var(--text-xl);
}

@media (min-width: 1024px) {
  h1 { font-size: var(--text-5xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-2xl); }
}

/* Selection */
::selection {
  background: var(--color-accent);
  color: #000;
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Scrollbar (subtle) */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--color-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-tertiary);
}

/* Utilities */
.overflow-hidden {
  overflow: hidden !important;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Alpine.js cloak */
[x-cloak] { display: none !important; }
