/* =============================================================
   Trail-map theme
   Two pages share this stylesheet: index.html (guest, themed)
   and admin.html (utilitarian, just enough theme to match).
   ============================================================= */

/* ---------- design tokens ---------- */
:root {
  /* palette */
  --cream:    #fbf6ef;   /* page background */
  --parchment:#fffaf2;   /* card surfaces */
  --forest:   #3d5a3d;   /* topo lines, primary ink accents */
  --moss:     #6b8367;   /* secondary text */
  --rust:     #b86b3a;   /* trail blazes, primary action */
  --rust-dk:  #8f4f25;   /* hover */
  --sky:      #a8c4d4;   /* gentle accents */
  --ink:      #2a2620;   /* body text */
  --muted:    #7a6f68;   /* meta text */
  --error:    #b04848;
  --line:     #e4d8c8;   /* hairline borders */

  /* typography */
  --font-display: "Fraunces", "Cormorant Garamond", Georgia, serif;
  --font-hand:    "Caveat", "Bradley Hand", cursive;
  --font-stamp:   "Special Elite", "Courier New", monospace;
  --font-body:    "Inter", system-ui, -apple-system, sans-serif;

  /* shape */
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 12px 30px rgba(61, 90, 61, 0.10),
            0 2px 6px  rgba(61, 90, 61, 0.06);
  --shadow-lift: 0 18px 40px rgba(61, 90, 61, 0.14),
                 0 3px 8px  rgba(61, 90, 61, 0.08);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p, ul, ol, figure, fieldset { margin: 0; padding: 0; }
fieldset { border: 0; }
button { font: inherit; cursor: pointer; }

/* ---------- base ---------- */
body {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--ink);
  line-height: 1.65;
  letter-spacing: 0.01em;
  min-height: 100vh;
  display: flex;
  justify-content: center;

  background-color: var(--cream);
  background-image: url("../svg/topo.svg");
  background-repeat: repeat;
  background-size: 600px 600px;
}

h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.4rem, 4.5vw, 3.1rem);
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-bottom: 0.4rem;
}

.lede {
  font-size: 1.2rem;
  color: var(--moss);
  margin-bottom: 1.5rem;
}

.event-date {
  font-family: var(--font-stamp);
  font-size: 1.25rem;
  color: var(--rust);
  text-align: center;
  letter-spacing: 0.12em;
  margin-bottom: 0.6rem;
}

/* ---------- layout ---------- */
.stage {
  width: 100%;
  max-width: 600px;
  padding: 2.5rem 1.25rem 4rem;
}
.stage.admin { max-width: 1100px; }

.screen { display: none; }
.screen.active { display: block; }

/* ---------- card / parchment surface for each screen ---------- */
#password-screen,
#rsvp-form-screen,
#success-screen {
  background: var(--parchment);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 2rem 1.75rem 2rem;
  box-shadow: var(--shadow);
  position: relative;
}

/* ---------- trail header (number + diamond blaze) ---------- */
.trail-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-stamp);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: var(--rust);
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}
.trail-header::before {
  content: "";
  width: 12px;
  height: 12px;
  background: var(--rust);
  transform: rotate(45deg);
  flex-shrink: 0;
}
.trail-header .dot {
  flex: 1;
  height: 1px;
  background: repeating-linear-gradient(
    to right,
    var(--rust) 0 4px,
    transparent 4px 8px
  );
  opacity: 0.55;
}

/* ---------- hero crew (the little party walking the trail) ---------- */
.crew {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.1rem 0.5rem;
  margin: 0.5rem 0 1.6rem;
  user-select: none;
}
@media (min-width: 480px) {
  .crew { gap: 0.1rem 1.4rem; }
  .crew-sep { display: none; }
}
.crew-member {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}
.crew-emoji {
  font-size: 1.6rem;
  line-height: 1;
}
.crew-name {
  font-family: var(--font-hand);
  font-size: 1rem;
  color: var(--moss);
  line-height: 1;
}
.crew-sep {
  color: var(--moss);
  font-size: 1rem;
  padding-top: 0.35rem;
  align-self: flex-start;
}

