/* ─── Custom Properties ─────────────────────────────────────────────────── */
:root {
  --clr-bg: #fdfaf6;
  --clr-surface: #ffffff;
  --clr-primary: #3b2d1f;
  --clr-accent: #b8935a;
  --clr-accent-light: #f4ecdf;
  --clr-text: #1c1814;
  --clr-text-muted: #6b6057;
  --clr-border: #e8dfd3;
  --clr-success: #1e5c35;
  --clr-success-bg: #eaf4ee;
  --clr-error: #b91c1c;
  --clr-error-bg: #fef2f2;

  --ff-display: 'Cormorant Garamond', Georgia, serif;
  --ff-body: 'Inter', system-ui, sans-serif;

  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06);

  --max-w: 640px;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
}

/* ─── Reset / Base ──────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--ff-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--clr-text);
  background: var(--clr-bg);
  min-height: 100dvh;
}

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

a {
  color: inherit;
}

ul,
ol {
  list-style: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input {
  font-family: inherit;
  font-size: 16px; /* prevents iOS auto-zoom */
}

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

.hidden {
  display: none !important;
}

/* ─── Auth Modal ────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--clr-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  z-index: 100;
}

.modal-box {
  width: 100%;
  max-width: 400px;
  background: var(--clr-surface);
  border-radius: var(--radius);
  padding: var(--space-lg) var(--space-md);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.modal-couple {
  font-family: var(--ff-display);
  font-size: 2.5rem;
  font-weight: 400;
  color: var(--clr-primary);
  line-height: 1.1;
}

.modal-date {
  font-size: 0.875rem;
  color: var(--clr-text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: var(--space-xs);
  margin-bottom: var(--space-lg);
}

.modal-divider {
  width: 40px;
  height: 1px;
  background: var(--clr-accent);
  margin: var(--space-md) auto;
}

.modal-prompt {
  font-size: 0.9375rem;
  color: var(--clr-text-muted);
  margin-bottom: var(--space-md);
}

.modal-box form {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.modal-box input[type="password"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--clr-border);
  border-radius: 8px;
  background: var(--clr-bg);
  color: var(--clr-text);
  text-align: center;
  letter-spacing: 0.1em;
  transition: border-color 0.15s;
}

.modal-box input[type="password"]:focus {
  outline: none;
  border-color: var(--clr-accent);
}

.modal-box input[type="password"]::placeholder {
  letter-spacing: 0.02em;
  color: var(--clr-text-muted);
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--clr-primary);
  color: #fff;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-align: center;
  transition: background 0.15s, opacity 0.15s;
  min-height: 48px;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: #2a1f14;
  outline: 2px solid var(--clr-accent);
  outline-offset: 2px;
}

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

.auth-error {
  color: var(--clr-error);
  font-size: 0.875rem;
  margin-top: var(--space-xs);
}

/* ─── App Shell ─────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ─── Header ────────────────────────────────────────────────────────────── */
.site-header {
  text-align: center;
  padding: var(--space-lg) var(--space-md) var(--space-md);
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
}

.couple-names {
  font-family: var(--ff-display);
  font-size: 2rem;
  font-weight: 400;
  color: var(--clr-primary);
  line-height: 1.1;
}

.wedding-date {
  font-size: 0.8125rem;
  color: var(--clr-text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 0.25rem;
}

/* ─── Tab Navigation ────────────────────────────────────────────────────── */
.tab-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  box-shadow: var(--shadow-sm);
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--clr-text-muted);
  text-decoration: none;
  text-align: center;
  letter-spacing: 0.02em;
  border-bottom: 2.5px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  min-height: 48px;
  line-height: 1.2;
}

.tab:hover {
  color: var(--clr-primary);
}

.tab.active {
  color: var(--clr-primary);
  border-bottom-color: var(--clr-accent);
  font-weight: 600;
}

/* ─── Main Content ──────────────────────────────────────────────────────── */
main {
  flex: 1;
  width: 100%;
}

.tab-panel {
  padding: var(--space-lg) var(--space-md);
  max-width: var(--max-w);
  margin: 0 auto;
}

.section-heading {
  font-family: var(--ff-display);
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--clr-primary);
  margin-bottom: var(--space-md);
}

.section-intro {
  color: var(--clr-text-muted);
  margin-bottom: var(--space-md);
}

/* ─── Search Form ───────────────────────────────────────────────────────── */
.search-form {
  margin-bottom: var(--space-lg);
}

.search-row {
  display: flex;
  gap: 0.5rem;
}

.search-input {
  flex: 1;
  padding: 0.875rem 1rem;
  border: 1.5px solid var(--clr-border);
  border-radius: 8px;
  background: var(--clr-surface);
  color: var(--clr-text);
  font-size: 16px;
  transition: border-color 0.15s;
  min-height: 48px;
}

.search-input:focus {
  outline: none;
  border-color: var(--clr-accent);
}

.search-input::placeholder {
  color: var(--clr-text-muted);
}

.search-btn {
  padding: 0.875rem 1.25rem;
  background: var(--clr-accent);
  color: #fff;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s;
  min-height: 48px;
  min-width: 44px;
}

.search-btn:hover,
.search-btn:focus-visible {
  background: #9a7840;
  outline: 2px solid var(--clr-primary);
  outline-offset: 2px;
}

