/**
 * ==============================================================================
 * Jeweltech Training (JTT) — Design Tokens & Core Stylesheet
 * ==============================================================================
 * Canonical Design System: JTT_DESIGN_SYSTEM.md
 * Visual Philosophy: Editorial Jewellery Education (Warm Ivory, Deep Espresso, Restrained Gold)
 */

/* Canonical Typography Font Loading (Cormorant Garamond & DM Sans) */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400;1,600&display=swap');

:root {
  color-scheme: light;

  /* ==============================================================================
     1. Canonical Palette Tokens (JTT_DESIGN_SYSTEM.md)
     ============================================================================== */
  --color-ivory: #F8F6F0;
  --color-white: #FFFFFF;
  --color-espresso: #292519;
  --color-gold: #B49A63;
  --color-taupe: #716B60;
  --color-border: #DED8CA;
  --color-border-strong: #C9BEA8;
  --color-gold-hover: #9A804A;
  --color-text-inverse: #FFFFFF;
  --color-danger: #A83232;
  --color-success: #286747;
  --color-warning: #805B17;
  --color-focus: #6B5427;

  /* ==============================================================================
     2. Canonical Typography Tokens (JTT_DESIGN_SYSTEM.md Standard)
     ============================================================================== */
  --font-heading: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "DM Sans", Arial, Helvetica, sans-serif;

  /* Canonical Type Scale Tokens */
  --text-hero-h1: clamp(2.5rem, 5vw, 4rem);
  --text-hero: var(--text-hero-h1);
  --text-page-h1: clamp(2.25rem, 4.5vw, 3.5rem);
  --text-h1: var(--text-page-h1);
  --text-h2: clamp(1.875rem, 3.5vw, 2.625rem);
  --text-h3: clamp(1.5rem, 2.5vw, 2rem);
  --text-h4: clamp(1.25rem, 2vw, 1.625rem);
  --text-lead: clamp(1.0625rem, 1.5vw, 1.25rem);
  --text-body: 1rem;
  --text-body-sm: 0.875rem;
  --text-small: 0.875rem;
  --text-caption: 0.75rem;
  --text-eyebrow: 0.8125rem;
  --text-button: 0.9375rem;
  --text-nav: 0.9375rem;

  /* ==============================================================================
     3. Canonical 4px Spacing Scale
     ============================================================================== */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* ==============================================================================
     4. Canonical Containers & Layout
     ============================================================================== */
  --container-max: 1200px;
  --container-wide: 1320px;
  --container-reading: 720px;
  --page-gutter: clamp(20px, 5vw, 72px);

  /* ==============================================================================
     5. Legacy Theme Compatibility Aliases
     ==============================================================================
     Preserved temporarily to maintain backwards compatibility with existing
     components and regression suites (#0a0f1d, #c59b27) until individual component
     migration in subsequent phases.
  */
  --color-bg-primary: #0a0f1d;
  --color-bg-surface: #101626;
  --color-bg-card: #141c30;
  --color-bg-elevated: #1a253e;

  /* Legacy Accent Aliases */
  --color-gold-legacy: #c59b27;
  --color-gold-light: #dfb746;
  --color-gold-dark: #996515;
  --color-gold-subtle: rgba(197, 155, 39, 0.1);
  --color-gold-border: rgba(197, 155, 39, 0.3);
  --color-gold-glow: rgba(197, 155, 39, 0.25);
  --grad-gold: linear-gradient(135deg, #dfb746 0%, #c59b27 50%, #996515 100%);
  --grad-surface: linear-gradient(180deg, rgba(20, 28, 48, 0.8) 0%, rgba(16, 22, 38, 0.95) 100%);

  /* Legacy Text Aliases */
  --color-text-main: #f8fafc;
  --color-text-muted: #94a3b8;
  --color-text-light: #cbd5e1;
  --color-text-faint: #64748b;
  --color-border-subtle: rgba(255, 255, 255, 0.08);

  /* Legacy Badges */
  --color-warning-bg: rgba(66, 32, 6, 0.8);
  --color-warning-text: #fde047;
  --color-warning-border: #a16207;

  /* Font Family Aliases mapped to Canonical Fonts */
  --font-family-display: var(--font-heading);
  --font-family-body: var(--font-body);

  /* Layout & Elevations */
  --max-width-site: var(--container-max);
  --header-height: 80px;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-card: 14px;
  --radius-video: 14px;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-gold: 0 4px 18px rgba(197, 155, 39, 0.18);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--color-bg-primary);
  color: var(--color-text-main);
  line-height: 1.68;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.nav-drawer-open {
  overflow: hidden;
}

/* Accessibility: Keyboard Skip Link */
.skip-link {
  position: absolute;
  top: -120px;
  left: 1.5rem;
  background: var(--color-gold);
  color: var(--color-espresso);
  padding: 0.65rem 1.25rem;
  z-index: 10000;
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: top var(--transition-fast);
  text-decoration: none;
  box-shadow: var(--shadow-lg);
}

.skip-link:focus {
  top: 1rem;
  outline: 3px solid var(--color-focus);
}

/* Focus Indicators */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

/* ==============================================================================
   6. Canonical Container Utilities (JTT_DESIGN_SYSTEM.md Standard)
   ============================================================================== */
.container {
  width: min(
    calc(100% - 2 * var(--page-gutter)),
    var(--container-max)
  );
  margin-inline: auto;
}

.container--wide {
  width: min(
    calc(100% - 2 * var(--page-gutter)),
    var(--container-wide)
  );
  margin-inline: auto;
}

.container--reading {
  width: min(
    calc(100% - 2 * var(--page-gutter)),
    var(--container-reading)
  );
  margin-inline: auto;
}

.section {
  padding: var(--space-16) 0;
  position: relative;
}

.section--compact-top {
  padding-top: var(--space-4);
}

.section--no-top {
  padding-top: 0;
}

@media (max-width: 768px) {
  .section {
    padding: var(--space-10) 0;
  }

  .section--compact-top {
    padding-top: var(--space-2);
  }

  .section--no-top {
    padding-top: 0;
  }
}

.section-hero {
  padding: var(--space-16) 0;
  border-bottom: 1px solid var(--color-border-subtle);
  background: radial-gradient(circle at 50% 10%, rgba(20, 28, 48, 0.6) 0%, rgba(10, 15, 29, 1) 75%);
}

.section-alt {
  background: var(--color-bg-surface);
  border-top: 1px solid var(--color-border-subtle);
  border-bottom: 1px solid var(--color-border-subtle);
}

/* ==============================================================================
   7. Typography Hierarchy & Utilities (JTT_DESIGN_SYSTEM.md Standard)
   ============================================================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: inherit;
  font-weight: 500;
  letter-spacing: 0.01em;
}

h1, .text-page-h1 {
  font-size: var(--text-page-h1);
  font-weight: 500;
  line-height: 1.1;
  margin-bottom: var(--space-4);
}

.text-hero-h1,
.hero-headline {
  font-size: var(--text-hero-h1);
  font-weight: 500;
  line-height: 1.14;
  letter-spacing: normal;
  text-wrap: balance;
  margin-bottom: var(--space-5);
}

h2, .text-h2 {
  font-size: var(--text-h2);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.005em;
  margin-bottom: var(--space-3);
}

h3, .text-h3 {
  font-size: var(--text-h3);
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: var(--space-2);
}

h4, .text-h4 {
  font-size: var(--text-h4);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: var(--space-2);
}

p, .text-body {
  line-height: 1.7;
  margin-bottom: var(--space-4);
}

ul, ol {
  line-height: 1.68;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

/* Section Header Presentation */
.section-header-block {
  max-width: 760px;
  margin-bottom: var(--space-12);
}

@media (max-width: 640px) {
  .section-header-block {
    margin-bottom: var(--space-8);
  }
}

.section-header-center {
  margin-inline: auto;
  text-align: center;
}

.section-eyebrow, .text-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-eyebrow);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-gold-light);
  margin-bottom: var(--space-2);
}

