/* ---------------------------------------------------------------------------
   Baby Crawford — warm cream, sage and sky. One deliberate light theme.
   --------------------------------------------------------------------------- */

:root {
  /* Paper: the cream of the clouds and stars */
  --cream: #f7f1e5;
  --cream-deep: #eee4d3;
  --paper: #fffcf6;

  /* Ink: the night sky */
  --ink: #16202f;
  --ink-soft: #4b5b71;
  --ink-faint: #8d99a9;

  /* Accents: the rocket and the red planets */
  --accent: #c85f3a;
  --accent-deep: #a8431f;

  /* Supporting: ringed planets and the blue haze */
  --rust: #b4472c;
  --tan: #d9c3a0;
  --sky: #6d8aa8;
  --navy: #131c2b;
  --navy-soft: #22334a;

  --line: #e4d9c6;
  --shadow-sm: 0 1px 2px rgba(19, 28, 43, 0.05), 0 4px 12px rgba(19, 28, 43, 0.06);
  --shadow-md: 0 2px 6px rgba(19, 28, 43, 0.08), 0 16px 40px rgba(19, 28, 43, 0.12);
  --radius: 14px;
  --radius-lg: 22px;
  --serif: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --wrap: 1080px;
  --header-h: 66px;
}

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

/* Class rules like `display: grid` outrank the UA's [hidden] rule, so state this louder. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

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

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -0.015em; margin: 0; }
p { margin: 0 0 1rem; }
a { color: var(--accent-deep); }

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

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

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--cream); padding: 0.6rem 1rem; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

:where(a, button, input, textarea, select, summary):focus-visible {
  outline: 2.5px solid var(--accent-deep);
  outline-offset: 2px;
  border-radius: 6px;
}

/* --- Header ---------------------------------------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--cream) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.site-header.is-stuck { border-bottom-color: var(--line); }

.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: var(--header-h); }

.brand {
  font-family: var(--serif); font-size: 1.12rem; color: var(--ink);
  text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem;
  white-space: nowrap;
}
.brand-mark {
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  font-size: 0; line-height: 0; flex: none;
}

.site-nav { display: flex; gap: 1.4rem; }
.site-nav a {
  color: var(--ink-soft); text-decoration: none; font-size: 0.94rem; font-weight: 500;
  padding: 0.2rem 0; border-bottom: 1.5px solid transparent;
}
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--accent); }

@media (max-width: 560px) {
  .brand { font-size: 0.95rem; gap: 0.4rem; }
  .site-nav { gap: 0.7rem; }
  .site-nav a { font-size: 0.76rem; }
}

/* Below this the two simply cannot share a row; the hero states the name anyway. */
@media (max-width: 379px) {
  .brand { display: none; }
  .header-inner { justify-content: flex-end; }
}

/* --- Hero ------------------------------------------------------------------ */

.hero { padding: clamp(3.5rem, 9vw, 7rem) 0 0; text-align: center; position: relative; }
.hero-inner { max-width: 720px; }

.eyebrow {
  text-transform: uppercase; letter-spacing: 0.22em; font-size: 0.72rem;
  color: var(--ink-faint); font-weight: 600; margin-bottom: 1.1rem;
}
.hero-title { font-size: clamp(2.8rem, 8vw, 4.6rem); margin-bottom: 1rem; }
.hero-tagline { font-size: clamp(1.05rem, 2.4vw, 1.28rem); color: var(--ink-soft); margin-bottom: 1.8rem; }

.countdown {
  display: inline-flex; flex-direction: column; align-items: center; gap: 0.15rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 1rem 2.2rem; box-shadow: var(--shadow-sm); margin-bottom: 1.8rem;
}
.countdown-number { font-family: var(--serif); font-size: 2.3rem; line-height: 1; color: var(--accent-deep); }
.countdown-label { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-faint); }

.hero-note { color: var(--ink-soft); max-width: 56ch; margin-inline: auto; }
.hero-note:empty { display: none; }

.hero-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin-top: 1.6rem; }

/* Dotted like the rocket's trail in the artwork. */
.hero-rule {
  margin: clamp(3rem, 7vw, 5rem) auto 0; width: min(100% - 2.5rem, var(--wrap)); height: 0;
  border-top: 2px dotted var(--line);
}

/* --- Buttons --------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: inherit; font-weight: 500; font-size: 0.95rem;
  padding: 0.66rem 1.35rem; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--accent-deep); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: #55705a; }

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

.btn-small { padding: 0.42rem 0.9rem; font-size: 0.86rem; }

.linkish {
  background: none; border: 0; padding: 0; font: inherit; color: var(--accent-deep);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

/* --- Sections -------------------------------------------------------------- */

.section { padding: clamp(3.5rem, 8vw, 6rem) 0; }
.section-alt { background: var(--cream-deep); }

.section-head { max-width: 640px; margin-bottom: 2.2rem; }
.section-head h2 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); margin-bottom: 0.6rem; }
.section-head h2::after {
  content: ''; display: block; width: 46px; height: 2px; margin-top: 0.75rem;
  background: linear-gradient(to right, var(--accent), transparent);
}
.section-sub { color: var(--ink-soft); margin: 0; }

