/*
 * Leather-Hats.com storefront. Hand written, no framework.
 * Mobile first. One layout breakpoint at 900px; header steps at 1100px and 1280px.
 * Values come from design/README.md.
 */

/* ---------- Tokens ---------- */

:root {
    --ink: #1d1511;          /* near black brown: text, headings */
    --ink-2: #3a2c22;        /* dark brown: second text, field borders */
    --tan: #a97a4e;          /* saddle tan: dashed frames, progress. Not for text on cream. */
    --oxblood: #6e2a24;      /* buttons, links, errors, focus, chosen */
    --oxblood-dark: #561f1a; /* main button hover */
    --sand: #d3c5aa;         /* lines */
    --cream: #f2ecdd;        /* page */
    --cream-light: #faf6ec;  /* fields, chips, summary box */
    --pic: #e9e0cc;          /* behind 1:1 pictures */
    --logo: #2b201a;         /* hat mark */
    --veil: rgba(58, 44, 34, .45);
    --veil-light: rgba(58, 44, 34, .3);

    --serif: 'Libre Caslon Text', Georgia, serif;
    --sans: 'Public Sans', system-ui, sans-serif;

    --s1: 4px;
    --s2: 8px;
    --s3: 12px;
    --s4: 16px;
    --s5: 24px;
    --s6: 32px;
    --s7: 48px;
    --s8: 64px;

    --page: 1240px;
    --gutter: 16px;
    --radius: 2px;
    --header-h: 60px;
    --ring: 0 0 0 2px var(--cream), 0 0 0 4px var(--oxblood);
}

@media (min-width: 900px) {
    :root { --header-h: 84px; }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--cream);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 25px;
    -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

button, input, select, textarea { font: inherit; color: inherit; }

a { color: var(--oxblood); }
a:hover { color: var(--ink); }

:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 2px; }

summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }

ul, ol { margin: 0; padding: 0; list-style: none; }

p { margin: 0; }

