/* The Left Sock portal styles. Every colour comes from theme.css (generated: npm run theme). */

:root {
  --surface: var(--md-sys-color-surface);
  --card: var(--md-sys-color-surface-container);
  --text: var(--md-sys-color-on-surface);
  --muted: var(--md-sys-color-on-surface-variant);
  --edge: var(--md-sys-color-outline);
  --hairline: var(--md-sys-color-outline-variant);
  --brand: var(--md-sys-color-primary);
  --on-brand: var(--md-sys-color-on-primary);
  --action: var(--md-sys-color-tertiary);
  --on-action: var(--md-sys-color-on-tertiary);
  --error: var(--md-sys-color-error);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font: 1.0625rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.brand { max-width: 42rem; margin: 0 auto; padding: 1.25rem 1rem 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mark { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text); font-weight: 700; font-size: 1.05rem; text-decoration: none; }
.wordmark { display: block; height: 28px; width: auto; }

/* Light/dark lockup: the one matching the theme (data-theme on <html>, else the device setting). */
.wordmark-light { display: none; }
:root[data-theme="light"] .wordmark-light { display: block; }
:root[data-theme="light"] .wordmark-dark { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .wordmark-light { display: block; }
  :root:not([data-theme="dark"]) .wordmark-dark { display: none; }
}

/* Light/dark controls (docs/theme-toggle-plan.md): a two-part switch from 480px wide, a circle below.
   Hidden without JavaScript, and kept invisible (space held) until theme-toggle.js has run. The
   selected look comes from data-theme and the device setting, never from the script. */
.theme-switch, .theme-toggle { display: none; flex: none; }
[data-js] .theme-toggle { display: inline-flex; }
@media (min-width: 480px) {
  [data-js] .theme-toggle { display: none; }
  [data-js] .theme-switch { display: inline-flex; }
}
[data-js]:not([data-theme-ready]) .theme-switch,
[data-js]:not([data-theme-ready]) .theme-toggle { visibility: hidden; }

.theme-switch { padding: 3px; gap: 2px; border: 1px solid var(--hairline); border-radius: 999px; background: var(--card); }
.theme-switch button,
.theme-toggle {
  align-items: center;
  justify-content: center;
  padding: 0;
  font: inherit;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.theme-switch button { display: inline-flex; width: 38px; min-width: 38px; min-height: 38px; }
.theme-toggle { width: 44px; min-width: 44px; min-height: 44px; border: 1px solid var(--hairline); }
.theme-toggle:hover { color: var(--text); border-color: var(--edge); }
.theme-switch svg, .theme-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (pointer: coarse) { .theme-switch button { width: 44px; min-width: 44px; min-height: 44px; } }

/* Selected half, and the circle's icon (it shows the theme you'd switch to). */
.theme-switch [data-theme-set="dark"],
:root[data-theme="light"] .theme-switch [data-theme-set="light"] { background: var(--brand); color: var(--md-sys-color-on-primary); }
:root[data-theme="light"] .theme-switch [data-theme-set="dark"] { background: transparent; color: var(--muted); }
.theme-toggle .i-moon { display: none; }
:root[data-theme="light"] .theme-toggle .i-sun { display: none; }
:root[data-theme="light"] .theme-toggle .i-moon { display: inline; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-switch [data-theme-set="light"] { background: var(--brand); color: var(--md-sys-color-on-primary); }
  :root:not([data-theme="dark"]) .theme-switch [data-theme-set="dark"] { background: transparent; color: var(--muted); }
  :root:not([data-theme="dark"]) .theme-toggle .i-sun { display: none; }
  :root:not([data-theme="dark"]) .theme-toggle .i-moon { display: inline; }
}
/* Hover only the unselected half (:root lifts it above the resets above). */
:root .theme-switch button:hover:not([aria-pressed="true"]) { color: var(--text); }

/* Windows high contrast: the selected half in system highlight colours, with a visible focus ring. */
@media (forced-colors: active) {
  .theme-switch [data-theme-set="dark"],
  :root[data-theme="light"] .theme-switch [data-theme-set="light"] { forced-color-adjust: none; background: Highlight; color: HighlightText; outline-color: CanvasText; }
  :root[data-theme="light"] .theme-switch [data-theme-set="dark"] { forced-color-adjust: auto; }
}
@media (forced-colors: active) and (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-switch [data-theme-set="light"] { forced-color-adjust: none; background: Highlight; color: HighlightText; outline-color: CanvasText; }
  :root:not([data-theme="dark"]) .theme-switch [data-theme-set="dark"] { forced-color-adjust: auto; }
}

main { max-width: 42rem; margin: 0 auto; padding: 1rem 1rem 4rem; }

h1 { font-size: 2.1rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; margin: 1rem 0 0.75rem; }
h1 .hl { color: var(--brand); }
h2 { font-size: 1.2rem; margin: 0.5rem 0 0; }
p { margin: 0 0 1rem; }
main > p { color: var(--muted); }
a { color: var(--brand); }

.card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-left: 4px solid var(--brand); /* keeps colour on screen while scrolling a long card */
  border-radius: 14px;
  padding: 1.25rem 1.25rem 0.25rem;
  margin: 1.25rem 0;
}

/* "PART 1 OF 2" above a card's title */
.eyebrow {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.25rem;
}

.field { margin: 1.5rem 0; border: 0; padding: 0; }
fieldset.field { min-width: 0; }
label, legend { display: block; font-weight: 600; margin-bottom: 0.35rem; }
legend { padding: 0; }
.hint { color: var(--muted); margin: 0 0 0.4rem; font-size: 0.95rem; }

input[type="text"], input[type="email"], input[type="tel"], textarea, select {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.7rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 8px;
}
textarea { resize: vertical; }
::placeholder { color: var(--muted); }

input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }

