/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif; background-color: #0D0D0D; color: #FFFFFF; line-height: 1.6; min-height: 100vh; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; font: inherit; border: none; background: none; color: inherit; }
:focus-visible { outline: 2px solid #FFD700; outline-offset: 2px; border-radius: 4px; }
::selection { background: #D7001D; color: #FFFFFF; }

/* ===== CSS Variables ===== */
:root {
  --ml-red: #D7001D;
  --ml-black: #1A1A1A;
  --ml-gold: #FFD700;
  --ml-gold-gradient: linear-gradient(135deg, #FFD700, #FFA500);
  --ml-bg-dark: #0D0D0D;
  --ml-surface-dark: #1E1E1E;
  --ml-text-primary: #FFFFFF;
  --ml-text-secondary: #B0B0B0;
  --ml-data-highlight: #00FF88;
  --ml-border-subtle: #333333;
  --ml-radius-sm: 8px;
  --ml-radius-md: 16px;
  --ml-radius-lg: 24px;
  --ml-radius-xl: 32px;
  --ml-gap: 1rem;
  --ml-max-width: 1200px;
  --ml-font-heading: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* ===== Skip Link ===== */
.ml-skip-link {
  position: fixed; top: -100%; left: 1rem; z-index: 10000;
  background: var(--ml-gold-gradient); color: #1A1A1A; font-weight: 700;
  padding: 0.5rem 1.5rem; border-radius: 0 0 var(--ml-radius-sm) var(--ml-radius-sm);
  transition: top 0.3s;
}
.ml-skip-link:focus { top: 0; }

/* ===== Header & Nav ===== */
.ml-header {
  position: sticky; top: 1rem; z-index: 9999;
  display: flex; justify-content: center; padding: 0 1rem;
  pointer-events: none;
}
.ml-nav {
  pointer-events: auto;
  background: rgba(26, 26, 26, 0.92); backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid rgba(215, 0, 29, 0.25); border-radius: 60px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.7), 0 0 0 1px rgba(215,0,29,0.08);
  width: 100%; max-width: var(--ml-max-width);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.ml-nav:hover { border-color: rgba(215, 0, 29, 0.45); box-shadow: 0 8px 40px rgba(215,0,29,0.12), 0 0 0 1px rgba(215,0,29,0.12); }
.ml-nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 1.25rem 0.5rem 0.75rem;
  gap: 0.5rem;
}
.ml-brand {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 800; font-size: 1.2rem; letter-spacing: 0.02em;
  flex-shrink: 0;
}
.ml-brand-icon { width: 34px; height: auto; flex-shrink: 0; }
.ml-brand-text { color: #FFFFFF; }
.ml-brand-accent { color: var(--ml-gold); font-style: italic; }
.ml-nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 4px;
  width: 36px; height: 36px; padding: 6px; border-radius: 50%;
  background: rgba(215,0,29,0.15); transition: background 0.25s;
}
.ml-nav-toggle:hover { background: rgba(215,0,29,0.3); }
.ml-nav-toggle-line {
  display: block; height: 2px; background: #FFFFFF; border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.ml-nav-list {
  display: flex; align-items: center; gap: 0.15rem;
  flex-wrap: wrap; justify-content: flex-end;
}
.ml-nav-link {
  display: block; padding: 0.45rem 0.9rem; border-radius: 40px;
  font-size: 0.85rem; font-weight: 600; color: var(--ml-text-secondary);
  transition: background 0.25s, color 0.25s, box-shadow 0.25s;
  white-space: nowrap;
}
.ml-nav-link:hover { color: #FFFFFF; background: rgba(255,255,255,0.06); }
.ml-nav-link[aria-current="page"] {
  color: #1A1A1A; background: var(--ml-gold-gradient);
  box-shadow: 0 2px 12px rgba(255,215,0,0.25); font-weight: 700;
}

/* ===== Mobile Nav ===== */
@media (max-width: 767px) {
  .ml-header { top: 0.5rem; padding: 0 0.75rem; }
  .ml-nav { border-radius: var(--ml-radius-md); }
  .ml-nav-inner { flex-wrap: wrap; padding: 0.5rem 0.75rem; }
  .ml-nav-toggle { display: flex; }
  .ml-nav-list {
    display: none; width: 100%; flex-direction: column; gap: 0.25rem;
    padding: 0.5rem 0 0.25rem; border-top: 1px solid rgba(255,255,255,0.06);
  }
  .ml-nav[data-open] .ml-nav-list { display: flex; }
  .ml-nav[data-open] .ml-nav-toggle-line:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .ml-nav[data-open] .ml-nav-toggle-line:nth-child(2) { opacity: 0; }
  .ml-nav[data-open] .ml-nav-toggle-line:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .ml-nav-link {
    padding: 0.7rem 1rem; font-size: 0.95rem; white-space: normal;
    border-radius: var(--ml-radius-sm); text-align: center;
  }
  .ml-nav-link[aria-current="page"] { box-shadow: none; }
  .ml-brand-icon { width: 30px; }
  .ml-brand-text { font-size: 1.05rem; }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .ml-nav-inner { padding: 0.5rem 1rem; }
  .ml-nav-link { padding: 0.4rem 0.65rem; font-size: 0.8rem; }
  .ml-brand-text { font-size: 1.05rem; }
}

/* ===== Footer ===== */
.ml-footer {
  background: #0A0A0A; border-top: 1px solid rgba(215,0,29,0.15);
  padding: 3rem 1rem 2rem; margin-top: 4rem;
}
.ml-footer-inner {
  max-width: var(--ml-max-width); margin: 0 auto;
  display: grid; grid-template-columns: 1fr 2fr; gap: 2rem 3rem;
}
.ml-footer-brand { display: flex; flex-direction: column; gap: 0.25rem; }
.ml-footer-icon { width: 36px; height: auto; margin-bottom: 0.25rem; }
.ml-footer-brand-name { font-size: 1.3rem; font-weight: 800; color: #FFFFFF; letter-spacing: 0.02em; }
.ml-footer-tagline { font-size: 0.8rem; color: var(--ml-gold); font-style: italic; opacity: 0.85; }
.ml-footer-info { display: flex; flex-direction: column; gap: 0.75rem; }
.ml-footer-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.ml-footer-link {
  font-size: 0.85rem; color: var(--ml-text-secondary); padding: 0.25rem 0;
  border-bottom: 1px solid transparent; transition: color 0.2s, border-color 0.2s;
}
.ml-footer-link:hover { color: var(--ml-gold); border-bottom-color: var(--ml-gold); }
.ml-footer-contact { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-size: 0.8rem; color: var(--ml-text-secondary); }
.ml-footer-contact-item { display: inline-flex; align-items: center; gap: 0.25rem; }
.ml-footer-timestamp { font-size: 0.78rem; color: rgba(255,255,255,0.35); margin-top: 0.25rem; }
.ml-footer-icp { font-size: 0.75rem; color: rgba(255,255,255,0.25); }

@media (max-width: 767px) {
  .ml-footer { padding: 2rem 1rem 1.5rem; }
  .ml-footer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
  .ml-footer-brand { text-align: center; align-items: center; }
  .ml-footer-links { justify-content: center; }
  .ml-footer-contact { justify-content: center; flex-direction: column; align-items: center; gap: 0.35rem; }
  .ml-footer-timestamp { text-align: center; }
  .ml-footer-icp { text-align: center; }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .ml-footer-inner { gap: 2rem; }
}

/* ===== Shared Components ===== */
.ml-container {
  max-width: var(--ml-max-width); margin: 0 auto;
  padding: 0 1.5rem; width: 100%;
}
@media (max-width: 767px) { .ml-container { padding: 0 1rem; } }

.ml-section { padding: 4rem 0; }
.ml-section--narrow { padding: 2.5rem 0; }

.ml-heading {
  font-family: var(--ml-font-heading); font-weight: 800; font-style: italic;
  font-size: 2.8rem; line-height: 1.2; color: #FFFFFF;
  letter-spacing: -0.01em;
}
.ml-heading .ml-heading-accent { color: var(--ml-gold); }
@media (max-width: 767px) { .ml-heading { font-size: 2rem; } }

.ml-subheading {
  font-size: 1.2rem; font-weight: 600; color: var(--ml-text-secondary);
  margin-top: 0.5rem;
}

.ml-note {
  font-size: 0.8rem; color: var(--ml-text-secondary);
  line-height: 1.5;
}
.ml-note--vertical {
  writing-mode: vertical-rl; text-orientation: mixed;
  font-size: 0.7rem; letter-spacing: 0.1em;
}

/* Buttons */
.ml-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.6rem 1.8rem; border-radius: 40px; font-weight: 700;
  font-size: 0.9rem; transition: transform 0.2s, box-shadow 0.25s, background 0.25s;
  border: none; cursor: pointer; text-align: center;
}
.ml-btn:hover { transform: translateY(-1px); }
.ml-btn:active { transform: translateY(0); }
.ml-btn-primary { background: var(--ml-red); color: #FFFFFF; box-shadow: 0 2px 12px rgba(215,0,29,0.25); }
.ml-btn-primary:hover { box-shadow: 0 4px 20px rgba(215,0,29,0.35); }
.ml-btn-gold { background: var(--ml-gold-gradient); color: #1A1A1A; box-shadow: 0 2px 16px rgba(255,215,0,0.2); }
.ml-btn-gold:hover { box-shadow: 0 4px 24px rgba(255,215,0,0.35); }

/* Cards */
.ml-card {
  background: var(--ml-surface-dark); border-radius: var(--ml-radius-md);
  border: 1px solid var(--ml-border-subtle); padding: 1.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s;
}
.ml-card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(0,0,0,0.5); border-color: rgba(215,0,29,0.25); }
.ml-card--gold { border-color: rgba(255,215,0,0.2); }
.ml-card--gold:hover { border-color: rgba(255,215,0,0.4); }

/* Data Highlight */
.ml-data-highlight {
  font-weight: 800; font-size: 1.4rem;
  background: var(--ml-gold-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ml-data-highlight--green {
  background: #00FF88; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Grid System (Bento) */
.ml-grid {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--ml-gap);
}
.ml-grid__item { min-width: 0; }
.ml-grid__item--span-3 { grid-column: span 3; }
.ml-grid__item--span-4 { grid-column: span 4; }
.ml-grid__item--span-5 { grid-column: span 5; }
.ml-grid__item--span-6 { grid-column: span 6; }
.ml-grid__item--span-7 { grid-column: span 7; }
.ml-grid__item--span-8 { grid-column: span 8; }
.ml-grid__item--span-9 { grid-column: span 9; }
.ml-grid__item--span-12 { grid-column: span 12; }
@media (max-width: 767px) {
  .ml-grid { grid-template-columns: 1fr; gap: 0.75rem; }
  .ml-grid__item { grid-column: span 1 !important; }
}
@media (min-width: 768px) and (max-width: 1024px) {
  .ml-grid { gap: 0.75rem; }
  .ml-grid__item--span-3 { grid-column: span 4; }
  .ml-grid__item--span-4 { grid-column: span 6; }
  .ml-grid__item--span-5 { grid-column: span 6; }
  .ml-grid__item--span-6 { grid-column: span 6; }
  .ml-grid__item--span-7 { grid-column: span 8; }
  .ml-grid__item--span-8 { grid-column: span 8; }
  .ml-grid__item--span-9 { grid-column: span 10; }
}

/* ===== Scroll Progress ===== */
[data-scroll-progress] {
  position: fixed; top: 0; left: 0; z-index: 99999;
  width: 0%; height: 3px;
  background: var(--ml-gold-gradient);
  box-shadow: 0 0 12px rgba(255,215,0,0.4);
  transition: width 0.1s linear;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) { [data-scroll-progress] { display: none; } }

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
  .ml-card:hover { transform: none; }
  .ml-btn:hover { transform: none; }
}

/* ===== Accessibility ===== */
@media (prefers-contrast: more) {
  .ml-nav-link { color: #FFFFFF; }
  .ml-nav-link[aria-current="page"] { background: #FFD700; color: #000000; }
  .ml-footer-link { color: #FFFFFF; }
}
