/* Adventure diaries — order form */
:root {
  --paper: #f5f1ea;
  --surface: #fffdf9;
  --photo: #ece6dc;
  --ink: #211e1a;
  --muted: #6c655c;
  --line: #ddd4c6;
  --accent: #8a4b1f;
  --accent-ink: #fffaf3;
  --danger: #9c1c1c;
  --danger-bg: #fbeceb;
  --note-bg: #fbf1dc;
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
}
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

.wrap { width: min(100% - 32px, 1040px); margin-inline: auto; }
main.wrap { padding-bottom: 56px; min-height: calc(100vh - 130px); }
body.admin .wrap { width: min(100% - 32px, 1320px); }  /* tables need the room */

/* ----- header ----- */
.top { border-bottom: 1px solid var(--line); }
.top-in { display: flex; justify-content: space-between; align-items: center; padding-block: 14px; }
.brand { font-family: var(--serif); font-size: 1.1rem; color: var(--ink); text-decoration: none; letter-spacing: .01em; }
.lang { color: var(--muted); font-size: .9rem; }

/* ----- intro ----- */
.intro { padding-block: 44px 28px; max-width: 46rem; }
.eyebrow { margin: 0 0 8px; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
h1 { margin: 0 0 12px; font-family: var(--serif); font-weight: 500; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; text-wrap: balance; }
h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 1.5rem; }
h3 { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.3; }
.lead { margin: 0; font-size: 1.1rem; color: var(--muted); text-wrap: pretty; }
.hint { margin: 0; font-size: .86rem; color: var(--muted); }
.spec { margin: 0; font-size: .86rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 16px; }

