@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400;1,700&family=EB+Garamond:ital,wght@0,400;0,500;1,400&family=UnifrakturMaguntia&display=swap');

/* ── Variables (shared with The Wedding Times) ────────────── */
:root {
  --cream:      #e9e1d2;
  --cream-dark: #e2d9c8;
  --card:       #faf7f0;
  --ink:        #2b2117;
  --ink-soft:   #6b5c47;
  --rule:       #c6b89c;
  --rust:       #8a3b27;
  --rust-light: #a84b33;
  --sage:       #5c6b47;
}

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

html, body {
  background: var(--cream);
  color: var(--ink);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 18px;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }

/* ── Typography helpers ───────────────────────────────────── */
.masthead { font-family: 'UnifrakturMaguntia', cursive; color: var(--ink); }
.heading  { font-family: 'Playfair Display', Georgia, serif; }
.eyebrow  {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.center { text-align: center; }

/* ── Rules ────────────────────────────────────────────────── */
.rule-double { border: none; border-top: 3px double var(--rule); }
.rule-single { border: none; border-top: 1px solid var(--rule); }

/* ── Layout ───────────────────────────────────────────────── */
.container { max-width: 1120px; margin: 0 auto; padding: 0 1rem; }

/* ── Header / Masthead ────────────────────────────────────── */
.site-header { background: var(--cream); }
.header-top  {
  display: flex; align-items: center; justify-content: space-between;
  padding: .4rem 1rem;
  border-bottom: 1px solid var(--rule);
}
.masthead-title {
  font-size: clamp(2.6rem, 8vw, 5rem);
  line-height: 1;
  text-align: center;
  padding: .6rem 1rem .4rem;
  display: block;
}
.header-nav {
  display: flex; align-items: center; justify-content: center; gap: 1.1rem;
  padding: .45rem 1rem;
  border-bottom: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
  flex-wrap: wrap;
}
.nav-action { color: var(--rust); }
.nav-action:hover { text-decoration: underline; }


/* ── Sections ─────────────────────────────────────────────── */
.app-main { padding-top: 2.25rem; padding-bottom: 3rem; }
.section { margin-bottom: 2.75rem; }
.section:last-child { margin-bottom: 0; }
.section-head { text-align: center; margin-bottom: 1.75rem; }
.section-title { font-size: clamp(1.7rem, 5vw, 2.4rem); margin: .3rem 0 .2rem; }
.section-sub {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic; color: var(--ink-soft);
  font-size: .95rem;
}
.rule-double { margin: 2.75rem 0; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.1rem;
  font-family: 'EB Garamond', serif;
  font-size: .75rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  transition: opacity .15s;
  white-space: nowrap;
}
.btn:hover { opacity: .82; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-ink  { background: var(--ink);  color: var(--card); }
.btn-rust { background: var(--rust); color: var(--card); }

/* ── Panels / inputs ──────────────────────────────────────── */
.panel {
  background: var(--card);
  box-shadow: 2px 4px 14px rgba(43,33,23,.12);
  padding: 1.75rem;
}
.field {
  width: 100%;
  padding: .6rem .85rem;
  border: 1px solid var(--rule);
  background: var(--cream);
  color: var(--ink);
  font-family: 'EB Garamond', serif;
  font-size: 1rem;
}
.field:focus { outline: 2px solid var(--rust); outline-offset: 1px; }
.form-error { color: var(--rust); font-style: italic; font-size: .9rem; margin-top: .6rem; }

/* ── Unlock page ──────────────────────────────────────────── */
.unlock-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center; padding: 2rem 1rem;
}
.unlock-box { width: 100%; max-width: 400px; }
.unlock-box .masthead-title { font-size: clamp(2.2rem, 7vw, 3.4rem); margin-bottom: .5rem; }

/* ── Dashboard stats ──────────────────────────────────────── */
.stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 560px) { .stat-grid { grid-template-columns: repeat(3, 1fr); gap: 1rem; } }
@media (min-width: 900px) { .stat-grid { grid-template-columns: repeat(5, 1fr); } }
.stat-card {
  background: var(--card); box-shadow: 1px 2px 8px rgba(43,33,23,.1);
  padding: .85rem .5rem; text-align: center;
}
.stat-card .num { font-family: 'Playfair Display', serif; font-size: 1.8rem; line-height: 1.1; }
.stat-card .num.rust { color: var(--rust); }
.stat-card .num.sage { color: var(--sage); }
.stat-card .lbl { display: block; margin-top: .2rem; }

/* ── Progress bar ─────────────────────────────────────────── */
.progress-wrap { margin-bottom: 2rem; }
.progress-labels {
  display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .35rem;
}
.progress-bar { height: 10px; background: var(--card); border: 1px solid var(--rule); }
.progress-fill {
  height: 100%; width: 0;
  background: repeating-linear-gradient(-45deg, var(--rust), var(--rust) 6px, var(--rust-light) 6px, var(--rust-light) 12px);
  transition: width .5s ease;
}