.empty { color: var(--ink-faint); font-style: italic; }

/* --- Registry -------------------------------------------------------------- */

.registry-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1.2rem;
  flex-wrap: wrap; margin-bottom: 1.8rem;
}
.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chip {
  font: inherit; font-size: 0.86rem; padding: 0.36rem 0.9rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-soft); cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--cream); }

.switch { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; color: var(--ink-soft); cursor: pointer; }
.switch input { accent-color: var(--accent-deep); width: 1rem; height: 1rem; }

.registry-status { color: var(--ink-faint); font-size: 0.9rem; }
.registry-status:empty { display: none; }

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

.gift {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm); transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.gift:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.gift.is-taken { opacity: 0.72; }

.gift-media {
  aspect-ratio: 4 / 3; background: var(--cream-deep); position: relative;
  display: grid; place-items: center; overflow: hidden;
}
.gift-media img { width: 100%; height: 100%; object-fit: cover; }
.gift-monogram { font-family: var(--serif); font-size: 2.4rem; color: var(--ink-faint); opacity: 0.55; }

.gift-flag {
  position: absolute; top: 0.7rem; left: 0.7rem;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.25rem 0.6rem; border-radius: 999px; background: var(--rust); color: #fff;
}
.gift-flag.flag-taken { background: var(--ink-soft); }

.gift-body { padding: 1.05rem 1.15rem 1.15rem; display: flex; flex-direction: column; gap: 0.45rem; flex: 1; }
.gift-category { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; }
.gift-title { font-size: 1.12rem; }
.gift-desc { font-size: 0.9rem; color: var(--ink-soft); margin: 0; }
.gift-meta { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; font-size: 0.88rem; color: var(--ink-soft); }
.gift-price { font-weight: 600; color: var(--ink); }
.gift-remaining { color: var(--accent-deep); font-weight: 500; }
.gift-remaining.is-none { color: var(--ink-faint); font-weight: 400; }

.gift-actions { display: flex; gap: 0.5rem; align-items: center; margin-top: auto; padding-top: 0.7rem; flex-wrap: wrap; }

.registry-footnote { margin-top: 2rem; font-size: 0.9rem; color: var(--ink-soft); }
.shipping { font-size: 0.9rem; color: var(--ink-soft); }

/* --- Shower ---------------------------------------------------------------- */

.shower-wrap { max-width: 720px; }
.shower-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 4vw, 2.4rem); box-shadow: var(--shadow-sm);
}
.shower-details { display: grid; grid-template-columns: max-content 1fr; gap: 0.55rem 1.4rem; margin: 0 0 1.4rem; }
.shower-details dt {
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600; padding-top: 0.28rem;
}
.shower-details dd { margin: 0; font-size: 1.02rem; }
.shower-details dd .lead { font-family: var(--serif); font-size: 1.25rem; }
@media (max-width: 520px) {
  .shower-details { grid-template-columns: 1fr; gap: 0.15rem; }
  .shower-details dd { margin-bottom: 0.85rem; }
}
.shower-notes { color: var(--ink-soft); }
.shower-notes:empty { display: none; }
.shower-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* --- Gallery --------------------------------------------------------------- */

.photo-grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }
.photo {
  padding: 0; border: 1px solid var(--line); background: var(--paper); cursor: zoom-in;
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.photo:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.photo img { aspect-ratio: 1; object-fit: cover; width: 100%; }
.photo figcaption {
  font-size: 0.82rem; color: var(--ink-soft); padding: 0.55rem 0.7rem; text-align: left;
}
.photo figcaption:empty { display: none; }

/* --- Guestbook ------------------------------------------------------------- */

.guestbook-wrap { max-width: 760px; }

.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: clamp(1.2rem, 3vw, 1.8rem); box-shadow: var(--shadow-sm);
}