.choice {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  font-weight: 400;
  margin: 0;
  cursor: pointer;
}
.choice input { width: 1.25rem; height: 1.25rem; flex: none; }

/* Two columns of checkboxes; one column on very narrow screens. */
.columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1rem; }
.columns .choice { align-items: flex-start; padding: 0.6rem 0; min-height: 44px; line-height: 1.3; }
.columns .choice input { margin-top: 0.05rem; }
@media (max-width: 340px) { .columns { grid-template-columns: 1fr; } }

/* Pills: a row of radios. The input stays in the label (keyboard, no JS); the span is what's drawn. */
.pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pill { position: relative; margin: 0; font-weight: 400; cursor: pointer; }
.pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pill span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border: 1px solid var(--edge);
  border-radius: 999px;
  color: var(--text);
}
.pill input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 700; }
.pill input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }

button {
  min-height: 48px;
  padding: 0.75rem 1.6rem;
  font: inherit;
  font-weight: 700;
  color: var(--on-action);
  background: var(--action);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

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

.error { color: var(--error); font-weight: 600; margin: 0 0 0.4rem; }
/* A choice question with a problem (stop log, Revision 4): an error-coloured bar beside it. */
.field.invalid { border-left: 4px solid var(--error); padding-left: 0.75rem; }
/* Element-qualified so it outranks input[type="text"] and friends above. */
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--error); border-width: 2px; }
.error-summary {
  background: var(--card);
  border: 2px solid var(--error);
  border-radius: 10px;
  padding: 0.5rem 1rem;
  margin: 1.5rem 0;
}
.error-summary h2 { margin-top: 0.5rem; color: var(--error); }
.error-summary a { color: var(--text); }
.warning { border-left: 4px solid var(--error); padding-left: 0.75rem; }

.cf-turnstile { margin: 1.5rem 0; }

.card.thanks { border-left: 4px solid var(--action); padding-bottom: 0.5rem; }
.card.thanks h1 { font-size: 1.6rem; margin-top: 0; }
.card.thanks p { color: var(--muted); }

/* Honeypot: off-screen, not display:none, so simple bots still fill it. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Footer, shared with the company site */
footer { max-width: 42rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; border-top: 1px solid var(--hairline); color: var(--muted); font-size: 0.95rem; }
footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; align-items: center; }
footer a { display: inline-flex; align-items: center; min-height: 44px; }

/* Admin */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--hairline); vertical-align: top; }
td code { word-break: break-all; }
.scroll { overflow-x: auto; }
th { color: var(--muted); font-weight: 600; }
dt { font-weight: 600; margin-top: 0.75rem; color: var(--muted); }
dd { margin: 0; white-space: pre-wrap; }
nav { margin: 1rem 0; }