.wrap {
    max-width: var(--page);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.skip {
    position: absolute;
    left: var(--s4);
    top: -100px;
    z-index: 100;
    padding: var(--s3) var(--s4);
    background: var(--ink);
    color: var(--cream);
}
.skip:focus { top: var(--s2); color: var(--cream); }

@keyframes lh-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lh-left { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes lh-right { from { transform: translateX(100%); } to { transform: none; } }
@keyframes lh-up { from { transform: translateY(100%); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

/* ---------- Type roles ---------- */

.hero-title {
    margin: 0;
    font-family: var(--serif);
    font-weight: 400;
    font-size: 36px;
    line-height: 40px;
}

h1, .h1 {
    margin: 0;
    font-family: var(--serif);
    font-weight: 400;
    font-size: 30px;
    line-height: 34px;
}

h2, .h2 {
    margin: 0;
    font-family: var(--serif);
    font-weight: 400;
    font-size: 26px;
    line-height: 32px;
}

h3, .h3, .label {
    margin: 0;
    font-family: var(--sans);
    font-weight: 600;
    font-size: 17px;
    line-height: 24px;
}

.lead { font-size: 18px; line-height: 28px; }

.small { font-size: 14px; line-height: 20px; }

.caps {
    font-size: 12.5px;
    letter-spacing: .16em;
    text-transform: uppercase;
}

@media (min-width: 900px) {
    .hero-title { font-size: 56px; line-height: 60px; }
    h1, .h1 { font-size: 40px; line-height: 44px; }
}

/* ---------- Buttons and links ---------- */

.button,
.button-second {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 22px;
    border-radius: var(--radius);
    font-family: var(--sans);
    font-weight: 600;
    font-size: 16px;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}

.button {
    border: 0;
    background: var(--oxblood);
    color: var(--cream);
}
.button:hover { background: var(--oxblood-dark); color: var(--cream); }

.button-second {
    border: 1px solid var(--ink);
    background: transparent;
    color: var(--ink);
}
.button-second:hover { color: var(--oxblood); border-color: var(--oxblood); }

/* Add to cart, Go to checkout, Pay */
.button-lg { min-height: 52px; }

.button:disabled,
.button.is-disabled {
    background: var(--sand);
    color: var(--ink-2);
    cursor: default;
}

.link { color: var(--oxblood); text-decoration: underline; }
.link:hover { color: var(--ink); }

/* ---------- Form fields ---------- */

.field {
    display: grid;
    gap: var(--s1);
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
}

.field input,
.field select,
.field textarea,
.input {
    width: 100%;
    height: 48px;
    padding: 0 12px;
    border: 1px solid var(--ink-2);
    border-radius: var(--radius);
    background: var(--cream-light);
    font-weight: 400;
    font-size: 16px;
}

.field textarea { height: auto; min-height: 120px; padding: 12px; }

.field [aria-invalid="true"] { border-color: var(--oxblood); }

.field-error {
    color: var(--oxblood);
    font-weight: 400;
    font-size: 14px;
}

/* ---------- Checkbox row (filter option) ---------- */

.opt {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    color: var(--ink);
    text-decoration: none;
}
.opt:hover { color: var(--oxblood); }
.opt.is-zero { opacity: .45; }

.box {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px solid var(--ink-2);
    border-radius: var(--radius);
    color: var(--cream);
    font-size: 13px;
    line-height: 1;
}

.opt.is-on .box:not(.sw) {
    background: var(--oxblood);
    border-color: var(--oxblood);
}
.opt.is-on .box:not(.sw)::after { content: '\2713' / ''; }

.opt-label { flex: 1; font-size: 15px; line-height: 20px; }

.opt-count { font-size: 14px; line-height: 20px; color: var(--ink-2); }

/* ---------- Color swatch ---------- */

.sw,
.dot {
    border: 1px solid rgba(29, 21, 17, .35);
    border-radius: 50%;
}

.box.sw { width: 20px; height: 20px; }

.opt.is-on .sw,
.sw.is-on { box-shadow: var(--ring); }

/* In choice buttons */
.sw-14 { flex: none; width: 14px; height: 14px; }

.sw-black { background: #1c1917; }
.sw-dark-brown { background: #3e2a1e; }
.sw-brown { background: #6b4429; }
.sw-tan { background: #b58a5c; }
.sw-wine-red { background: #6a1f2b; }
.sw-red { background: #9a2b24; }
.sw-cream-and-white { background: #f4eee0; }
.sw-grey { background: #8c8a86; }
.sw-blue { background: #34506e; }
.sw-green { background: #4c5d3d; }
.sw-pink { background: #d9a3a6; }

/* ---------- Chip ---------- */

.chip {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: var(--s2);
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--ink-2);
    border-radius: 18px;
    background: var(--cream-light);
    color: var(--ink);
    font-size: 14px;
    line-height: 20px;
    text-decoration: none;
    white-space: nowrap;
}
.chip span { font-size: 16px; line-height: 1; }
.chip:hover { border-color: var(--oxblood); color: var(--oxblood); }

/* ---------- Tag ---------- */

.tag {
    display: inline-block;
    padding: 3px 7px;
    border: 1px solid var(--ink-2);
    background: var(--cream);
    color: var(--ink);
    font-size: 11px;
    line-height: 16px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* ---------- Price ---------- */

.price { font-size: 15px; line-height: 22px; }

.price-lg { font-family: var(--serif); font-size: 24px; line-height: 32px; }

/* ---------- Product card ---------- */

/* The offer bar above the header. Text comes from config('shop.announcement'). */
.announce {
    margin: 0;
    padding: var(--s2) 16px;
    background: var(--oxblood);
    color: var(--cream-light);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .16em;
    line-height: 1.35;
    text-align: center;
    text-transform: uppercase;
}

.card {
    display: block;
    min-width: 0;
    color: var(--ink);
    text-decoration: none;
}
.card:hover { color: var(--ink); }
.card:hover .card-title { color: var(--oxblood); }

.card-pic {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    padding: 14px;
    border: 1px solid transparent;
    background: var(--pic);
    color: var(--ink-2);
    font-size: 12px;
    line-height: 1.35;
    text-align: center;
    overflow: hidden;
}

.card-pic img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* The worn picture fades in over the hat picture when the card is hovered or focused. */
.card-pic .card-pic-hover { opacity: 0; transition: opacity .2s ease; }
.card:hover .card-pic-hover,
.card:focus-visible .card-pic-hover { opacity: 1; }
@media (hover: none) { .card-pic .card-pic-hover { display: none; } }
@media (prefers-reduced-motion: reduce) { .card-pic .card-pic-hover { transition: none; } }

.card-pic-empty { border: 1px dashed var(--tan); }

.card-pic .tag {
    position: absolute;
    left: var(--s2);
    top: var(--s2);
}

.card-title {
    display: block;
    margin-top: 10px;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.3;
    text-wrap: pretty;
}

.card-material {
    display: block;
    margin-top: 2px;
    color: var(--ink-2);
    font-size: 14px;
    line-height: 20px;
}

.card .price { display: block; margin-top: var(--s1); }

.dots {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: var(--s2);
}

.dot { width: 12px; height: 12px; }

/* ---------- Breadcrumb ---------- */

.breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s2);
    color: var(--ink-2);
    font-size: 14px;
    line-height: 20px;
}
.breadcrumb li { display: flex; gap: var(--s2); min-width: 0; }
.breadcrumb li + li::before { content: '/' / ''; }
.breadcrumb a { white-space: nowrap; }
.breadcrumb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Accordion ---------- */

.accordion {
    border-top: 1px solid var(--sand);
    border-bottom: 1px solid var(--sand);
}
.accordion + .accordion { border-top: 0; }

.accordion > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    font-weight: 600;
}
.accordion > summary::after { content: '+' / ''; font-weight: 400; }
.accordion[open] > summary::after { content: '\2212' / ''; }
.accordion[open] { padding-bottom: 14px; }

/* ---------- Table ---------- */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}
.table th,
.table td {
    padding: var(--s2) var(--s3) var(--s2) 0;
    border-bottom: 1px solid var(--sand);
    text-align: left;
    vertical-align: top;
}
.table thead th { border-bottom: 2px solid var(--ink); font-weight: 600; }

/* ---------- Side panel ---------- */

.veil {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: var(--veil);
    animation: lh-fade .2s;
}

.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 41;
    display: flex;
    flex-direction: column;
    width: min(92vw, 420px);
    padding: 10px 20px 24px;
    overflow: auto;
    background: var(--cream);
    animation: lh-right .25s ease-out;
}

.side-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    font-family: var(--serif);
    font-size: 20px;
}

.panel-close {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--ink);
    text-decoration: underline;
}

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: var(--s5);
    z-index: 50;
    transform: translateX(-50%);
    padding: 12px 18px;
    border-radius: var(--radius);
    background: var(--ink);
    color: var(--cream);
    font-size: 15px;
}

/* ---------- Header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--cream);
    border-bottom: 1px solid var(--sand);
}

.header-row {
    display: grid;
    grid-template-columns: auto auto 1fr;
    grid-template-rows: var(--header-h);
    align-items: center;
    column-gap: 2px;
    max-width: var(--page);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    color: var(--ink);
    font-family: var(--serif);
    font-size: 16px;
    letter-spacing: .01em;
    text-decoration: none;
    white-space: nowrap;
}
.logo:hover { color: var(--ink); }
.logo img { flex: none; width: 30px; height: 30px; }

@media (max-width: 349px) {
    .wordmark {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
}

/* Header panels share one pattern: the summary toggles, its ::before is the veil.
   A click on the veil is a click on the summary, so it closes the panel. */
.menu-m > summary,
.search-drop > summary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--ink);
}

.menu-m > summary { margin-left: -10px; }

.bars,
.bars::before {
    display: block;
    width: 22px;
    height: 1px;
    background: var(--ink);
}
.bars { position: relative; top: -4px; }
.bars::before { content: ''; position: relative; top: 8px; }

.menu-m[open] > summary::before,
.kinds-drop[open] > summary::before,
.search-drop[open] > summary::before {
    content: '';
    position: fixed;
    inset: calc(var(--header-h) + 1px) 0 0;
    background: var(--veil-light);
    cursor: default;
    animation: lh-fade .2s;
}

/* The desktop panels hang under the header, so their veil starts at the header's
   lower edge wherever the header is: below the offer bar at the top of a page,
   or at the top of the window once the header sticks. */
.kinds-drop[open] > summary::before,
.search-drop[open] > summary::before {
    position: absolute;
    inset: 100% 0 auto;
    height: 100vh;
}

/* Mobile menu: full height panel from the left. */
.menu-m[open] > summary::before { inset: 0; background: var(--veil); }

.menu-m[open] > summary::after {
    content: 'Close' / '';
    position: fixed;
    top: 6px;
    left: calc(min(100vw, 420px) - 24px - 60px);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 60px;
    min-height: 44px;
    color: var(--cream);
    font-size: 12.5px;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.menu-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    width: min(100vw, 420px);
    padding: 8px 24px 32px;
    overflow: auto;
    background: var(--ink);
    color: var(--cream);
    animation: lh-left .25s ease-out;
}
.menu-panel a { color: var(--cream); text-decoration: none; }
.menu-panel a:hover { color: var(--sand); }
.menu-panel :focus-visible { outline-color: var(--cream); }

.menu-mark { flex: none; margin: 11px 0; color: var(--cream); }

.menu-search {
    display: flex;
    align-items: center;
    margin: 12px 0 20px;
    border-bottom: 1px solid var(--tan);
}
.menu-search input {
    flex: 1;
    min-width: 0;
    height: 48px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--cream);
    font-size: 16px;
}
.menu-search input::placeholder { color: var(--sand); }
.menu-search button {
    height: 48px;
    padding: 0 0 0 10px;
    border: 0;
    background: none;
    color: var(--cream);
    font-size: 12.5px;
    letter-spacing: .16em;
    text-transform: uppercase;
    cursor: pointer;
}

.menu-kinds a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    min-height: 52px;
    padding-top: 12px;
}
.menu-kinds a span:first-child { font-family: var(--serif); font-size: 25px; line-height: 1.15; }
.menu-kinds a span:last-child { color: var(--sand); font-size: 13px; }
.menu-kinds a[aria-current="page"] span:first-child { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

.menu-help {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
    margin-top: auto;
    padding-top: 32px;
}
.menu-help a {
    display: flex;
    align-items: center;
    min-height: 44px;
    font-size: 12.5px;
    letter-spacing: .16em;
    text-transform: uppercase;
}

/* Desktop menu */
.menu { display: none; }

.menu > ul {
    display: flex;
    justify-content: center;
    gap: 18px;
}

.menu > ul > li > a,
.kinds-drop > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    color: var(--ink);
    font-size: 11.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
}
.menu > ul > li > a:hover,
.kinds-drop > summary:hover { color: var(--oxblood); }
.menu a[aria-current="page"] { color: var(--oxblood); text-decoration: underline; text-underline-offset: 6px; }

.kinds-drop > summary::after { content: '+' / ''; font-size: 15px; letter-spacing: 0; line-height: 1; }
.kinds-drop[open] > summary::after { content: '\2212' / ''; }

.menu-care { display: none; }

/* All hats panel: full width under the header. The padding centers the grid on the page width. */
.kinds-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 22px 32px;
    padding: 28px max(var(--gutter), calc((100% - var(--page)) / 2 + var(--gutter))) 36px;
    border-top: 1px solid var(--sand);
    border-bottom: 1px solid var(--ink-2);
    background: var(--cream);
    animation: lh-fade .2s;
}
.kinds-panel a {
    display: block;
    padding-top: 12px;
    border-top: 1px solid var(--sand);
    color: var(--ink);
    text-decoration: none;
}
/* The first row of five sits right under the panel's own line and needs no line of its own. */
.kinds-panel li:nth-child(-n+5) a { padding-top: 0; border-top: 0; }
.kinds-panel a:hover,
.kinds-panel a[aria-current="page"] { color: var(--oxblood); text-decoration: none; }
.kinds-panel a:hover .kinds-count,
.kinds-panel a[aria-current="page"] .kinds-count { color: var(--oxblood); }
/* The page you are on gets one line under its name, not under the count too. */
.kinds-panel a[aria-current="page"] .kinds-name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }
.kinds-name { display: block; font-family: var(--serif); font-size: 21px; line-height: 1.2; }
.kinds-count {
    display: block;
    margin-top: 4px;
    color: var(--ink-2);
    font-size: 12.5px;
    letter-spacing: .16em;
    text-transform: uppercase;
}

/* Search */
.search-drop { justify-self: end; }
.search-drop > summary { margin-right: 0; }
.search-close { display: none; }
.search-drop[open] .icon-search { display: none; }
.search-drop[open] .search-close {
    display: block;
    font-size: 12.5px;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.search-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding: 12px max(var(--gutter), calc((100% - 760px) / 2 + var(--gutter))) 20px;
    border-top: 1px solid var(--sand);
    border-bottom: 1px solid var(--ink-2);
    background: var(--cream);
    animation: lh-fade .2s;
}
.search-panel input {
    flex: 1 1 100%;
    min-width: 0;
    height: 56px;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--ink-2);
    border-radius: 0;
    background: none;
    font-family: var(--serif);
    font-size: 20px;
}

