:root {
    --footer-height: 24px;
    --sheet-title-bar-height: 40px;
    --sheet-header-height-offset: 13px;
    --navigation-height: 48px;
    --header-height: 80px;
    --sbwidth: 0px;
    --mobile-scale: 1; /* JS sets <1 on mobile to fit table to 100vw */

    /* Background Colors */
    --site-header-bg: #444;
    --nav-bg: #333;
    --nav-button-bg: #e00000;
    --nav-button-hover-bg: #a60000;
    --sheet-title-bg: #aaa;
    --sheet-header-bg: #bbb;
    --sub-header-bg: #ddd;
    --cell-bg: #fff;
    --loader-overlay-bg: rgba(0,0,0,0.4);
    --footer-bg: #303030;
    --modal-backdrop-bg: rgba(0,0,0,0.5);
    --modal-bg: #fff;

    /* Border Coloring */
    --nav-border: #000;
    --cell-border: #333;
    --separator-color: #000;
    --sheet-header-border: #666;
    --loader: #e00000;

    /* Font Colors */
    --site-header-color: #f00;
    --nav-color: #fff;
    --sheet-title-color: #f00;
    --sheet-header-color: #000;
    --sub-header-color: #f00;
    --footer-color: #eee;
    --footer-link-color: #e00000;
    --modal-color: #000;
}
html { font-size: 14px; }
html, body {
    margin: 0;
}
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: scroll;
    overflow-y: scroll;
    width: fit-content;
}
.body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

/* ### Header & Title Bar ### */
.header-wrapper {
    position: sticky;
    left: 0;
    width: calc(100vw - var(--sbwidth, 0px)); /* account for scrollbar width */
    z-index: 6;
}
.header {
    background-color: var(--site-header-bg);
    padding: 10px;
    justify-content: space-between;
    align-items: center;
    display: flex;
}
.print-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    padding: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
}
.print-btn:hover { opacity: 0.85; }

.header-title {
    font-family: "UT-Nickel", "Russo One", sans-serif;
    padding-left: 10px;
    font-size: 4rem;
    color: var(--site-header-color);
    -webkit-text-stroke: #000 0.01px;
    text-shadow: 1px 1px 2px black;
    margin: 0px;
}

/* Hamburger Menu w/ Animation */
.hamburger-wrapper {
    position: relative;
    display: none;
    flex-direction: column;
    align-items: flex-end;
    padding: 0 8px;
}

.hamburger {
    width: 30px;
    height: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    z-index: 10;
}

