/* ============================================================
   Table Styling - Ported from mdBook theme
   ============================================================
   This file contains all table-related styling including:
   - Grayscale color palette for light and dark modes
   - Table-specific CSS variables
   - Table structure and styling
   - Responsive table wrapper
   ============================================================ */

/* ============================================================
   Font Weight Variables
   ============================================================ */
:root {
    --font-body-weight-book: 400; /* Buch */
    --font-body-weight-kraeftig: 500; /* Kräftig */
}

/* ============================================================
   Light Mode - Grayscale & Table Variables
   ============================================================ */
.light, html:not(.js) {
    /* LaunchDarkly Grayscale Colors (Light Mode) */
    --grayscale-1: #fdfcfd;
    --grayscale-2: #faf9fb;
    --grayscale-3: #f2eff3;
    --grayscale-4: #eae7ec;
    --grayscale-5: #e3dfe6;
    --grayscale-6: #dbd8e0;
    --grayscale-7: #d0cdd7;
    --grayscale-8: #bcbac7;
    --grayscale-9: #8e8c99;
    --grayscale-10: #84828e;
    --grayscale-11: #65636d;
    --grayscale-12: #211f26;
    --grayscale-a1: #55005503;
    --grayscale-a2: #2b005506;
    --grayscale-a3: #30004010;
    --grayscale-a4: #20003618;
    --grayscale-a5: #20003820;
    --grayscale-a6: #14003527;
    --grayscale-a7: #10003332;
    --grayscale-a8: #08003145;
    --grayscale-a9: #05001d73;
    --grayscale-a10: #0500197d;
    --grayscale-a11: #0400119c;
    --grayscale-a12: #020008e0;
    --grayscale-contrast: #000;
    --grayscale-surface: #ffffffcc;
    --grayscale-indicator: #8e8c99;
    --grayscale-track: #8e8c99;

    /* Table-specific variables */
    --table-border-color: hsl(0, 0%, 95%);
    --table-header-bg: transparent;
    --table-alternate-bg: var(--grayscale-1);
    --table-border: var(--grayscale-4);
}

/* Display P3 color space support for light mode */
@supports (color: color(display-p3 1 1 1)) {
    @media (color-gamut: p3) {
        .light, html:not(.js) {
            --grayscale-1: color(display-p3 0.991 0.988 0.992);
            --grayscale-2: color(display-p3 0.98 0.976 0.984);
            --grayscale-3: color(display-p3 0.946 0.938 0.952);
            --grayscale-4: color(display-p3 0.915 0.906 0.925);
            --grayscale-5: color(display-p3 0.886 0.876 0.901);
            --grayscale-6: color(display-p3 0.856 0.846 0.875);
            --grayscale-7: color(display-p3 0.814 0.804 0.84);
            --grayscale-8: color(display-p3 0.735 0.728 0.777);
            --grayscale-9: color(display-p3 0.555 0.549 0.596);
            --grayscale-10: color(display-p3 0.514 0.508 0.552);
            --grayscale-11: color(display-p3 0.395 0.388 0.424);
            --grayscale-12: color(display-p3 0.128 0.122 0.147);
            --grayscale-surface: color(display-p3 1 1 1 / 80%);
        }
    }
}

/* ============================================================
   Dark Mode - Grayscale & Table Variables
   ============================================================ */
.dark {
    /* LaunchDarkly Grayscale Colors (Dark Mode) */
    --grayscale-1: #111111;
    --grayscale-2: #191919;
    --grayscale-3: #222222;
    --grayscale-4: #2a2a2a;
    --grayscale-5: #313131;
    --grayscale-6: #3a3a3a;
    --grayscale-7: #484848;
    --grayscale-8: #606060;
    --grayscale-9: #6e6e6e;
    --grayscale-10: #7b7b7b;
    --grayscale-11: #b4b4b4;
    --grayscale-12: #eeeeee;
    --grayscale-a1: #00000000;
    --grayscale-a2: #ffffff09;
    --grayscale-a3: #ffffff12;
    --grayscale-a4: #ffffff1b;
    --grayscale-a5: #ffffff22;
    --grayscale-a6: #ffffff2c;
    --grayscale-a7: #ffffff3b;
    --grayscale-a8: #ffffff55;
    --grayscale-a9: #ffffff64;
    --grayscale-a10: #ffffff72;
    --grayscale-a11: #ffffffaf;
    --grayscale-a12: #ffffffed;
    --grayscale-contrast: #fff;
    --grayscale-surface: rgba(0, 0, 0, 0.05);
    --grayscale-indicator: #6e6e6e;
    --grayscale-track: #6e6e6e;

    /* Table-specific variables */
    --table-border-color: hsl(200, 7%, 13%);
    --table-header-bg: transparent;
    --table-alternate-bg: var(--grayscale-2);
    --table-border: var(--grayscale-6);
}

