/*
 * Palette sampled from the hero illustration: night sky, rust planets,
 * parchment clouds, Saturn gold.
 */

:root {
  --page: #f5efe3;        /* parchment, from the clouds */
  --card: #fffcf6;
  --ink: #16232f;         /* deep space navy, used as text */
  --ink-soft: #4a5a69;
  --ink-faint: #8494a1;
  --line: #e4dac8;

  --accent: #c04a26;      /* rust, from the red planets */
  --accent-dark: #a33d1e;
  --wash-rust: #faebe3;

  --navy: #16283c;
  --navy-deep: #0e1a26;
  --slate: #5a7c9b;       /* the small blue planets */
  --wash-blue: #e8eef4;
  --gold: #c9a66b;        /* Saturn's rings */
  --gold-bright: #e8c97a; /* stars */

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(22, 35, 47, 0.04), 0 8px 24px rgba(22, 35, 47, 0.07);
  --shadow-lift: 0 2px 4px rgba(22, 35, 47, 0.07), 0 16px 40px rgba(22, 35, 47, 0.12);

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/*
 * The UA rule for [hidden] is `display: none`, which ANY author rule that sets
 * display will beat -- .login-shell{display:grid} and .btn{display:inline-flex}
 * both did, so toggling .hidden left those elements on screen. This wins.
 */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--accent-dark); }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

.wrap {
  width: min(1080px, 100% - 2.5rem);
  margin-inline: auto;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); transform: translateY(-1px); }

.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: #fff; border-color: var(--ink-faint); }

.btn-quiet {
  background: none;
  border: none;
  padding: 0;
  color: var(--ink-faint);
  font: inherit;
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
}
.btn-quiet:hover { color: var(--accent); }

.btn-sm { padding: 0.45rem 0.95rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  /* Gradient underneath doubles as the fallback if the photo fails to load. */
  background:
    linear-gradient(180deg, rgba(14, 26, 38, 0) 45%, rgba(14, 26, 38, 0.55) 78%, var(--page) 100%),
    linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 55%, #24384d 100%);
  padding: clamp(3.5rem, 10vw, 7rem) 0 clamp(3rem, 7vw, 5rem);
  text-align: center;
  color: #fff;
}

/* The illustration sits in its own layer so the scrim above can stay separate. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("/hero-1100.jpg");
  background-size: cover;
  background-position: center 35%;
  z-index: 0;
}

@media (min-width: 641px) {
  .hero::before { background-image: url("/hero-2000.jpg"); }
}

/* Darkens the sky just enough for text contrast, and melts into the page. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(90% 65% at 50% 32%, rgba(14, 26, 38, 0.34) 0%, rgba(14, 26, 38, 0.72) 100%),
    linear-gradient(180deg, rgba(14, 26, 38, 0.45) 0%, rgba(14, 26, 38, 0.12) 30%, rgba(14, 26, 38, 0.72) 72%, var(--page) 100%);
  z-index: 1;
}

.hero > .wrap {
  position: relative;
  z-index: 2;
}

/*
 * On a phone the hero is tall and narrow, and `cover` on a 1.79:1 illustration
 * crops away every planet -- you get a slice of empty sky. Instead show the
 * whole artwork as a band near its own aspect ratio (62vw keeps ~90% of the
 * width) with the text below it on navy.
 *
 * This block MUST come after the base .hero::before/::after rules: same
 * specificity, so source order decides which one wins.
 */
@media (max-width: 640px) {
  .hero {
    --band: min(62vw, 300px);
    padding-top: calc(var(--band) + 2rem);
    /* Solid navy well past the band, so the scrim's bottom meets an identical
       colour and leaves no seam where the picture ends. */
    background: linear-gradient(
      180deg,
      var(--navy-deep) 0px,
      var(--navy-deep) 420px,
      var(--navy) 62%,
      var(--page) 100%
    );
  }

  .hero::before {
    bottom: auto;
    height: var(--band);
    background-position: center center;
  }

  /* Reaches full navy exactly at the band's bottom edge, so the artwork
     dissolves into the background instead of stopping at a hard line. */
  .hero::after {
    bottom: auto;
    height: var(--band);
    background: linear-gradient(
      180deg,
      rgba(14, 26, 38, 0.1) 0%,
      rgba(14, 26, 38, 0) 30%,
      rgba(14, 26, 38, 0.28) 58%,
      rgba(14, 26, 38, 0.82) 85%,
      var(--navy-deep) 100%
    );
  }

  .hero h1,
  .hero .subhead,
  .hero .welcome { text-shadow: none; }
}