.hamburger span {
    display: block;
    height: 4px;
    background: white;
    border-radius: 2px;
    transition: 0.4s ease;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Mobile View Dropdown Menu */
.mobile-menu {
    position: absolute;
    top: 56px;
    right: 0;
    background-color: var(--nav-bg);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    overflow: hidden;
    max-height: 0;
    width: 200px;
    padding: 0 10px; /* combine left/right padding */
    display: flex;
    flex-direction: column;
    transform: translateY(0);
    transition:
        max-height 0.5s ease,
        padding-top 0.4s ease,
        padding-bottom 0.4s ease,
        transform 0.4s ease;
    z-index: 100;
    padding-top: 0px;
    padding-bottom: 0px;
}

.mobile-menu.show {
    max-height: 1000px;
    padding-top: 6px;
    padding-bottom: 6px;
}

/* shared button styles for navigation and mobile menu */
.navigation button,
.mobile-menu button {
    background-color: var(--nav-button-bg);
    color: var(--nav-color);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    text-align: center;
    transition: background 0.2s ease;
}

.mobile-menu button {
    width: 100%;
    margin: 4px 0;
    padding: 10px;
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
    pointer-events: none;
    border-radius: 4px;
    transition: background 0.2s, opacity 0.3s ease, transform 0.4s ease;
}

.mobile-menu.show button {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Opening Animation */
.mobile-menu.show button:nth-child(1) { transition-delay: 0.05s; }
.mobile-menu.show button:nth-child(2) { transition-delay: 0.10s; }
.mobile-menu.show button:nth-child(3) { transition-delay: 0.15s; }
.mobile-menu.show button:nth-child(4) { transition-delay: 0.20s; }
.mobile-menu.show button:nth-child(5) { transition-delay: 0.25s; }
.mobile-menu.show button:nth-child(6) { transition-delay: 0.30s; }
.mobile-menu.show button:nth-child(7) { transition-delay: 0.35s; }

/* Closing Animation */
.mobile-menu.hiding button:nth-child(1) { transition-delay: 0.35s; }
.mobile-menu.hiding button:nth-child(2) { transition-delay: 0.30s; }
.mobile-menu.hiding button:nth-child(3) { transition-delay: 0.25s; }
.mobile-menu.hiding button:nth-child(4) { transition-delay: 0.20s; }
.mobile-menu.hiding button:nth-child(5) { transition-delay: 0.15s; }
.mobile-menu.hiding button:nth-child(6) { transition-delay: 0.10s; }
.mobile-menu.hiding button:nth-child(7) { transition-delay: 0.05s; }

.mobile-menu.hiding {
    max-height: 0;
    padding-top: 0px;
    padding-bottom: 0px;
    transition-delay: 0.2s;
}

.mobile-menu.hiding button {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
    pointer-events: none;
}

.mobile-menu button:hover {
    background-color: var(--nav-button-hover-bg);
}

/* ### Navigation Bar ### */
.navigation {
    margin: 0px;
    padding: 0 5px;
    background-color: var(--nav-bg);
    border-top: 4px solid var(--nav-border);
    border-bottom: 4px solid var(--nav-border);
    width: calc(100vw - var(--sbwidth, 0px) - 10px); /* account for scrollbar width / padding */
    position: sticky;
    left: 0;
}
.navigation .buttons {
    display: flex;
    justify-content: left;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
}

.navigation button {
    font-family: "Roboto", sans-serif;
    font-weight: 650;
    width: 120px;
    padding: 10px 0;
    font-size: 1rem;
    box-sizing: border-box;
    margin: 5px;
    text-align: center;
    cursor: pointer;
    background-color: var(--nav-button-bg);
    color: var(--nav-color);
    border: none;
    border-radius: 5px;
    transition: background 0.4s ease;
}

.navigation button:hover {
    background-color: var(--nav-button-hover-bg);
}

/* ### Main Body Content ### */
/* Loading Icon */
.excel-content .overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--loader-overlay-bg);
    backdrop-filter: blur(4px);
    display: flex;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 999;
}
.excel-content .loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid transparent;
    border-top: 4px solid var(--loader);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}
.excel-content.loading .overlay,
.excel-content.loading .loader {
    opacity: 1;
    pointer-events: all;
}
@keyframes spin {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}
/* ───────────────────────────────────────────────────────────────────────────── */
/*                              Base table styling                               */
/* ───────────────────────────────────────────────────────────────────────────── */
.excel-content {
    flex: 1 1 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ────────── Mobile Scale Wrapper ────────── */
.excel.content .table-scale {
    position: relative;
    width: 100vw;
}

/* ────────── Sheet Title Bar ────────── */
.sheet-title-bar {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--sheet-title-bar-height);
    padding: 6px 10px;
    border-bottom: 1px solid var(--sheet-header-border);
    background: var(--sheet-title-bg);
    left: 0;
    width: calc(100vw - var(--sbwidth, 0px) - 20px); /* account for padding + scrollbar */
}
.sheet-title {
    margin: 0;
    position: sticky;
    left: 10px;
    z-index: 5;
    background: var(--sheet-title-bg);
    padding-right: 8px;
}
.sheet-title .sheet-title-sticky {
    color: var(--sheet-title-color);
    font-family: "Russo One", sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    -webkit-text-stroke-width: 0.3px;
    -webkit-text-stroke-color: black;
    text-shadow: 0.5px 0.5px 1.5px black;
    display: inline-block;
}

/* ────────── Print Header Style - Sheet Title ────────── */
.print-header {
    display: none;  /* Shown Only in Print */
    font-family: "Russo One", sans-serif;
    font-size: 1.5rem;
    margin: 0 0 12px 0;
    color: #000;
}

/* ────────── Table Styling ────────── */
.excel-content #excel-output {
	flex: 0 1 auto;     /* fill remaining space under the title bar */
	min-height: auto;   /* allow scroll container to shrink */
	height: auto;       /* no fixed height math */
}
.excel-content .excel-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
}

/* ────────── Sticky Sheet Header ────────── */
.excel-content .excel-table thead {
    position: sticky;
    top: calc(var(--sheet-title-bar-height) + var(--sheet-header-height-offset));
    z-index: 3;
}