/* ----- catalogue ----- */
.catalog { padding-bottom: 40px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.card-photo { aspect-ratio: 1; background: var(--photo); border-radius: 6px; overflow: hidden; margin-bottom: 6px; }
.card-photo img { width: 100%; height: 100%; object-fit: contain; }
.card-kind { margin: 0; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.card-dots { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.card-color-name { font-size: .82rem; color: var(--muted); margin-left: 2px; }
.dot-btn { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid var(--surface); background: var(--c); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.dot-btn[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; }

/* ----- buttons ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); padding-inline: 28px; }
.btn-primary:hover { background: #723c16; }
.btn-ghost { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-ghost:hover { background: rgba(33, 30, 26, .06); }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: .86rem; background: var(--ink); color: var(--surface); }
.btn-small:hover { background: #000; }
.link { background: none; border: 0; padding: 6px 0; font: inherit; font-size: .86rem; color: var(--muted); text-decoration: underline; cursor: pointer; }
:focus-visible { outline: 3px solid #2f6fd0; outline-offset: 2px; }

/* ----- form ----- */
.order { border-top: 1px solid var(--line); padding-top: 36px; scroll-margin-top: 12px; }
.block { margin-bottom: 36px; }
.block > h2 { margin-bottom: 16px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pair-qty { grid-template-columns: 7.5rem 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: .86rem; font-weight: 600; }
input[type="text"], input[type="number"], input[type="password"], select {
  width: 100%; min-height: 44px; padding: 9px 12px;
  font: inherit; color: var(--ink);
  background: #fff; border: 1px solid #b9af9f; border-radius: 8px;
}
input:focus, select:focus { border-color: var(--ink); }

.lines { display: grid; gap: 16px; margin-bottom: 16px; }
.line { position: relative; margin: 0; min-width: 0; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.line legend { float: left; width: 100%; padding: 0; margin-bottom: 14px; font-family: var(--serif); font-size: 1.15rem; }
.line-remove { position: absolute; top: 14px; right: 16px; background: none; border: 0; padding: 6px 2px; font: inherit; font-size: .86rem; color: var(--danger); text-decoration: underline; cursor: pointer; }
.line-grid { clear: both; display: grid; grid-template-columns: 168px 1fr; gap: 20px; align-items: start; }
.line-photo { margin: 0; }
.line-photo img { width: 100%; aspect-ratio: 1; height: auto; object-fit: contain; background: var(--photo); border-radius: 6px; }
.line-photo figcaption { margin-top: 8px; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.line-fields { display: grid; gap: 14px; min-width: 0; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 12px 6px 8px; background: #fff; border: 1px solid #b9af9f; border-radius: 999px; cursor: pointer; font-size: .9rem; }
.swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.dot { width: 22px; height: 22px; border-radius: 50%; background: var(--c); flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.swatch:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 600; }
.swatch:has(input:focus-visible) { outline: 3px solid #2f6fd0; outline-offset: 2px; }

.note { margin: 0; padding: 10px 12px; background: var(--note-bg); border-left: 3px solid #c58a1c; border-radius: 4px; font-size: .9rem; }

.send { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 20px; border-top: 1px solid var(--line); }
.total { margin: 0; font-size: 1.05rem; }
.total strong { font-variant-numeric: tabular-nums; }

.errors { margin-bottom: 28px; padding: 14px 16px; background: var(--danger-bg); border: 1px solid #e3b5b1; border-radius: var(--radius); color: var(--danger); }
.errors p { margin: 0 0 6px; font-weight: 600; }
.errors ul { margin: 0; padding-left: 20px; }

/* ----- confirmation ----- */
.thanks { padding-bottom: 20px; }
.recap { list-style: none; margin: 24px 0 28px; padding: 0; border-top: 1px solid var(--line); }
.recap li { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.recap-qty { flex: none; min-width: 3rem; font-family: var(--serif); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.recap-main { display: grid; gap: 2px; }
.recap-text { overflow-wrap: anywhere; }

/* ----- admin ----- */
.admin-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-block: 36px 20px; }
.admin-head h1 { margin: 0; font-size: 2rem; }
.admin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 32px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat-n { display: block; font-family: var(--serif); font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-l { font-size: .86rem; color: var(--muted); }
.admin-block { margin-bottom: 36px; }
.admin-block h2 { margin-bottom: 12px; }
.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.wrap-ok { white-space: normal; min-width: 12rem; overflow-wrap: anywhere; }
thead th { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
tbody tr:last-child td, tfoot td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
/* All-orders table: a rule only where a new order starts, so one person's lines read as a group. */
.orders-table tbody td { border-bottom: 0; }
.orders-table tbody tr.order-start:not(:first-child) td { border-top: 1px solid var(--line); }
.orders-table tbody tr:not(.order-start) td { padding-top: 2px; }
tfoot td, .col-total { font-weight: 700; }
.zero { color: #b3aa9c; }
.th-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: baseline; }
.login { max-width: 22rem; padding-block: 48px; display: grid; gap: 14px; }

.admin-user { font-size: .86rem; color: var(--muted); }
.foot { border-top: 1px solid var(--line); padding-block: 18px 28px; font-size: .82rem; }
.foot a { color: var(--muted); }

/* ----- small screens ----- */
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .intro { padding-block: 28px 20px; }
  .line-grid { grid-template-columns: 1fr; }
  .line-photo { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; }
  .line-photo figcaption { margin: 0; }
  .send { flex-direction: column; align-items: stretch; }
  .card-actions .btn { width: 100%; }
}
@media (max-width: 620px) {
  .cards { gap: 10px; }
  .card { padding: 10px; }
  .card h3 { font-size: .92rem; }
  .card-dots { gap: 5px; }
  .dot-btn { width: 24px; height: 24px; }
  .card-color-name { flex-basis: 100%; margin-left: 0; }
}
@media (max-width: 420px) {
  .pair { grid-template-columns: 1fr; }
  .pair-qty { grid-template-columns: 6.5rem 1fr; }
  .stats { grid-template-columns: 1fr; }
}
@media (max-width: 330px) {
  .cards { grid-template-columns: 1fr; }
}
