:root {
    /* ==========================================================================
       Material 3 Design Tokens (Simplified & Adapted)
       Ref: https://m3.material.io/
       ========================================================================== */

    /* --- Color Palette (Light Theme) --- */
    /* Primary - The main brand color */
    --md-sys-color-primary: #006495;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #CBE6FF;
    --md-sys-color-on-primary-container: #001E30;

    /* Secondary - Less prominent than primary */
    --md-sys-color-secondary: #50606E;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #D3E5F5;
    --md-sys-color-on-secondary-container: #0C1D29;

    /* Tertiary - Balancing/Accent color */
    --md-sys-color-tertiary: #65587B;
    --md-sys-color-on-tertiary: #FFFFFF;
    --md-sys-color-tertiary-container: #EBDDFF;
    --md-sys-color-on-tertiary-container: #201634;

    /* Error */
    --md-sys-color-error: #BA1A1A;
    --md-sys-color-on-error: #FFFFFF;
    --md-sys-color-error-container: #FFDAD6;
    --md-sys-color-on-error-container: #410002;

    /* Backgrounds & Surfaces */
    --md-sys-color-background: #FCFCFF;
    --md-sys-color-on-background: #1A1C1E;
    
    --md-sys-color-surface: #FCFCFF;
    --md-sys-color-on-surface: #1A1C1E;
    
    --md-sys-color-surface-variant: #DEE3EB;
    --md-sys-color-on-surface-variant: #42474E;
    
    --md-sys-color-outline: #72777F;
    --md-sys-color-outline-variant: #C2C7CF;

    /* Surfaces at Elevations */
    --md-sys-color-surface-container-low: #F6F8FB;  /* Page bg */
    --md-sys-color-surface-container: #F0F4F8;      /* Card bg */
    --md-sys-color-surface-container-high: #EAEFF4;
    --md-sys-color-surface-container-highest: #E4E9EE;

    /* --- Typography (Roboto/System) --- */
    --md-sys-typescale-display-large: 400 57px/64px 'Google Sans', 'Noto Sans SC', sans-serif;
    --md-sys-typescale-headline-large: 400 32px/40px 'Google Sans', 'Noto Sans SC', sans-serif;
    --md-sys-typescale-headline-medium: 400 28px/36px 'Google Sans', 'Noto Sans SC', sans-serif;
    --md-sys-typescale-title-large: 400 22px/28px 'Google Sans', 'Noto Sans SC', sans-serif;
    --md-sys-typescale-title-medium: 500 16px/24px 'Google Sans', 'Noto Sans SC', sans-serif;
    --md-sys-typescale-body-large: 400 16px/24px 'Google Sans', 'Noto Sans SC', sans-serif;
    --md-sys-typescale-body-medium: 400 14px/20px 'Google Sans', 'Noto Sans SC', sans-serif;
    --md-sys-typescale-label-large: 500 14px/20px 'Google Sans', 'Noto Sans SC', sans-serif;

    /* --- Elevation (Shadows) --- */
    --md-sys-elevation-level-0: none;
    --md-sys-elevation-level-1: 0px 1px 2px rgba(0, 0, 0, 0.3), 0px 1px 3px 1px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-level-2: 0px 1px 2px rgba(0, 0, 0, 0.3), 0px 2px 6px 2px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-level-3: 0px 4px 8px 3px rgba(0, 0, 0, 0.15), 0px 1px 3px rgba(0, 0, 0, 0.3);
    --md-sys-elevation-level-4: 0px 6px 10px 4px rgba(0, 0, 0, 0.15), 0px 2px 3px rgba(0, 0, 0, 0.3);
    --md-sys-elevation-level-5: 0px 8px 12px 6px rgba(0, 0, 0, 0.15), 0px 4px 4px rgba(0, 0, 0, 0.3);

    /* --- Shapes (Extreme Rounded) --- */
    --md-sys-shape-corner-none: 0px;
    --md-sys-shape-corner-extra-small: 4px;
    --md-sys-shape-corner-small: 8px;
    --md-sys-shape-corner-medium: 12px;
    --md-sys-shape-corner-large: 16px;
    --md-sys-shape-corner-extra-large: 28px; /* Key for cards */
    --md-sys-shape-corner-full: 9999px;      /* Key for buttons/pills */
}

