@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Utility animation classes */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
}

.fade-in-left {
    opacity: 0;
    transform: translateX(-30px);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(30px);
}

.fade-in-scale {
    opacity: 0;
    transform: scale(0.9);
}

/* Fade-in Animation Styles */
.fade-in-up {
    animation: fadeInUp 0.5s ease-in-out;
}

.fade-in-right {
    animation: fadeInRight 0.5s ease-in-out;
}

.fade-in-left {
    animation: fadeInLeft 0.5s ease-in-out;
}

/* Animation Keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* KPI Card Styles - GRACE Balanced (cyan-lean) */
.kpi-card {
    width: 320px;
    height: 200px;
    padding: 32px;
    background: var(--color-neutral);
    border: 1px solid var(--color-secondary);
    border-radius: 16px;
    box-shadow: 0px 4px 6px rgba(11, 31, 57, 0.05), 0px 2px 4px rgba(11, 31, 57, 0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.kpi-card h3 {
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
}

.kpi-card p {
    font-size: 16px;
    font-weight: 400;
    color: var(--color-primary);
    margin-top: 8px;
}

.kpi-card.positive h3 {
    color: var(--color-accent);
}

.kpi-card.negative h3 {
    color: var(--color-secondary);
}

/* Component-specific utilities */
.hero-gradient {
    background: linear-gradient(135deg, var(--color-primary) 50%, var(--color-primary-2) 50%);
}

.risk-card-surface {
    background: var(--color-neutral);
    border: 1px solid var(--color-secondary);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-card);
}

.chart-wrapper {
    background: var(--color-neutral);
    border: 1px solid var(--color-secondary);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-card);
}

/* Input components with P2 focus system */
.input-field {
    background: var(--color-neutral);
    border: 2px solid var(--color-secondary);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--color-text-body);
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--color-primary-2);
    box-shadow: var(--focus-ring);
}

.input-field::placeholder {
    color: var(--color-secondary);
}

/* Table styling with P2 headers */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.data-table thead {
    background: var(--color-primary-2);
    color: white;
}

.data-table th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.025em;
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-secondary);
    color: var(--color-text-body);
}

.data-table tbody tr:nth-child(even) {
    background: var(--color-neutral);
}

.data-table tbody tr:hover {
    background: rgba(0, 185, 212, 0.04);
}

/* Notice cards with P2 left stripe */
.notice-card {
    background: var(--color-neutral);
    border: 1px solid var(--color-secondary);
    border-left: 4px solid var(--color-primary-2);
    border-radius: 8px;
    padding: 20px;
    margin: 16px 0;
}

.notice-card-title {
    color: var(--color-primary);
    font-weight: 600;
    margin-bottom: 8px;
}

.notice-card-body {
    color: var(--color-text-body);
    line-height: 1.6;
}

/* Timeline connection lines */
.timeline-line-10 {
    left: 10%;
    top: -120px;
    height: 120px;
    transform: translateX(-50%);
}

.timeline-line-30 {
    left: 30%;
    top: -120px;
    height: 120px;
    transform: translateX(-50%);
}

.timeline-line-50 {
    left: 50%;
    top: -120px;
    height: 120px;
    transform: translateX(-50%);
}

.timeline-line-70 {
    left: 70%;
    top: -120px;
    height: 120px;
    transform: translateX(-50%);
}

.timeline-line-90 {
    left: 90%;
    top: -120px;
    height: 120px;
    transform: translateX(-50%);
}

/* Delay Utility Classes */
.delay-05s {
    animation-delay: 0.05s;
}

.delay-1s {
    animation-delay: 0.1s;
}

.delay-15s {
    animation-delay: 0.15s;
}

.delay-2s {
    animation-delay: 0.2s;
}

.delay-25s {
    animation-delay: 0.25s;
}

.delay-3s {
    animation-delay: 0.3s;
}

.delay-35s {
    animation-delay: 0.35s;
}