@media (min-width: 900px) {
    .header-row {
        grid-template-columns: auto 1fr auto;
        column-gap: 20px;
    }

    .menu-m { display: none; }
    .menu { display: block; }

    .logo { font-size: 17px; }
    .logo img { width: 38px; height: 38px; }

    .search-drop > summary { margin-right: 0; }

    .search-panel { padding-top: 28px; padding-bottom: 36px; }
    .search-panel input { flex-basis: 200px; font-size: 26px; }
}

@media (min-width: 1100px) {
    .logo { font-size: 19px; }
    .menu > ul { gap: 22px; }
    .menu > ul > li > a,
    .kinds-drop > summary { font-size: 12.5px; letter-spacing: .16em; }
    .menu-care { display: block; }
}

@media (min-width: 1280px) {
    .logo { font-size: 21px; }
    .menu > ul { gap: 40px; }
}

/* ---------- Footer ---------- */

.site-footer {
    margin-top: 72px;
    border-top: 1px solid var(--sand);
}

.footer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    max-width: var(--page);
    margin: 0 auto;
    padding: 32px var(--gutter) 40px;
    font-size: 15px;
}

.footer-name { margin-bottom: 8px; font-family: var(--serif); font-size: 19px; }
.footer-line { max-width: 34ch; color: var(--ink-2); }
.footer-grid .footer-badge { display: inline-block; min-height: 0; margin-top: 16px; }

