/**
 * Unified Design System
 * Comprehensive application of MIT Technology Review and BTQ design principles
 * Replaces fragmented CSS with cohesive, principle-based system
 */

/* ========================================
 * CORE DESIGN TOKENS
 * Borrowed from MIT TR spacing and BTQ interactions
 * ======================================== */

:root {
    /* Spacing - MIT TR system (5rem/8rem pattern) */
    --section-padding-mobile: 3rem;
    --section-padding-tablet: 5rem;
    --section-padding-desktop: 8rem;

    /* Typography - BTQ bold headlines + MIT TR body */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-black: 800;

    /* Transitions - BTQ smooth interactions */
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast: 200ms;
    --duration-normal: 300ms;
    --duration-slow: 500ms;

    /* Borders - Subtle like both sites */
    --border-width: 1px;
    --border-radius-card: 8px;
    --border-radius-button: 6px;
}

/* ========================================
 * RESET & BASE - Clean foundation
 * ======================================== */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ========================================
 * TYPOGRAPHY - MIT TR/BTQ hybrid approach
 * ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-bold);
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

h1 {
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

h2 {
    font-size: clamp(2rem, 4vw, 3.5rem);
}

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

p {
    line-height: 1.6;
    margin-top: 0;
    margin-bottom: 1rem;
}

/* ========================================
 * LAYOUT - Generous spacing principle
 * ======================================== */

section {
    padding-top: var(--section-padding-mobile);
    padding-bottom: var(--section-padding-mobile);
}

@media (min-width: 48rem) {
    section {
        padding-top: var(--section-padding-tablet);
        padding-bottom: var(--section-padding-tablet);
    }
}

@media (min-width: 64rem) {
    section {
        padding-top: var(--section-padding-desktop);
        padding-bottom: var(--section-padding-desktop);
    }
}

/* ========================================
 * CARDS - BTQ hover + MIT TR borders
 * ======================================== */

.card,
.company-card {
    background: var(--bg-elevated);
    border: var(--border-width) solid var(--border-subtle);
    border-radius: var(--border-radius-card);
    padding: 2rem;
    transition: all var(--duration-normal) var(--ease-smooth);
}

.card:hover,
.company-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* ========================================
 * BUTTONS - BTQ interaction patterns
 * ======================================== */

button,
.button,
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    font-weight: var(--font-weight-semibold);
    font-size: 1rem;
    border-radius: var(--border-radius-button);
    border: var(--border-width) solid transparent;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-smooth);
    text-decoration: none;
    min-height: 44px;
}

button:hover,
.button:hover,
.btn:hover {
    transform: translateY(-2px);
}

/* ========================================
 * GRIDS - Flexible like both sites
 * ======================================== */

.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
    gap: 2rem;
}

.grid-2 {
    display: grid;
    gap: 2rem;
}

@media (min-width: 48rem) {
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.grid-3 {
    display: grid;
    gap: 2rem;
}

@media (min-width: 48rem) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 64rem) {
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
 * INTERACTIVE STATES - Smooth feedback
 * ======================================== */

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

a:hover {
    color: var(--text-secondary);
}

/* ========================================
 * LOADING STATES - Professional skeleton
 * ======================================== */

.loading-skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 0%,
        var(--bg-tertiary) 50%,
        var(--bg-secondary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer-smooth 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes shimmer-smooth {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
 * ACCESSIBILITY - WCAG compliance
 * ======================================== */

*:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}

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

/* ========================================
 * RESPONSIVE UTILITIES
 * ======================================== */

.container {
    max-width: 75rem;
    margin: 0 auto;
    padding: 0 1.5rem;
}

@media (min-width: 48rem) {
    .container {
        padding: 0 3rem;
    }
}

@media (min-width: 64rem) {
    .container {
        padding: 0 5rem;
    }
}

.hide-mobile {
    display: none;
}

@media (min-width: 48rem) {
    .hide-mobile {
        display: block;
    }
}

.show-mobile {
    display: block;
}

@media (min-width: 48rem) {
    .show-mobile {
        display: none;
    }
}

/* ========================================
 * FORMS - Clean input styling
 * ======================================== */

input,
select,
textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: var(--border-width) solid var(--border-subtle);
    border-radius: var(--border-radius-button);
    background: var(--bg-elevated);
    color: var(--text-primary);
    transition: border-color var(--duration-fast) var(--ease-smooth);
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--border-medium);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--border-strong);
}

label {
    display: block;
    font-weight: var(--font-weight-medium);
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* ========================================
 * NAVIGATION - Link styles
 * ======================================== */

nav a {
    font-weight: var(--font-weight-medium);
    transition: color var(--duration-fast) var(--ease-smooth);
}

nav a:hover {
    color: var(--text-secondary);
}

nav a.active {
    font-weight: var(--font-weight-semibold);
}

/* ========================================
 * IMAGES - Responsive and optimized
 * ======================================== */

img {
    max-width: 100%;
    height: auto;
    display: block;
}

figure {
    margin: 2rem 0;
}

figcaption {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
}

/* ========================================
 * TABLES - Clean data presentation
 * ======================================== */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
}

th,
td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: var(--border-width) solid var(--border-subtle);
}

th {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

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

tr:hover {
    background: var(--bg-elevated);
}

/* ========================================
 * CODE - Monospace styling
 * ======================================== */

code,
pre {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
}

code {
    padding: 0.25rem 0.5rem;
    background: var(--bg-elevated);
    border-radius: 4px;
}

pre {
    padding: 1.5rem;
    background: var(--bg-elevated);
    border-radius: var(--border-radius-card);
    overflow-x: auto;
    margin: 2rem 0;
}

pre code {
    padding: 0;
    background: none;
}