.delay-6s {
    animation-delay: 0.6s;
}

.delay-7s {
    animation-delay: 0.7s;
}

/* Compliance Badge Styles */
.compliance-badge-text {
    font-family: 'Georgia', serif;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #374151;
}

/* Dark Theme Navigation Styles */
.nav-link-dark {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    color: #A0AEC0;
    font-weight: 500;
    text-decoration: none;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
}

.nav-link-dark:hover {
    color: var(--color-accent);
    background-color: rgba(44, 182, 125, 0.1);
    box-shadow: 0 0 20px rgba(44, 182, 125, 0.2);
}

.nav-link-dark svg {
    transition: color 0.3s ease;
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    min-width: 1rem;
    min-height: 1rem;
}

.nav-link-dark:hover svg {
    color: var(--color-accent);
}

/* Dark Theme Button Styles */
.btn-primary-dark {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 25px -5px rgba(12, 35, 64, 0.08), 0 10px 10px -5px rgba(12, 35, 64, 0.03);
}

.btn-primary-dark:hover { background: rgba(255, 255, 255, 0.2); transform: translateY(-1px); }

/* Prevent shrinking icons in header CTA */
header .btn-primary-dark svg { flex-shrink: 0; width: 1rem; height: 1rem; min-width: 1rem; min-height: 1rem; }

/* Compact CTA variant (used in global nav) */
.btn-primary-dark--compact { padding: 0.5rem 1.25rem !important; }

/* Mobile Navigation Dark Styles */
.mobile-nav-link-dark {
    display: block;
    padding: 0.875rem 0;
    font-weight: 500;
    color: #A0AEC0;
    border-bottom: 1px solid #1C2A4E;
    font-size: 0.95rem;
    text-decoration: none;
    transition: color 0.3s ease;
}

.mobile-nav-link-dark:focus-visible,
.mobile-nav-link-dark:hover {
    color: var(--color-accent);
}

/* Footer Styles */
.footer-link {
    color: #A0AEC0;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.footer-link:hover {
    color: var(--color-accent);
    text-shadow: 0 0 10px rgba(44, 182, 125, 0.4);
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    color: #A0AEC0;
    background-color: #1C2A4E;
    border: 1px solid #A0AEC0;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    text-decoration: none;
}

.social-link:hover {
    color: var(--color-accent);
    background-color: rgba(44, 182, 125, 0.1);
    box-shadow: 0 0 15px rgba(44, 182, 125, 0.3);
    transform: translateY(-2px);
}

/* Brand Logo Glow */
.brand-glow { text-shadow: 0 0 20px rgba(255, 255, 255, 0.3); }
.brand-glow-footer { text-shadow: 0 0 15px rgba(255, 255, 255, 0.3); }

/* Brand logo image overlay gradient (match site tokens) */
.brand-overlay {
    background-image: linear-gradient(90deg, var(--color-accent), var(--color-primary-2));
}

/* Brand text color + hover effect (matches logo overlay) */
.brand-silver {
    color: var(--color-secondary);
    /* default silver */
    transition: color 0.35s ease, text-shadow 0.35s ease, transform 0.35s ease, background-image 0.35s ease;
    -webkit-background-clip: text;
    background-clip: text;
}

/* When the parent .group is hovered (logo link), reveal a connected green->cyan gradient on the brand text
   so the logo overlay and text appear visually linked. Use token colors for consistency. */
.group:hover .brand-silver {
    color: transparent;
    /* reveal background-clip gradient */
    background-image: linear-gradient(90deg, var(--color-accent), var(--color-primary-2));
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow: 0 0 18px rgba(0, 185, 212, 0.30);
}

