/* Craftsman Christmas: one holiday theme for every page. Mobile first. */

:root {
  --bg: #f6f1e7;
  --card: #fffdf8;
  --text: #1f2a24;
  --muted: #5b6b62;
  --border: #e4dccb;
  --green: #1f5c45;
  --green-soft: #e3efe8;
  --red: #b3262e;
  --red-soft: #f8e4e2;
  --gold: #b88a22;
  --gold-soft: #f7edd2;
  --ok: #2f8f5b;
  --bad: #b3262e;
  --warn: #a8650f;
  --accent: var(--green);
  --panel: var(--card);
  --shadow: 0 1px 2px rgb(31 42 36 / 6%), 0 6px 20px rgb(31 42 36 / 6%);
  --radius: 14px;
  --heading: "Fraunces", Georgia, "Times New Roman", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1813;
    --card: #13241c;
    --text: #eef3ef;
    --muted: #9fb3a8;
    --border: #25392e;
    --green: #5cc196;
    --green-soft: #183a2c;
    --red: #ec6a6f;
    --red-soft: #3a1c1e;
    --gold: #e8bd5a;
    --gold-soft: #3a3016;
    --ok: #5cc196;
    --bad: #ec6a6f;
    --warn: #e8bd5a;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 20px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c1813;
  --card: #13241c;
  --text: #eef3ef;
  --muted: #9fb3a8;
  --border: #25392e;
  --green: #5cc196;
  --green-soft: #183a2c;
  --red: #ec6a6f;
  --red-soft: #3a1c1e;
  --gold: #e8bd5a;
  --gold-soft: #3a3016;
  --ok: #5cc196;
  --bad: #ec6a6f;
  --warn: #e8bd5a;
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--green); }
h1, h2, h3 { font-family: var(--heading); line-height: 1.2; font-weight: 650; }
h1 { font-size: clamp(28px, 7vw, 44px); margin: 0 0 12px; }
h2 { font-size: 22px; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
h3 { font-size: 18px; margin: 0 0 8px; }
p { margin: 0 0 12px; }

/* ---------- string of lights ---------- */

.lights-string {
  position: relative;
  height: 34px;
  overflow: hidden;
  background: var(--green);
}
.lights-string::before {
  /* the wire */
  content: "";
  position: absolute;
  left: -10px;
  right: -10px;
  top: 6px;
  height: 18px;
  border-bottom: 2px solid rgb(0 0 0 / 35%);
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
.lights-string span {
  position: absolute;
  top: 14px;
  width: 10px;
  height: 15px;
  border-radius: 50% 50% 45% 45%;
  background: var(--c);
  box-shadow: 0 0 10px 2px var(--c);
  animation: twinkle 2.6s ease-in-out infinite;
  animation-delay: var(--d);
}
@keyframes twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .lights-string span { animation: none; }
}

/* ---------- header and layout ---------- */

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.site-header .inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  font-family: var(--heading);
  font-weight: 700;
  font-size: 20px;
  color: var(--red);
  text-decoration: none;
  white-space: nowrap;
}
.brand small { display: block; font: 12px/1.2 system-ui, sans-serif; color: var(--muted); font-weight: 500; }
.site-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}
main.narrow { max-width: 640px; }

.site-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  color: var(--muted);
  font-size: 14px;
  border-top: 1px solid var(--border);
}

/* ---------- cards / panels ---------- */

.card, .panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card.festive { border-top: 4px solid var(--red); }
.hint { color: var(--muted); font-size: 14px; font-weight: normal; font-family: system-ui, sans-serif; }

/* ---------- buttons and inputs ---------- */

button, .button {
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  min-height: 42px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button:hover, .button:hover { border-color: var(--green); }
button:disabled { opacity: 0.55; cursor: default; }
button:focus-visible, .button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.primary:hover { filter: brightness(1.08); border-color: var(--red); }
.secondary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
:root[data-theme="dark"] .secondary, :root[data-theme="dark"] .primary { color: #0c1813; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .secondary, :root:not([data-theme="light"]) .primary { color: #0c1813; }
}
.big { font-size: 17px; padding: 12px 20px; min-height: 50px; }
.link-button { background: none; border: none; color: var(--green); text-decoration: underline; padding: 0; min-height: 0; }
button[aria-pressed="true"] { background: var(--green); color: #fff; border-color: var(--green); }

.help {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
  color: var(--green);
  border-color: var(--green);
  flex: none;
}

label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 500; }
input, select, textarea {
  font: inherit;
  font-size: 16px; /* 16px stops iPhone zooming in on focus */
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
}
input[type="range"] { padding: 0; min-height: 28px; accent-color: var(--red); background: none; border: none; }
input[type="color"] { padding: 3px; width: 52px; }
input[type="number"] { width: 100px; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--green); }

.form { display: grid; gap: 14px; }
.error-text { color: var(--bad); font-weight: 500; }
.ok-text { color: var(--ok); font-weight: 500; }

/* ---------- pills, dots, status ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.pill.ok { background: var(--green-soft); color: var(--ok); }
.pill.bad { background: var(--red-soft); color: var(--bad); }
.pill.warn { background: var(--gold-soft); color: var(--warn); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--bad); flex: none; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }

/* ---------- listen (top of the home page, and /listen) ---------- */