/* ==========================================================================
   Global Reset & Base
   ========================================================================== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Google Sans', 'Noto Sans SC', 'PingFang SC', sans-serif;
    background-color: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-on-background);
    -webkit-font-smoothing: antialiased;
    font-size: 16px;
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ==========================================================================
   Components
   ========================================================================== */

/* --- Buttons --- */
.m3-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 24px;
    border-radius: var(--md-sys-shape-corner-full);
    font: var(--md-sys-typescale-label-large);
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    cursor: pointer;
    border: none;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.m3-btn-filled {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    box-shadow: var(--md-sys-elevation-level-0);
}
.m3-btn-filled:hover {
    box-shadow: var(--md-sys-elevation-level-1);
    background-color: color-mix(in srgb, var(--md-sys-color-primary), white 8%);
}

.m3-btn-tonal {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}
.m3-btn-tonal:hover {
    background-color: color-mix(in srgb, var(--md-sys-color-secondary-container), black 8%);
}

.m3-icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    transition: background 0.2s;
}
.m3-icon-btn:hover {
    background-color: rgba(0,0,0,0.08);
}

/* --- Cards --- */
.m3-card {
    background-color: #FFFFFF; /* Using pure white for cleaner look on light bg */
    border-radius: var(--md-sys-shape-corner-extra-large); /* 28px */
    padding: 24px;
    transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.m3-card-elevated {
    box-shadow: var(--md-sys-elevation-level-1);
}
.m3-card-elevated:hover {
    box-shadow: var(--md-sys-elevation-level-2);
    transform: translateY(-2px);
}

.m3-card-outlined {
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
}

/* --- Search Bar (Hero) --- */
.m3-search-bar {
    background-color: var(--md-sys-color-surface-container-high);
    border-radius: var(--md-sys-shape-corner-full);
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 16px 0 24px;
    transition: all 0.2s;
    box-shadow: var(--md-sys-elevation-level-1); /* Slight elevation */
    max-width: 720px;
    margin: 0 auto;
    border: 1px solid transparent;
}
.m3-search-bar:hover {
    background-color: var(--md-sys-color-surface-container-highest);
    box-shadow: var(--md-sys-elevation-level-2);
}
.m3-search-bar:focus-within {
    background-color: var(--md-sys-color-surface-container-highest);
    border-color: var(--md-sys-color-primary);
    box-shadow: var(--md-sys-elevation-level-3);
}

.m3-search-input {
    flex: 1;
    border: none;
    background: transparent;
    height: 100%;
    font: var(--md-sys-typescale-body-large);
    color: var(--md-sys-color-on-surface);
    outline: none;
}

/* --- Badges/Chips --- */
.m3-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 8px; /* Slightly squarer than buttons */
    font-size: 12px;
    font-weight: 500;
    gap: 6px;
}
.m3-badge-success {
    background-color: #E6F4EA;
    color: #137333;
}
.m3-badge-primary {
    background-color: #E3F2FD;
    color: #006495;
}
.m3-badge-neutral {
    background-color: #F2F2F2;
    color: #50606E;
}
.m3-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
}

/* ==========================================================================
   Page Layouts
   ========================================================================== */

/* --- Navbar (Simple) --- */
.app-bar {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    background: transparent;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}
.app-logo {
    font-weight: 700;
    font-size: 20px;
    color: var(--md-sys-color-on-surface);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --- Hero Section --- */
.hero-wrapper {
    padding: 120px 24px 60px;
    text-align: center;
    background: linear-gradient(180deg, #E3F2FD 0%, var(--md-sys-color-surface-container-low) 100%);
    border-radius: 0 0 48px 48px; /* Unique bottom curve */
    margin-bottom: 40px;
}

.hero-title {
    font: var(--md-sys-typescale-display-large);
    color: var(--md-sys-color-on-surface);
    margin-bottom: 16px;
}
.hero-subtitle {
    font: var(--md-sys-typescale-body-large);
    color: var(--md-sys-color-on-surface-variant);
    max-width: 600px;
    margin: 0 auto 48px;
}

.stats-row {
    display: flex;
    justify-content: center;
    gap: 64px;
    margin-top: 48px;
}
.stat-item {
    text-align: center;
}
.stat-val {
    display: block;
    font: var(--md-sys-typescale-headline-large);
    color: var(--md-sys-color-primary);
    font-weight: 700;
}
.stat-label {
    font: var(--md-sys-typescale-label-large);
    color: var(--md-sys-color-secondary);
}

/* --- Grid Section --- */
.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

.section-title {
    font: var(--md-sys-typescale-title-large);
    color: var(--md-sys-color-on-surface);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.api-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); /* Wider cards */
    gap: 24px;
}

/* API Card Specifics */
.api-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.api-card-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.api-card-header {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    align-items: center;
}

.api-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-primary);
}