/* Design Tokens - GRACE Balanced (cyan-lean) */
:root {
    /* Primary Palette */
    --color-primary: #0B1F39;
    /* P1 - deep navy: site chrome, titles, headers */
    --color-primary-2: #00B9D4;
    /* P2 - vivid cyan: tabs, headers, focus, interaction */
    --color-secondary: #BFC7D5;
    /* Secondary - silver: borders, dividers, rails */
    --color-accent: #2CB67D;
    /* Accent - emerald: primary CTAs, positive KPIs */
    --color-backup-accent: #FFB200;
    /* Backup Accent - amber: secondary CTAs */
    --color-neutral: #EEF2F6;
    /* Neutral - surface: backgrounds, cards */

    /* Semantic tokens */
    --color-bg-section: var(--color-neutral);
    --color-text-primary: var(--color-primary);
    --color-text-body: #0B1220;
    /* Body text on neutral backgrounds */

    /* Focus ring */
    --focus-ring: 0 0 0 3px rgba(0, 185, 212, 0.3);

    /* Shadows */
    --shadow-soft: 0 4px 6px rgba(11, 31, 57, 0.05), 0 2px 4px rgba(11, 31, 57, 0.04);
    --shadow-card: 0px 4px 6px rgba(11, 31, 57, 0.05), 0px 2px 4px rgba(11, 31, 57, 0.04);
}

/* Background utilities */
.bg-primary {
    background-color: var(--color-primary);
}

.bg-primary-2 {
    background-color: var(--color-primary-2);
}

.bg-secondary {
    background-color: var(--color-secondary);
}

.bg-accent {
    background-color: var(--color-accent);
}

.bg-backup-accent {
    background-color: var(--color-backup-accent);
}

.bg-section-neutral {
    background-color: var(--color-bg-section);
}

/* Text utilities */
.text-primary {
    color: var(--color-text-primary);
}

.text-primary-2 {
    color: var(--color-primary-2);
}

.text-secondary {
    color: var(--color-secondary);
}

.text-accent {
    color: var(--color-accent);
}

.text-backup-accent {
    color: var(--color-backup-accent);
}

.text-body {
    color: var(--color-text-body);
}

/* Border utilities */
.border-secondary {
    border-color: var(--color-secondary);
}

/* Mobile baseline enhancements */
img, svg, video { max-width: 100%; height: auto; }
pre { overflow-x: auto; }
/* Prevent grid children from forcing overflow on small screens */
:where(.grid) > * { min-width: 0; }
/* Improve anchor navigation with fixed headers */
:where(h1,h2,h3,h4,h5,h6)[id] { scroll-margin-top: 88px; }

/* Fluid title utility for phone screens */
.fluid-title { font-size: clamp(1.75rem, 6vw, 3rem); line-height: 1.1; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  html { scroll-behavior: auto; }
}

.border-primary-2 {
    border-color: var(--color-primary-2);
}

/* Fill utility for SVG elements */
.fill-accent {
    fill: var(--color-accent);
}

.fill-primary-2 {
    fill: var(--color-primary-2);
}

/* Small swatch */
.swatch-accent {
    background-color: var(--color-accent);
}

/* Gradient utilities */
.bg-gradient-accent {
    background-image: linear-gradient(to bottom right, var(--color-accent), var(--color-primary-2));
}

.gradient-accent-primary2 {
    background-image: linear-gradient(to right, var(--color-accent), var(--color-primary-2));
}

.hero-gradient {
    background-image: linear-gradient(to right, var(--color-primary), var(--color-primary-2));
}

/* Text gradient (uses background-clip) */
.text-gradient-primary {
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    background-image: linear-gradient(90deg, var(--color-primary-2), var(--color-accent));
}

/* Legend / small utilities */
.legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.legend-swatch.accent-gradient {
    background-image: linear-gradient(45deg, var(--color-accent), var(--color-primary-2));
}

.legend-swatch.silver-circle {
    background: #A0AEC0;
    border-radius: 50%;
}

/* helpers used in markup */
.bg-accent.h-1 {
    height: 0.25rem;
}