/* Stop log (rep pages on the tablet): large targets, larger text */
.rep { font-size: 1.125rem; }
.rep .big, .rep button { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 56px; box-sizing: border-box; margin: 0.75rem 0; text-align: center; }
.rep a.big { padding: 0.75rem 1rem; font-weight: 700; color: var(--on-action); background: var(--action); border-radius: 10px; text-decoration: none; }
.rep a.big.secondary, .rep button.secondary { color: var(--text); background: var(--card); border: 2px solid var(--md-sys-color-outline); }
.rep .choice { min-height: 56px; }
.rep .notice { border-left: 4px solid var(--action); padding-left: 0.75rem; }
/* Read by screen readers, not shown (the stop log home's heading: the cards say it). */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
/* Stop log home (Revision 5, K1): the kiosk's cards (cards.css), tall enough to fill a portrait tablet. */
.home .btn-container { margin: 1.25rem 0; }
.home .btn-card { min-height: clamp(240px, 30vh, 480px); }
/* Visited near here / Near here (Revision 5, K2 and K3), filled by locate.js or by the server. */
.rep .nearby { margin: 1rem 0; padding: 0.75rem 1rem; border-left: 4px solid var(--action); background: var(--card); border-radius: 0 10px 10px 0; }
.rep .nearby h2 { margin: 0 0 0.5rem; font-size: 1.125rem; }
.rep .nearby ul { margin: 0; padding-left: 1.25rem; }
.rep .nearby li { margin: 0.35rem 0; }
.rep .nearby[hidden] { display: none; }
/* QR pop-up: a CSS :target overlay, no script (stop-log plan, Revision 2) */
.qr-overlay { display: none; }
.qr-overlay:target { display: flex; position: fixed; inset: 0; z-index: 10; align-items: center; justify-content: center; padding: 1rem; background: var(--surface); }
.qr-box { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 40rem; color: var(--text); text-align: center; }
.qr-box svg { display: block; width: min(92vw, 72vh); height: auto; }
.qr-box .big { max-width: 20rem; }
.rep .reminders { margin-top: 2rem; }
.rep .reminders li { margin: 0.5rem 0; }
/* Folds (Revision 3, G2): a boxed, full-width summary with a chevron that turns when open. */
.rep details { margin: 0.75rem 0; }
.rep summary {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 56px; padding: 0.5rem 1rem; font-weight: 700; cursor: pointer; list-style: none;
  background: var(--card); border: 2px solid var(--edge); border-radius: 10px;
}
.rep summary::-webkit-details-marker { display: none; }
.rep summary::after {
  content: ""; flex: none; width: 0.6rem; height: 0.6rem; margin-right: 0.25rem;
  border-right: 3px solid var(--text); border-bottom: 3px solid var(--text);
  transform: rotate(-45deg); transition: transform 0.15s;
}
.rep details[open] > summary::after { transform: rotate(45deg); }
.rep details[open] > summary { border-color: var(--action); }
.rep summary:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; }

/* "Other: [box]" on one row (Revision 3, G3) */
.other-row { flex-wrap: wrap; }
.other-row .choice { flex: none; }
.other-row input[type="text"] { flex: 1 1 10rem; width: auto; }

/* Come-back chips (Revision 3, G4): checkboxes drawn as chips, 3 to a row. */
.chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.chip { position: relative; margin: 0; font-weight: 400; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span {
  display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0.25rem 0.4rem;
  text-align: center; line-height: 1.2; border: 2px solid var(--edge); border-radius: 999px; background: var(--card);
}
.chip input:checked + span { color: var(--on-action); background: var(--action); border-color: var(--action); font-weight: 700; }
.chip input:focus-visible + span { outline: 3px solid var(--action); outline-offset: 2px; }
fieldset.days { margin: 0.75rem 0 0; padding: 0; border: 0; min-width: 0; }
fieldset.days legend { font-weight: 600; }
.rep .credit { font-size: 0.85rem; }
.rep details dd { white-space: normal; margin-bottom: 0.5rem; }