.form { display: flex; flex-direction: column; gap: 0.95rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label { font-size: 0.83rem; font-weight: 600; color: var(--ink-soft); }
.optional { font-weight: 400; color: var(--ink-faint); }

input[type="text"], input[type="email"], input[type="number"], input[type="password"],
input[type="date"], input[type="url"], textarea, select {
  font: inherit; font-size: 0.96rem; color: var(--ink);
  background: var(--cream); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.6rem 0.75rem; width: 100%;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-footer { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.form-message { margin: 0; font-size: 0.88rem; color: var(--ink-soft); }
.form-message.is-error { color: #a4483a; }
.form-message.is-success { color: var(--accent-deep); }

.notes { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: 0.9rem; }
.note {
  background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--sky);
  border-radius: var(--radius); padding: 1rem 1.2rem;
}
.note-message { margin: 0 0 0.5rem; font-family: var(--serif); font-size: 1.04rem; }
.note-meta { font-size: 0.8rem; color: var(--ink-faint); margin: 0; }

/* --- Footer ---------------------------------------------------------------- */

.site-footer { padding: 3rem 0 3.5rem; text-align: center; border-top: 1px solid var(--line); }
.thank-you { max-width: 52ch; margin-inline: auto; color: var(--ink-soft); font-family: var(--serif); font-size: 1.05rem; }
.thank-you:empty { display: none; }
.footer-meta { font-size: 0.82rem; color: var(--ink-faint); margin: 1.2rem 0 0; }
.footer-meta a { color: var(--ink-faint); }

/* --- Dialogs --------------------------------------------------------------- */

.modal, .lightbox {
  border: 0; padding: 0; background: var(--paper); color: var(--ink);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  width: min(100% - 2rem, 480px); max-height: 88vh;
}
.modal::backdrop, .lightbox::backdrop { background: rgba(47, 43, 38, 0.45); backdrop-filter: blur(3px); }
.lightbox { width: min(100% - 2rem, 820px); background: var(--ink); }

.modal-close-form { position: sticky; top: 0; height: 0; text-align: right; z-index: 2; }
.modal-close {
  border: 0; background: transparent; font-size: 1.6rem; line-height: 1;
  color: var(--ink-faint); cursor: pointer; padding: 0.7rem 0.9rem;
}
.lightbox .modal-close { color: var(--cream-deep); }
.modal-close:hover { color: var(--ink); }

.modal-body { padding: 1.6rem clamp(1.2rem, 4vw, 1.9rem) 1.7rem; overflow-y: auto; }
.modal-body h3 { font-size: 1.45rem; margin-bottom: 0.5rem; }
.modal-gift { font-family: var(--serif); font-size: 1.05rem; color: var(--accent-deep); margin-bottom: 1.2rem; }

.code-label { font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 0.35rem; }
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.5rem; letter-spacing: 0.18em; text-align: center;
  background: var(--cream-deep); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 0.85rem; margin-bottom: 1.2rem;
}

.lightbox figure { margin: 0; }
.lightbox img { width: 100%; max-height: 74vh; object-fit: contain; }
.lightbox figcaption { color: var(--cream-deep); padding: 0.9rem 1.2rem; font-size: 0.9rem; text-align: center; }
.lightbox figcaption:empty { display: none; }

/* --- Background photo -----------------------------------------------------
   Tuned for a dark, painterly night sky. A navy veil deepens the art just
   enough for cream text to sit on it, instead of washing the picture out the
   way a light scrim would. `has-sky` carries the type changes that both
   placements share. */

body.bg-hero .hero {
  background-image:
    linear-gradient(to bottom, rgba(19, 28, 43, 0.30), rgba(19, 28, 43, 0.56)),
    var(--bg-image);
  background-size: cover;
  background-position: center;
}

body.bg-page {
  background-image:
    linear-gradient(rgba(19, 28, 43, 0.58), rgba(19, 28, 43, 0.72)),
    var(--bg-image);
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
}

/* Content sits on solid paper; the sky shows through at the hero and footer. */
body.bg-page .section { background: var(--cream); }
body.bg-page .section-alt { background: var(--cream-deep); }
body.bg-page .site-footer { background: transparent; border-top-color: rgba(242, 232, 216, 0.22); }
body.bg-page .site-footer .thank-you,
body.bg-page .site-footer .footer-meta { color: var(--cream); }
body.bg-page .site-footer .footer-meta a { color: var(--tan); }

/* Fixed attachment stutters badly on touch devices. */
@media (max-width: 820px), (hover: none) {
  body.bg-page { background-attachment: scroll; }
}

/* --- Type over the sky ---------------------------------------------------- */

.has-sky .hero {
  margin-top: calc(var(--header-h) * -1);
  padding-top: calc(var(--header-h) + clamp(3rem, 8vw, 6rem));
  padding-bottom: clamp(3.5rem, 8vw, 6rem);
}
.has-sky .hero-title,
.has-sky .hero-tagline,
.has-sky .hero-note { color: var(--cream); }
.has-sky .eyebrow { color: var(--tan); }

.has-sky .countdown {
  background: rgba(255, 252, 246, 0.10);
  border-color: rgba(242, 232, 216, 0.28);
  backdrop-filter: blur(6px);
  box-shadow: none;
}
.has-sky .countdown-number { color: var(--cream); }
.has-sky .countdown-label { color: var(--tan); }

.has-sky .btn-ghost { color: var(--cream); border-color: rgba(242, 232, 216, 0.42); }
.has-sky .btn-ghost:hover:not(:disabled) { background: rgba(255, 252, 246, 0.14); }

.has-sky .hero-rule { display: none; }

/* The header floats over the artwork until you scroll past it. */
.has-sky .site-header:not(.is-stuck) { background: transparent; }
.has-sky .site-header:not(.is-stuck) .brand { color: var(--cream); }
.has-sky .site-header:not(.is-stuck) .brand-mark { background: var(--accent); }
.has-sky .site-header:not(.is-stuck) .site-nav a { color: rgba(247, 241, 229, 0.84); }
.has-sky .site-header:not(.is-stuck) .site-nav a:hover {
  color: var(--cream);
  border-bottom-color: var(--accent);
}
