/* ============================================
   UI Minimum Design System
   ============================================
   Philosophy: Leverage browser defaults & HTML spec.
   Minimal CSS, maximum native behavior.
   Card component as the primitive building block.
   ============================================ */

/* === System Tokens === */
:root {
    /* Colors - Soft, accessible palette */
    --uim-bg: #f0f4ff;
    --uim-surface: #ffffff;
    --uim-text: #1a1f36;
    --uim-text-muted: #5a607f;
    --uim-border: #d6dff5;
    --uim-accent: #4f5dff;
    --uim-accent-hover: #3d4ee6;
    --uim-shadow: rgba(15, 23, 42, 0.08);

    /* Spacing - Relative to rem */
    --uim-space-xs: 0.5rem;
    --uim-space-sm: 0.75rem;
    --uim-space-md: 1rem;
    --uim-space-lg: 1.5rem;
    --uim-space-xl: 2rem;

    /* Border radius */
    --uim-radius: 16px;
    --uim-radius-sm: 8px;
    --uim-radius-pill: 999px;

    /* Typography - System fonts first */
    --uim-font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* === Base Reset (Minimal) === */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 100%;
    /* Respect user's browser settings */
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--uim-font);
    background: var(--uim-bg);
    color: var(--uim-text);
    line-height: 1.6;
    margin: 0;
    min-height: 100dvh;
}

/* === Native Typography Enhancement === */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0 0 var(--uim-space-sm);
    font-weight: 700;
    line-height: 1.3;
    color: var(--uim-text);
}

h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
}

h3 {
    font-size: clamp(1.125rem, 2.5vw, 1.5rem);
}

h4 {
    font-size: 1.125rem;
}

p {
    margin: 0 0 var(--uim-space-md);
    color: var(--uim-text-muted);
}