/* ─── Results ───────────────────────────────────────────────────────────── */
.results {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.result-empty {
  padding: var(--space-md);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  text-align: center;
}

.result-empty .muted {
  color: var(--clr-text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.result-multiple .muted {
  color: var(--clr-text-muted);
  font-size: 0.9375rem;
  margin-bottom: var(--space-sm);
}

.match-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.match-btn {
  display: block;
  width: 100%;
  padding: 0.875rem 1rem;
  text-align: left;
  background: var(--clr-surface);
  border: 1.5px solid var(--clr-border);
  border-radius: 8px;
  color: var(--clr-text);
  font-size: 1rem;
  transition: border-color 0.15s, background 0.15s;
  min-height: 48px;
}

.match-btn:hover,
.match-btn:focus-visible {
  border-color: var(--clr-accent);
  background: var(--clr-accent-light);
  outline: none;
}

/* ─── Guest Card ────────────────────────────────────────────────────────── */
.guest-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
}

.guest-name {
  font-family: var(--ff-display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--clr-primary);
  margin-bottom: var(--space-xs);
}

.guest-table {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.table-num {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--clr-text);
}

.table-name {
  font-size: 0.9375rem;
  color: var(--clr-text-muted);
  background: var(--clr-accent-light);
  padding: 0.125rem 0.625rem;
  border-radius: 99px;
}

/* ─── Check-in Button & Confirmed State ─────────────────────────────────── */
.btn-checkin {
  display: block;
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--clr-primary);
  color: #fff;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  transition: background 0.15s;
  min-height: 48px;
}

.btn-checkin:hover,
.btn-checkin:focus-visible {
  background: #2a1f14;
  outline: 2px solid var(--clr-accent);
  outline-offset: 2px;
}

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

.checkin-confirmed {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--clr-success-bg);
  color: var(--clr-success);
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9375rem;
}

.checkmark {
  font-size: 1.125rem;
  font-weight: 700;
}

/* ─── Menu ──────────────────────────────────────────────────────────────── */
.course {
  margin-bottom: var(--space-xl);
}

.course:last-child {
  margin-bottom: 0;
}

.course-title {
  font-family: var(--ff-display);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--clr-primary);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--clr-border);
}

.menu-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.menu-item {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: var(--space-md);
}

.menu-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: 0.375rem;
}

.item-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--clr-text);
  flex: 1;
}

.item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  flex-shrink: 0;
}

.tag {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.1875rem 0.5rem;
  border-radius: 99px;
  white-space: nowrap;
}

.tag-v {
  background: #d1fae5;
  color: #065f46;
}

.tag-vg {
  background: #bbf7d0;
  color: #14532d;
}

.tag-gf {
  background: #fef3c7;
  color: #92400e;
}

.tag-n {
  background: #fee2e2;
  color: #991b1b;
}

.item-desc {
  font-size: 0.9375rem;
  color: var(--clr-text-muted);
  line-height: 1.5;
}

/* ─── Tag Legend ────────────────────────────────────────────────────────── */
.tag-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: var(--space-lg);
  padding: var(--space-sm) var(--space-md);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 8px;
  font-size: 0.8125rem;
  color: var(--clr-text-muted);
}

.tag-legend span {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* ─── Program / Timeline ────────────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.4375rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 1.5px;
  background: var(--clr-border);
}

.timeline-item {
  position: relative;
  margin-bottom: var(--space-lg);
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -1.625rem;
  top: 0.3125rem;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  background: var(--clr-surface);
  border: 2px solid var(--clr-border);
  transition: border-color 0.15s, background 0.15s;
}

.timeline-item.is-past .timeline-marker {
  background: var(--clr-border);
  border-color: var(--clr-border);
}

.timeline-item.is-current .timeline-marker {
  background: var(--clr-accent);
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 3px var(--clr-accent-light);
}

.timeline-item.is-next .timeline-marker {
  border-color: var(--clr-accent);
}

.event-time {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--clr-text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.1875rem;
}

.event-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--clr-text);
  margin-bottom: 0.25rem;
}

.timeline-item.is-current .event-title {
  color: var(--clr-primary);
}

.timeline-item.is-past .event-title,
.timeline-item.is-past .event-time {
  color: var(--clr-text-muted);
}

.event-desc {
  font-size: 0.9375rem;
  color: var(--clr-text-muted);
  margin-bottom: 0.25rem;
  line-height: 1.5;
}

.event-location {
  font-size: 0.8125rem;
  color: var(--clr-text-muted);
}

.event-location::before {
  content: 'Location: ';
  font-weight: 600;
}

.event-badge {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.125rem 0.5rem;
  border-radius: 99px;
  vertical-align: middle;
}

.event-badge-current {
  background: var(--clr-accent);
  color: #fff;
}

.event-badge-next {
  background: var(--clr-accent-light);
  color: var(--clr-accent);
}

/* ─── Error state ───────────────────────────────────────────────────────── */
.error-msg {
  color: var(--clr-error);
  background: var(--clr-error-bg);
  border-radius: 8px;
  padding: var(--space-md);
  font-size: 0.9375rem;
}

/* ─── Desktop ───────────────────────────────────────────────────────────── */
@media (min-width: 768px) {
  .couple-names {
    font-size: 2.75rem;
  }

  .tab {
    font-size: 0.875rem;
    padding: 1rem 0.5rem;
  }

  .tab-panel {
    padding: var(--space-xl) var(--space-lg);
  }

  .section-heading {
    font-size: 2.25rem;
  }

  .menu-items {
    gap: var(--space-md);
  }

  .timeline {
    padding-left: 2.5rem;
  }

  .modal-couple {
    font-size: 3rem;
  }
}
