/*
 * waitformeet
 *
 * Hand-written, no framework, no build step. Colours come from custom properties so
 * the accent is a single value the admin UI can change, and both themes are defined
 * up front: the visitor's system preference decides, and an explicit choice is
 * stamped onto the root element as data-theme.
 *
 * The font stack is deliberately the system one. It renders Cyrillic, Latin and CJK
 * from fonts the device already has, which means nothing to download and no locale
 * that silently falls back to something ugly.
 */

:root {
  --accent: #e5687f;

  --bg: #fdf8f6;
  --bg-raised: #ffffff;
  --text: #2b2028;
  --text-muted: #6f6270;
  --border: #e8dcdf;
  --shadow: 0 1px 2px rgb(43 32 40 / 6%), 0 8px 24px rgb(43 32 40 / 6%);

  --radius: 14px;
  --radius-small: 8px;
  --space: 1rem;
  --measure: 68ch;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans", sans-serif;
  --font-numeric: ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16121a;
    --bg-raised: #201a26;
    --text: #f2ebf2;
    --text-muted: #a99fae;
    --border: #322a3a;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
  }
}

/* An explicit choice must win over the system preference in both directions. */
:root[data-theme="light"] {
  --bg: #fdf8f6;
  --bg-raised: #ffffff;
  --text: #2b2028;
  --text-muted: #6f6270;
  --border: #e8dcdf;
  --shadow: 0 1px 2px rgb(43 32 40 / 6%), 0 8px 24px rgb(43 32 40 / 6%);
}

:root[data-theme="dark"] {
  --bg: #16121a;
  --bg-raised: #201a26;
  --text: #f2ebf2;
  --text-muted: #a99fae;
  --border: #322a3a;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  /* A whisper of the accent behind the page, so the deployment's colour is felt
     rather than only seen on buttons. */
  background-image: radial-gradient(
    ellipse 80% 50% at 50% -10%,
    color-mix(in oklab, var(--accent) 18%, transparent),
    transparent
  );
  background-repeat: no-repeat;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5em;
  font-weight: 650;
}

p {
  margin: 0 0 0.75em;
}

a {
  color: inherit;
  text-decoration-color: color-mix(in oklab, var(--accent) 60%, transparent);
  text-underline-offset: 3px;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: var(--space);
  top: var(--space);
  z-index: 10;
  padding: 0.5em 1em;
  background: var(--bg-raised);
  border-radius: var(--radius-small);
  box-shadow: var(--shadow);
}

/* Header and navigation */

.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space);
  align-items: center;
  justify-content: space-between;
  padding: var(--space) clamp(var(--space), 4vw, 2.5rem);
  max-width: 72rem;
  width: 100%;
  margin: 0 auto;
}

.site-header__title {
  font-weight: 650;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.6rem, 2vw, 1.2rem);
  font-size: 0.95rem;
}

.inline-form {
  display: inline;
}

.link-button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in oklab, var(--accent) 60%, transparent);
  text-underline-offset: 3px;
}

.icon-button {
  font: inherit;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text);
}

/* Only one of the two glyphs is shown, whichever matches the active theme. */
.icon-button__moon {
  display: none;
}

:root[data-theme="dark"] .icon-button__sun,
.icon-button[data-theme-state="dark"] .icon-button__sun {
  display: none;
}

:root[data-theme="dark"] .icon-button__moon,
.icon-button[data-theme-state="dark"] .icon-button__moon {
  display: block;
}

/* Layout */

.main {
  flex: 1;
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(var(--space), 3vw, 2rem) clamp(var(--space), 4vw, 2.5rem) 4rem;
  display: flex;
  flex-direction: column;
  gap: clamp(2rem, 5vw, 3.5rem);
}