/* Link rows are 44 px touch targets; the grids add no row gap. */
.footer-shop {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}
.footer-help,
.footer-company { display: grid; gap: 0; }
.footer-company { margin-top: 8px; }

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 24px;
    max-width: var(--page);
    margin: 0 auto;
    padding: 16px var(--gutter) 24px;
    border-top: 1px solid var(--sand);
    color: var(--ink-2);
    font-size: 14px;
}
.site-footer .footer-bottom a { display: inline; min-height: 0; text-decoration: underline; }
.footer-bottom span:first-child a { margin-left: 12px; }

.site-footer a {
    display: flex;
    align-items: center;
    min-height: 44px;
    color: var(--ink);
    text-decoration: none;
}
.site-footer a:hover { color: var(--oxblood); }

@media (min-width: 900px) {
    .footer-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.7fr) minmax(0, .8fr) minmax(0, 1.2fr); gap: 40px; }
}

/* ---------- Category page ---------- */

.breadcrumb { padding-top: 20px; }

.breadcrumb + h1 { margin: 12px 0 10px; }

.intro { max-width: 62ch; margin-bottom: 20px; text-wrap: pretty; }

.catalog {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.results { min-width: 0; scroll-margin-top: calc(var(--header-h) + 1px); }

/* Mobile: the bar sticks under the header. */
.toolbar {
    position: sticky;
    top: var(--header-h);
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 0 calc(var(--gutter) * -1) 12px;
    padding: 8px var(--gutter);
    border-bottom: 1px solid var(--sand);
    background: var(--cream);
}

.filter-open {
    flex: none;
    min-height: 44px;
    padding: 0 16px;
    white-space: nowrap;
}

.result-count {
    flex: 1;
    color: var(--ink-2);
    font-size: 15px;
    white-space: nowrap;
}

.sort { position: relative; font-size: 15px; }
.sort > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--ink-2);
    border-radius: var(--radius);
    background: var(--cream-light);
    white-space: nowrap;
}
.sort > summary::after { content: '+' / ''; }
.sort[open] > summary::after { content: '\2212' / ''; }
.sort ul {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 11;
    min-width: 100%;
    padding: 4px 0;
    border: 1px solid var(--ink-2);
    border-radius: var(--radius);
    background: var(--cream-light);
}
.sort a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
}
.sort a:hover { color: var(--oxblood); }
.sort a[aria-current="true"] { color: var(--oxblood); font-weight: 600; }

.chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.chips-clear {
    display: inline-flex;
    flex: none;
    align-items: center;
    min-height: 44px;
    padding: 0 4px;
    font-size: 14px;
    white-space: nowrap;
}

.empty {
    padding: 40px 24px;
    border: 1px solid var(--sand);
    text-align: center;
}
.empty p { color: var(--ink-2); }
.empty .empty-title {
    margin-bottom: 6px;
    color: var(--ink);
    font-family: var(--serif);
    font-size: 22px;
    line-height: 1.3;
}
.empty .button { margin-top: 20px; }
.empty .button + p { margin-top: 16px; }

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 16px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-top: 40px;
    font-size: 15px;
}
.page-num,
.page-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 8px;
}
.page-num[aria-current="page"] { border: 1px solid var(--ink); font-weight: 600; }
.page-step.is-off { color: var(--ink-2); opacity: .45; }

/* Filter panel. Mobile: a full height sheet, shown when #filters is the target. */
.filters { display: none; }

.filters:target {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: block;
    padding: 8px 20px 0;
    overflow: auto;
    background: var(--cream);
    animation: lh-up .25s ease-out;
}

.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    margin-bottom: 8px;
}
.sheet-title { font-family: var(--serif); font-size: 22px; }
.sheet-close {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--ink);
}

.sheet-foot {
    position: sticky;
    bottom: 0;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--sand);
    background: var(--cream);
}
.sheet-foot .button { width: 100%; }

.filter-group { border-top: 1px solid var(--sand); }
.filter-group[open] { padding-bottom: 10px; }
.filter-group > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    font-weight: 600;
}
/* The sign shows that a group folds: + when closed, U+2212 minus when open. */
.filter-group > summary::after { content: '+' / ''; margin-left: 12px; font-weight: 400; }
.filter-group[open] > summary::after { content: '\2212' / ''; }
.filter-picked { margin-left: auto; color: var(--ink-2); font-weight: 400; font-size: 14px; }

