/* Secret Santa LMDDC: ink on snow, one red postbox. */

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/static/fonts/fraunces-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url("/static/fonts/fraunces-latin-italic.woff2") format("woff2");
}

:root {
  --snow: #f3f5f4;
  --paper: #fffdf8;
  --ink: #14201b;
  --spruce: #163a2f;
  --pine: #2f6a52;
  --pine-soft: #dde9e2;
  --post: #b3202e;
  --post-deep: #7e1620;
  --post-ink: #fff4f2;
  --brass: #c9a24a;
  --mist: #d8dedb;
  --muted: #5c6c65;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --measure: 42rem;
  --radius: 4px;
}

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

html { background: var(--snow); color: var(--ink); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variation-settings: "opsz" 14, "SOFT" 30;
  min-height: 100vh;
}

#snow {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.shell { position: relative; z-index: 1; }

a { color: var(--pine); text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { color: var(--spruce); }

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

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--spruce);
  font-variation-settings: "opsz" 72, "SOFT" 60;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
p { margin: 0 0 1em; }

.muted { color: var(--muted); }
.empty { color: var(--muted); font-style: italic; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.25rem 1.25rem 0;
}
.brand {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--spruce);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.lang { display: flex; gap: 0.25rem; font-family: var(--sans); font-size: 0.8125rem; }
.lang a {
  padding: 0.15rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
}
.lang a[aria-current="true"] { border-color: var(--mist); color: var(--spruce); background: var(--paper); }

/* ------------------------------------------------------------ flash */

.flash {
  max-width: var(--measure);
  margin: 1rem auto 0;
  padding: 0.75rem 1.25rem;
  font-family: var(--sans);
  font-size: 0.9375rem;
  border-left: 4px solid var(--pine);
  background: var(--pine-soft);
  color: var(--spruce);
}
.flash-error { border-left-color: var(--post); background: #f9e4e4; color: var(--post-deep); }

/* ------------------------------------------------------------- letter */

.letter {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.hero { padding-top: 1rem; }
.hero .santa { width: 11rem; margin-bottom: 0.5rem; }
.hero h1 { font-size: clamp(2.25rem, 7vw, 3.5rem); font-weight: 300; margin-bottom: 0.75rem; }
.lead { font-size: 1.25rem; max-width: 34rem; }

.note {
  background: var(--paper);
  border: 1px solid var(--mist);
  padding: 1.5rem;
  margin: 1.5rem 0;
}
.note h1 { font-size: 1.5rem; }
.note p:last-child { margin-bottom: 0; }

.event-name { font-style: italic; color: var(--muted); margin-bottom: 2.5rem; }

.reveal { margin-bottom: 3rem; }
.reveal-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; margin-bottom: 1rem; }
.reveal-head .santa { width: 9.5rem; flex: none; }
.greeting { font-size: 1.375rem; font-style: italic; margin-bottom: 0.25rem; }
.reveal h1 { font-size: 1.25rem; color: var(--muted); font-weight: 400; margin-bottom: 0; }

/* ----------------------------------------------------------- santa */

.santa { display: block; height: auto; overflow: visible; }
.santa-eyes { transform-box: fill-box; transform-origin: center; animation: santa-blink 7s infinite; }
@keyframes santa-blink {
  0%, 94%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(0.08); }
}
.note-with-santa .santa { width: 7rem; margin-bottom: 0.75rem; }

.tag {
  position: relative;
  display: inline-block;
  background: var(--paper);
  border: 1px solid var(--mist);
  padding: 1.1rem 1.5rem 1.1rem 3.25rem;
  margin: 0 0 1.75rem;
  box-shadow: 0 1px 0 var(--mist);
  max-width: 100%;
}
.tag::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 1.45rem solid transparent;
  border-bottom: 1.45rem solid transparent;
  border-right: 1rem solid var(--paper);
  transform: translate(-100%, -50%);
}
.tag-hole {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: var(--snow);
  border: 2px solid var(--brass);
  transform: translateY(-50%);
}
.tag strong {
  font-weight: 500;
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  line-height: 1.1;
  color: var(--spruce);
  font-variation-settings: "opsz" 144, "SOFT" 100;
  letter-spacing: -0.01em;
  display: block;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1rem 1.5rem;
  margin: 0 0 1.5rem;
  padding: 1rem 0;
  border-top: 1px solid var(--mist);
  border-bottom: 1px solid var(--mist);
}
.facts div { margin: 0; }
.facts dt { font-family: var(--sans); font-size: 0.8125rem; color: var(--muted); }
.facts dd { margin: 0; font-size: 1.125rem; }
.countdown { font-size: 1.75rem; font-variation-settings: "opsz" 72; line-height: 1; }