/* ── Insert bar ───────────────────────────────────────────── */
.insert-bar {
  display: flex; gap: .6rem; margin-bottom: 1.5rem; flex-wrap: wrap;
  background: var(--card); box-shadow: 1px 2px 8px rgba(43,33,23,.1);
  padding: .85rem;
}
.insert-bar .insert-name { flex: 1 1 240px; }
.insert-bar .insert-side { flex: 0 0 auto; width: auto; }
.insert-bar .btn { flex: 0 0 auto; }

/* ── Toolbar / filters ────────────────────────────────────── */
.toolbar { margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
.filter-row { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: baseline; }
.filter-select {
  -webkit-appearance: none; appearance: none;
  border: none; background: transparent; color: var(--ink);
  font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-size: .95rem;
  padding: 0 1.2rem 0 0; cursor: pointer; max-width: 100%;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%232b2117' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right center;
}
.filter-select:focus { outline: none; }
.quick-filter {
  display: inline-flex; align-items: center; gap: .45rem;
  font-family: 'Playfair Display', serif; font-style: italic; font-size: .95rem; cursor: pointer;
}
.quick-filter input { accent-color: var(--rust); }
.toolbar-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.list-count { margin-bottom: .75rem; }

/* ── Inline ledger ────────────────────────────────────────── */
/* Shared column template for header + rows on desktop */
.list-head, .party-row {
  --cols: minmax(170px, 2.4fr) minmax(96px, 1fr) minmax(120px, 1.4fr)
          minmax(115px, 1.2fr) 64px 78px 78px 36px;
}

.list-head {
  display: none;
  gap: .6rem; align-items: end;
  padding: 0 .9rem .4rem;
}
@media (min-width: 860px) {
  .list-head { display: grid; grid-template-columns: var(--cols); }
}

#party-list { display: flex; flex-direction: column; gap: .6rem; }

.party-row {
  background: var(--card);
  box-shadow: 1px 2px 8px rgba(43,33,23,.12);
  border-left: 3px solid var(--rule);
  padding: .8rem .9rem;
  display: grid;
  grid-template-columns: 1fr 1fr;   /* mobile: two-up cells */
  gap: .6rem .7rem;
  transition: box-shadow .2s ease, background-color .5s ease;
}
.party-row.status-confirmed { border-left-color: var(--sage); }
.party-row.status-declined  { border-left-color: var(--rust); }
.party-row.row-saved { background-color: #eef0e6; }

@media (min-width: 860px) {
  .party-row {
    grid-template-columns: var(--cols);
    align-items: center;
    gap: .6rem;
  }
}

.cell { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.cell-name { grid-column: 1 / -1; }   /* name spans full width on mobile */
@media (min-width: 860px) { .cell-name { grid-column: auto; } }

.col-label { display: block; }
@media (min-width: 860px) { .col-label { display: none; } }  /* header row covers labels on desktop */

.row-field, .row-num { padding: .45rem .55rem; font-size: .95rem; }
.row-num { text-align: center; }
select.row-field {
  -webkit-appearance: none; appearance: none;
  padding-right: 1.4rem;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%232b2117' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .5rem center;
}

.cell-invited, .cell-adults, .cell-under6 { align-items: center; }
.cell-invited .row-check {
  width: 22px; height: 22px; accent-color: var(--sage); cursor: pointer; margin-top: .1rem;
}
.cell-actions { align-items: center; justify-content: center; }
.row-delete {
  color: var(--rule); font-size: 1.4rem; line-height: 1;
  padding: .1rem .35rem; transition: color .15s;
}
.row-delete:hover { color: var(--rust); }

/* On mobile the delete sits inline at the end; give it a subtle label affordance */
@media (max-width: 859px) {
  .cell-invited, .cell-adults, .cell-under6 { align-items: flex-start; }
  .cell-actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end;
                  border-top: 1px solid var(--rule); padding-top: .5rem; margin-top: .1rem; }
}

/* ── Empty state ──────────────────────────────────────────── */
.empty {
  text-align: center; padding: 2.5rem 1rem;
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: 1.15rem; color: var(--ink-soft);
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  text-align: center; padding: 2rem 1rem;
  border-top: 1px solid var(--rule); margin-top: 3rem;
}

/* ── Toast ────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--card);
  padding: .55rem 1.25rem; font-size: .8rem; letter-spacing: .06em;
  pointer-events: none; opacity: 0; transition: opacity .25s;
  white-space: nowrap; z-index: 200;
}
#toast.show { opacity: 1; }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--cream-dark); }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }

:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }
