/* === Reset / base styles === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* === Layout Helpers === */
.container {
    width: 90%;
    max-width: 800px;
    margin: 0 auto;
}

html {
    scroll-behavior: smooth;
}

/* === Header === */
.site-header {
    position: sticky;
    top: 0;
    z-index: 999;
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid #eee;
    padding: 1rem 0;
    transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title.small {
    font-size: 1rem;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.site-nav a {
    color: #555;
    text-decoration: none;
    margin-left: 1.5rem;
    font-weight: 500;
    transition: color 0.2s ease-in-out;
}

.site-nav a:hover {
    color: #111;
}

/* === Menu / Scroll === */

#dataset,
#authors,
#cite,
#contact {
    scroll-margin-top: 6rem; /* adjust to header height */
}

/* === Main / content === */
.site-main {
    padding: 2rem 0;
}

.intro h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: #111;
}

.intro p {
    font-size: 1.125rem;
    color: #444;
    max-width: 600px;
}

/* === Footer === */
.site-footer {
    padding: 2rem 0;
    border-top: 1px solid #eee;
    text-align: center;
    color: #777;
    font-size: 0.9rem;
}

/* ---------- Existing base styles assumed above (reset, container, header, footer) ---------- */

/* Tablet-specific/hero styles */
.tablet-main {
    padding: 1.5rem 0 4rem;
    background-color: #fff;
}

.tablet-hero {
    text-align: center;
    max-width: 760px;
    margin: 0 auto;
    padding: 4rem 1rem;
}

/* Logo */
.tablet-logo {
    display: block;
    margin: 0 auto 1.5rem;
    width: 110px;
    height: auto;
    image-rendering: -webkit-optimize-contrast;
}

.tablet-title {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 3.2rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    margin: 0.5rem 0 1.2rem;
    color: #111;
    line-height: 1.1;
}

@media (max-width: 640px) {
    .tablet-title {
        font-size: 2.4rem;
        letter-spacing: 0.08em;
    }
}

/* Description paragraph similar tone to Things */
.tablet-description {
    font-size: 1.125rem;
    color: #444;
    max-width: 46ch;
    margin: 0 auto 1.5rem;
    line-height: 1.6;
}

mark {
    background: rgba(113, 153, 209, .25);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-weight: 500;
}

.tablet-main-diagram {
    width: 100%;
    max-width: 720px;
    margin: 1.2rem 0 2rem;
}

/* CTA button — minimal, slightly elevated */
.tablet-cta {
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    text-decoration: none;
    padding: 0.9rem 1.6rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.98rem;
    border: 1px solid transparent;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* primary (Download) style resembling the prominent Thing button */
.btn-primary {
    background: linear-gradient(180deg, #111 0%, #0b0b0b 100%);
    color: #fff;
    box-shadow: 0 6px 18px rgba(17,17,17,0.12);
}

.btn-primary:hover,
.btn-primary:focus {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(17,17,17,0.14);
    outline: none;
}

/* Subtle divider and details */
.tablet-divider {
    border: none;
    height: 1px;
    background: #efefef;
    margin: 2.5rem auto;
    max-width: 720px;
}
.tablet-cite,
.tablet-details,
.tablet-contact {
    text-align: left;
    color: #444;
    font-size: 1rem;
    line-height: 1.6;
    margin-top: 3rem;
}

/* Make sure header small title looks good on dataset page */
.site-title.small {
    font-size: 1rem;
    letter-spacing: 0.06em;
    font-weight: 700;
}

/* Responsive tweaks */
@media (max-width: 640px) {
    .tablet-hero {
        padding: 3rem 1rem;
    }
    .tablet-title {
        font-size: 2rem;
    }
    .tablet-logo { width: 110px; }
    .btn { padding: 0.75rem 1.2rem; }
}

/* === Cite section === */

/* === Cite block with Copy button === */
.cite-block {
    margin-top: 1rem;
    position: relative;
}

.cite-block pre {
    background-color: #f6f8fa;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #24292e;
    margin: 0;
}

/* Copy button (GitHub-inspired) */
.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: #f6f8fa;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #24292e;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.copy-btn:hover {
    background-color: #f3f4f6;
    border-color: #c9d1d9;
}

.copy-btn:active {
    background-color: #eaeef2;
}

/* Links with the "light-url" class */
a.light-url {
    color: #5c9cf5;
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

a.light-url:hover,
a.light-url:focus {
    color: #2f7be7; /* slightly darker blue on hover */
    text-decoration: underline;
}

a.light-url:visited {
    color: #5c9cf5; /* keep consistent color for visited links */
}

/* === Authors section === */
.tablet-authors {
    margin-top: 3rem;
    margin-bottom: 2.5rem;
    text-align: left;
    color: #333;
}

.tablet-authors h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: #111;
}

/* Grid: 4 in a row on wide screens, collapses to 2x2 below 900px */
.authors-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    align-items: start;
    max-width: 960px;
    margin: 0.5rem 0;
}

/* Author card */
.author {
    display: inline-block;
    text-align: center;
    margin: 0.5rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
}

.author img {
    border-radius: 50%;
    width: 80px;
    height: 80px;
    object-fit: cover;
}

.author:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    background-color: white;
}

/* Circular photo */
.author-photo {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    margin: 0 auto 0.6rem;
    box-shadow: 0 6px 18px rgba(17,17,17,0.06);
    border: 2px solid rgba(0,0,0,0.03);
}

/* Name and affiliation */
.author-caption {
    font-size: 0.95rem;
    color: #333;
    line-height: 1.2;
}

.author-name {
    margin-bottom: 0.18rem;
}

.author-affil {
    font-size: 0.86rem;
    color: #666;
}

/* Responsive behavior: collapse to 2 columns on medium/smaller screens */
@media (max-width: 900px) {
    .authors-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .author-photo {
        width: 84px;
        height: 84px;
    }
}

/* Small screens: single column stacking (optional) */
@media (max-width: 420px) {
    .authors-grid {
        grid-template-columns: 1fr;
    }

    .author-photo {
        width: 88px;
        height: 88px;
    }
}

/* Formal university name styling */
.author-uni {
    font-family: "Times New Roman", Times, Georgia, serif;
    font-size: 0.9rem;
    color: #444;
    margin-top: 0.1rem;
    letter-spacing: 0.01em;
}

.author-uni .of {
    font-style: italic;
    font-weight: 400;
    color: #333;
}

/* === TABLE === */

/* === Tasks table === */
.table-wrap {
    margin-top: 2rem;
    overflow-x: auto; /* allow horizontal scroll if needed */
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
}

/* Clean table styling matching the site's aesthetic */
.tasks-table {
    width: 100%;
    border-collapse: separate;
    font-size: 0.95rem;
    color: #333;
    min-width: 640px; /* encourage horizontal scroll on narrower screens */
}

.tasks-table thead th {
    text-align: left;
    font-weight: 700;
    padding: 0.9rem 0.75rem;
    border-bottom: 1px solid #eee;
    color: #111;
    background: transparent;
    overflow: visible;
    position: relative; /* ensure positioned context but lower z-index by default */
}

.tasks-table tbody td {
    #padding: 0.75rem 0.75rem;
    border-bottom: 1px solid #fafafa;
    vertical-align: middle;
    overflow: visible;
    position: relative; /* ensure positioned context but lower z-index by default */
}

.tasks-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    padding-right: 1rem;
}

.tasks-table .pct {
    color: #666;
    margin-left: 0.5rem;
    font-size: 0.88rem;
}

/* Seeds column behavior */
.seeds-cell {
    position: relative;
    max-width: 340px; /* cap for layout, can adjust */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 1; /* default */
}

/* always show the first seed */
.seed-first {
    display: inline-block;
    margin-right: 0.4rem;
    font-weight: 600;
    color: #444;
}

/* the toggle button that reveals the full list */
.seeds-toggle {
    display: inline-block;
    #background: transparent;
    background: #EDF2FC;
    border: 0;
    padding: 0 0.35rem;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: #5c9cf5; /* use your light-url blue for affordance */
    border-radius: 4px;
}

/* slight hover affordance */
.seeds-toggle:hover,
.seeds-toggle:focus {
    text-decoration: underline;
    outline: none;
}

/* the popover (hidden by default) */
.seeds-popover {
    display: none;
    position: absolute;
    left: 0;
    top: 2.6rem;
    min-width: 220px;
    max-width: 460px;
    background: #ffffff;
    border: 1px solid #e6e9ee;
    box-shadow: 0 10px 30px rgba(15, 20, 25, 0.06);
    padding: 0.7rem;
    border-radius: 8px;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    font-size: 0.92rem;
    #color: #222;
    white-space: normal;
    font-weight: 600;
    color: #444;
}

/* show popover on hover (desktop) */
.seeds-cell:hover .seeds-popover,
.seeds-cell:focus-within .seeds-popover {
    display: block;
}

/* when popover opened by JS we add .open on parent */
.seeds-cell.open {
    z-index: 9999; /* bring the opened cell (and its popover) above everything else */
}

/* ensure the popover itself has very high stacking priority */
.seeds-popover {
    z-index: 10000;
}

/* small screens — hide the long seeds list in the table cell itself and rely on the popover */
@media (max-width: 900px) {
    .seeds-cell {
        max-width: 160px;
    }

    /* prevent the full comma list from overflowing — the popover is the source of truth */
    .seeds-cell .seeds-popover {
        left: 0;
        right: auto;
    }
}