.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-bright);
  font-weight: 700;
  margin: 0 0 1rem;
}

.hero h1 {
  font-size: clamp(2.3rem, 6.5vw, 4.15rem);
  max-width: 16ch;
  margin-inline: auto;
  color: #fffdf7;
  text-shadow: 0 2px 24px rgba(9, 17, 26, 0.55);
}

.hero .subhead {
  font-size: clamp(1.02rem, 2.2vw, 1.2rem);
  color: rgba(255, 253, 247, 0.9);
  max-width: 46ch;
  margin: 1.1rem auto 0;
  text-shadow: 0 1px 14px rgba(9, 17, 26, 0.6);
}

.hero .welcome {
  max-width: 54ch;
  margin: 1.6rem auto 0;
  color: rgba(255, 253, 247, 0.82);
  white-space: pre-line;
  text-shadow: 0 1px 14px rgba(9, 17, 26, 0.6);
}

/* ---------- shower details ---------- */

.details {
  position: relative;
  z-index: 2;
  margin-top: clamp(2rem, 5vw, 3rem);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  text-align: left;
  /* This card lives inside .hero, which sets color:#fff -- without resetting
     here, every value in it inherits white and vanishes on the cream. */
  color: var(--ink);
}

.details h2 {
  font-size: 1.35rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1.25rem 1.75rem;
}

.detail {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
}

.detail .icon {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--wash-blue);
  color: var(--accent-dark);
}

.detail .label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}

.detail .value {
  font-weight: 600;
  white-space: pre-line;
}

.detail .value a { text-decoration: none; }
.detail .value a:hover { text-decoration: underline; }

.details-cta {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  text-align: center;
}

.details-cta p { margin: 0 0 1rem; color: var(--ink-soft); }

/* ---------- sections ---------- */

section.registry { padding: clamp(3rem, 7vw, 4.5rem) 0 5rem; }

.section-head { text-align: center; margin-bottom: 2rem; }
.section-head h2 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
.section-head p { color: var(--ink-soft); max-width: 52ch; margin: 0.75rem auto 0; white-space: pre-line; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font: inherit;
  font-size: 0.87rem;
  font-weight: 600;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- item grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 1.5rem;
}

.item {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.item:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.item.is-taken { opacity: 0.72; }

.item-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--wash-blue);
  overflow: hidden;
}

.item-media img { width: 100%; height: 100%; object-fit: cover; }

.item-media .placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #a9bccd;
}

.badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: rgba(255, 253, 249, 0.94);
  backdrop-filter: blur(4px);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  box-shadow: 0 1px 3px rgba(47, 42, 38, 0.12);
}

