/* ============================================
   BASE.CSS — Association of Women Judges of Uzbekistan
   Design System Implementation
   ============================================ */

/* --- RESET (modern minimal) --- */
*, *::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%;
}

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

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

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

ul, ol {
  list-style: none;
}

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

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

/* --- CSS CUSTOM PROPERTIES --- */
:root {
  /* Paper & backgrounds */
  --paper: #FAF6EC;
  --paper-deep: #F2EBD8;
  --white: #FFFFFF;

  /* Navy — institutional authority */
  --navy: #1B3A5C;
  --navy-deep: #0F2440;

  /* Gold — logo accent, heritage */
  --gold: #B8860B;
  --gold-light: #D4A73A;

  /* Burgundy — CTA, emphasis */
  --burgundy: #7A1E2E;
  --burgundy-hover: #8E2335;

  /* Interactive state variants */
  --gold-hover: #C99917;
  --gold-active: #A07807;
  --navy-hover: #234A75;
  --navy-active: #142E48;

  /* Text */
  --ink: #1A1F2E;
  --ink-soft: #3D4454;
  --ink-muted: #6B7280;

  /* Lines & dividers */
  --line: #D9D0B8;
  --line-soft: #E6E2D8;

  /* Typography — font families */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Literata', Georgia, serif;
  --font-ui: 'Inter', -apple-system, sans-serif;

  /* Typography — font sizes (Display — Fraunces) */
  --fs-display-xl: 72px;
  --fs-display-lg: 56px;
  --fs-display-md: 42px;
  --fs-display-sm: 32px;
  --fs-display-xs: 24px;

  /* Typography — font sizes (Body — Literata) */
  --fs-body-lg: 20px;
  --fs-body-md: 18px;
  --fs-body-sm: 16px;
  --fs-body-xs: 14px;

  /* Typography — font sizes (UI — Inter) */
  --fs-ui-md: 14px;
  --fs-ui-sm: 12px;

  /* Spacing (8px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;
  --space-8: 80px;
  --space-9: 120px;

  /* Layout */
  --container-max: 1200px;
  --container-padding: 32px;
  --text-column-max: 740px;

  /* Animation */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 0.2s;
  --duration-base: 0.3s;
  --duration-slow: 0.6s;
}

/* --- BASE TYPOGRAPHY --- */
body {
  font-family: var(--font-body);
  font-size: var(--fs-body-md);
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: 0.2px;
  color: var(--ink);
  background-color: var(--paper);
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--navy);
}

h1 {
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.15;
}

h3 {
  font-size: 22px;
  line-height: 1.25;
}

h4 {
  font-size: var(--fs-body-lg);
  line-height: 1.3;
}

h5 {
  font-size: var(--fs-body-md);
  line-height: 1.4;
}

h6 {
  font-size: var(--fs-body-sm);
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

p {
  margin-bottom: var(--space-3);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--navy);
  text-decoration: none;
  background-image: linear-gradient(var(--gold), var(--gold));
  background-size: 0 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.3s ease;
}

a:hover {
  background-size: 100% 2px;
}

ul, ol {
  padding-left: var(--space-4);
}

ul {
  list-style: disc;
}

ol {
  list-style: decimal;
}

li {
  margin-bottom: var(--space-2);
}

blockquote {
  font-family: var(--font-body);
  font-style: italic;
  font-size: var(--fs-body-lg);
  line-height: 1.6;
  color: var(--ink-soft);
  border-left: 3px solid var(--gold);
  padding-left: var(--space-4);
  margin: var(--space-5) 0;
}

/* --- OPENTYPE FEATURES --- */

/* Editorial body text — old-style figures, discretionary ligatures */
.c-article__body,
.c-article__body p,
.o-text-column,
.o-text-column p {
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1, 'onum' 1, 'dlig' 1;
  hanging-punctuation: first last;
  text-wrap: pretty;
}

/* Headlines — text-wrap balance for two-line elegance */
h1, h2, h3,
.c-hero__title,
.c-section__title {
  text-wrap: balance;
}

/* Tabular numbers for stats */
.s-stats__number,
.c-hero__stat strong,
.c-timeline__date {
  font-feature-settings: 'tnum' 1, 'lnum' 1;
  font-variant-numeric: tabular-nums lining-nums;
}

/* Eyebrows — small caps + tracking */
.c-section__eyebrow,
.c-hero__eyebrow {
  font-feature-settings: 'smcp' 1, 'kern' 1;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.14em;
}

/* --- CYRILLIC TYPOGRAPHY --- */
[lang="ru"] body,
[lang="ru"] p,
[lang="ru"] .c-article__body {
  letter-spacing: 0.01em;
}

[lang="ru"] h1,
[lang="ru"] h2,
[lang="ru"] .c-hero__title,
[lang="ru"] .c-section__title {
  letter-spacing: -0.005em;
}

.c-hero__stat strong,
.s-stats__number,
.c-timeline__date,
time {
  font-variant-numeric: lining-nums tabular-nums;
}

[lang="ru"] .c-article__body p,
[lang="ru"] .o-text-column p {
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* --- LAYOUT OBJECTS --- */
.o-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.o-text-column {
  max-width: var(--text-column-max);
}

.o-section {
  padding: var(--space-8) 0;
}

/* --- FOCUS RINGS (WCAG 2.2 AA) --- */
*:focus { outline: none; }

*:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--paper),
    0 0 0 4px var(--gold),
    0 0 0 8px rgba(184, 134, 11, 0.2);
  border-radius: inherit;
  transition: box-shadow 0.2s ease;
}

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

/* --- CSS SCROLL-DRIVEN ANIMATIONS --- */
@supports (animation-timeline: view()) {
  .c-section__title,
  .c-section__head {
    animation: editorialReveal linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 35%;
  }
  .s-stats__number,
  .c-hero__stat strong {
    animation: scaleInGold linear both;
    animation-timeline: view();
    animation-range: entry 15% entry 55%;
  }
  .c-news-card,
  .c-mission-card,
  .c-event-card,
  .c-region-card {
    animation: cardRise linear both;
    animation-timeline: view();
    animation-range: entry 5% entry 45%;
  }
}

@keyframes editorialReveal {
  from { opacity: 0; transform: translateY(32px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleInGold {
  from { opacity: 0; transform: scale(0.88); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes cardRise {
  from { opacity: 0; transform: translateY(48px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  @supports (animation-timeline: view()) {
    .c-section__title, .c-section__head,
    .s-stats__number, .c-hero__stat strong,
    .c-news-card, .c-mission-card, .c-event-card, .c-region-card {
      animation: none;
    }
  }
}


/* --- PRELOADER --- */
.c-preloader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(184, 134, 11, 0.1);
  z-index: 10001;
  transition: opacity 0.4s ease;
}
.c-preloader__bar {
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width 0.4s ease;
}
.c-preloader.is-done {
  opacity: 0;
}

/* --- RESPONSIVE --- */
@media (max-width: 639px) {
  :root {
    --container-padding: 16px;
  }
}
