/* SPDX-License-Identifier: AGPL-3.0-only */
/*
 * The app's only stylesheet. Served from the app itself (CSP style-src 'self'), with system fonts
 * only, so no page loads anything from anywhere else. Every page is readable without it.
 */

:root {
  --accent: #a11d33;
  --accent-deep: #5e0f1d;
  --spruce: #165c42;
  --spruce-deep: #0b3a29;
  --parchment: #fdf8ec;
  --parchment-edge: #f1e6cc;
  --brass: #c4912f;
  --text: #22201f;
  --text-soft: #5b5550;
  --card: #fffdf8;
  --line: #e6dcc4;
  --alert: #8f1a2b;
  --alert-wash: #fbe9ea;
  --calm-wash: #e7f3ec;
  --radius-big: 1.6rem;
  --radius: 1rem;
  --lift: 0 1.4rem 3.2rem rgba(60, 22, 18, 0.14), 0 0.2rem 0.6rem rgba(60, 22, 18, 0.08);
  --font-body: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: ui-serif, Georgia, "Times New Roman", serif;
}

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

[hidden] {
  display: none !important;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  line-height: 1.6;
  color: var(--text);
  background-color: var(--parchment);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.9) 0 0.18rem, transparent 0.22rem),
    radial-gradient(circle at 64% 4%, rgba(255, 255, 255, 0.85) 0 0.14rem, transparent 0.18rem),
    radial-gradient(circle at 86% 15%, rgba(255, 255, 255, 0.8) 0 0.2rem, transparent 0.24rem),
    linear-gradient(180deg, var(--spruce-deep) 0, var(--spruce) 13rem, var(--parchment) 13rem);
  background-repeat: no-repeat;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-deep);
}

:focus-visible {
  outline: 0.2rem solid var(--brass);
  outline-offset: 0.15rem;
}

h1,
h2 {
  font-family: var(--font-display);
  line-height: 1.2;
  color: var(--accent-deep);
}

h1 {
  font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.9rem);
  margin: 0.4rem 0 0.8rem;
}

h2 {
  font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem);
  margin: 0 0 0.6rem;
}

code {
  font-size: 0.95em;
  padding: 0 0.25em;
  border-radius: 0.3rem;
  background: var(--parchment-edge);
}

/* Off screen until it has keyboard focus. */

.jump-to-content {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  border-radius: 0.6rem;
  background: var(--card);
  color: var(--accent-deep);
  font-weight: 700;
}

.jump-to-content:focus {
  top: 1rem;
}

/* Masthead: a band of evergreen with the app's name on a ribbon. */

.masthead {
  color: var(--parchment);
}

.masthead-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  width: min(68rem, 100% - 2rem);
  margin: 0 auto;
  padding: 1.1rem 0 0.6rem;
}

.wordmark {
  position: relative;
  display: inline-block;
  padding: 0.35rem 1.1rem 0.35rem 2.3rem;
  border-radius: 0.5rem 1.6rem 1.6rem 0.5rem;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  box-shadow: 0 0.5rem 1.2rem rgba(0, 0, 0, 0.25);
}

.wordmark::before {
  content: "";
  position: absolute;
  left: 0.75rem;
  top: 50%;
  width: 0.85rem;
  height: 0.85rem;
  margin-top: -0.425rem;
  border-radius: 50%;
  background: var(--brass);
  box-shadow: inset -0.15rem -0.15rem 0 rgba(0, 0, 0, 0.18);
}

.wordmark:hover {
  color: #fff;
  background: var(--accent-deep);
}

.masthead-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.masthead-links a {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  color: var(--parchment);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.1);
}

.masthead-links a:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* The sheet: one large card of paper laid over the band. */

.sheet {
  flex: 1;
  width: min(68rem, 100% - 2rem);
  margin: 1.2rem auto 2.5rem;
  padding: clamp(1.25rem, 1rem + 2.5vw, 3rem);
  border-radius: var(--radius-big);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--lift);
}

.colophon {
  width: min(68rem, 100% - 2rem);
  margin: 0 auto 2rem;
  color: var(--text-soft);
  font-size: 0.9rem;
  text-align: center;
}

/* Home and simple pages. */

.lede {
  max-width: 40rem;
}

.kicker {
  margin: 0;
  color: var(--spruce);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.panel {
  padding: 1.2rem 1.3rem;
  border-radius: var(--radius);
  background: var(--parchment);
  border-top: 0.3rem solid var(--spruce);
}

.panel:nth-child(2) {
  border-top-color: var(--accent);
}

.panel:nth-child(3) {
  border-top-color: var(--brass);
}

.panel p {
  margin: 0;
  color: var(--text-soft);
}

.prose {
  max-width: 44rem;
}

.prose h2 {
  margin-top: 2rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px dotted var(--line);
}

/* Buttons. */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin: 1.2rem 0;
}

.button-main,
.button-quiet,
.button-danger,
.button-small {
  display: inline-block;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  border-radius: 999px;
  border: 2px solid transparent;
}

.button-main {
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0.45rem 1rem rgba(161, 29, 51, 0.28);
}

.button-main:hover {
  background: var(--accent-deep);
  color: #fff;
}

.button-quiet {
  padding: 0.7rem 1.3rem;
  background: transparent;
  color: var(--spruce-deep);
  border-color: var(--spruce);
}

.button-quiet:hover {
  background: var(--calm-wash);
  color: var(--spruce-deep);
}

