/* ==========================================================================
   BEIKORA — Base Reset + Typography
   Modern CSS reset with design-system-grounded base styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   BOX MODEL RESET
   -------------------------------------------------------------------------- */

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

/* --------------------------------------------------------------------------
   ROOT + BODY
   -------------------------------------------------------------------------- */

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  /* Premium rendering for serif display */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
  font-kerning: normal;
}

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

body {
  background-color: var(--scaffold);
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: var(--lh-normal);
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  /* Subtle ambient vignette so scaffold never feels flat */
  background-image:
    radial-gradient(ellipse 1200px 800px at 50% -10%, oklch(1 0 0 / 0.025), transparent 60%),
    radial-gradient(ellipse 900px 600px at 100% 100%, oklch(1 0 0 / 0.015), transparent 60%);
  background-attachment: fixed;
}

/* Global film grain overlay — premium texture (very subtle) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: var(--grain-url);
  background-size: 300px 300px;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
}

/* Keep content above the grain */
body > * {
  position: relative;
  z-index: 2;
}

/* --------------------------------------------------------------------------
   TYPOGRAPHY — Headings
   -------------------------------------------------------------------------- */

/* h1 y h2 — DM Serif Display (solo weight 400, no bold sintético) */
h1,
h2 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--lh-tight);
  color: var(--on-surface);
  text-wrap: balance;
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

/* h3 a h6 — Plus Jakarta Sans */
h3,
h4,
h5,
h6 {
  font-family: var(--font-body);
  font-weight: 700;
  line-height: var(--lh-snug);
  color: var(--on-surface);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-hero);
  letter-spacing: var(--ls-display);
  line-height: var(--lh-display);
}

h2 {
  font-size: var(--text-h2);
  letter-spacing: var(--ls-tighter);
  line-height: var(--lh-tight);
}

h3 {
  font-size: var(--text-h3);
  letter-spacing: var(--ls-snug);
  line-height: var(--lh-snug);
}

h4 {
  font-size: var(--text-body-lg);
  letter-spacing: var(--ls-snug);
}

h5 {
  font-size: var(--text-body);
  letter-spacing: var(--ls-normal);
}

h6 {
  font-size: var(--text-sm);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   TYPOGRAPHY — Body text
   -------------------------------------------------------------------------- */

p {
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--lh-relaxed);
  color: var(--on-surface-variant);
  max-width: 68ch;
  text-wrap: pretty;
}

p + p {
  margin-top: var(--space-md);
}

/* --------------------------------------------------------------------------
   TYPOGRAPHY — Inline elements
   -------------------------------------------------------------------------- */

strong,
b {
  font-weight: 700;
  color: var(--on-surface);
}

em,
i {
  font-style: italic;
}

small {
  font-size: var(--text-xs);
  color: var(--on-surface-variant);
}

/* --------------------------------------------------------------------------
   LINKS
   -------------------------------------------------------------------------- */

a {
  color: var(--on-surface-variant);
  text-decoration: none;
  transition: color var(--duration-short) var(--ease-default);
}

a:hover {
  color: var(--on-surface);
}

