/* ============================================================
   Apollo 45th Anniversary Jacket
   Palette: work-jacket navy, chambray paper, brass hardware.
   Signature: the form card reads like a sewn-in garment label.
   ============================================================ */

:root {
    --navy: #16273c;        /* jacket shell */
    --navy-deep: #0e1a29;
    --chambray: #eef0f2;    /* page background */
    --label: #faf8f3;       /* garment label */
    --thread: #9aa5b1;      /* stitch color */
    --brass: #a97f2e;       /* zipper hardware / 45th accent */
    --ink: #1c2733;
    --ink-soft: #55616e;
    --error: #b3401f;

    --font-display: "Archivo Black", "Arial Black", sans-serif;
    --font-body: "Archivo", -apple-system, "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", "Consolas", monospace;
}

* { box-sizing: border-box; }

/* The hidden attribute must always win. Without this, any class that sets
   display (e.g. .btn { display: block }) overrides the browser's built-in
   [hidden] rule - which is how the confirm dialog's unused middle button
   ("Alt") kept showing on two-button dialogs like the Admin Report. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--chambray);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.5;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ---------- masthead ---------- */

.masthead {
    background: var(--navy);
    color: #fff;
    border-bottom: 3px solid var(--brass);
}

.masthead-inner {
    max-width: 30rem;
    margin: 0 auto;
    padding: 0.9rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.logo-link { display: block; line-height: 0; }

.logo {
    height: 44px;          /* svg is white-fill; sits directly on the navy */
    width: auto;
    display: block;
}

.logo-45 { height: 84px; } /* squarer 45th lockup gets more height */

@media (min-width: 640px) {
    .logo { height: 52px; }
    .logo-45 { height: 104px; }
}

.anniv-tab {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    color: var(--navy-deep);
    background: linear-gradient(180deg, #cfa54a, var(--brass));
    padding: 0.3rem 0.55rem;
    border-radius: 2px;
    white-space: nowrap;
}

/* ---------- page frame ---------- */

.page {
    width: 100%;
    max-width: 30rem;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 1.5rem;
}

.intro { margin: 0.5rem 0 1.5rem; }
.intro-compact { margin-bottom: 1rem; }

.intro h1 {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 5.5vw, 1.9rem);
    line-height: 1.15;
    margin: 0 0 0.6rem;
    color: var(--navy);
}

.intro p { margin: 0; color: var(--ink-soft); }

/* ---------- the stitched label card (signature) ---------- */

.card {
    background: var(--label);
    border-radius: 6px;
    padding: 1.5rem 1.25rem;
    box-shadow: 0 1px 2px rgba(14, 26, 41, 0.10), 0 8px 24px rgba(14, 26, 41, 0.08);
    position: relative;
}

.card.stitched {
    border: 1px solid #e2ddd2;
}

.card.stitched::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 2px dashed var(--thread);
    border-radius: 4px;
    pointer-events: none;
    opacity: 0.55;
}

.card > * { position: relative; }

.card-title {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin: 0 0 1.1rem;
}

/* ---------- form fields ---------- */