.organiser-note { border-left: 3px solid var(--brass); padding-left: 1rem; margin: 1.5rem 0 0; }
.organiser-note h2 { font-size: 0.9375rem; font-family: var(--sans); color: var(--muted); font-weight: 500; margin-bottom: 0.25rem; }
.organiser-note p { font-style: italic; margin: 0; }

/* ------------------------------------------------------------- thread */

.thread-section { margin-top: 1rem; }
.thread { list-style: none; margin: 1.25rem 0; padding: 0; display: grid; gap: 0.75rem; }
.letter-card {
  background: var(--paper);
  border: 1px solid var(--mist);
  padding: 1rem 1.25rem;
  max-width: 36rem;
}
.letter-card.mine { background: var(--pine-soft); border-color: transparent; margin-left: auto; }
.letter-body { margin: 0 0 0.5rem; white-space: pre-line; }
.letter-meta { margin: 0; font-family: var(--sans); font-size: 0.8125rem; color: var(--muted); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.write { display: grid; gap: 0.5rem; margin-top: 1.5rem; }
.write label { font-family: var(--sans); font-size: 0.9375rem; color: var(--spruce); }

textarea, input, select {
  font: inherit;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--mist);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  width: 100%;
}
input, select { font-family: var(--sans); }
textarea { resize: vertical; min-height: 6rem; line-height: 1.5; }
textarea:focus, input:focus, select:focus { border-color: var(--pine); outline-offset: 0; }

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--snow);
  background: var(--spruce);
  border: 1px solid var(--spruce);
  border-radius: var(--radius);
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  text-decoration: none;
  justify-self: start;
  line-height: 1.3;
}
.btn:hover { background: var(--pine); border-color: var(--pine); color: var(--snow); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-quiet { background: transparent; color: var(--spruce); border-color: var(--mist); }
.btn-quiet:hover { background: var(--paper); color: var(--spruce); border-color: var(--spruce); }
.btn-small { padding: 0.3rem 0.7rem; font-size: 0.8125rem; }
.btn-primary { background: var(--pine); border-color: var(--pine); }
.btn-primary:hover { background: var(--spruce); border-color: var(--spruce); }
.btn-danger { background: var(--post); border-color: var(--post); }
.btn-danger:hover { background: var(--post-deep); border-color: var(--post-deep); }
.btn-paper { background: var(--paper); color: var(--post-deep); border-color: var(--paper); font-weight: 600; }
.btn-paper:hover { background: #fff; color: var(--post-deep); border-color: #fff; }

/* ------------------------------------------------------------ postbox */

.postbox {
  background: var(--post);
  color: var(--post-ink);
  padding: 0 1.25rem 3rem;
  margin-top: 1rem;
  box-shadow: inset 0 12px 24px -12px rgba(0, 0, 0, 0.35);
}
.postbox-inner { max-width: var(--measure); margin: 0 auto; position: relative; padding-top: 2.75rem; }
.postbox-slot {
  width: min(16rem, 70%);
  height: 0.9rem;
  margin: 0 auto 2rem;
  border-radius: 999px;
  background: var(--post-deep);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.25);
}
.postbox h2 { color: var(--post-ink); font-size: 1.75rem; font-variation-settings: "opsz" 96, "SOFT" 80; }
.postbox-intro { max-width: 32rem; opacity: 0.92; }
.postbox-empty, .postbox-closed { font-style: italic; opacity: 0.85; }
.postbox .thread { margin-top: 1.5rem; }
.postbox .letter-card { background: var(--paper); color: var(--ink); border-color: transparent; }
.postbox .letter-card.mine { background: #fff7e8; }
.postbox .letter-meta { color: var(--muted); }
.postbox-form label { color: var(--post-ink); }
.postbox-form textarea { border-color: transparent; }
.postbox-form textarea:focus { border-color: var(--brass); }
.postbox :focus-visible { outline-color: var(--paper); }

/* ----------------------------------------------------------- colophon */

.colophon {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
}
.colophon p { margin: 0; max-width: 34rem; }
.snow-toggle {
  font: inherit;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--mist);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  cursor: pointer;
  white-space: nowrap;
}
.snow-toggle[aria-pressed="false"] { text-decoration: line-through; }
.snow-toggle:hover { color: var(--spruce); border-color: var(--spruce); }

/* --------------------------------------------------------------- desk */

.page-admin { font-family: var(--sans); font-size: 0.9375rem; }
.page-admin .brand { font-family: var(--serif); }
.desk { max-width: 56rem; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.desk-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.desk-head h1 { font-size: 2rem; margin: 0; }
.desk-title { display: flex; align-items: flex-end; gap: 0.75rem; }
.desk-title .santa { width: 4.5rem; }
.inline { display: inline-flex; gap: 0.75rem; align-items: center; margin: 0; }

.panel {
  background: var(--paper);
  border: 1px solid var(--mist);
  padding: 1.25rem 1.5rem;
  margin: 1rem 0;
}
.panel h2 { font-size: 1.25rem; }
.panel h3 { font-size: 1rem; font-family: var(--sans); font-weight: 600; margin: 1.25rem 0 0.5rem; }
.panel-danger { border-color: #e7b9b9; }
.panel-danger h2 { color: var(--post-deep); }

.event-title { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.event-title h2 { margin: 0; font-size: 1.5rem; }
.facts-admin { border: 0; padding: 0.5rem 0 0; margin: 0.5rem 0; }
.facts-admin dd { font-size: 1rem; }

.pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--mist);
  color: var(--muted);
}
.pill-drawn { color: var(--spruce); background: var(--pine-soft); border-color: transparent; }
.pill-closed { color: var(--post-deep); background: #f9e4e4; border-color: transparent; }

.people { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1rem; }
.people th, .people td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--mist); vertical-align: middle; }
.people th { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.people .email { color: var(--muted); font-size: 0.875rem; word-break: break-all; }
.people .actions { text-align: right; white-space: nowrap; }
.ok { color: var(--pine); }
.warn { color: var(--post-deep); }

.exclusions { list-style: none; padding: 0; margin: 0.5rem 0 1rem; }
.exclusions li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.4rem 0; border-bottom: 1px solid var(--mist); }

.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.75rem; align-items: end; margin-top: 1rem; }
.grid-form h3 { grid-column: 1 / -1; margin: 0; }
.stack-form { display: grid; gap: 0.9rem; max-width: 32rem; }
.field { display: grid; gap: 0.3rem; }
.field label { font-size: 0.8125rem; color: var(--muted); }
.field small { color: var(--muted); font-size: 0.8125rem; }
.field-check { grid-template-columns: auto 1fr; align-items: start; gap: 0.6rem; }
.field-check input { width: 1.1rem; height: 1.1rem; margin-top: 0.2rem; }
.field-check label { font-size: 0.9375rem; color: var(--ink); }
.field-submit { align-self: end; }
.confirm-form { display: grid; gap: 0.6rem; max-width: 32rem; padding: 1rem 0; border-top: 1px solid var(--mist); }
.confirm-form:first-of-type { border-top: 0; padding-top: 0; }
.confirm-form p { margin: 0; }

@media (max-width: 40rem) {
  .reveal-head { flex-direction: column-reverse; align-items: flex-start; gap: 0.5rem; }
  .reveal-head .santa { width: 7.5rem; }
  .hero .santa { width: 8.5rem; }
  .colophon { flex-direction: column; }
  .people th:nth-child(3), .people td:nth-child(3) { display: none; }
  .letter-card.mine { margin-left: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  #snow { display: none; }
  .santa-eyes { animation: none; }
}