@media (min-width: 900px) {
    .catalog { grid-template-columns: 240px minmax(0, 1fr); }

    .filters,
    .filters:target {
        position: static;
        display: block;
        padding: 0;
        overflow: visible;
        animation: none;
    }

    .sheet-head,
    .sheet-foot,
    .filter-open { display: none; }

    .toolbar {
        position: static;
        margin: 0 0 12px;
        padding: 0;
        border-bottom: 0;
    }

    .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Product page ---------- */

.product {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
    align-items: start;
    margin-top: 16px;
}

.gallery { display: grid; gap: 8px; }

.gallery-main { padding: 16px; font-size: 13px; }
.gallery-main .tag { top: 4px; right: 4px; left: auto; }

.thumbs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.thumb {
    display: block;
    aspect-ratio: 1;
    border: 2px solid transparent;
    background: var(--pic);
}
.thumb[aria-current="true"] { border-color: var(--oxblood); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }


.buy h1 { margin-bottom: 12px; text-wrap: balance; }

.buy-intro { margin-bottom: 16px; font-size: 17px; text-wrap: pretty; }

.buy-price { margin-bottom: 20px; }

.choices,
.sizes,
.ship {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}
.choices { margin-bottom: 20px; }

.pick-label { margin-bottom: 8px; padding: 0; font-weight: 600; }
.pick-label span { font-weight: 400; }

.choice-row,
.size-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.choice-pick { display: flex; }

/* Choice and size buttons are labels around a hidden radio. */
.choice,
.size-button {
    display: flex;
    align-items: center;
    border: 1px solid var(--ink-2);
    border-radius: var(--radius);
    color: var(--ink);
    cursor: pointer;
}

.choice {
    gap: 8px;
    min-height: 44px;
    padding: 0 12px;
    font-size: 14px;
    white-space: nowrap;
}

.size-button {
    justify-content: center;
    min-width: 56px;
    min-height: 48px;
    padding: 0 8px;
    font-weight: 600;
}

.choice.is-on,
:checked + .choice,
:checked + .size-button {
    border-color: var(--oxblood);
    box-shadow: inset 0 0 0 1px var(--oxblood);
    background: var(--cream-light);
}
.choice.is-on { cursor: default; }

:focus-visible + .choice,
:focus-visible + .size-button { outline: 2px solid var(--oxblood); outline-offset: 2px; }

.size-line {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0 12px;
    margin-bottom: 8px;
    scroll-margin-top: calc(var(--header-h) + 16px);
}
.size-line .pick-label { margin: 0; }

.size-row { margin-bottom: 6px; }

.size-error {
    min-height: 20px;
    margin-bottom: 8px;
    color: var(--oxblood);
    font-size: 14px;
    line-height: 20px;
}

.ship {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px 12px;
    margin: 20px 0 8px;
}
.ship legend { margin-bottom: 4px; padding: 0; }
.ship-note,
.ship-wide { grid-column: 1 / -1; }
.ship-note { color: var(--ink-2); }
/* Email and full name share a row, like state and ZIP. On a phone each gets its own row. */
@media (max-width: 559px) {
    .ship-half { grid-column: 1 / -1; }
}

.buy-error {
    margin-top: 12px;
    color: var(--oxblood);
    font-size: 14px;
    line-height: 20px;
}

/* Quantity, Add to cart and Buy now share one row; minmax(0) lets a long label wrap, never overflow. */
/* "Added to cart" dialog on the product page. */
.added {
    width: min(440px, calc(100vw - 2 * var(--gutter)));
    padding: var(--s5);
    border: 1px solid var(--sand);
    border-radius: var(--radius);
    background: var(--cream);
    color: var(--ink);
}
.added::backdrop { background: var(--veil); }
.added h2 { margin-bottom: var(--s4); }
.added h2:focus { outline: none; }
.added-item { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: var(--s4); align-items: center; }
.added-item img { width: 88px; height: 88px; background: var(--pic); object-fit: cover; }
.added-item img[hidden] { display: none; }
.added-name { font-weight: 600; }
.added-meta { color: var(--ink-2); font-size: 15px; }
.added-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); margin-top: var(--s5); }
.added-actions form { margin: 0; }
.added-actions .button,
.added-actions .button-second { width: 100%; gap: 6px; padding: 0 12px; }

.buy-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    margin-top: 20px;
}
.buy-button { width: 100%; padding: 0 12px; font-size: 16px; }

/* One box that looks like the buttons beside it: a small "Qty" label, the number, and an arrow. */
.buy-qty {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 52px;
    border: 1px solid var(--ink);
    border-radius: var(--radius);
    background: var(--cream-light);
}
.buy-qty:hover { border-color: var(--oxblood); }
.buy-qty:focus-within { box-shadow: var(--ring); }
.buy-qty-label {
    padding-left: 12px;
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    pointer-events: none;
}
.buy-qty select {
    align-self: stretch;
    padding: 0 30px 0 8px;
    border: 0;
    border-radius: var(--radius);
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%231d1511' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center;
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}
.buy-qty select:focus { outline: none; }
.buy-qty:has([aria-invalid="true"]) { border-color: var(--oxblood); }

/* Narrow phones: tighter boxes so "Add to cart" stays on one line. */
@media (max-width: 420px) {
    .buy-row { gap: 6px; }
    .buy-button { padding: 0 4px; font-size: 15px; }
    .buy-qty-label { padding-left: 8px; }
    .buy-qty select { padding: 0 24px 0 6px; background-position: right 8px center; }
}

.buy-note { margin-top: 8px; color: var(--ink-2); }

.buy-heading { margin: 32px 0 8px; }

.spec th,
.spec td { padding: 10px 0; }
.spec tr:first-child > * { border-top: 1px solid var(--sand); }
.spec th { width: 40%; color: var(--ink-2); font-weight: 400; }

.about { display: grid; gap: 12px; max-width: 58ch; text-wrap: pretty; }
.about ul { padding-left: 20px; list-style: disc; }
.about ol { padding-left: 20px; list-style: decimal; }

.more { padding: 48px 0 8px; }
.more h2 { margin-bottom: 16px; }

.shelf {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 16px;
}

@media (min-width: 900px) {
    .product { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Find your size: a <details> side panel. The summary's ::before is the veil and
   its ::after is Close; a click on either closes the panel. */
.size-drop > summary {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--oxblood);
    font-size: 15px;
    text-decoration: underline;
}
.size-drop > summary:hover { color: var(--ink); }

.size-drop[open] > summary::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 40;
    background: var(--veil);
    cursor: default;
    animation: lh-fade .2s;
}

.size-drop[open] > summary::after {
    content: 'Close' / '';
    position: fixed;
    top: 12px;
    right: 20px;
    z-index: 42;
    display: flex;
    align-items: center;
    min-height: 44px;
    color: var(--ink);
    font-size: 16px;
}

.size-drop .side-panel { display: block; color: var(--ink); }

.size-this { margin: 8px 0 12px; }

.size-steps {
    display: grid;
    gap: 6px;
    margin-bottom: 20px;
    padding-left: 20px;
    list-style: decimal;
}