/* visually-hidden helper */
.visually-hidden {
    position: absolute !important;
    height: 1px; width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

/* accent for total row */
.tasks-table .total-row td {
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

/* Ultra-compact table layout */
.tasks-table {
    border-collapse: collapse; /* remove any extra spacing between rows */
    width: 100%;
    font-size: 0.9rem;
    line-height: 1.2;
}

/* Reduce padding dramatically */
.tasks-table th,
.tasks-table td {
    padding: 2px 8px; /* minimal spacing */
}

/* Left-align first two columns */
.tasks-table th:first-child,
.tasks-table td:first-child,
.tasks-table th:nth-child(2),
.tasks-table td:nth-child(2) {
    text-align: left;
}

/* Right-align numeric column */
.tasks-table th:last-child,
.tasks-table td:last-child {
    text-align: right;
}

/* Optional: subtle horizontal separators for clarity */
.tasks-table tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Make sure table looks good on very small screens */
@media (max-width: 420px) {
    .tasks-table thead th {
        font-size: 0.9rem;
    }
    .tasks-table {
        min-width: 520px;
    }
}

/* 1) Ensure table and rows don't create higher stacking contexts */
.tasks-table,
.tasks-table thead,
.tasks-table tbody,
.tasks-table tr,
.tasks-table th,
.tasks-table td {
    position: static; /* avoid creating new stacking context unexpectedly */
    z-index: auto;
}

/* 2) Make the seeds cell positioned for absolute popover placement,
   but keep its default z-index low unless opened */
.seeds-cell {
    position: relative;   /* positioning context for the popover */
    z-index: 1;           /* keep it low by default */
}

/* 3) When opened, raise the cell just above other rows */
.seeds-cell.open {
    z-index: 9999;        /* high enough to beat other page elements */
}

/* 4) Popover itself must be above the opened cell */
.seeds-popover {
    position: absolute;   /* placed relative to .seeds-cell */
    top: calc(100% + 8px);
    left: 0;
    z-index: 10000;       /* 1 above .seeds-cell.open */
}

/* 5) If you're using backdrop-filter or anything that creates a stacking context
   on the header or other ancestors, ensure they have lower z-index than popover */
.site-header,
.site-footer {
    z-index: 1000;        /* keep header/footer below popovers */
}

/* 6) Defensive: if any ancestor still creates an isolated stacking context
   (e.g., has transform, filter, will-change), move the popover into the document body.
   This CSS is for the portal fallback; it won't hurt if you don't use it. */
.seeds-popover-portal {
    position: absolute !important;
    z-index: 10000 !important;
}
/* ======================== TABLE ===================== */
/* Two-column layout containing the table and the right-side element */
.table-and-side {
    display: flex;
    gap: 0.25rem;              /* space between table and side column */
    align-items: flex-start;   /* align top edges */
    margin-top: 1rem;
    width: 100%;
}

/* Left column (table) allowed to shrink — min-width: 0 is important */
.table-column {
    flex: 1 1 0%;
    min-width: 0;              /* allows the table to shrink inside flex */
}

/* The wrapper keeps the table scrollable if it gets too narrow */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Right side column: fixed-ish width but flexible */
.side-column {
    flex: 0 0 320px;           /* recommended width for image; change as needed */
    max-width: 34%;
    min-width: 160px;
    text-align: left;
}

/* Image styling */
.side-image {
    display: block;
    width: 200px;
    height: auto;
    object-fit: contain;
    box-shadow: 0 8px 20px rgba(15,20,25,0.06);
    margin-bottom: 0.5rem;
    margin-top: 2.5rem;
}

/* Make table less likely to force overflow — allow it to compress */
.tasks-table {
    width: 100%;
    min-width: 0; /* allow shrinking inside .table-column */
    table-layout: auto; /* keep normal layout for readability */
}

/* === RESPONSIVE: stack image under table when table gets too narrow === */
@media (max-width: 900px) {
    .table-and-side {
        flex-direction: column; /* stack vertically */
        gap: 0.75rem;           /* smaller gap when stacked */
    }

    .side-column {
        flex: 0 0 auto;
        max-width: 100%;
        width: 100%;
    }
}

/* Make the canvas responsive */
.side-column canvas {
    max-height: 200px;
    margin-bottom: 0.5rem;
    display: block;
    max-width: 200px;
    margin-top: 2.5rem;
}

/* Legend text styling */
#pie-legend {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #666;
}

/* Optional: subtle hover effect on slices */
.side-column canvas:hover {
    cursor: pointer;
}

.pie-title {
    margin-top: 2.0rem;
}

/* ===== Buttons ====== */
.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap; /* wrap on narrow screens */
    justify-content: center; /* centers buttons horizontally */
    margin-top: 1.5rem;
}