.api-title-group {
    flex: 1;
}
.api-title {
    font: var(--md-sys-typescale-title-medium);
    margin: 0 0 4px;
}

.api-desc {
    font: var(--md-sys-typescale-body-medium);
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 24px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.api-meta {
    border-top: 1px solid var(--md-sys-color-outline-variant);
    padding-top: 16px;
    display: flex;
    gap: 20px;
    font: var(--md-sys-typescale-body-medium);
    color: var(--md-sys-color-secondary);
    font-size: 13px;
}
.api-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================================================
   Detail Page Styles
   ========================================================================== */

/* Detail Header - Gradient Background */
.detail-hero {
    background: linear-gradient(135deg, #E0F7FA 0%, #E8EAF6 100%);
    padding: 80px 24px 40px;
    border-radius: 0 0 32px 32px;
    margin-bottom: 32px;
}

.detail-container {
    max-width: 1200px;
    margin: 0 auto;
}

.detail-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    flex-wrap: wrap;
}

.detail-main-info {
    display: flex;
    align-items: center;
    gap: 24px;
}

.detail-large-icon {
    width: 96px;
    height: 96px;
    border-radius: 24px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    box-shadow: var(--md-sys-elevation-level-1);
    overflow: hidden; /* Ensure image crop */
}

.detail-title h1 {
    font: var(--md-sys-typescale-headline-large);
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.detail-desc {
    font: var(--md-sys-typescale-body-large);
    color: var(--md-sys-color-on-surface-variant);
    max-width: 600px;
}

/* Tabs */
.tabs-wrapper {
    background: #FFFFFF;
    border-radius: var(--md-sys-shape-corner-extra-large);
    box-shadow: var(--md-sys-elevation-level-1);
    overflow: hidden;
    margin-bottom: 40px;
}

.tabs-header {
    display: flex;
    padding: 0 24px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    background: #FAFAFA;
}

.tab-item {
    padding: 18px 24px;
    font: var(--md-sys-typescale-label-large);
    color: var(--md-sys-color-on-surface-variant);
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.tab-item:hover {
    background-color: rgba(0,0,0,0.04);
}

.tab-item.active {
    color: var(--md-sys-color-primary);
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--md-sys-color-primary);
    border-radius: 3px 3px 0 0;
}

.tab-content {
    padding: 32px;
    min-height: 300px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}
.tab-pane.active {
    display: block;
}

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

/* Code & Tables */
.info-table {
    width: 100%;
    border-collapse: collapse;
}
.info-table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--md-sys-color-secondary);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    font-weight: 500;
}
.info-table td {
    padding: 16px;
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface);
}

.code-block {
    border-radius: 16px;
    overflow: hidden; /* Clips the inner pre/code corners */
    margin: 0;
    box-shadow: var(--md-sys-elevation-level-1);
    background: #282c34; /* Match atom-one-dark bg */
    color: #abb2bf; /* Match atom-one-dark fg to prevent black text on dark bg */
}

/* Override/Reset for generated markdown content */
.code-block pre {
    margin: 0;
    padding: 24px;
    background: transparent !important; /* Let container handle bg */
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 14px;
    line-height: 1.6;
    overflow-x: auto;
}

.code-block code {
    font-family: inherit;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-wrapper { border-radius: 0 0 24px 24px; padding: 100px 20px 40px; }
    .stats-row { flex-direction: column; gap: 24px; }
    .detail-header-content { flex-direction: column; align-items: flex-start; }
    .detail-main-info { flex-direction: column; align-items: flex-start; }
    .tabs-header { overflow-x: auto; }
}