.size-table { font-size: 15px; }
.size-table td:last-child { font-weight: 600; }

.size-note { margin-top: 16px; font-size: 15px; }
.size-note + .size-note { margin-top: 8px; }

.size-more { margin-top: 12px; }

/* ---------- Search field (search page) ---------- */

.search-field {
    display: flex;
    max-width: 480px;
    margin-bottom: 20px;
}
.search-field input {
    flex: 1;
    min-width: 0;
    height: 48px;
    padding: 0 12px;
    border: 1px solid var(--ink-2);
    border-right: 0;
    border-radius: var(--radius) 0 0 var(--radius);
    background: var(--cream-light);
    font-size: 16px;
}
.search-field button {
    height: 48px;
    padding: 0 18px;
    border: 0;
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--oxblood);
    color: var(--cream);
    font-weight: 600;
    cursor: pointer;
}
.search-field button:hover { background: var(--oxblood-dark); }

/* ---------- Home ---------- */

/* Mobile: the picture comes first and runs edge to edge. */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    align-items: center;
    padding: 0 0 8px;
}
.hero-text-only { padding-top: 32px; }

.hero .hero-title { margin-bottom: 16px; text-wrap: balance; }
.hero .lead { max-width: 44ch; margin-bottom: 24px; text-wrap: pretty; }

.hero-pic {
    position: relative;
    order: -1;
    aspect-ratio: 1;
    margin: 0 calc(var(--gutter) * -1);
    background: var(--pic);
    overflow: hidden;
}
.hero-pic img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-card {
    position: absolute;
    left: 16px;
    bottom: 16px;
    display: grid;
    gap: 2px;
    max-width: calc(100% - 32px);
    padding: 14px 16px;
    border: 1px solid var(--ink-2);
    background: var(--cream);
    color: var(--ink);
    text-align: left;
    text-decoration: none;
}
.hero-card:hover { border-color: var(--oxblood); color: var(--ink); }
.hero-card-name { display: none; font-family: var(--serif); font-size: 17px; line-height: 1.25; }
.hero-card-meta { display: none; color: var(--ink-2); font-size: 14px; line-height: 20px; }
.hero-card-go {
    color: var(--oxblood);
    font-size: 12.5px;
    line-height: 20px;
    letter-spacing: .16em;
    text-transform: uppercase;
    white-space: nowrap;
}

.home-kinds { padding: 40px 0 8px; }
.home-kinds h2,
.home-new h2 { margin-bottom: 16px; }

/* Mobile: one swipe row, tiles 42% wide. */
.tiles {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 42%;
    gap: 12px;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-left: var(--gutter);
    scrollbar-width: none;
}
.tiles::-webkit-scrollbar { display: none; }
.tiles li { scroll-snap-align: start; }

.tile { display: block; color: var(--ink); text-decoration: none; }
.tile:hover { color: var(--ink); }
.tile:hover .tile-name { color: var(--oxblood); }

.tile-pic {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    background: var(--pic);
    color: var(--ink-2);
    font-size: 12px;
    overflow: hidden;
}
.tile-pic img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tile-name { display: block; margin-top: 8px; font-weight: 600; }
.tile-count { display: block; color: var(--ink-2); font-size: 14px; line-height: 20px; }

.home-shelf { padding: 48px 0 8px; }

.shelf-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 16px;
}
.see-all { font-size: 15px; white-space: nowrap; }

.home-size {
    margin-top: 56px;
    padding: 28px 0;
    border-top: 1px solid var(--sand);
    border-bottom: 1px solid var(--sand);
}
.home-size-text { max-width: 60ch; }
.home-size h2 { margin-bottom: 8px; }
.home-size p { margin-bottom: 12px; text-wrap: pretty; }
.home-size a { font-weight: 600; }
.home-size .size-steps-drawn { margin: 24px 0 0; }

.shelf-text { max-width: 60ch; margin: -8px 0 16px; color: var(--ink-2); text-wrap: pretty; }

.home-faq { margin-top: 56px; }
.home-faq h2 { margin-bottom: 16px; }
.home-faq h3 { margin-bottom: 4px; font-family: var(--sans); font-size: 17px; line-height: 24px; font-weight: 600; }
.home-faq p { max-width: 60ch; text-wrap: pretty; }
.faq-list { display: grid; gap: 20px; }
.faq-item { padding-top: 16px; border-top: 1px solid var(--sand); }

@media (min-width: 900px) {
    .hero {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 32px;
        padding: 32px 0 16px;
    }
    .hero-text-only { grid-template-columns: minmax(0, 1fr); }

    /* Heading on the left, content on the right, so the page width is used. */
    .home-size,
    .home-faq {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
        gap: 48px;
        align-items: start;
    }
    .home-size { padding: 40px 0; }
    .home-size .size-steps-drawn { margin: 0; gap: 24px; }
    .home-faq h2 { margin-bottom: 0; }
    .faq-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 48px; }

    .hero-pic { order: 0; margin: 0; }

    .hero-card-name,
    .hero-card-meta { display: block; }
    .hero-card-go { margin-top: 6px; }

    .tiles {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        grid-auto-flow: row;
        grid-auto-columns: auto;
        gap: 16px;
        margin: 0;
        padding: 0;
        overflow-x: visible;
    }
}

/* ---------- Help pages: size guide and care tips ---------- */

.help-page { max-width: 720px; padding: 24px 0 8px; }
.help-page p { text-wrap: pretty; }
.help-lead { margin: 12px 0 8px; }

.help-part { padding-top: 32px; }
.help-part h2 { margin-bottom: 8px; }
.help-part p + p { margin-top: 12px; }
.help-part .size-table { margin-top: 16px; }

/* Each step: the drawing on top, then the number and the text on one line below it. */
.size-steps-drawn {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 16px 0;
    padding: 0;
    list-style: none;
    counter-reset: size-step;
}
.size-steps-drawn li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-content: start;
    column-gap: 4px;
    color: var(--ink-2);
    counter-increment: size-step;
}
.size-steps-drawn li::before { content: counter(size-step) '.'; grid-row: 2; color: var(--ink); font-weight: 600; }
.size-steps-drawn svg { grid-column: 1 / -1; grid-row: 1; margin-bottom: 8px; }

