/* Impact Engine — shared styles
   Matches the visual identity of peisenha.github.io */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a365d;
    --accent-color: #2c5282;
    --text-color: #2d3748;
    --text-light: #4a5568;
    --background: #f7fafc;
    --card-background: #ffffff;
    --border-color: #e2e8f0;
    --hover-color: #edf2f7;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.7;
    color: var(--text-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    padding: 40px 20px;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    background-color: var(--card-background);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: fadeIn 0.6s ease-out;
}

/* Navigation */

nav {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    padding: 20px 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0;
    padding: 0;
}

nav li {
    margin: 0;
    padding: 0;
}

nav li::before {
    content: none;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95em;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
    border-bottom: none;
}

nav a:hover {
    background-color: rgba(255,255,255,0.15);
    transform: translateY(-2px);
    color: white;
    border-bottom: none;
}

/* Content area */

.content {
    padding: 60px 80px 80px;
}

/* Header */

header {
    margin-bottom: 70px;
    padding-bottom: 50px;
    border-bottom: 3px solid var(--border-color);
    position: relative;
}

header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 120px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

/* Typography */

h1 {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 3.5em;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

h2 {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 2em;
    font-weight: 600;
    margin-top: 65px;
    margin-bottom: 30px;
    color: var(--primary-color);
    position: relative;
    padding-bottom: 15px;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

h3 {
    font-size: 1.4em;
    font-weight: 600;
    margin-top: 35px;
    margin-bottom: 12px;
    color: var(--accent-color);
}

h3 .badges {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    margin-right: 10px;
    vertical-align: middle;
}

h3 .badges a {
    border-bottom: none;
    line-height: 0;
}

h3 .badges img {
    height: 1.4em;
}

p {
    margin-bottom: 18px;
    color: var(--text-light);
    line-height: 1.8;
}

strong {
    font-weight: 600;
    color: var(--text-color);
}

em {
    font-style: italic;
}

pre {
    background-color: var(--hover-color);
    border-left: 4px solid var(--accent-color);
    border-radius: 0 8px 8px 0;
    padding: 20px 24px;
    overflow-x: auto;
    margin: 24px 0;
    font-size: 0.9em;
    line-height: 1.6;
}

pre code {
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, monospace;
    color: var(--text-color);
}

code {
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, monospace;
    font-size: 0.9em;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    font-weight: 500;
}

a:hover {
    color: var(--primary-color);
    border-bottom-color: var(--accent-color);
}

/* Tagline (italic serif intro) */

.tagline {
    font-family: 'Crimson Pro', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 1.3em;
    color: var(--text-light);
    margin-bottom: 25px;
    line-height: 1.8;
}

.subtitle {
    font-size: 1.05em;
    color: var(--text-light);
    line-height: 1.8;
    font-weight: 300;
    margin-bottom: 22px;
}

/* Lists */

.content ul {
    margin-left: 0;
    margin-bottom: 25px;
    list-style: none;
}

.content li {
    margin-bottom: 20px;
    padding-left: 30px;
    position: relative;
    color: var(--text-light);
    line-height: 1.8;
}

.content li::before {
    content: '\25B8';
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.2em;
}

/* Card grid */

.card-grid {
    display: grid;
    gap: 24px;
    margin-top: 40px;
    margin-bottom: 40px;
}

.card-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

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

.card-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.card {
    background-color: var(--hover-color);
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    padding: 30px;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-4px);
}

.card h3 {
    margin-top: 0;
    margin-bottom: 12px;
}

.card p {
    margin-bottom: 0;
    font-size: 0.95em;
}

.card-compact {
    padding: 20px 24px;
}

.card-compact h3 {
    font-size: 1.1em;
    margin-bottom: 4px;
}

.card-compact p {
    font-size: 0.85em;
}

.badge {
    display: block;
    margin-top: 10px;
    height: 20px;
}

.card a {
    display: inline-block;
    margin-top: 12px;
}

/* Tables */

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    margin-bottom: 30px;
    font-size: 0.95em;
}

th {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 3px solid var(--border-color);
    color: var(--primary-color);
    font-weight: 600;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-light);
}

tr:hover {
    background-color: var(--hover-color);
}

/* Horizontal rule */

hr {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: 60px 0;
}

/* Back link */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    padding: 12px 24px;
    background-color: var(--hover-color);
    border-radius: 8px;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.back-link:hover {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 82, 130, 0.3);
}

/* Section spacing for sub-pages */

section {
    scroll-margin-top: 80px;
}

/* Responsive */

@media (max-width: 768px) {
    body {
        padding: 20px 10px;
    }

    .container {
        border-radius: 8px;
    }

    nav {
        padding: 15px 20px;
    }

    nav ul {
        gap: 15px;
    }

    nav a {
        font-size: 0.85em;
        padding: 6px 12px;
    }

    .content {
        padding: 40px 30px;
    }

    h1 {
        font-size: 2.5em;
    }

    h2 {
        font-size: 1.6em;
        margin-top: 45px;
    }

    .card-grid-3 {
        grid-template-columns: 1fr;
    }

    .card-grid-2 {
        grid-template-columns: 1fr;
    }

    .card-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .content {
        padding: 30px 20px;
    }

    h1 {
        font-size: 2em;
    }

    .content li {
        padding-left: 25px;
    }
}

/* Side-by-side layout (image left, text right) */

.section-flex {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.section-flex .section-image {
    flex-shrink: 0;
    max-width: 240px;
    margin: 0;
    border-radius: 8px;
}

.section-flex .section-text {
    flex: 1;
}

@media (max-width: 768px) {
    .section-flex {
        flex-direction: column;
    }

    .section-flex .section-image {
        max-width: 200px;
        margin: 0 auto 20px;
    }
}

/* Diagrams */

.diagram-container {
    margin: 40px 0;
    text-align: center;
}

.diagram-container img {
    max-width: 100%;
    height: auto;
}

.diagram-caption {
    font-size: 0.85em;
    color: var(--text-light);
    margin-top: 12px;
    font-style: italic;
}

/* Animation */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