.listen-card {
  text-align: center;
  color: #f5efe2;
  background:
    radial-gradient(circle at 12% 18%, rgb(255 214 102 / 55%) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 24%, rgb(255 255 255 / 55%) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 42% 70%, rgb(255 255 255 / 40%) 0 1px, transparent 2px),
    linear-gradient(160deg, #10241b, #0b1712 70%);
  background-size: 140px 140px, 90px 90px, 70px 70px, auto;
  border-radius: var(--radius);
  padding: 24px 18px;
  box-shadow: var(--shadow);
  border: 1px solid #23392e;
}
.live-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: #e8bd5a; margin-bottom: 6px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #ec6a6f; box-shadow: 0 0 10px #ec6a6f; animation: twinkle 1.6s ease-in-out infinite; }
.live-title { font-size: clamp(24px, 6.5vw, 36px); margin: 0 0 16px; color: #fff; }
.listen-button {
  font-size: 22px;
  font-weight: 700;
  min-height: 64px;
  min-width: min(280px, 100%);
  padding: 14px 28px;
  border-radius: 999px;
  border: none;
  color: #fff;
  background: linear-gradient(180deg, #d23a40, #a5232b);
  box-shadow: 0 6px 24px rgb(210 58 64 / 45%);
}
.listen-button:hover { filter: brightness(1.08); }
.listen-button[aria-pressed="true"] { background: linear-gradient(180deg, #2f8f5b, #1f5c45); box-shadow: 0 6px 24px rgb(47 143 91 / 45%); }
.live-status { margin: 14px auto 6px; color: #f5efe2; font-weight: 500; max-width: 460px; }
.live-hint { margin: 0 auto; color: #b9c8bf; font-size: 14px; max-width: 460px; }
.live-adjust { margin: 14px auto 0; max-width: 420px; text-align: left; color: #d8e2dc; font-size: 14px; }
.live-adjust summary { cursor: pointer; text-align: center; color: #b9c8bf; }
.live-adjust label { color: #d8e2dc; margin-top: 10px; }
.live-adjust .hint { color: #b9c8bf; }
body.listen-only main { padding-top: 28px; }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ---------- home page ---------- */

.hero {
  text-align: center;
  padding: 28px 18px;
  background:
    radial-gradient(circle at 15% 20%, var(--gold-soft) 0 2px, transparent 3px),
    radial-gradient(circle at 80% 30%, var(--red-soft) 0 3px, transparent 4px),
    radial-gradient(circle at 60% 80%, var(--green-soft) 0 3px, transparent 4px),
    var(--card);
  background-size: 120px 120px, 160px 160px, 140px 140px, auto;
}
.hero p { font-size: 18px; color: var(--muted); max-width: 560px; margin: 0 auto 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.steps { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.step { display: grid; gap: 6px; align-content: start; }
.step .num {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--red); color: #fff; font-weight: 700; font-family: var(--heading);
}
.step svg { width: 56px; height: 56px; }
.step-head { display: flex; align-items: center; gap: 10px; }

.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist li::before { content: "★"; color: var(--gold); flex: none; }

details.faq { border-top: 1px solid var(--border); padding: 12px 0; }
details.faq summary { cursor: pointer; font-weight: 600; }
details.faq p { margin: 8px 0 0; color: var(--muted); }

/* ---------- my house ---------- */

.mode-choices { display: grid; gap: 10px; }
.mode-choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  color: var(--text);
  font-size: 15px;
}
.mode-choice:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.mode-choice strong { display: block; font-size: 16px; }
.mode-choice span { color: var(--muted); }
.light-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.light-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border: 1px solid var(--border); border-radius: 10px;
}
.light-list li label { display: flex; align-items: center; gap: 12px; color: var(--text); font-size: 15px; flex: 1; cursor: pointer; }

/* ---------- dialogs (how-to guides) ---------- */

dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 20px 60px rgb(0 0 0 / 35%);
}
dialog::backdrop { background: rgb(12 24 19 / 55%); }
dialog .dialog-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--card);
}
dialog .dialog-head h2 { margin: 0; font-size: 20px; }
dialog .dialog-body { padding: 16px 18px 20px; overflow: auto; }
dialog ol, dialog ul { padding-left: 22px; margin: 0 0 12px; display: grid; gap: 8px; }
dialog .tip { background: var(--gold-soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.code {
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-wrap: anywhere;
  user-select: all;
}

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  box-shadow: var(--shadow); z-index: 10; font-size: 15px; max-width: calc(100vw - 32px);
}

/* ---------- admin console (also used by the simulator) ---------- */

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 12px; align-items: end; }
.modes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.row .label { min-width: 90px; color: var(--muted); font-size: 14px; }
.row[hidden] { display: none; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { display: inline-flex; gap: 0; padding: 0; overflow: hidden; height: 36px; min-height: 36px; min-width: 36px; border-radius: 8px; }
.swatch span { display: block; width: 20px; height: 100%; }
.swatch.single span { width: 36px; }
.swatch[aria-pressed="true"] { outline: 3px solid var(--gold); outline-offset: 2px; background: none; }

.drop {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px;
  border: 2px dashed var(--border); border-radius: 12px;
}
.drop.over { border-color: var(--green); background: var(--green-soft); }
.songs { margin: 12px 0 0; padding-left: 24px; display: grid; gap: 4px; }
.songs li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.songs li.playing .song-name { color: var(--red); font-weight: 700; }
.songs .song-name { background: none; border: none; padding: 4px 0; text-align: left; min-height: 36px; }
.songs .remove { padding: 0 10px; min-height: 32px; font-size: 14px; }
.songs .error { color: var(--bad); }
.mic { margin-top: 14px; }
.mic summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.level { display: inline-block; width: 80px; height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.level span { display: block; height: 100%; width: 0; background: var(--ok); transition: width 0.2s; }
.beat-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--border); flex: none; }
.beat-dot.on { background: var(--gold); box-shadow: 0 0 12px var(--gold); }

.street { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 12px; }
.house { border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: #0e1428; color: #e6e9f2; display: grid; gap: 8px; }
.house-top { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.house label { color: #b8c0d8; }
.house label input[type="range"] { width: 100%; }
.house .check { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.strand { display: flex; justify-content: space-between; padding: 10px 4px; border-top: 2px solid #2b3555; --bulb: #2a2f40; --glow: 0; }
.bulb { width: 9px; height: 12px; border-radius: 50% 50% 45% 45%; background: var(--bulb); box-shadow: 0 0 calc(14px * var(--glow)) calc(3px * var(--glow)) var(--bulb); opacity: calc(0.35 + 0.65 * var(--glow)); }
.roof { height: 54px; background: linear-gradient(#1a2240, #121a33); clip-path: polygon(50% 0, 100% 60%, 100% 100%, 0 100%, 0 60%); }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; }
td .offset { display: flex; align-items: center; gap: 8px; }
td .offset input { width: 140px; }
.warn { color: var(--warn); }

.admin-houses { display: grid; gap: 12px; }
.admin-house { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.admin-house header { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.admin-house header h3 { margin: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline label { display: flex; gap: 8px; align-items: center; color: var(--text); }
.pending-list { display: grid; gap: 8px; }
.pending-item { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px; border-radius: 10px; background: var(--gold-soft); }

/* ---------- printable signs (/sign) ---------- */

.sheet {
  background: #fff;
  color: #14231b;
  max-width: 640px;
  margin: 20px auto;
  padding: 28px 28px 32px;
  border: 10px solid #1f5c45;
  outline: 3px solid #b3262e;
  outline-offset: -18px;
  border-radius: 6px;
  text-align: center;
  box-shadow: var(--shadow);
}
.sheet-lights { display: flex; justify-content: space-between; margin: 0 6px 18px; }
.sheet-lights span { width: 14px; height: 20px; border-radius: 50% 50% 45% 45%; display: block; }
.sheet-kicker { font-family: var(--heading); color: #b3262e; font-size: 22px; font-weight: 700; margin: 0 0 6px; }
.sheet-title { font-size: 44px; line-height: 1.1; margin: 0 0 18px; color: #14231b; }
.sheet-qr { width: 70%; max-width: 380px; margin: 0 auto 14px; }
.sheet-qr.small { width: 46%; }
.sheet-qr svg { width: 100%; height: auto; display: block; }
.sheet-instructions { font-size: 22px; margin: 0 0 6px; }
.sheet-url { font: 700 22px/1.3 ui-monospace, Menlo, monospace; margin: 0 0 14px; color: #1f5c45; overflow-wrap: anywhere; }
.sheet-body { font-size: 18px; margin: 0 auto 18px; max-width: 480px; }
.sheet-passcode { font-size: 20px; margin: 4px 0 14px; }
.sheet-passcode .blank { display: inline-block; width: 220px; border-bottom: 2px solid #14231b; height: 1.2em; vertical-align: bottom; }
.sheet-small { font-size: 15px; color: #3f5148; margin: 0; }

@media print {
  @page { size: letter; margin: 0.4in; }
  body.signs { background: #fff; }
  .no-print { display: none; }
  .sheet { box-shadow: none; margin: 0 auto; max-width: none; min-height: 9.9in; break-after: page;
    display: flex; flex-direction: column; justify-content: center; }
  body[data-printing="yard"] [data-sheet="flyer"],
  body[data-printing="flyer"] [data-sheet="yard"] { display: none; }
  .sheet-title { font-size: 60px; }
  .sheet-kicker { font-size: 28px; }
  .sheet-instructions, .sheet-url { font-size: 28px; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Sections grouped inside the admin console keep the page's spacing. */
#console, #street-admin { display: grid; gap: 18px; min-width: 0; }
.row label.label { display: inline-flex; }

[hidden] { display: none !important; }

@media (max-width: 600px) {
  .card, .panel { padding: 14px; }
  .row .label { min-width: 100%; }
  .site-header .inner { padding: 10px 14px; }
  .brand { font-size: 18px; }
}