.section-heading {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.empty {
  color: var(--text-muted);
}

.banner {
  padding: 0.75em 1em;
  border-radius: var(--radius-small);
  border: 1px solid var(--border);
  margin: 0;
}

.banner--error {
  border-color: color-mix(in oklab, #d64545 45%, var(--border));
  background: color-mix(in oklab, #d64545 12%, var(--bg-raised));
}

.banner--notice {
  border-color: color-mix(in oklab, var(--accent) 45%, var(--border));
  background: color-mix(in oklab, var(--accent) 10%, var(--bg-raised));
}

/* Countdown */

.countdown {
  text-align: center;
}

.countdown__heading {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  text-wrap: balance;
}

.countdown__units {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.4rem, 2vw, 1rem);
  margin: clamp(1rem, 4vw, 2rem) 0 1rem;
}

.countdown__unit {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(0.6rem, 2.5vw, 1.4rem) 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.countdown__value {
  font-family: var(--font-numeric);
  font-size: clamp(1.8rem, 8vw, 3.6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  /* Tabular figures stop the layout twitching as the seconds tick. */
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.countdown__label {
  font-size: clamp(0.7rem, 2vw, 0.85rem);
  color: var(--text-muted);
}

.countdown__target {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* The "we made it" state only appears once the counter reaches zero. */
.countdown__reached {
  display: none;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
}

.countdown.is-reached .countdown__units,
.countdown.is-reached .countdown__target {
  display: none;
}

.countdown.is-reached .countdown__reached {
  display: block;
}

/* Progress */

.progress {
  max-width: var(--measure);
  width: 100%;
  margin-inline: auto;
  text-align: center;
}

.progress__apart {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.progress__track {
  height: 10px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--accent) 14%, var(--bg-raised));
  border: 1px solid var(--border);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  width: calc(var(--progress, 0) * 100%);
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    color-mix(in oklab, var(--accent) 70%, white),
    var(--accent)
  );
  transition: width 600ms ease;
}

.progress__percent {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Clocks */

.clocks__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: var(--space);
}

.clock {
  position: relative;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem;
  text-align: center;
  overflow: hidden;
}

/* A warm wash for daytime, a cool one for night, so a glance tells you which. */
.clock::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.5;
  pointer-events: none;
}

.clock.is-day::before {
  background: linear-gradient(160deg, rgb(255 214 140 / 30%), transparent 60%);
}

.clock.is-night::before {
  background: linear-gradient(160deg, rgb(122 137 214 / 28%), transparent 60%);
}

.clock > * {
  position: relative;
}

.clock__who {
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.clock__time {
  font-family: var(--font-numeric);
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin: 0;
}

.clock__date,
.clock__where {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Timeline */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.timeline__item {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.85rem;
  align-items: start;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
}

.timeline__item.is-past {
  opacity: 0.62;
}

.timeline__marker {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: color-mix(in oklab, var(--accent) 16%, var(--bg));
  font-size: 1rem;
}

.timeline__body p {
  margin: 0;
}

.timeline__title {
  font-weight: 600;
}

.timeline__when {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.timeline__relative::before {
  content: "· ";
}

.timeline__note {
  margin-top: 0.35rem !important;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* Quote */

.quote__text {
  margin: 0;
  padding: 1.2rem 1.4rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-raised);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 1.05rem;
  max-width: var(--measure);
}

/* Cards and forms */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.2rem, 4vw, 2rem);
  width: 100%;
}

.card--narrow {
  max-width: 26rem;
  margin-inline: auto;
}

.card--centred {
  text-align: center;
}

.card__heading {
  font-size: 1.35rem;
}

.card__intro {
  color: var(--text-muted);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.9rem;
  font-weight: 600;
}

.field__hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
input[type="number"],
select,
textarea {
  font: inherit;
  color: inherit;
  width: 100%;
  padding: 0.6em 0.75em;
  border-radius: var(--radius-small);
  border: 1px solid var(--border);
  background: var(--bg);
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

.button {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
  text-align: center;
  text-decoration: none;
  padding: 0.65em 1.2em;
  border-radius: var(--radius-small);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.button--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.button:hover {
  filter: brightness(1.05);
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 1.2rem 0;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.error-code {
  font-family: var(--font-numeric);
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
  line-height: 1;
}

/* Footer */

.site-footer {
  padding: var(--space) clamp(var(--space), 4vw, 2.5rem) 2rem;
  max-width: 72rem;
  width: 100%;
  margin: 0 auto;
  border-top: 1px solid var(--border);
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.lang-switch select {
  width: auto;
  padding: 0.35em 0.6em;
}

/* Wide content must scroll inside its own box rather than the page. */
.scroll-x {
  overflow-x: auto;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Admin */

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.admin-nav a {
  padding: 0.4em 0.9em;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text-muted);
}

.admin-nav a[aria-current="page"] {
  background: color-mix(in oklab, var(--accent) 16%, var(--bg-raised));
  color: var(--text);
  font-weight: 600;
}

.fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* A disabled fieldset is how the seed-locked form is shown: every control is
   genuinely inert rather than merely styled to look that way. */
.fieldset[disabled] {
  opacity: 0.7;
}

.fieldset--boxed {
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 1rem;
}

.fieldset--boxed legend {
  padding: 0 0.5em;
  font-weight: 600;
  font-size: 0.9rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1rem;
  align-items: start;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
}

.checkbox input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
}

.form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding-top: 0.4rem;
}

.form--row {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.form--row:last-child {
  border-bottom: 0;
}

.button--danger {
  border-color: color-mix(in oklab, #d64545 55%, var(--border));
  color: #d64545;
  background: transparent;
}

.card--highlight {
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 8%, var(--bg-raised));
}

.invite-link {
  display: inline-block;
  padding: 0.5em 0.7em;
  border-radius: var(--radius-small);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  white-space: nowrap;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.list__row:last-child {
  border-bottom: 0;
}

.list__main {
  flex: 1;
  min-width: 12rem;
}

.list__meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.user-row__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.pill {
  font-size: 0.75rem;
  padding: 0.15em 0.6em;
  border-radius: 999px;
  background: color-mix(in oklab, var(--accent) 16%, var(--bg));
  color: var(--text-muted);
}

.main > .card + .card {
  margin-top: -1rem;
}

/* Notes */

.note-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 1rem;
}

.note {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.2rem;
}

.note--hidden {
  opacity: 0.55;
}

.note__body {
  margin: 0 0 0.6rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.note__by {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Gallery */

.gallery__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
  gap: 1rem;
}

.gallery__item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-raised);
}

.gallery__caption {
  margin: 0.4rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.lightbox {
  border: 0;
  padding: 0;
  max-width: min(94vw, 60rem);
  max-height: 94vh;
  background: var(--bg-raised);
  border-radius: var(--radius);
  color: var(--text);
}

.lightbox::backdrop {
  background: rgb(0 0 0 / 72%);
  backdrop-filter: blur(2px);
}

.lightbox__image {
  display: block;
  max-width: 100%;
  max-height: 82vh;
  margin: 0 auto;
}

.lightbox__caption {
  margin: 0;
  padding: 0.75rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

.lightbox__close {
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  border: 0;
  background: none;
  color: var(--text);
}

/* Confetti sits above everything and intercepts nothing. */
.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* Weather */

.clock__weather {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.clock__weather-icon {
  font-size: 1.1rem;
}