/* ---------- forms ---------- */
form { display: grid; gap: 1rem; }
label {
  font-family: var(--font-stamp);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--moss);
}
fieldset legend { /* same look as <label> */
  font-family: var(--font-stamp);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--moss);
  margin-bottom: 0.5rem;
}

input[type="text"], input[type="tel"], input[type="password"],
select, textarea {
  font: inherit;
  color: var(--ink);
  width: 100%;
  padding: 0.7rem 0.3rem;
  min-height: 44px;
  background: transparent;
  border: 0;
  border-bottom: 1.5px dashed var(--line);
  border-radius: 0;
  transition: border-color 120ms ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-bottom-color: var(--rust);
  border-bottom-style: solid;
}
textarea {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  resize: vertical;
  min-height: 4.5rem;
}
textarea:focus { border-color: var(--rust); border-style: solid; }

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--moss) 50%),
    linear-gradient(135deg, var(--moss) 50%, transparent 50%);
  background-position:
    calc(100% - 14px) 55%,
    calc(100% - 9px)  55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 1.6rem;
}

/* radio group laid out as 'pick a path' chips */
.radio-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.radio-row label {
  font-family: var(--font-body);
  font-size: 0.95rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  padding: 0.5rem 0.9rem;
  border: 1.5px dashed var(--line);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 120ms ease;
}
.radio-row label:hover { border-color: var(--rust); }
.radio-row input[type="radio"] {
  appearance: none;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--moss);
  border-radius: 50%;
  margin: 0;
  position: relative;
}
.radio-row input[type="radio"]:checked {
  border-color: var(--rust);
  background: var(--rust);
  box-shadow: inset 0 0 0 2px var(--parchment);
}
.radio-row label:has(input:checked) {
  border-style: solid;
  border-color: var(--rust);
  color: var(--rust-dk);
  background: rgba(184, 107, 58, 0.06);
}

/* ---------- password emoji trail ---------- */
.pw-trail {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.2rem;
  min-height: 2rem;
  font-size: 1.3rem;
  line-height: 1;
  margin: -0.25rem 0 0.25rem;
}
.pw-trail span {
  display: inline-block;
  animation: emoji-pop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes emoji-pop {
  from { transform: scale(0) translateY(4px); opacity: 0; }
  to   { transform: scale(1) translateY(0);   opacity: 1; }
}
.pw-trail.celebrating span {
  animation: emoji-celebrate 0.55s ease 3;
  animation-delay: calc(var(--idx) * 40ms);
}
@keyframes emoji-celebrate {
  0%   { transform: translateY(0)   rotate(0deg); }
  30%  { transform: translateY(-10px) rotate(-15deg); }
  60%  { transform: translateY(-6px)  rotate(10deg); }
  100% { transform: translateY(0)   rotate(0deg); }
}
.pw-trail.shaking {
  animation: trail-shake 0.4s ease;
}
@keyframes trail-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

/* ---------- floating emoji bursts (attending / menu picks) ---------- */
.emoji-float {
  position: fixed;
  pointer-events: none;
  font-size: 1.5rem;
  line-height: 1;
  z-index: 200;
  animation: emoji-float-up 0.9s ease-out forwards;
}
@keyframes emoji-float-up {
  0%   { transform: translateY(0) scale(0.7); opacity: 1; }
  60%  { opacity: 1; }
  100% { transform: translateY(-72px) scale(1.2); opacity: 0; }
}

/* Radio label micro-animations on selection */
.radio-row label { transform-origin: center; }
.radio-row label.anim-yes {
  animation: label-yes 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.radio-row label.anim-no {
  animation: label-no 0.4s ease;
}
@keyframes label-yes {
  0%   { transform: scale(1) rotate(0deg); }
  40%  { transform: scale(1.12) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); }
}
@keyframes label-no {
  0%   { transform: translateY(0); }
  35%  { transform: translateY(4px); }
  100% { transform: translateY(0); }
}

/* ---------- buttons ---------- */
button {
  padding: 0.8rem 1.2rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--rust);
  color: var(--parchment);
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow);
  transition: transform 100ms ease, background 120ms ease,
              box-shadow 120ms ease;
}
button:hover { background: var(--rust-dk); box-shadow: var(--shadow-lift); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

/* small ghost-style secondary button for the "edit my RSVP" link */
#edit-rsvp {
  background: transparent;
  color: var(--moss);
  box-shadow: none;
  padding: 0.4rem 0;
  font-family: var(--font-stamp);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-style: dashed;
  text-underline-offset: 4px;
}
#edit-rsvp:hover { color: var(--rust); background: transparent; }