/* Ensure high-specificity when needed */
.bg-primary,
.bg-primary-2,
.bg-accent,
.bg-section-neutral {
    color: inherit;
}

/* Card surface used for charts and panels (replaces inline styles) */
.risk-card-surface {
    width: 100%;
    max-width: 640px;
    padding: 32px;
    background: var(--color-neutral);
    border: 1px solid var(--color-secondary);
    border-radius: 16px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.05), 0px 2px 4px rgba(0, 0, 0, 0.04);
}

.chart-wrapper {
    width: 100%;
    height: 180px;
    position: relative;
}

/* Global section spacing: apply 3rem margin + padding to all sections
   Footer and header are not <section> elements so they are unaffected. */
/* Scope default section spacing to non-home pages to avoid conflicts on the index */
body:not(.home) section {
    margin: 3rem 0;
    padding: 3rem;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    body:not(.home) section {
        margin: 1.5rem 0;
        /* vertical-only spacing on mobile */
        padding: 1.5rem 0;
    }
}

/* Prevent wrapping in header text */
.nav-link-dark span { white-space: nowrap; }
.brand-silver { white-space: nowrap; padding-inline: 0.25rem; }
header .desktop-nav > a { flex-shrink: 0; }

/* Increase text line spacing on small viewports for readability */
@media (max-width: 640px) {
  /* Double the line-height for content text only */
  #content p,
  #content li,
  #content .leading-relaxed,
  #content .leading-normal,
  #content .leading-snug {
    line-height: 2 !important;
  }
}

/* Keep desktop nav links static; only outer gaps flex */
header .desktop-nav { flex: 0 0 auto; }
/* Fluid nav scale (set via JS for smoothness) */
header .nav-scale { transform-origin: center center; transition: transform 140ms ease; }

/* Fixed header fallback (site‑wide) */
header[role="banner"] {
  position: fixed;
  top: 0; left: 0; right: 0;
  width: 100%;
  z-index: 1000;
}

/* Footer spacing overrides: reduce vertical padding and internal gaps */
footer {
    /* keep background/border but remove any extra outer padding */
    padding: 0;
}

footer .max-w-7xl {
    /* override heavy utility padding (py-16) with smaller vertical padding */
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

footer .max-w-7xl .grid {
    gap: 1rem !important;
}

footer .max-w-7xl p,
footer .max-w-7xl .space-y-4>* {
    margin-bottom: 0.5rem !important;
}
/* Mobile navigation panel styles */
.mobile-menu {
    display: none;
}

@media (max-width: 1023px) {
    .mobile-menu {
        display: block;
    }

    .desktop-nav {
        display: none;
    }
}

.mobile-nav-panel {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    -webkit-backdrop-filter: saturate(1.5) blur(6px);
    backdrop-filter: saturate(1.5) blur(6px);
    z-index: 60;
    display: flex;
    justify-content: flex-end;
}

.mobile-nav-panel[hidden] {
    display: none;
}

.mobile-nav-panel .panel {
    width: 78%;
    max-width: 320px;
    background: #ffffff;
    height: 100%;
    padding: 2rem 1.5rem;
    box-shadow: -4px 0 12px -2px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    transform: translateX(0);
}

/* Mobile nav spacing is handled in global/navbar partial */

.mobile-nav-panel .close-btn {
    position: absolute;
    top: .75rem;
    right: .75rem;
    padding: .5rem;
    border-radius: .5rem;
}

.mobile-nav-link {
    display: block;
    padding: .875rem 0;
    font-weight: 500;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
    font-size: .95rem;
}

.mobile-nav-link:focus-visible,
.mobile-nav-link:hover {
    color: #1e40af;
}

@media (min-width: 1024px) {
    .mobile-nav-panel {
        display: none !important;
    }
}

/* KPI counter animation helper */
.kpi-value[data-animated="true"] {
    will-change: contents;
}
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

img[loading="lazy"] {
    content-visibility: auto;
}