/* Help pages: the answer box, the list of parts at the side, the care parts. */
.help-layout { display: grid; gap: var(--s6); }
.help-toc { display: none; }
.help-answer {
    display: grid;
    gap: var(--s2);
    margin: var(--s4) 0 var(--s2);
    padding: var(--s5);
    border: 1px solid var(--sand);
    border-left: 3px solid var(--oxblood);
    border-radius: var(--radius);
    background: var(--cream-light);
}
.help-answer p { max-width: none; margin: 0; }
.help-answer p:last-child { font-size: 18px; line-height: 28px; }
.help-page [id] { scroll-margin-top: calc(var(--header-h) + var(--s5)); }

.care-material { margin-top: var(--s6); padding-top: var(--s6); border-top: 1px solid var(--sand); }
.care-material h2 { margin-bottom: 4px; }
.care-kind { margin-bottom: 12px; color: var(--ink-2); font-size: 15px; }
.care-material p + p { margin-top: 12px; }
.care-lists { display: grid; gap: var(--s3); margin-top: var(--s4); }
.care-lists > div { padding: var(--s4); border: 1px solid var(--sand); border-radius: var(--radius); background: var(--cream-light); }
.care-lists .label { margin-bottom: var(--s2); }
.care-lists ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 15px; line-height: 22px; }
.care-lists li { position: relative; padding-left: 22px; }
.care-lists li::before { position: absolute; left: 0; font-weight: 600; }
.care-do li::before { content: '\2713'; color: #3d6b3a; }
.care-avoid li::before { content: '\00d7'; color: var(--oxblood); font-size: 18px; }

.help-page .faq { margin-top: var(--s6); border-top: 1px solid var(--sand); }
.help-next { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s7); }