/* ────────── Font Definition for Table ────────── */
.excel-content .excel-table,
.excel-content .excel-table th,
.excel-content .excel-table td {
    font-family: "Roboto", sans-serif;
}

/* ────────── not sure ────────── */
.excel-content .excel-table col {
    vertical-align: top;
}

.excel-content .excel-table th,
.excel-content .excel-table td {
    border: 1px solid var(--cell-border);
    padding: 6px 8px;
    text-align: left;
    white-space: nowrap;
    background-clip: padding-box;
	vertical-align: top;
}

/* Clip long content ONLY when we explicitly set a width/max-width from JS */
.excel-cell-wrap {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Price column hook (via data-type="price") */
.excel-content .excel-table td[data-type="price"] {
	text-align: right;
}

/* Column hook for align-left */
.excel-content .excel-table td[data-align="left"] {
	text-align: left;
}
/* Column hook for align-right */
.excel-content .excel-table td[data-align="right"] {
	text-align: right;
}
/* Column hook for align-center */
.excel-content .excel-table td[data-align="center"] {
    text-align: center;
}

/* Separator row styling */
.excel-content .excel-table tbody tr.separator td {
    border: none;
    border-top: 1px solid var(--separator-color);
    height: 0;
    padding: 0;
    background: transparent;
}

/* Highlight Header Titles */
.excel-content .excel-table thead tr:nth-child(1) {
    font-weight: bold;
    background: var(--sheet-header-bg);
    color: var(--sheet-header-color);
}

/* Sub Headers */
.excel-content .excel-table tbody tr.sub-header td {
    position: relative;
    background-color: var(--sub-header-bg);
    text-shadow: 1px 1px 2px black;
    font-weight: bold;
    padding: 8px;
    color: var(--sub-header-color);
    font-family: "Russo One", sans-serif;
    font-size: 1.1rem;
}
.excel-content .excel-table tbody tr.sub-header .sub-header-sticky {
    position: sticky;
    left: 9px;
    z-index: 2;                 /* above scrolling cells */
    background: #ddd;         /* same as sub-header row bg to mask underflow */
    padding-right: 8px;
    display: inline-block;
    -webkit-text-stroke-color: black;
    -webkit-text-stroke-width: 0.15px;
}

/* Conditional color hooks using data attributes set in JS */
[data-condition="Used C"] { color: #f00; font-weight: 500; }
[data-condition="Used"] { color: #f00; }
[data-condition="Very Good"] { color: #2c9631; }
[data-condition="Like New"] { color: #00bd09; }
[data-condition="Brand New"] { color: #00ff11; font-weight: 600; }

/* Keyword text colors for when data-color is set */
[data-color="black"] { color: #000; }
[data-color="blue"] { color: #1565c0; }
[data-color="red"] { color: #df1a1a; }
[data-color="green"] { color: #2d9632; }
[data-color="gray"] { color: #616161; }
[data-color="dark gray"] { color: #333333; }
[data-color="light gray"] { color: #8f8f8f; }
[data-color="orange"] { color: #ef6c00; }
[data-color="yellow"] { color: #f9d925; }
[data-color="purple"] { color: #6a1b9a; }
[data-color="teal"] { color: #00bda7; }
[data-color="camo"] { color: #667441; }
[data-color="kit"] { color: #ff8c00; font-family: "Russo One", sans-serif; font-style: italic; font-weight: bold; text-decoration: underline; }

/* Keyword text colors for when data-color is set (Clothing Sizes) */
td:is([data-col="MEN" i],[data-col="WOMEN" i])[data-color="S"] { color: #494529 }
td:is([data-col="MEN" i],[data-col="WOMEN" i])[data-color="M"] { color: #c00 }
td:is([data-col="MEN" i],[data-col="WOMEN" i])[data-color="L"] { color: #974706 }
td:is([data-col="MEN" i],[data-col="WOMEN" i])[data-color="XL"] { color: #07c }
td:is([data-col="MEN" i],[data-col="WOMEN" i])[data-color="2X"] { color: #8064a2 }
td:is([data-col="MEN" i],[data-col="WOMEN" i])[data-color="3X"] { color: #f00 }
td:is([data-col="MEN" i],[data-col="WOMEN" i])[data-color="4X"] { color: #f00 }

/* ### Footer ### */
footer {
    height: var(--footer-height);
    position: sticky;
    left: 0;
    width: calc(100vw - var(--sbwidth, 0px) - 16px); /* account for padding + scrollbar */
    background: var(--footer-bg);
    color: var(--footer-color);
    padding: 8px;
    font-size: 0.75rem;
    z-index: 50;
    margin-top: auto;
    text-align: center;
}
footer a {
    color: var(--footer-link-color);
    text-decoration: none;
}
footer .footer-box {
    position: static;
}

/* ### Modal ### */
/* Modal backdrop + container */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    padding-bottom: var(--footer-height);
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 20;
}

/* When active, allow clicks and fade in */
.modal.active {
    opacity: 1;
    pointer-events: auto;
}

/* Modal content wrapper */
.modal-card {
    background: var(--modal-bg);
    color: var(--modal-color);
    max-width: 500px;
    width: 90%;
    max-height: 85%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 6px;
    position: relative;
    font-family: "Roboto", sans-serif;
    font-size: 1rem;
    transform: translateY(-10px);
    transition: transform 0.3s ease;
}
.modal.active .modal-card {
    transform: translateY(0);
}
.modal-content {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px;
}
.modal-content h2 {
    text-align: center;
}
.modal-backdrop {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: var(--modal-backdrop-bg);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 19;
}
.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-close {
    flex-shrink: 0;
    display: block;
    width: 100%;
    padding: 12px 16px;
    background-color: var(--nav-button-bg);
    color: var(--nav-color);
    border: none;
    border-top: 1px solid rgba(0,0,0,0.08);
    border-radius: 0 0 6px 6px;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s ease;
}
.modal-close:hover,
.modal-close:focus-visible {
    background-color: var(--nav-button-hover-bg);
}

/* --- Markdown content inside the modal --- */
.modal-content h1, .modal-content h2, .modal-content h3 { margin: 0.3em 0 0.4em; }
.modal-content h4 {margin: 0.7em 0;}
.modal-content p { margin: 0.25em 0; line-height: 1.2; }
.modal-content ul, .modal-content ol { margin: 0.25em 0; padding-left: 2ch; }
.modal-content li { margin: 0; line-height: 1.25; }
.modal-content hr { border: none; border-top: 1px solid #ccc; margin: 12px 0; }

/* Font-size utilities used by the editor component */
.modal-content .fs-sm { font-size: 0.9rem; }
.modal-content .fs-md { font-size: 1rem; }   /* default */
.modal-content .fs-lg { font-size: 1.15rem; }
.modal-content .fs-xl { font-size: 1.3rem; }

/* Responsive Format and Layout */
@media (max-width: 398px) {
    :root {
        --header-height: 24px;
        --sheet-title-bar-height: 12px;
    }
    html { font-size: clamp(10px , 2.5vw + 10px, 14px); }
    body {
        overflow: auto;
    }
    .header-wrapper {
        position: sticky !important;
        width: 100vw !important; /* ignore scrollbar width on wide screens */
    }
    .header-title {
        font-size: 1.5rem;
    }
    .header {
        height: var(--header-height) !important;
    }
    .navigation {
        display: none !important;
    }
    .hamburger-wrapper {
        display: flex;
        
    }
    .sheet-title-bar {
        height: var(--sheet-title-bar-height);
    }
    .sheet-title #sheet-title{
        font-size: 0.75rem;
    }
    .excel-content .excel-table {
        transform: scale(var(--mobile-scale, 1));
        transform-origin: top left;
        will-change: transform;
    }
    .excel-content .excel-table thead {
        position: static;
        top: auto;
        z-index: auto;
    }
}
@media (399px <= width <= 934px) {
    :root {
        --header-height: 24px;
        --sheet-title-bar-height: 16px;
    }
    html { font-size: clamp(10px , 2.5vw + 10px, 14px); }
    body {
        overflow: auto;
        overflow-x: hidden;
        width: 100vw;
    }
    .header-wrapper {
        position: sticky !important;
        width: 100vw !important; /* ignore scrollbar width on wide screens */
    }
    .header-title {
        font-size: 2rem;
        height: var(--header-height);
    }
    .navigation {
        display: none !important;
    }
    .hamburger-wrapper {
        display: flex;
        
    }
    .sheet-title-bar {
        height: var(--sheet-title-bar-height);
    }
    .sheet-title #sheet-title{
        font-size: 1rem;
    }
    .excel-content .excel-table {
        transform: scale(var(--mobile-scale, 1));
        transform-origin: top left;
        will-change: transform;
    }
    .excel-content .excel-table thead {
        position: static;
        top: auto;
        z-index: auto;
    }
}
@media (min-width: 935px) {
    .mobile-menu {
        display: none !important;
    }
}

/* ───────────────────────────────────────────────────────────────────────── */
/* PRINT LAYOUT                                                              */
/* - 8mm physical margins                                                    */
/* - Show a simple print header with the sheet title                         */
/* - Disable sticky & colored backgrounds that can cause odd print shifts    */
/* - Keep cells nowrap, center the table, and scale to fit page width        */
/* ───────────────────────────────────────────────────────────────────────── */
@page {
    margin: 8mm; /* exact physical margin around the page */
}
@media print {
    :root { --mobile-scale: 1 !important; } /* Neutralize mobile Scaling */
    /* Kill any layout side-effects that add phantom margins/heights */
    html, body {
        margin: 0 !important;
        padding: 0 !important;
        min-height: auto !important;
        width: auto !important;
        overflow: visible !important;
    }
    body {
        display: block !important;       /* avoid flex in print */
        width: auto !important;          /* ignore fit-content on screen */
    }
    /* Hard reset margins/padding on printable elements so @page(8mm) is the ONLY margin. */
    body, .excel-content, #excel-output, table, thead, tbody, tr, th, td, h1, h2 {
        margin: 0 !important;
        padding: 0 !important;
    }
    .excel-content .table-scale { height: auto !important; width: auto !important; }
    .excel-content .excel-table { transform: none !important; }
    /* Restore the intended cell padding after the reset */
    .excel-content .excel-table th,
    .excel-content .excel-table td {
        padding: 6px 8px !important;
    }

    /* Hide all non-print chrome so only table + print-header remain */
    .header-wrapper,
    .navigation,
    footer,
    .modal,
    .modal-backdrop,
    #overlay,
    #loader,
    .sheet-actions {
        display: none !important;
    }

    /* Minimal print header (title injected by JS), no extra spacing */
    .print-header {
        display: block !important;
        background: none !important;
        color: #000 !important;
        text-shadow: none !important;
        margin: 0 0 4mm 0 !important;    /* small gap to table; no top padding */
        padding: 0 !important;
        text-align: center;
    }

    /* Nix sticky + colored bars that can skew top/bottom spacing */
    .sheet-title-bar,
    .sheet-title,
    .sheet-title .sheet-title-sticky {
        position: static !important;
        background: none !important;
        color: #000 !important;
        text-shadow: none !important;
        -webkit-text-stroke: 0 !important;
    }
    .sheet-title-bar { display: none !important; }

    /* Header row should not be sticky when printing */
    .excel-content .excel-table thead {
        position: static !important;
        top: auto !important;
        z-index: auto !important;
        background: none !important;
        color: #000 !important;
    }

    /* Sub-headers: keep font/weight, remove backgrounds/colors */
    .excel-content .excel-table tbody tr.sub-header td,
    .excel-content .excel-table tbody tr.sub-header .sub-header-sticky {
        position: static !important;
        background: none !important;
        color: #000 !important;
        text-shadow: none !important;
        padding-right: 0 !important;
    }

    /* Zero out any container padding/margins; center the table block */
    .excel-content,
    .excel-content #excel-output {
        margin: 0 !important;
        padding: 0 !important;
    }
    /* Use zoom on the whole print tree for better mobile consistency */
    body {
        zoom: var(--print-zoom, 1); /* JS sets --print-zoom; keeps physical 8mm margins exact */
    }
    .excel-content .excel-table {
        margin: 0 auto !important;   /* center horizontally */
        table-layout: auto !important;
        border-collapse: collapse;
        border-spacing: 0;
        border: 0.5px solid #000 !important; /* thin black border around table */
    }
    /* Never wrap cells; let scale handle fit */
    .excel-content .excel-table th,
    .excel-content .excel-table td {
        white-space: nowrap !important;
        border: 0.5px solid #000 !important; /* thin black border for print */
    }
    .excel-content .excel-table tbody tr.separator td {
        border-top: 0.5px solid #000 !important;
        padding: 0 !important;
    }
}

/* Font Family Declarations */
@font-face {
    font-family: "UT-Nickel";
    src: url(/assets/fonts/UT-Nickel.otf);
    font-weight: normal;
    font-style: normal;
    font-variation-settings: 
        "wdth" 100;
}