.badge.purchased { background: var(--navy); color: #fff; }
.badge.claimed { background: var(--gold); color: #fff; }

.item-body { padding: 1.15rem 1.25rem 1.35rem; display: flex; flex-direction: column; flex: 1; gap: 0.55rem; }

.item-store {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
}

.item h3 { font-size: 1.1rem; font-family: var(--sans); font-weight: 700; letter-spacing: 0; }

.item .desc {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item .price { font-weight: 700; color: var(--accent); }

.item-foot { margin-top: auto; padding-top: 0.9rem; display: flex; flex-direction: column; gap: 0.55rem; }

.item-link {
  font-size: 0.87rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent-dark);
}
.item-link:hover { text-decoration: underline; }

.qty-note { font-size: 0.8rem; color: var(--ink-faint); }

.you-got-it {
  background: var(--wash-blue);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  color: var(--accent-dark);
  font-weight: 600;
}

/* ---------- empty / loading ---------- */

.empty {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--ink-faint);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.skeleton { background: linear-gradient(90deg, #ebe3d3 25%, #f4ede0 50%, #ebe3d3 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); height: 320px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- modal ---------- */

dialog.modal {
  border: none;
  padding: 0;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  width: min(460px, calc(100vw - 2rem));
  box-shadow: var(--shadow-lift);
}
dialog.modal::backdrop { background: rgba(47, 42, 38, 0.45); backdrop-filter: blur(2px); }

.modal-inner { padding: 1.6rem 1.6rem 1.75rem; }
.modal-inner h2 { font-size: 1.4rem; }
.modal-sub { color: var(--ink-soft); font-size: 0.92rem; margin: 0.4rem 0 1.3rem; }

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.82rem; font-weight: 700; margin-bottom: 0.35rem; }
.field .hint { font-weight: 400; color: var(--ink-faint); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"], textarea, select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font: inherit;
  color: var(--ink);
}

input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

textarea { resize: vertical; min-height: 76px; }

.check { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.92rem; }
.check input { margin-top: 0.25rem; flex: none; }

.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1.4rem; }

.alert {
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  font-size: 0.88rem;
  margin-bottom: 1rem;
}
.alert.error { background: var(--wash-rust); color: #8c4a30; }
.alert.success { background: var(--wash-blue); color: var(--accent-dark); }
.alert[hidden] { display: none; }

/* ---------- footer ---------- */

footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0 2.5rem;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.85rem;
}
footer a { color: var(--ink-faint); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 200%);
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lift);
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  z-index: 50;
}
.toast.show { transform: translate(-50%, 0); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

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

/* ================= admin dashboard ================= */

.admin-bar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 1rem 0;
}

.admin-bar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-bar .brand { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.admin-bar nav { display: flex; gap: 0.5rem; align-items: center; }

.login-shell { display: grid; place-items: center; min-height: 100vh; padding: 2rem 1rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.25rem, 3vw, 1.9rem);
}

.login-shell .card { width: min(400px, 100%); }
.login-shell h1 { font-size: 1.6rem; margin-bottom: 0.4rem; }

.admin-main { padding: 2rem 0 5rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem 1.15rem; }
.stat .n { font-family: var(--serif); font-size: 1.9rem; font-weight: 600; line-height: 1; }
.stat .k { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); font-weight: 700; margin-top: 0.35rem; }

.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.5rem; border-bottom: 1px solid var(--line); }

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.65rem 0.9rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.93rem;
  color: var(--ink-faint);
  cursor: pointer;
  margin-bottom: -1px;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.panel[hidden] { display: none; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }
.form-grid .span-2 { grid-column: 1 / -1; }

.section-title { font-size: 1.15rem; margin-bottom: 0.35rem; }
.section-desc { color: var(--ink-soft); font-size: 0.9rem; margin: 0 0 1.25rem; }

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

.row-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.admin-item {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 1rem;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
}

.admin-item.archived { opacity: 0.6; }

.admin-item .thumb {
  width: 74px;
  height: 74px;
  border-radius: 10px;
  background: var(--wash-blue);
  object-fit: cover;
  display: grid;
  place-items: center;
  color: #a9bccd;
  font-size: 0.7rem;
  overflow: hidden;
}
.admin-item .thumb img { width: 100%; height: 100%; object-fit: cover; }

.admin-item .meta { min-width: 0; }
.admin-item .meta strong { display: block; overflow: hidden; text-overflow: ellipsis; }
.admin-item .meta .sub { font-size: 0.83rem; color: var(--ink-faint); }

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.pill.open { background: var(--wash-blue); color: var(--accent-dark); }
.pill.claimed { background: #fdf1dc; color: #8a6620; }
.pill.purchased { background: var(--navy); color: #fff; }

table.claims { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
table.claims th, table.claims td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); font-size: 0.9rem; vertical-align: top; }
table.claims th { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); background: #f7f1e5; }
table.claims tr:last-child td { border-bottom: none; }

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

.danger { color: #a8462a; }

@media (max-width: 620px) {
  .admin-item { grid-template-columns: 56px 1fr; }
  .admin-item .thumb { width: 56px; height: 56px; }
  .admin-item .row-actions { grid-column: 1 / -1; }
}