a:focus-visible {
  outline: 2px solid var(--on-surface);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

/* --------------------------------------------------------------------------
   IMAGES + MEDIA
   -------------------------------------------------------------------------- */

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

svg {
  display: block;
  overflow: hidden;
  /* SVGs with explicit width/height attrs keep their dimensions */
}

/* --------------------------------------------------------------------------
   LISTS
   -------------------------------------------------------------------------- */

ul,
ol {
  list-style: none;
}

/* --------------------------------------------------------------------------
   FORM ELEMENTS — Baseline normalization
   -------------------------------------------------------------------------- */

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

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

/* --------------------------------------------------------------------------
   TABLES
   -------------------------------------------------------------------------- */

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

/* --------------------------------------------------------------------------
   LAYOUT — Container
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

.container--md {
  max-width: var(--container-md);
}

.container--sm {
  max-width: var(--container-sm);
}

/* --------------------------------------------------------------------------
   LAYOUT — Section base
   -------------------------------------------------------------------------- */

.section {
  padding-block: var(--section-gap);
}

.section--sm {
  padding-block: calc(var(--section-gap) * 0.6);
}

.section--lg {
  padding-block: calc(var(--section-gap) * 1.4);
}

/* --------------------------------------------------------------------------
   ACCESSIBILITY — Visually hidden (screen readers only)
   -------------------------------------------------------------------------- */

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

/* --------------------------------------------------------------------------
   SELECTION
   -------------------------------------------------------------------------- */

::selection {
  background-color: oklch(0.97 0.003 75 / 0.22);
  color: var(--on-surface);
}

::-moz-selection {
  background-color: oklch(0.97 0.003 75 / 0.22);
  color: var(--on-surface);
}

/* --------------------------------------------------------------------------
   ACCESSIBILITY — Skip link
   -------------------------------------------------------------------------- */

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 9999;
  background: #FFFFFF;
  color: #000000;
  padding: 12px 20px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 700;
  font-size: var(--text-sm);
  text-decoration: none;
  transition: top var(--duration-short) var(--ease-default);
}
.skip-link:focus {
  top: 0;
}

/* --------------------------------------------------------------------------
   SCROLLBAR — Webkit (dark, minimal)
   -------------------------------------------------------------------------- */

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

::-webkit-scrollbar-track {
  background: var(--surface-low);
}

::-webkit-scrollbar-thumb {
  background-color: var(--surface-highest);
  border-radius: var(--radius-full);
  border: 1px solid var(--surface-low);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--on-surface-variant);
}

::-webkit-scrollbar-corner {
  background: var(--surface-low);
}

/* --------------------------------------------------------------------------
   FOCUS — Global visible focus ring
   -------------------------------------------------------------------------- */

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid oklch(0.97 0.003 75 / 0.75);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
  transition: outline-offset var(--duration-short) var(--ease-default);
}

/* --------------------------------------------------------------------------
   DIVIDER
   -------------------------------------------------------------------------- */

hr {
  border: none;
  border-top: 1px solid var(--surface-highest);
  margin-block: var(--space-lg);
}

/* --------------------------------------------------------------------------
   UTILITY — Flex + Grid shorthands
   -------------------------------------------------------------------------- */

.flex {
  display: flex;
}

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

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm  { gap: var(--space-sm);  }
.gap-md  { gap: var(--space-md);  }
.gap-lg  { gap: var(--space-lg);  }
.gap-xl  { gap: var(--space-xl);  }
.gap-xxl { gap: var(--space-xxl); }

/* --------------------------------------------------------------------------
   UTILITY — Text helpers
   -------------------------------------------------------------------------- */

.text-center  { text-align: center; }
.text-left    { text-align: left;   }
.text-right   { text-align: right;  }

.text-muted   { color: var(--on-surface-variant); }
.text-primary { color: var(--primary); }

.font-display { font-family: var(--font-display); }
.font-body    { font-family: var(--font-body);    }

/* --------------------------------------------------------------------------
   UTILITY — Spacing helpers (padding / margin)
   -------------------------------------------------------------------------- */

.mt-sm  { margin-top: var(--space-sm);  }
.mt-md  { margin-top: var(--space-md);  }
.mt-lg  { margin-top: var(--space-lg);  }
.mt-xl  { margin-top: var(--space-xl);  }
.mt-xxl { margin-top: var(--space-xxl); }

.mb-sm  { margin-bottom: var(--space-sm);  }
.mb-md  { margin-bottom: var(--space-md);  }
.mb-lg  { margin-bottom: var(--space-lg);  }
.mb-xl  { margin-bottom: var(--space-xl);  }
.mb-xxl { margin-bottom: var(--space-xxl); }

/* --------------------------------------------------------------------------
   UTILITY — Width
   -------------------------------------------------------------------------- */

.w-full  { width: 100%;  }
.h-full  { height: 100%; }

/* --------------------------------------------------------------------------
   UTILITY — Display
   -------------------------------------------------------------------------- */

.hidden { display: none; }

@media (max-width: 767px) {
  .hidden-mobile { display: none; }
}

@media (min-width: 768px) {
  .hidden-desktop { display: none; }
}