.field { margin-bottom: 1.1rem; border: 0; padding: 0; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled .input, fieldset:disabled .size-chip { opacity: 0.65; }

label, legend {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.input {
    width: 100%;
    font-family: var(--font-body);
    font-size: 1.05rem;       /* >=16px stops iOS zoom-on-focus */
    padding: 0.75rem 0.85rem; /* comfortable thumb target */
    border: 1.5px solid #c9c3b6;
    border-radius: 4px;
    background: #fff;
    color: var(--ink);
}

.input:focus {
    outline: 2px solid var(--navy);
    outline-offset: 1px;
    border-color: var(--navy);
}

.input-code {
    font-family: var(--font-mono);
    letter-spacing: 0.08em;
}

.hint {
    font-size: 0.82rem;
    color: var(--ink-soft);
    margin: 0.35rem 0 0;
}

.field-row { display: flex; gap: 0.75rem; }
.grow { flex: 1; }
.w-state { width: 4.5rem; }
.w-zip { width: 7rem; }

/* size picker: tappable chips, not a dropdown */

.size-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.size-chip { position: relative; margin: 0; }

.size-chip input {
    position: absolute;
    opacity: 0;
    inset: 0;
}

.size-chip span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border: 1.5px solid #c9c3b6;
    border-radius: 4px;
    background: #fff;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.size-chip input:checked + span {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

.size-chip input:focus-visible + span {
    outline: 2px solid var(--brass);
    outline-offset: 2px;
}

/* ---------- buttons ---------- */

.btn {
    display: block;
    width: 100%;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1.05rem;
    text-align: center;
    text-decoration: none;
    padding: 0.9rem 1rem;
    border-radius: 4px;
    border: 1.5px solid transparent;
    cursor: pointer;
    margin-top: 0.5rem;
}

.btn {
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--navy);
    color: #fff;
}
.btn-primary:hover { background: var(--navy-deep); }

.btn-secondary {
    /* Unified with .btn-primary: one consistent look for all regular buttons */
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}
.btn-secondary:hover { background: var(--navy-deep); border-color: var(--navy-deep); }

.btn-quiet {
    background: none;
    border: 0;
    color: var(--ink-soft);
    font-size: 0.85rem;
    text-decoration: underline;
    padding: 0.5rem;
    width: auto;
    margin: 0 auto;
    cursor: pointer;
}

.signout { margin-top: 1rem; text-align: center; }

.btn:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* ---------- validation ---------- */

/* Error chips: light red band + darker red left bar, so messages read as
   marked elements instead of stray text. The framework adds the
   *-errors / *-error classes only when something is actually wrong, so
   the chip never renders as an empty red stripe. */
.validation-summary { color: var(--error); font-weight: 600; margin-bottom: 1rem; }
.validation-summary ul { margin: 0; padding-left: 1.1rem; }
.validation-summary:empty { display: none; }
.validation-summary.validation-summary-errors {
    background: #fdecea;
    border-left: 4px solid var(--error);
    border-radius: 0 4px 4px 0;
    padding: 0.6rem 0.75rem;
}

.field-error { display: block; color: var(--error); font-size: 0.85rem; margin-top: 0.3rem; }
.field-error:empty { display: none; }
.field-error.field-validation-error {
    background: #fdecea;
    border-left: 4px solid var(--error);
    border-radius: 0 4px 4px 0;
    padding: 0.45rem 0.6rem;
    font-weight: 600;
}

/* The offending field itself: stronger border + soft red ring + faint tint */
input.input-validation-error {
    border: 2px solid var(--error);
    background: #fffbfa;
    box-shadow: 0 0 0 3px rgba(178, 58, 31, 0.12);
}

/* Chip/radio grids (style, size) have no input box to redden - outline the
   whole group while its error is showing */
.choice-grid-error {
    outline: 2px solid var(--error);
    outline-offset: 5px;
    border-radius: 4px;
}

/* ---------- confirmation summary ---------- */

.summary { margin: 0 0 1.25rem; }
.summary dt {
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-top: 0.9rem;
}
.summary dt:first-child { margin-top: 0; }
.summary dd { margin: 0.15rem 0 0; font-size: 1.05rem; }

/* ---------- footer ---------- */

.footer {
    max-width: 30rem;
    margin: 0 auto;
    padding: 0.25rem 1.25rem 2rem;
    color: var(--ink-soft);
    font-size: 0.8rem;
    text-align: center;
}

/* ---------- wider screens ---------- */

@media (min-width: 640px) {
    .page { padding-top: 2.5rem; }
    .card { padding: 2rem 1.75rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

.input-upper { text-transform: uppercase; }

.style-grid { grid-template-columns: repeat(2, 1fr); margin-bottom: 1rem; }

.footer a { color: var(--navy); text-decoration: underline; }

/* ---------- admin area ---------- */

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.admin-nav a { color: var(--navy); font-weight: 600; text-decoration: none; }
.admin-nav a:hover { text-decoration: underline; }

.admin-message {
    background: #eef6ec;
    border: 1px solid #b7d4b0;
    border-radius: 4px;
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    margin: 0 0 1rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.stat { text-align: center; padding: 1rem 0.5rem; }
.stat-num { display: block; font-family: var(--font-display); font-size: 1.6rem; color: var(--navy); }
.stat-label { display: block; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); margin-top: 0.2rem; }

.table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table th { text-align: left; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); padding: 0.4rem 0.5rem; border-bottom: 2px solid #ddd6c8; }
.table td { padding: 0.45rem 0.5rem; border-bottom: 1px solid #eae4d8; vertical-align: top; }
.table .num { text-align: right; }
.table-scroll { overflow-x: auto; }
.row-inactive td { color: var(--ink-soft); }

.search-row { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.search-row .input { flex: 1; }
/* Orders page export-date dropdown: natural width beside the search box;
   on narrow screens it drops to its own full-width line under the search. */
.search-row select.input { flex: 0 1 auto; width: auto; cursor: pointer; }
@media (max-width: 640px) {
    .search-row-filters { flex-wrap: wrap; }
    .search-row-filters select.input { flex: 1 1 100%; order: 3; }
}
.btn-inline { width: auto; margin-top: 0; padding: 0.6rem 1rem; }
.inline-form { display: inline; }

/* Admin pages: data tables need a desk-width column; employee pages stay narrow */
.page-wide { max-width: 64rem; }

@media (min-width: 900px) {
    .page-wide .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1rem; font-size: 0.9rem; }
.pager a { color: var(--navy); font-weight: 600; }
.pager span { color: var(--ink-soft); }

.btn-clear { align-self: center; white-space: nowrap; }

.admin-nav-exit { margin-left: auto; display: flex; gap: 1rem; align-items: center; }
.nav-signout {
    background: none; border: 0; padding: 0; cursor: pointer;
    font-family: var(--font-body); font-size: 0.9rem; font-weight: 600;
    color: var(--ink-soft); text-decoration: underline;
}

.page-nav { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; margin-bottom: 0.25rem; }
/* Upper-right "Admin" link on the employee pages - same look as the admin nav's Home link */
.nav-link { color: var(--navy); font-size: 0.9rem; font-weight: 600; text-decoration: none; }
.nav-link:hover { text-decoration: underline; }

.btn-delete { color: var(--error); padding: 0; line-height: inherit; vertical-align: baseline; }

/* current-page marker in the admin nav: brass underline, matching the masthead accent */
.admin-nav a.nav-current {
    color: var(--navy);
    border-bottom: 2px solid var(--brass);
    padding-bottom: 2px;
}
.admin-nav a.nav-current:hover { text-decoration: none; }

/* ---------- confirmation dialog (styled replacement for window.confirm) ---------- */

.confirm-dialog {
    border: 1px solid #e2ddd2;
    border-radius: 6px;
    padding: 1.5rem 1.25rem;
    width: min(90vw, 24rem);
    background: var(--label);
    color: var(--ink);
    font-family: var(--font-body);
    box-shadow: 0 1px 2px rgba(14, 26, 41, 0.10), 0 16px 48px rgba(14, 26, 41, 0.25);
    position: relative;
}

.confirm-dialog::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 2px dashed var(--thread);
    border-radius: 4px;
    pointer-events: none;
    opacity: 0.55;
}

.confirm-dialog > * { position: relative; }

.confirm-dialog::backdrop {
    background: rgba(14, 26, 41, 0.55);
}

.confirm-message {
    margin: 0 0 1.25rem;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 0.75rem;
}

.confirm-actions .btn {
    flex: 1;
    margin-top: 0;
    min-height: 48px;   /* thumb-sized on phones */
}

.btn-danger {
    background: var(--error);
    color: #fff;
}
.btn-danger:hover { background: #93331a; }

.admin-message-warning {
    background: #fdf4dc;
    border-color: #dcc27a;
}

/* ---------- jacket imagery ---------- */

.jacket-showcase {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin: 0 0 1.5rem;
}

.jacket-showcase img {
    height: 200px;
    width: auto;
    background: #fff;
    border: 1px solid #e2ddd2;
    border-radius: 6px;
    padding: 0.5rem;
    box-shadow: 0 1px 2px rgba(14, 26, 41, 0.08);
}

/* style picker: photo cards instead of text chips */
.style-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.style-card {
    position: relative;
    margin: 0;
    display: flex;
    flex-direction: column;
    border: 1.5px solid #c9c3b6;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
    cursor: pointer;
}

.style-card input {
    position: absolute;
    opacity: 0;
    inset: 0;
}

.style-card img {
    width: 100%;
    height: 160px;
    object-fit: contain;
    padding: 0.5rem 0.5rem 0;
    background: #fff;
}

.style-card span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    font-weight: 600;
    border-top: 1.5px solid #eee8dc;
    margin-top: 0.5rem;
}

/* Selection is marked by the navy border/ring and label band below - the
   image area stays white so the product photos always match. */

.style-card:has(input:checked) {
    border-color: var(--navy);
    box-shadow: 0 0 0 1.5px var(--navy);
}

.style-card input:checked ~ span {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

.style-card input:focus-visible ~ span {
    outline: 2px solid var(--brass);
    outline-offset: -4px;
}

@media (max-width: 420px) {
    .jacket-showcase img { height: 150px; }
}

/* the invisible stretched radios intercept hover - they need the hand too */
.size-chip, .size-chip input, .style-card input { cursor: pointer; }

/* Quiet action buttons rendered inline inside a .hint row (admin CSV
   downloads): match the surrounding hint text instead of button spacing. */
.hint .btn-quiet {
    padding: 0;
    margin: 0;
    font-size: inherit;
    color: var(--ink-soft);
}

/* Size charts: collapsed <details> under the size picker on the claim form */
.size-charts { margin: 0.75rem 0 0; }
.size-charts summary { cursor: pointer; font-size: 0.85rem; color: var(--ink-soft); text-decoration: underline; width: fit-content; }
.size-charts h3 { font-size: 0.9rem; margin: 0.9rem 0 0.35rem; }
.size-charts .table { font-size: 0.82rem; }
.size-charts .table th, .size-charts .table td { padding: 0.35rem 0.45rem; white-space: nowrap; }
.size-charts .table th:first-child { text-align: left; }
.size-charts .measure-note { margin-top: 0.75rem; }

/* FAQ page */
.faq-item { border-bottom: 1px solid var(--line, #ddd); padding: 0.35rem 0; }
.faq-item summary { cursor: pointer; font-weight: 600; padding: 0.4rem 0; }
.faq-item p, .faq-item ul { font-size: 0.92rem; margin: 0.4rem 0 0.6rem; }
.faq-item ul { padding-left: 1.3rem; }
.faq-reminders-title { margin-top: 1.5rem; }
.faq-reminders { font-size: 0.92rem; padding-left: 1.3rem; }

/* Left-aligned variant of the page-nav row (FAQ back button) */
.page-nav-left { justify-content: flex-start; }

/* Links inside data tables (e.g. order emails): site colors, not browser blue */
.table a { color: var(--navy); text-decoration: underline; }

/* Hover tooltips for the download/copy actions on the admin Orders page.
   Structure (real child element, arrow as ::after OF the bubble - so the
   bubble keeps true rounded corners + shadow, and the arrow can't detach):
     <button class="btn-quiet tooltip">Label
         <span class="tooltip-text" aria-hidden="true">Description</span>
     </button> */
.tooltip { position: relative; cursor: pointer; }
.tooltip .tooltip-text {
    visibility: hidden;
    opacity: 0;
    width: max-content;
    max-width: 280px;
    background-color: var(--navy);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.4;
    text-align: left;
    text-decoration: none; /* the parent link is underlined; the bubble must not inherit it */
    border-radius: 5px;
    padding: 0.5rem 0.65rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    position: absolute;
    z-index: 20;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    transition: opacity 0.15s ease 0.15s; /* slight delay so it doesn't flicker on pass-over */
    pointer-events: none;
}
/* The downward-pointing triangle, anchored to the bubble itself */
.tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 7px;
    border-style: solid;
    border-color: var(--navy) transparent transparent transparent;
}
.tooltip:hover .tooltip-text, .tooltip:focus-visible .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Jacket photo gallery: zoom badge on the style cards + full-screen viewer */
.style-card { position: relative; }
.zoom-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(22, 39, 60, 0.85);
    color: #fff;
    border: 0;
    border-radius: 4px;
    padding: 4px 7px;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
}
.zoom-badge:hover { background: var(--navy); }

.jacket-gallery {
    border: 0;
    border-radius: 8px;
    padding: 0;
    max-width: min(92vw, 640px);
}
.jacket-gallery::backdrop { background: rgba(0, 0, 0, 0.55); }
.jacket-gallery figure { margin: 0; }
.jacket-gallery img {
    display: block;
    width: 100%;
    max-height: 75vh;
    object-fit: contain;
    background: #f4f2ec;
}
.jacket-gallery figcaption { text-align: center; font-weight: 600; padding: 0.5rem; }
.gallery-controls { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0 0.75rem 0.75rem; }
.gallery-close {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    background: rgba(22, 39, 60, 0.85);
    color: #fff;
    border: 0;
    border-radius: 4px;
    width: 2rem;
    height: 2rem;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}
.gallery-close:hover { background: var(--navy); }

/* Buttons are not text: never show a blinking insertion caret in them
   (Chromium draws one when a button is focused programmatically, e.g. by
   dialog.showModal()), and their labels aren't selectable. */
button, .btn {
    caret-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* Narrow columns (State, ZIP) can't fit an error chip: collapse to a red "!"
   badge. The message text is kept at font-size 0 so screen readers still
   announce it; the red field border marks which box is wrong. */
.field-error-compact.field-validation-error {
    font-size: 0;
    background: none;
    border: 0;
    padding: 0;
}
.field-error-compact.field-validation-error::before {
    content: "!";
    display: inline-block;
    width: 1.35rem;
    height: 1.35rem;
    line-height: 1.35rem;
    text-align: center;
    border-radius: 50%;
    background: var(--error);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    margin-top: 0.35rem;
}

/* Slight breathing room between consecutive intro paragraphs - about half
   a line, so it reads as a pause rather than a full blank line */
.intro p + p { margin-top: 0.5em; }

/* "Ordering Closed" notice: replaces the second intro paragraph on the home
   page once Campaign:EditCutoffDate passes. Navy panel with the brass bar so
   it reads as the headline of the page, not a hint. */
.closed-notice {
    background: var(--navy);
    color: #fff;
    border-left: 4px solid var(--brass);
    border-radius: 0 6px 6px 0;
    padding: 1rem 1.15rem;
    margin: 0 0 1.5rem;
    box-shadow: 0 1px 2px rgba(14, 26, 41, 0.10), 0 8px 24px rgba(14, 26, 41, 0.08);
}
.closed-notice h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    line-height: 1.2;
    margin: 0 0 0.4rem;
    color: #fff;
}
.closed-notice p { margin: 0; color: rgba(255, 255, 255, 0.92); }
.closed-notice a { color: #fff; text-decoration: underline; }