.section-eyebrow::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 2px;
  background: var(--color-gold);
}

.page-lead, .text-lead {
  font-size: var(--text-lead);
  color: var(--color-text-light);
  line-height: 1.6;
}

.text-small {
  font-size: var(--text-small);
  line-height: 1.55;
}

/* Badges */
.badge-pending {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
  border: 1px solid var(--color-warning-border);
}

.badge-duration {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-gold-light);
  background: var(--color-gold-subtle);
  border: 1px solid var(--color-gold-border);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.03em;
}

/* ==============================================================================
   8. Canonical Light Theme Page Foundation (JTT_DESIGN_SYSTEM.md Standard)
   ============================================================================== */
body.page-light {
  background-color: var(--color-ivory);
  color: var(--color-espresso);
}

body.page-light h1,
body.page-light h2,
body.page-light h3,
body.page-light h4,
body.page-light h5,
body.page-light h6 {
  color: var(--color-espresso);
}

body.page-light p {
  color: var(--color-taupe);
}

body.page-light .page-lead,
body.page-light .text-lead {
  color: var(--color-taupe);
  line-height: 1.6;
}

body.page-light .section-eyebrow,
body.page-light .text-eyebrow {
  color: var(--color-focus);
}

body.page-light .section-eyebrow::before {
  background: var(--color-gold);
}

body.page-light .section {
  background-color: var(--color-ivory);
}

body.page-light .section-alt {
  background-color: var(--color-white);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

body.page-light .section-hero {
  background: var(--color-ivory);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-16) 0;
}

body.page-light .page-header {
  background: var(--color-ivory);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-16) 0 var(--space-12);
}

@media (max-width: 768px) {
  body.page-light .page-header {
    padding: var(--space-10) 0 var(--space-8);
  }
}

body.page-light .badge-pending {
  background: var(--color-white);
  color: var(--color-warning);
  border: 1px solid var(--color-border);
}

body.page-light .badge-duration {
  background: var(--color-white);
  color: var(--color-focus);
  border: 1px solid var(--color-border);
}

/* Respect 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;
  }
}

/* Keep the redesign's canonical typography independent of the legacy site setting. */
.redesign-shell {
  font-family: var(--font-body) !important;
}

.redesign-shell h1,
.redesign-shell h2,
.redesign-shell h3,
.redesign-shell h4,
.redesign-shell h5,
.redesign-shell h6 {
  font-family: var(--font-heading) !important;
}