.button-danger {
  padding: 0.7rem 1.3rem;
  background: var(--alert-wash);
  color: var(--alert);
  border-color: var(--alert);
}

.button-danger:hover {
  background: var(--alert);
  color: #fff;
}

.button-small {
  padding: 0.35rem 0.85rem;
  font-size: 0.9rem;
  background: var(--parchment);
  color: var(--spruce-deep);
  border-color: var(--line);
}

.button-small:hover {
  border-color: var(--spruce);
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Cards and lists. */

.card {
  margin: 1.2rem 0;
  padding: 1.2rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.card-feature {
  background: var(--calm-wash);
  border-color: #b9dcc8;
}

.card-danger {
  border-color: #efc2c7;
}

.crumb {
  margin: 0;
  font-size: 0.95rem;
}

.crumb a::before {
  content: "\2190\00a0";
}

.greeting,
.meta,
.hint,
.empty {
  color: var(--text-soft);
}

.meta,
.hint {
  font-size: 0.92rem;
  margin: 0.2rem 0 0.6rem;
}

.drawing-list,
.people-list,
.pick-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.drawing-item h2 {
  margin: 0;
}

.drawing-item h2 a {
  text-decoration: none;
}

.drawing-item h2 a:hover {
  text-decoration: underline;
}

.person,
.pick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px dashed var(--line);
}

.person:last-child,
.pick:last-child {
  border-bottom: 0;
}

.person-name {
  font-weight: 700;
}

.person-email {
  color: var(--text-soft);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.person form {
  margin-left: auto;
}

/* Forms. */

.form fieldset,
fieldset.card {
  min-width: 0;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}

legend {
  font-weight: 700;
  color: var(--spruce-deep);
  padding: 0;
}

fieldset.card legend {
  float: left;
  width: 100%;
  margin-bottom: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--accent-deep);
}

.person-row,
.exclusion-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.2rem 1rem;
  padding: 0.8rem 0;
  border-top: 1px dashed var(--line);
}

.person-row legend,
.exclusion-row legend {
  float: left;
  width: 100%;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0.5rem 0;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0 1rem;
}

.field.check {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

label {
  font-weight: 600;
}

.pick-label {
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--text-soft);
}

input:not([type="checkbox"]) {
  width: 100%;
  font: inherit;
  padding: 0.55rem 0.8rem;
  border: 2px solid var(--line);
  border-radius: 0.7rem;
  background: var(--parchment);
  color: var(--text);
}

.pick input:not([type="checkbox"]) {
  width: auto;
  flex: 1 1 10rem;
}

input:not([type="checkbox"]):focus {
  border-color: var(--spruce);
  background: #fff;
}

input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--accent);
}

input[aria-invalid="true"] {
  border-color: var(--alert);
  background: var(--alert-wash);
}

.field-error {
  margin: 0.1rem 0 0;
  color: var(--alert);
  font-weight: 700;
  font-size: 0.92rem;
  flex-basis: 100%;
}

.field-error::before {
  content: "\2715\00a0";
}

.mode-note,
.privacy-note {
  margin: 0.8rem 0;
  padding: 0.7rem 1rem;
  border-radius: 0.8rem;
  background: var(--parchment);
  border-left: 0.35rem solid var(--spruce);
}

.notice {
  margin: 1rem 0;
  padding: 0.85rem 1.1rem;
  border-radius: 0.8rem;
  font-weight: 600;
}

.notice p {
  margin: 0.2rem 0;
}

.notice-ok {
  background: var(--calm-wash);
  color: var(--spruce-deep);
}

.notice-problem {
  background: var(--alert-wash);
  color: var(--alert);
}

/* Facts and tables. */

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 2rem;
  margin: 1rem 0;
}

.facts div {
  min-width: 9rem;
}

.facts dt {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.facts dd {
  margin: 0;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.6rem 0.5rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

thead th {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
}

tbody th {
  font-weight: 700;
}

td {
  overflow-wrap: anywhere;
}

td form {
  margin: 0;
}

.status {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  background: var(--parchment-edge);
  color: var(--text-soft);
}

.status-sent {
  background: var(--calm-wash);
  color: var(--spruce-deep);
}

.status-failed,
.status-uncertain {
  background: var(--alert-wash);
  color: var(--alert);
}

.status-reason {
  font-size: 0.88rem;
  color: var(--text-soft);
}

.status-line {
  font-weight: 700;
}

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

/* The match page: a gift tag. */

.match-card {
  max-width: 34rem;
  margin: 0 auto;
  text-align: center;
}

.match-status {
  color: var(--text-soft);
}

.match-drawing {
  margin: 0;
  color: var(--spruce);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.match-lead {
  margin: 1.2rem 0 0;
  font-size: 1.1rem;
}

.match-recipient {
  position: relative;
  margin: 0.6rem auto 1.2rem;
  padding: 1.1rem 1.5rem;
  max-width: 26rem;
  border-radius: 0.6rem 1.4rem;
  border: 2px dashed var(--brass);
  background: var(--parchment);
  color: var(--accent-deep);
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 1.3rem + 2vw, 2.4rem);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.match-card .facts,
.match-card .actions {
  justify-content: center;
}

@media (max-width: 36rem) {
  .sheet {
    border-radius: var(--radius);
  }

  .person form {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .button-main,
  .button-quiet,
  .button-danger,
  .button-small,
  .masthead-links a {
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }
}