.error { color: var(--error); font-size: 0.9rem; margin-top: 0.25rem; }

/* When the guest selects "Sadly, no", the menu picks lose their `required`
   attribute — soften them visually so it's clear they're optional. */
.menu-pick.is-dim { opacity: 0.55; }
.menu-pick.is-dim select { pointer-events: auto; }

/* ---------- success screen flourishes ---------- */
#success-screen { text-align: center; }
#success-screen h1 {
  font-family: var(--font-hand);
  font-size: clamp(2.6rem, 6vw, 3.8rem);
  color: var(--forest);
}
#success-message {
  font-family: var(--font-hand);
  font-size: 1.5rem;
  color: var(--moss);
  margin: 0.4rem 0 1.5rem;
  line-height: 1.3;
}

/* ---------- venue card (success screen) ---------- */
.venue-card {
  margin: 1.25rem auto 1.75rem;
  padding: 1rem 1.25rem;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  background: rgba(184, 107, 58, 0.04);
  max-width: 340px;
}
.venue-when {
  font-family: var(--font-stamp);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: 0.3rem;
}
.venue-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--forest);
  margin-bottom: 0.5rem;
  line-height: 1.2;
}
.venue-address {
  display: block;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--moss);
  text-decoration: none;
  line-height: 1.5;
  transition: color 120ms ease;
}
.venue-address:hover { color: var(--rust); }
.venue-map-cta {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--font-stamp);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rust);
  text-decoration: underline;
  text-decoration-style: dashed;
  text-underline-offset: 3px;
}

/* ---------- footer note ---------- */
.signoff {
  text-align: center;
  margin-top: 1.5rem;
  font-family: var(--font-hand);
  color: var(--moss);
  font-size: 1.1rem;
}

/* =============================================================
   Admin — keep it utilitarian, just adopt the type/palette
   ============================================================= */
.stage.admin h1 { color: var(--forest); }

#admin-login {
  background: var(--parchment);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.5rem 0;
}
.counts .card {
  background: var(--parchment);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  box-shadow: var(--shadow);
  min-width: 140px;
}
.counts .card .n {
  font-size: 1.6rem;
  font-family: var(--font-display);
  color: var(--forest);
}
.counts .card .label {
  color: var(--moss);
  font-size: 0.78rem;
  font-family: var(--font-stamp);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#rsvp-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--parchment);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
}
#rsvp-table th, #rsvp-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
#rsvp-table th {
  background: #f4ead9;
  font-family: var(--font-stamp);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--moss);
}