@media (min-width: 560px) {
    .care-lists { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
    .size-steps-drawn { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1040px) {
    .help-layout { grid-template-columns: minmax(0, 720px) 280px; justify-content: space-between; align-items: start; }
    .help-side { position: sticky; top: calc(var(--header-h) + var(--s5)); display: grid; gap: var(--s4); margin-top: var(--s7); }
    .help-toc {
        display: block;
        padding: var(--s5);
        border: 1px solid var(--sand);
        border-radius: var(--radius);
        background: var(--cream-light);
    }
    .help-toc .label { padding-bottom: var(--s3); border-bottom: 1px solid var(--sand); }
    .help-toc ul { margin: var(--s3) 0 0; padding: 0; list-style: none; display: grid; gap: 2px; font-size: 15px; }
    .help-toc a { display: block; padding: 6px 0 6px 12px; border-left: 2px solid var(--sand); color: var(--ink-2); text-decoration: none; }
    .help-toc a:hover { border-left-color: var(--oxblood); color: var(--oxblood); }
    .help-layout .help-side .source-row { margin: 0; }
    .help-layout .help-side .source-link {
        display: grid;
        justify-items: center;
        gap: var(--s3);
        width: 100%;
        padding: var(--s5);
        font-size: 15px;
        line-height: 22px;
        text-align: center;
    }
    .help-layout .help-side .source-link svg { width: 28px; height: 28px; }
    .help-layout .help-side .source-link strong {
        margin-top: var(--s3);
        padding: 10px 12px;
        border: 1px solid var(--oxblood);
        border-radius: var(--radius);
        font-size: 14px;
        line-height: 20px;
    }
    .help-layout .help-side .source-link:hover strong { background: var(--oxblood); color: var(--cream-light); }
}

/* ---------- Cart and order summary ---------- */

.header-end {
    display: flex;
    align-items: center;
    justify-self: end;
    gap: 4px;
}

.cart-link {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 44px;
    padding: 0 6px;
    margin-right: -6px;
    color: var(--ink);
    font-size: 11.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
}
.cart-link:hover { color: var(--oxblood); }

@media (min-width: 1100px) {
    .cart-link { font-size: 12.5px; letter-spacing: .16em; }
}

.cart-page { max-width: 760px; margin: var(--s6) auto 0; display: grid; gap: var(--s4); }
.cart-note {
    margin: 0;
    padding: var(--s3) var(--s4);
    border: 1px solid var(--sand);
    background: var(--cream-light);
}
.cart-empty { margin: var(--s4) 0 0; }
.cart-go { margin: 0; }
.checkout-form { display: grid; gap: var(--s4); }
.checkout-form .ship { margin: 0; }
.checkout-side { display: grid; gap: var(--s4); min-width: 0; }
.checkout-order .label,
.checkout-pay .label { margin-bottom: var(--s2); }
.checkout-order .checkout-note { margin-top: var(--s2); }
.checkout-pay { display: grid; gap: var(--s3); }
.checkout-pay[hidden] { display: none; }
.checkout-pay .label { margin-bottom: 0; }
.pay-box {
    min-height: 120px;
    padding: var(--s4);
    border: 1px solid var(--sand);
    border-radius: var(--radius);
    background: #fff;
}
.checkout-side .buy-error:empty { display: none; }
.is-placed .ship input { background: transparent; color: var(--ink-2); }
.is-placed .offer,
.is-placed .offer-remove { display: none; }
.checkout-form .buy-error { margin: 0; }
.checkout-note { margin: 0; color: var(--ink-2); }

/* Country choice: show the address fields and the shipping price that fit it.
   A browser without :has() shows both sets, which still works. */
@supports selector(:has(*)) {
    .checkout-form:has(select[name="ship_country"] option[value="US"]:checked) .ship-abroad,
    .checkout-form:has(select[name="ship_country"] option:not([value="US"]):checked) .ship-us { display: none; }
}

/* Wide screens: the address on the left, the order in a column on the right that stays in view. */
@media (min-width: 900px) {
    .checkout-page { max-width: 1040px; }
    .checkout-form { grid-template-columns: minmax(0, 1fr) minmax(0, 400px); column-gap: var(--s7); align-items: start; }
    .checkout-form > * { grid-column: 1; }
    .checkout-form > .checkout-side { grid-column: 2; grid-row: 1 / span 6; }
    .pay-page .cart-go .button { width: 100%; }
    .checkout-form .ship { margin-top: 0; }
}
.cart-go .button { width: 100%; }

.summary {
    padding: var(--s4);
    border: 1px solid var(--sand);
    border-radius: var(--radius);
    background: var(--cream-light);
}
.summary-lines { margin: 0; padding: 0; list-style: none; }

/* On a narrow screen the picture and the text sit in a row, the controls drop below. */
.summary-line {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: var(--s1) var(--s3);
    padding: var(--s4) 0;
    border-bottom: 1px solid var(--sand);
}
.summary-line:first-child { padding-top: 0; }
.summary-pic { grid-row: span 2; width: 72px; padding: 0; }
.summary-info { min-width: 0; }
.summary-name { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.summary-name:hover { color: var(--oxblood); }
.summary-info p { margin: 0; }
.summary-total { margin: 0; font-weight: 600; text-align: right; }
.summary-edit {
    grid-column: 2 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s3) var(--s4);
}
.summary-edit form { margin: 0; }
.summary-qty { display: flex; align-items: center; gap: var(--s2); }
.summary-qty .field select { width: 80px; }
.summary-qty .button-second { min-height: 44px; padding: 0 16px; }
.summary-remove {
    min-height: 44px;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    cursor: pointer;
}

.summary-sums { margin: 0; padding-top: var(--s4); }
.summary-sums > div { display: flex; justify-content: space-between; gap: var(--s4); padding: var(--s1) 0; }
.summary-sums dt, .summary-sums dd { margin: 0; }
.summary-sums > .summary-sum-total {
    margin-top: var(--s2);
    padding-top: var(--s3);
    border-top: 1px solid var(--ink-2);
    font-family: var(--serif);
    font-size: 20px;
}

@media (min-width: 900px) {
    .summary { padding: var(--s5); }
    .summary-line { grid-template-columns: 96px 1fr auto auto; align-items: center; }
    .summary-pic { grid-row: auto; width: 96px; }
    .summary-edit { grid-column: auto; }
    .summary-total { min-width: 80px; }
    .cart-go .button { width: auto; }
    .checkout-side .cart-go .button { width: 100%; }
}

/* ---------- Thank you page and the buyer's order page ---------- */

.done-lead { margin: 0; font-size: 18px; line-height: 28px; }
.done-box {
    display: grid;
    gap: var(--s3);
    padding: var(--s5);
    border: 1px solid var(--sand);
    border-radius: var(--radius);
    background: var(--cream-light);
}
.done-box p { margin: 0; text-wrap: pretty; }
.done-box .button { width: 100%; }
.done-page section > .label,
.order-page section > .label { margin-bottom: var(--s2); }
.done-thanks {
    display: grid;
    justify-items: center;
    gap: var(--s2);
    margin: var(--s4) 0 0;
    padding-top: var(--s6);
    border-top: 1px solid var(--sand);
    font-family: var(--serif);
    font-size: 24px;
    line-height: 32px;
    text-align: center;
}
.done-thanks svg { color: var(--oxblood); }
.source-row { margin: 0; text-align: center; }
.help-side .source-row { max-width: none; margin: 0 0 var(--s5); text-align: left; }
.source-link {
    display: inline-flex;
    align-items: center;
    gap: var(--s3);
    padding: var(--s3) var(--s4);
    border: 1px solid var(--sand);
    border-radius: var(--radius);
    background: var(--cream-light);
    color: var(--ink);
    font-size: 15px;
    line-height: 22px;
    text-align: left;
    text-decoration: none;
}
.source-link:hover { border-color: var(--oxblood); color: var(--ink); }
.source-link svg { flex: none; }
.source-link strong { display: block; color: var(--oxblood); }

.order-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.order-tools { display: flex; gap: var(--s2); }
.order-tools [hidden] { display: none; }
.order-tools .button-second { min-height: 40px; padding: 0 16px; }
.order-date { margin: calc(-1 * var(--s3)) 0 0; color: var(--ink-2); }
.order-tracking { margin: 0; display: grid; gap: var(--s2); }
.order-tracking dt { color: var(--ink-2); font-size: 15px; }
.order-tracking dd { margin: 0; font-weight: 600; font-size: 18px; overflow-wrap: anywhere; }
.order-address {
    display: grid;
    gap: 2px;
    padding: var(--s4) var(--s5);
    border: 1px solid var(--sand);
    border-radius: var(--radius);
    background: var(--cream-light);
    font-style: normal;
}
.order-notes { display: grid; gap: var(--s4); }
.order-note {
    display: grid;
    align-content: start;
    gap: var(--s2);
    padding: var(--s5);
    border: 1px solid var(--sand);
    border-left: 3px solid var(--oxblood);
    border-radius: var(--radius);
    background: var(--cream-light);
}
.order-note p { margin: 0; text-wrap: pretty; }
.order-keys { display: grid; gap: var(--s2); margin: var(--s1) 0 0; padding: 0; list-style: none; font-size: 15px; }
.order-keys span { white-space: nowrap; }
.order-keys kbd {
    display: inline-block;
    min-width: 28px;
    padding: 2px 8px;
    border: 1px solid var(--ink-2);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: var(--cream);
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
}
.order-number { font-family: var(--serif); font-size: 22px; line-height: 28px; letter-spacing: .02em; }
@media (min-width: 640px) {
    .order-notes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.summary-name:not(a):hover { color: var(--ink); }

/* Printing the order page: only the order, in black on white. */
@media print {
    body:has(.order-page) > :not(main),
    .order-page .order-tools,
    .order-page .order-notes { display: none !important; }
    body:has(.order-page) { background: #fff; color: #000; }
    .order-page { max-width: none; margin: 0; }
    .order-page .done-box,
    .order-page .order-address,
    .order-page .summary { background: #fff; border-color: #999; }
    .order-page .summary-line,
    .order-page section { break-inside: avoid; }
}
