/* ========== Reset & Base ========== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --green-600: #2e6129;
    --green-700: #1e4d1a;
    --green-50: #f0f7ef;
    --green-100: #dceeda;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --orange-500: #ed8936;
    --red-500: #ef4444;
    --blue-500: #3b82f6;
    --yellow-100: #fef9c3;
    --yellow-600: #ca8a04;
    --radius: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 70px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-50);
}

:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.45);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -48px;
    z-index: 200;
    padding: 10px 14px;
    background: white;
    color: var(--gray-900);
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    box-shadow: var(--shadow-md);
}

.skip-link:focus {
    top: 12px;
}

a {
    color: var(--green-600);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ========== Navigation ========== */
nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
}

.nav-logo {
    font-weight: 700;
    font-size: 1.25em;
    color: var(--green-600);
}

.nav-links {
    display: flex;
    gap: 28px;
    list-style: none;
}

.nav-links a {
    color: var(--gray-600);
    font-size: 0.9em;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--green-600);
    text-decoration: none;
}

.nav-hamburger {
    display: none;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--gray-700);
    padding: 4px 8px;
}

/* ========== Hero ========== */
.hero {
    background: linear-gradient(135deg, var(--green-600) 0%, var(--green-700) 100%);
    color: white;
    padding: 80px 24px 60px;
    text-align: center;
}

.hero h1 {
    font-size: 3.2em;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.hero .subtitle {
    font-size: 1.3em;
    opacity: 0.9;
    font-weight: 400;
}

.hero-lead {
    max-width: 760px;
    margin: 18px auto 0;
    font-size: 1.02em;
    color: rgba(255, 255, 255, 0.92);
}

.hero-lead code {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    padding: 2px 8px;
}

.hero-actions {
    max-width: 900px;
    margin: 28px auto 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    text-align: left;
}

.hero-command {
    background: rgba(17, 24, 39, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    padding: 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
    align-items: center;
}

.hero-command-label {
    grid-column: 1 / -1;
    font-size: 0.82em;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
}

.hero-command code {
    display: block;
    min-width: 0;
    overflow-x: auto;
    white-space: nowrap;
    font-family: 'Courier New', monospace;
    font-size: 0.94em;
    color: white;
}

.copy-btn {
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.88em;
    font-weight: 600;
    cursor: pointer;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* ========== Sections ========== */
.wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

section {
    padding: 60px 0;
}

section + section {
    border-top: 1px solid var(--gray-200);
}

.section-heading {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.section-lead {
    color: var(--gray-500);
    font-size: 1.05em;
    margin-bottom: 32px;
}

/* ========== Quick Start ========== */
.quick-start-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.qs-step {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.qs-step .step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--green-100);
    color: var(--green-600);
    font-weight: 700;
    border-radius: 50%;
    font-size: 0.9em;
    margin-bottom: 12px;
}

.qs-step h4 {
    font-size: 1em;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.qs-step p {
    color: var(--gray-500);
    font-size: 0.92em;
}

.qs-step code {
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
}

/* ========== Features Grid ========== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.feature-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.feature-card h4 {
    color: var(--green-600);
    margin-bottom: 8px;
    font-size: 1.05em;
}

.feature-card p {
    color: var(--gray-600);
    font-size: 0.92em;
}

/* ========== Behavior Table ========== */
.behavior-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.table-scroll {
    overflow-x: auto;
    border-radius: var(--radius);
}

.behavior-table th {
    background: var(--green-50);
    text-align: left;
    padding: 14px 20px;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid var(--gray-200);
}

.behavior-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.95em;
}

.behavior-table tr:last-child td {
    border-bottom: none;
}

.behavior-table code {
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.88em;
    white-space: nowrap;
}

/* ========== Examples Table ========== */
.examples-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.examples-table th {
    background: var(--green-50);
    text-align: left;
    padding: 14px 20px;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid var(--gray-200);
}

.examples-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-100);
    font-family: 'Courier New', monospace;
    font-size: 0.92em;
}

.examples-table tr:last-child td {
    border-bottom: none;
}

.note-box {
    background: var(--yellow-100);
    border-left: 4px solid var(--yellow-600);
    padding: 16px 20px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-top: 20px;
    font-size: 0.93em;
    color: var(--gray-700);
}

.note-box-secondary {
    margin-top: 12px;
}

.note-box strong {
    color: var(--yellow-600);
}

/* ========== Error Codes (Tabbed) ========== */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
    border-bottom: 2px solid var(--gray-200);
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: transparent;
    font-weight: 600;
    font-size: 0.95em;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--gray-700);
}

