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

:root {
  --cream: #faf6ef;
  --cream-deep: #f2ebe0;
  --paper: #fffdf9;
  --ink: #2f2b26;
  --ink-soft: #6b6259;
  --ink-faint: #9a9086;
  --sage: #7f9b83;
  --sage-deep: #5f7a64;
  --sky: #8ba9c6;
  --clay: #c98b6b;
  --line: #e6ddd0;
  --shadow-sm: 0 1px 2px rgba(47, 43, 38, 0.05), 0 4px 12px rgba(47, 43, 38, 0.05);
  --shadow-md: 0 2px 6px rgba(47, 43, 38, 0.07), 0 16px 40px rgba(47, 43, 38, 0.09);
  --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;
}

*, *::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(--sage-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(--sage-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: 66px; }

.brand {
  font-family: var(--serif); font-size: 1.12rem; color: var(--ink);
  text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem;
}
.brand-mark {
  width: 9px; height: 9px; border-radius: 50%; background: var(--sage);
  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(--sage); }

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

/* --- 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(--sage-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; }

.hero-rule {
  margin: clamp(3rem, 7vw, 5rem) auto 0; width: min(100% - 2.5rem, var(--wrap)); height: 1px;
  background: linear-gradient(to right, transparent, var(--line) 18%, var(--line) 82%, transparent);
}

/* --- 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(--sage-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(--sage-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-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(--sage); 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(--sage-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(--clay); 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(--sage-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(--sage); }

.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(--sage-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(--sage-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; }