/* Display P3 color space support for dark mode */
@supports (color: color(display-p3 1 1 1)) {
    @media (color-gamut: p3) {
        .dark {
            --grayscale-1: color(display-p3 0.067 0.067 0.067);
            --grayscale-2: color(display-p3 0.098 0.098 0.098);
            --grayscale-3: color(display-p3 0.135 0.135 0.135);
            --grayscale-4: color(display-p3 0.163 0.163 0.163);
            --grayscale-5: color(display-p3 0.192 0.192 0.192);
            --grayscale-6: color(display-p3 0.228 0.228 0.228);
            --grayscale-7: color(display-p3 0.283 0.283 0.283);
            --grayscale-8: color(display-p3 0.375 0.375 0.375);
            --grayscale-9: color(display-p3 0.431 0.431 0.431);
            --grayscale-10: color(display-p3 0.484 0.484 0.484);
            --grayscale-11: color(display-p3 0.706 0.706 0.706);
            --grayscale-12: color(display-p3 0.933 0.933 0.933);
            --grayscale-surface: color(display-p3 0 0 0 / 5%);
        }
    }
}

/* ============================================================
   Media Query: prefers-color-scheme: dark
   ============================================================ */
@media (prefers-color-scheme: dark) {
    html:not(.js) {
        /* LaunchDarkly Grayscale Colors (Dark Mode) */
        --grayscale-1: #111111;
        --grayscale-2: #191919;
        --grayscale-3: #222222;
        --grayscale-4: #2a2a2a;
        --grayscale-5: #313131;
        --grayscale-6: #3a3a3a;
        --grayscale-7: #484848;
        --grayscale-8: #606060;
        --grayscale-9: #6e6e6e;
        --grayscale-10: #7b7b7b;
        --grayscale-11: #b4b4b4;
        --grayscale-12: #eeeeee;
        --grayscale-a1: #00000000;
        --grayscale-a2: #ffffff09;
        --grayscale-a3: #ffffff12;
        --grayscale-a4: #ffffff1b;
        --grayscale-a5: #ffffff22;
        --grayscale-a6: #ffffff2c;
        --grayscale-a7: #ffffff3b;
        --grayscale-a8: #ffffff55;
        --grayscale-a9: #ffffff64;
        --grayscale-a10: #ffffff72;
        --grayscale-a11: #ffffffaf;
        --grayscale-a12: #ffffffed;
        --grayscale-contrast: #fff;
        --grayscale-surface: rgba(0, 0, 0, 0.05);
        --grayscale-indicator: #6e6e6e;
        --grayscale-track: #6e6e6e;

        /* Table-specific variables */
        --table-border-color: hsl(200, 7%, 13%);
        --table-header-bg: transparent;
        --table-alternate-bg: var(--grayscale-2);
        --table-border: var(--grayscale-6);
    }
}

/* Display P3 color space support for prefers-color-scheme: dark */
@supports (color: color(display-p3 1 1 1)) {
    @media (color-gamut: p3) and (prefers-color-scheme: dark) {
        html:not(.js) {
            --grayscale-1: color(display-p3 0.067 0.067 0.067);
            --grayscale-2: color(display-p3 0.098 0.098 0.098);
            --grayscale-3: color(display-p3 0.135 0.135 0.135);
            --grayscale-4: color(display-p3 0.163 0.163 0.163);
            --grayscale-5: color(display-p3 0.192 0.192 0.192);
            --grayscale-6: color(display-p3 0.228 0.228 0.228);
            --grayscale-7: color(display-p3 0.283 0.283 0.283);
            --grayscale-8: color(display-p3 0.375 0.375 0.375);
            --grayscale-9: color(display-p3 0.431 0.431 0.431);
            --grayscale-10: color(display-p3 0.484 0.484 0.484);
            --grayscale-11: color(display-p3 0.706 0.706 0.706);
            --grayscale-12: color(display-p3 0.933 0.933 0.933);
            --grayscale-surface: color(display-p3 0 0 0 / 5%);
        }
    }
}

/* ============================================================
   Table Styling
   ============================================================ */

/* Make wide tables scroll horizontally if they overflow */
.table-wrapper {
    overflow-x: auto;
}

/* Base table structure */
table {
    margin: 0 auto;
    border-collapse: collapse;
    width: 100%;
    border: 1px solid var(--table-border, var(--table-border-color));
    border-radius: 4px;
    overflow: hidden;
}

/* Cell padding and borders */
table td,
table thead th {
    padding: 8px 8px; 
    text-align: left;
    border-block-end: 1px solid var(--table-border, var(--table-border-color));
}

/* Table header background */
table thead {
    background: var(--table-header-bg);
}

/* Table header styling */
table thead th {
    font-family: 'Sohne', ui-sans-serif, system-ui, sans-serif;
    font-weight: 600;
    color: var(--fg);
    border-block-end: 1px solid var(--table-border, var(--table-border-color));
}

/* Alternative header cells (td in thead) */
table thead td {
    font-weight: var(--font-body-weight-kraeftig);
    border: none;
    border-block-end: 1px solid var(--table-border, var(--table-border-color));
}

/* Header rows should not have borders */
table thead tr {
    border: none;
}

/* Zebra striping - alternate background colors for rows */
table tbody tr:nth-child(even) {
    background: var(--table-alternate-bg);
}

/* Remove border from last row */
table tbody tr:last-child td {
    border-block-end: none;
}

/* Remove inline borders from body cells */
table tbody td {
    border-inline-end: none;
    border-inline-start: none;
}