.tab-btn[aria-selected="true"] {
    color: var(--green-600);
}

.tab-btn.active {
    color: var(--green-600);
    border-bottom-color: var(--green-600);
}

.tab-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 700;
    color: white;
}

.tab-badge-3xx { background: #48bb78; }
.tab-badge-4xx { background: var(--orange-500); }
.tab-badge-5xx { background: var(--red-500); }
.tab-badge-6xx { background: var(--green-600); }

.tab-panel {
    display: none;
    padding: 24px 0;
}

.tab-panel.active {
    display: block;
}

.error-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px;
}

.error-item {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 10px 16px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.92em;
}

.error-item .code {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--green-600);
    min-width: 36px;
}

.error-item .phrase {
    color: var(--gray-600);
}

/* ========== FAQ ========== */
.faq-list {
    display: grid;
    gap: 12px;
}

.faq-item {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.faq-item summary {
    padding: 18px 24px;
    font-weight: 600;
    cursor: pointer;
    color: var(--gray-800);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.3em;
    font-weight: 400;
    color: var(--gray-400);
    transition: transform 0.2s;
}

.faq-item[open] summary::after {
    content: '\2212';
}

.faq-item .faq-answer {
    padding: 0 24px 18px;
    color: var(--gray-600);
    font-size: 0.95em;
    line-height: 1.7;
}

.faq-item .faq-answer code {
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
}

/* ========== Footer ========== */
footer {
    background: var(--gray-900);
    color: var(--gray-300);
    padding: 40px 24px;
    text-align: center;
    font-size: 0.92em;
}

footer a {
    color: var(--blue-500);
}

footer .heart {
    color: #e74c3c;
    font-size: 1.1em;
}

footer .footer-sub {
    margin-top: 12px;
    opacity: 0.6;
    font-size: 0.85em;
}

/* ========== Dark Mode ========== */
@media (prefers-color-scheme: dark) {
    :root {
        --gray-50: #111827;
        --gray-100: #1f2937;
        --gray-200: #374151;
        --gray-300: #4b5563;
        --gray-500: #9ca3af;
        --gray-600: #d1d5db;
        --gray-700: #e5e7eb;
        --gray-800: #f3f4f6;
        --gray-900: #f9fafb;
        --green-50: #1a2e1a;
        --green-100: #264226;
        --yellow-100: #3d3419;
        --yellow-600: #eab308;
    }

    body {
        background: #0f1117;
    }

    nav {
        background: #1a1d27;
        border-bottom-color: #2d3040;
    }

    .skip-link {
        background: #1a1d27;
        color: var(--gray-800);
        border-color: #2d3040;
    }

    .feature-card,
    .qs-step,
    .faq-item,
    .error-item {
        background: #1a1d27;
        border-color: #2d3040;
    }

    .behavior-table,
    .examples-table {
        background: #1a1d27;
        border-color: #2d3040;
    }

    .behavior-table th,
    .examples-table th {
        background: #1e2530;
        border-bottom-color: #2d3040;
    }

    .behavior-table td,
    .examples-table td {
        border-bottom-color: #2d3040;
    }

    .behavior-table code,
    .faq-item .faq-answer code,
    .qs-step code {
        background: #2d3040;
    }

    .table-scroll:focus-visible {
        outline-color: rgba(96, 165, 250, 0.5);
    }

    .tabs {
        border-bottom-color: #2d3040;
    }

    footer {
        background: #0a0c10;
    }
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 16px 24px;
        border-bottom: 1px solid var(--gray-200);
        box-shadow: var(--shadow-md);
        gap: 12px;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-hamburger {
        display: block;
    }

    .hero h1 {
        font-size: 2.2em;
    }

    .hero .subtitle {
        font-size: 1.1em;
    }

    .hero-actions {
        grid-template-columns: 1fr;
    }

    .hero-command {
        grid-template-columns: 1fr;
    }

    .copy-btn {
        justify-self: start;
    }

    .quick-start-steps {
        grid-template-columns: 1fr;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .error-grid {
        grid-template-columns: 1fr;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        padding: 10px 16px;
        font-size: 0.85em;
        white-space: nowrap;
    }

    .behavior-table,
    .examples-table {
        min-width: 580px;
    }
}

@media (max-width: 768px) and (prefers-color-scheme: dark) {
    .nav-links {
        background: #1a1d27;
        border-bottom-color: #2d3040;
    }
}