/* Horizontal scroll wrapper for the admin table on narrow screens —
   the table is wide enough that letting it overflow the stage looks worse
   than scrolling within its own container. */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
}
#rsvp-table { min-width: 760px; }
#rsvp-table .cell-message {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* inline-edit row */
.row-editing td {
  background: #fdf5e6;
  vertical-align: top;
}
.row-editing input,
.row-editing select,
.row-editing textarea {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--parchment);
  width: 100%;
}
.row-actions { white-space: nowrap; }
.row-actions button {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  box-shadow: none;
  margin-right: 0.25rem;
}
.row-actions .row-cancel {
  background: transparent;
  color: var(--moss);
  border: 1px solid var(--line);
}
.row-actions .row-cancel:hover { color: var(--rust); border-color: var(--rust); }
.row-status {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.8rem;
  color: var(--moss);
}
.row-status.error { color: var(--error); }
.row-edit {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  background: transparent;
  color: var(--rust);
  border: 1px solid var(--line);
  box-shadow: none;
}
.row-edit:hover { background: var(--rust); color: var(--parchment); border-color: var(--rust); }

/* =============================================================
   Post-RSVP trail log (list of other guests on the success screen)
   ============================================================= */
.trail-header--inline { margin: 1.75rem 0 0.75rem; }

#rsvp-list {
  list-style: none;
  text-align: left;
  margin: 0 0 0.5rem;
}
.rsvp-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.25rem;
  border-bottom: 1px dashed var(--line);
}
.rsvp-list__item:last-child { border-bottom: 0; }
.rsvp-list__item.is-mine { background: rgba(184, 107, 58, 0.06); }
.rsvp-list__name {
  font-family: var(--font-body);
  color: var(--ink);
}
.rsvp-list__mine {
  display: inline-block;
  margin-left: 0.4rem;
  font-family: var(--font-stamp);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rust);
}
.rsvp-list__loading,
.rsvp-list__empty {
  padding: 0.55rem 0.25rem;
  font-family: var(--font-hand);
  color: var(--moss);
}

.pill {
  font-family: var(--font-stamp);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
  flex-shrink: 0;
}
.pill--yes { color: var(--rust-dk); background: rgba(184, 107, 58, 0.10); border-color: var(--rust); }
.pill--no  { color: var(--muted); background: transparent; }

/* =============================================================
   Trail progress indicator (above screen cards)
   ============================================================= */
.trail-progress {
  padding: 1rem 0.5rem 1.5rem;
}

.trail-track {
  position: relative;
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  margin-bottom: 0.6rem;
}

.trail-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: var(--rust);
  border-radius: 2px;
  transition: width 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}

.hiker {
  position: absolute;
  top: 50%;
  left: 0%;
  margin-top: -28px; /* sit above track: hiker height = 28px */
  transform: translateX(0);
  transition: left 0.65s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}

.hiker svg {
  display: block;
  animation: hiker-bob 0.7s ease-in-out infinite alternate;
}

@keyframes hiker-bob {
  from { transform: translateY(0); }
  to   { transform: translateY(-4px); }
}

.trail-waypoints {
  display: flex;
  justify-content: space-between;
}

.trail-wp {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
}

.wp-blaze {
  font-size: 1.1rem;
  color: var(--line);
  line-height: 1;
  transition: color 0.4s ease;
}

.trail-wp span {
  font-family: var(--font-stamp);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.4s ease;
  white-space: nowrap;
}

.trail-wp.active .wp-blaze { color: var(--rust); }
.trail-wp.active span { color: var(--forest); }
.trail-wp.done .wp-blaze { color: var(--moss); }
.trail-wp.done span { color: var(--moss); }

/* =============================================================
   Mobile-first tightening (<480px)
   ============================================================= */
@media (max-width: 480px) {
  .stage { padding: 1.5rem 0.9rem 3rem; }
  #password-screen,
  #rsvp-form-screen,
  #success-screen { padding: 1.5rem 1.1rem; }
  .stage.admin { max-width: 100%; }
  #admin-login { padding: 1.25rem; }
  /* 44px tap targets on form controls (not inside the admin table) */
  input[type="text"], input[type="tel"], input[type="password"],
  select, textarea { min-height: 44px; }
  form > button, #password-form button, #admin-form button { min-height: 44px; }
  .crew-emoji { font-size: 1.4rem; }
  .crew-name  { font-size: 0.9rem; }
}