.main-button {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* space between icon and text */
    background-color: #fff;
    color: #000;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.65rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(15,20,25,0.12);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.download-button {
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    font-weight: 600;
    color: #fff;
    background:#3c84f3;
    box-shadow: 0 6px 20px rgba(15,20,25,0.2);
}

.main-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(15,20,25,0.12);
}

.main-button:active {
    transform: translateY(0);
    box-shadow: 0 6px 20px rgba(15,20,25,0.06);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2em;
    height: 1.2em;
}

.btn-icon svg {
    width: 1.2em;
    height: 1.2em;
    display: block;
}

.btn-icon-download svg path {
    transform: scale(0.85);
    transform-origin: center;
    stroke: currentColor;
    stroke-width: 1.0;
    paint-order: stroke fill;
}

/* ==== Downloads ==== */
/* container / animation */
.dataset-table-container {
    height: 0;
    overflow: hidden;
    transition: height 360ms cubic-bezier(.2,.9,.2,1);
    will-change: height;
}

/* inner padding/content */
.dataset-content {
    padding: 0.75rem 0; /* controls spacing inside expanded area */
    background: transparent;
}

/* short explanatory note */
.dataset-note {
    margin: 0 0 0.5rem 0;
    color: #444;
    font-size: 0.95rem;
    max-width: 72ch;
}

/* GitHub-style code block */
.gh-code-block {
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", "Courier New", monospace;
    font-size: 0.92rem;
    color: #24292e;
    margin: 0 0 0.75rem 0;
    overflow-x: auto;
}

/* dataset / parts table shared styles */
.dataset-block {
    margin-bottom: 0.8rem;
}

.dataset-table, .parts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    color: #333;
    margin-top: 0.25rem;
}

/* compact padding */
.dataset-table th, .dataset-table td,
.parts-table th, .parts-table td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

/* header style */
.dataset-table thead th, .parts-table thead th {
    text-align: left;
    font-weight: 700;
    color: #111;
    padding-bottom: 8px;
    background: transparent;
}

/* right-align numeric columns (train examples / sizes) */
.dataset-table th:nth-child(2),
.dataset-table td:nth-child(2),
.parts-table th:nth-child(2),
.parts-table td:nth-child(2) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* rightmost download column center */
.dataset-table td:last-child,
.parts-table td:last-child {
    text-align: center;
}

/* light links */
a.light-url {
    color: #3c84f3;
    text-decoration: none;
}
a.light-url:hover { text-decoration: underline; }

/* small visual divider between blocks */
.dataset-sub-divider {
    height: 12px;
}

/* intra-header (low-toned highlighted row) */
.intra-header td {
    background: linear-gradient(90deg, rgba(242,246,250,1), rgba(250,250,250,1));
    color: #2f5d7f;
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.intra-header strong {
    font-weight: 600;

}

/* make sure the .num class uses narrow digits and right alignment */
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* small screens: keep layout readable */
@media (max-width: 640px) {
    .gh-code-block { font-size: 0.88rem; padding: 0.5rem; }
    .dataset-note { font-size: 0.9rem; }
    .dataset-table th, .dataset-table td,
    .parts-table th, .parts-table td { padding: 6px 6px; }
}

/* === Dataset Table Alignment === */
.dataset-table th:nth-child(1),
.dataset-table td:nth-child(1),
.parts-table th:nth-child(1),
.parts-table td:nth-child(1) {
    text-align: left;
}

.dataset-table th:nth-child(2),
.dataset-table td:nth-child(2),
.dataset-table th:nth-child(3),
.dataset-table td:nth-child(3),
.dataset-table th:nth-child(4),
.dataset-table td:nth-child(4),
.parts-table th:nth-child(2),
.parts-table td:nth-child(2),
.parts-table th:nth-child(3),
.parts-table td:nth-child(3) {
    text-align: right;
}

/* Align explanatory text and code block to the left */
.dataset-content {
    text-align: left;
    margin-left: auto;
    margin-right: auto;
    max-width: 720px; /* optional, keeps lines readable */
}

/* Optional: make the code block left-aligned as well */
.dataset-content .gh-code-block {
    text-align: left;
    margin-left: 0;
}

.intra-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2em;
    height: 1.2em;
    color: #2f5d7f;
    vertical-align: middle; /* aligns with text baseline */
    margin-right: 0.3em;     /* nice spacing between icon and text */
}

.intra-header-icon svg {
    width: 1.2em;
    height: 1.2em;
    display: block;
}

.clean-url {
    color: inherit;
    text-decoration: none;
    font-weight: inherit;
    cursor: pointer;
}