/* === The Card Primitive === */
.ui-card {
    background: var(--uim-surface);
    border: 1px solid var(--uim-border);
    border-radius: var(--uim-radius);
    padding: var(--uim-space-lg);
    box-shadow: 0 4px 24px var(--uim-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ui-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px var(--uim-shadow);
}

/* Card internal spacing - let native elements breathe */
.ui-card>h3 {
    margin-bottom: var(--uim-space-xs);
}

.ui-card>p {
    margin-bottom: var(--uim-space-md);
    font-size: 0.9375rem;
}

/* === Button - Pill Style (matching your design) === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--uim-space-sm) var(--uim-space-lg);
    border-radius: var(--uim-radius-pill);
    border: 1px solid var(--uim-border);
    background: var(--uim-surface);
    color: var(--uim-text);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    border-color: var(--uim-accent);
    color: var(--uim-accent);
}

.btn:focus-visible {
    outline: 2px solid var(--uim-accent);
    outline-offset: 2px;
}

/* Primary button variant */
.btn-primary {
    background: var(--uim-accent);
    border-color: var(--uim-accent);
    color: #ffffff !important;
}

.btn-primary:hover {
    background: var(--uim-accent-hover);
    border-color: var(--uim-accent-hover);
    color: #ffffff !important;
}

/* Ghost button (outlined) */
.btn-ghost {
    background: rgba(255, 255, 255, 0.9);
    border-color: #1a1f36;
    color: #1a1f36;
}

.btn-ghost:hover {
    background: var(--uim-surface);
    border-color: var(--uim-accent);
    color: var(--uim-accent);
}

/* === Responsive Grid === */
.responsive-grid {
    display: grid;
    gap: var(--uim-space-lg);
    grid-template-columns: 1fr;
}

@media (min-width: 600px) {

    .responsive-grid.two,
    .responsive-grid.three {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .responsive-grid.three {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* === Container === */
.site-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--uim-space-lg);
}

/* === Section Spacing === */
.section {
    padding: var(--uim-space-xl) 0;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--uim-space-lg);
}

/* === Links - Classic Underlined Style === */
a {
    color: var(--uim-accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover {
    color: var(--uim-accent-hover);
    text-decoration-thickness: 2px;
}

a:visited {
    color: #7b5fff;
}

/* Links that shouldn't be underlined */
.btn,
.ui-card a.card-link-overlay,
.site-brand,
.site-menu__link {
    text-decoration: none;
}

.text-link {
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: underline;
}

.text-link:hover {
    text-decoration-thickness: 2px;
}

/* === Image Card Component === */
.ui-image-card {
    display: block;
    position: relative;
    border-radius: var(--uim-radius);
    overflow: hidden;
    box-shadow: 0 4px 24px var(--uim-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
}

.ui-image-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(79, 93, 255, 0.15);
}

.ui-image-card img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ui-image-card:hover img {
    transform: scale(1.02);
}

.ui-image-card__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--uim-space-md);
    background: linear-gradient(to top, rgba(10, 14, 39, 0.8), transparent);
    color: white;
}

.ui-image-card__title {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0;
    color: white;
}

/* === Hero / Jumbotron with Circuit Pattern === */
.hero-circuit {
    position: relative;
    background: linear-gradient(135deg, #e8eeff 0%, #f0f4ff 50%, #e5edff 100%);
    overflow: hidden;
}

.hero-circuit::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400' viewBox='0 0 400 400'%3E%3Cg fill='none' stroke='%234f5dff' stroke-width='0.5' stroke-opacity='0.15'%3E%3C!-- Horizontal lines --%3E%3Cpath d='M0,50 H150 M200,50 H400'/%3E%3Cpath d='M0,100 H80 M120,100 H280 M320,100 H400'/%3E%3Cpath d='M0,150 H200 M250,150 H400'/%3E%3Cpath d='M0,200 H100 M150,200 H300 M350,200 H400'/%3E%3Cpath d='M0,250 H180 M220,250 H400'/%3E%3Cpath d='M0,300 H60 M100,300 H340 M380,300 H400'/%3E%3Cpath d='M0,350 H220 M260,350 H400'/%3E%3C!-- Vertical lines --%3E%3Cpath d='M50,0 V120 M50,160 V400'/%3E%3Cpath d='M100,0 V80 M100,120 V280 M100,320 V400'/%3E%3Cpath d='M150,0 V200 M150,240 V400'/%3E%3Cpath d='M200,0 V100 M200,140 V300 M200,340 V400'/%3E%3Cpath d='M250,0 V180 M250,220 V400'/%3E%3Cpath d='M300,0 V60 M300,100 V340 M300,380 V400'/%3E%3Cpath d='M350,0 V220 M350,260 V400'/%3E%3C!-- Connection nodes --%3E%3Ccircle cx='50' cy='50' r='3'/%3E%3Ccircle cx='150' cy='50' r='3'/%3E%3Ccircle cx='100' cy='100' r='3'/%3E%3Ccircle cx='200' cy='100' r='3'/%3E%3Ccircle cx='300' cy='100' r='3'/%3E%3Ccircle cx='50' cy='150' r='3'/%3E%3Ccircle cx='150' cy='150' r='3'/%3E%3Ccircle cx='250' cy='150' r='3'/%3E%3Ccircle cx='350' cy='150' r='3'/%3E%3Ccircle cx='100' cy='200' r='3'/%3E%3Ccircle cx='200' cy='200' r='3'/%3E%3Ccircle cx='300' cy='200' r='3'/%3E%3Ccircle cx='50' cy='250' r='3'/%3E%3Ccircle cx='150' cy='250' r='3'/%3E%3Ccircle cx='250' cy='250' r='3'/%3E%3Ccircle cx='350' cy='250' r='3'/%3E%3Ccircle cx='100' cy='300' r='3'/%3E%3Ccircle cx='200' cy='300' r='3'/%3E%3Ccircle cx='300' cy='300' r='3'/%3E%3Ccircle cx='50' cy='350' r='3'/%3E%3Ccircle cx='150' cy='350' r='3'/%3E%3Ccircle cx='250' cy='350' r='3'/%3E%3Ccircle cx='350' cy='350' r='3'/%3E%3C!-- Diagonal accents --%3E%3Cpath d='M80,100 L100,120'/%3E%3Cpath d='M280,100 L300,80'/%3E%3Cpath d='M180,250 L200,230'/%3E%3Cpath d='M320,300 L340,280'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 400px 400px;
    pointer-events: none;
    opacity: 1;
}

.hero-circuit__content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: var(--uim-space-xl) var(--uim-space-lg);
    max-width: 800px;
    margin: 0 auto;
}

.hero-circuit h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: var(--uim-space-md);
}

.hero-circuit .lede {
    font-size: 1.125rem;
    color: var(--uim-text-muted);
    margin-bottom: var(--uim-space-lg);
}

.hero-actions {
    display: flex;
    gap: var(--uim-space-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* Corner circuit decorations */
.hero-circuit::after {
    content: '';
    position: absolute;
    top: 20px;
    right: 20px;
    width: 120px;
    height: 120px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%234f5dff' stroke-width='1' stroke-opacity='0.25'%3E%3Cpath d='M0,20 H40 L60,40 V80 L80,100 H120'/%3E%3Cpath d='M20,0 V30 L40,50 H70'/%3E%3Ccircle cx='40' cy='20' r='4'/%3E%3Ccircle cx='60' cy='40' r='4'/%3E%3Ccircle cx='60' cy='80' r='4'/%3E%3Ccircle cx='80' cy='100' r='4'/%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

@media (max-width: 599px) {
    .hero-circuit::after {
        display: none;
    }
}

/* === Mobile Safety === */
@media (max-width: 599px) {
    :root {
        --uim-space-lg: 1rem;
        --uim-space-xl: 1.5rem;
    }

    .ui-card {
        padding: var(--uim-space-md);
    }

    .section-head {
        flex-direction: column;
        gap: var(--uim-space-sm);
    }
}

/* === Focus States (Accessibility) === */
:focus-visible {
    outline: 2px solid var(--uim-accent);
    outline-offset: 2px;
}

/* === Utility Classes === */
.text-muted {
    color: var(--uim-text-muted);
}

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

/* === Print Styles === */
@media print {
    .ui-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}