/* Friend Birthdays — "Save-the-Date Almanac" design system.
   Warm paper, cerise candle-flame accent, Bricolage display + Space Mono dates.
   Light is primary; dark via prefers-color-scheme. */

:root {
  --paper: #FCF4EE;
  --paper-2: #F5EBE2;
  --field: #FFFDF9;      /* form inputs + secondary buttons — distinct from paper */
  --ink: #241A20;
  --muted: #8B7E84;
  --line: #EADDD3;
  --flame: #D52E63;
  --flame-soft: #FBE1E9;
  --ok: #2f8f5b;
  --warn: #b06d00;
  --stop: #c0362f;

  /* One broadly-available system font for everything — no web-font dependency. */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: var(--font);
  --mono: var(--font);
  --body: var(--font);

  --shadow: 0 1px 0 rgba(36,26,32,.04), 0 12px 30px -18px rgba(36,26,32,.28);
  --radius: 12px;
}

/* Dark palette — applied when the system is dark (unless the user forced light),
   and always when the user explicitly picks dark. */
:root[data-theme="dark"] {
  --paper: #191319;
  --paper-2: #221A22;
  --field: #2A2130;
  --ink: #F2E9E6;
  --muted: #A99BA1;
  --line: #33272F;
  --flame: #FF6E97;
  --flame-soft: #33202A;
  --ok: #6ee7a3;
  --warn: #f5c451;
  --stop: #ff8a80;
  --shadow: 0 1px 0 rgba(0,0,0,.2), 0 16px 34px -20px rgba(0,0,0,.7);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #191319;
    --paper-2: #221A22;
    --field: #2A2130;
    --ink: #F2E9E6;
    --muted: #A99BA1;
    --line: #33272F;
    --flame: #FF6E97;
    --flame-soft: #33202A;
    --ok: #6ee7a3;
    --warn: #f5c451;
    --stop: #ff8a80;
    --shadow: 0 1px 0 rgba(0,0,0,.2), 0 16px 34px -20px rgba(0,0,0,.7);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Shell ---------- */
.wrap { max-width: 820px; margin-inline: auto; padding: 0 1.25rem; }

.masthead {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1.5rem 0 .75rem;
}
.brand {
  display: inline-flex; align-items: baseline; gap: .5rem;
  font-family: var(--display); font-weight: 800; font-size: 1.15rem;
  letter-spacing: -.01em; text-decoration: none; color: var(--ink);
}
.brand .dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--flame); align-self: center; }

main { padding: .5rem 0 4rem; }

.foot {
  border-top: 1px solid var(--line); margin-top: 2rem;
  padding: 1.25rem 0 2rem; color: var(--muted); font-size: .8rem;
  font-family: var(--mono);
}

/* ---------- Type ---------- */
h1 { font-family: var(--display); font-weight: 700; font-size: 1.9rem; letter-spacing: -.02em; margin: .3rem 0 .4rem; }
h2 { font-family: var(--display); font-weight: 700; font-size: 1.2rem; letter-spacing: -.01em; margin: 1.6rem 0 .5rem; }
p { margin: .5rem 0; }
a { color: var(--flame); text-underline-offset: 2px; }

.eyebrow {
  font-family: var(--mono); font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .16em; color: var(--muted);
}
.muted { color: var(--muted); }
.lead { color: var(--muted); font-size: 1rem; max-width: 52ch; }

/* ---------- Nav (tabs) ---------- */
nav.tabs {
  display: flex; align-items: center; flex-wrap: wrap; gap: .15rem;
  margin-left: auto;
}
nav.tabs a {
  font-family: var(--mono); font-size: .82rem; text-decoration: none;
  color: var(--muted); padding: .4rem .7rem; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
nav.tabs a:hover { color: var(--ink); }
nav.tabs a.active { color: var(--ink); background: var(--flame-soft); border-color: var(--line); }
nav.tabs .nav-right { display: inline-flex; align-items: center; }
nav.tabs .nav-right form { margin: 0; }
nav.tabs .nav-right button { margin: 0; padding: .35rem .7rem; font-size: .78rem; }

/* ---------- Account menu ---------- */
.acct { position: relative; display: inline-flex; }
.acct-trigger {
  padding: .15rem; border-radius: 999px; background: transparent;
  border: 1px solid transparent; display: inline-flex; align-items: center; gap: .4rem;
}
.acct-trigger:hover { border-color: var(--line); transform: none; }
.acct-trigger.admin {
  padding: .3rem .6rem .3rem .35rem; background: var(--flame-soft);
  border-color: var(--flame); color: var(--ink); font-weight: 700; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .06em;
}
.acct-menu {
  position: absolute; right: 0; top: calc(100% + .45rem); min-width: 232px; max-width: 80vw;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: .35rem; z-index: 40;
}
.acct-menu .acct-head { display: flex; gap: .55rem; align-items: center; padding: .5rem .55rem .6rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; }
.acct-menu .acct-head .nm { font-weight: 700; font-size: .9rem; }
.acct-menu .acct-head .em { color: var(--muted); font-size: .74rem; word-break: break-all; }
.acct-menu a, .acct-menu button {
  display: flex; width: 100%; text-align: left; align-items: center; gap: .5rem;
  padding: .5rem .55rem; margin: 0; border: none; background: transparent;
  border-radius: 8px; font-size: .88rem; font-weight: 500; color: var(--ink);
  text-decoration: none; cursor: pointer;
}
.acct-menu a:hover, .acct-menu button:hover { background: var(--flame-soft); transform: none; border: none; }
.acct-menu form { margin: 0; }
.acct-menu .sep { height: 1px; background: var(--line); margin: .3rem .2rem; }
/* theme segmented control inside the dropdown */
.acct-menu .theme-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .45rem .55rem; }
.acct-menu .theme-row .lbl { font-size: .82rem; color: var(--muted); }
.theme-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.acct-menu .theme-seg button {
  display: inline-flex; width: auto; padding: .28rem .5rem; font-size: .76rem;
  border-radius: 0; background: var(--field);
}
.acct-menu .theme-seg button + button { border-left: 1px solid var(--line); }
.acct-menu .theme-seg button.active { background: var(--flame); color: #fff; }

/* ---------- Buttons ---------- */
button, .btn {
  font-family: var(--body); font-size: .92rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem .95rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--field); color: var(--ink);
  text-decoration: none; transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
button:hover, .btn:hover { border-color: var(--muted); transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(0); }
button.primary, .btn.primary { background: var(--flame); border-color: var(--flame); color: #fff; }
button.primary:hover, .btn.primary:hover { filter: brightness(1.05); }
button.danger, .btn.danger { color: var(--stop); border-color: color-mix(in srgb, var(--stop) 40%, var(--line)); background: transparent; }
button.ghost, .btn.ghost { background: transparent; }
.edit-btn .edit-ico { display: none; }  /* pencil only shows in the compact (small-screen) form */

/* ---------- Forms ---------- */
label { display: block; margin-top: 1.1rem; font-weight: 600; font-size: .95rem; }
input[type=text], input[type=date], input[type=password], input[type=number],
textarea, select {
  width: 100%; padding: .6rem .7rem; margin-top: .3rem; font: inherit;
  color: var(--ink); background: var(--field); border: 1px solid var(--line);
  border-radius: 10px;
}
textarea { min-height: 5.5rem; resize: vertical; }
input:focus, textarea:focus, select:focus,
button:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--flame); outline-offset: 2px; border-color: var(--flame);
}
.field-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: .82rem; margin-top: .35rem; }

/* ---------- Cards / panels ---------- */
.panel {
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem 1.15rem; box-shadow: var(--shadow);
}

/* ---------- Date-stamp tile (the signature) ---------- */
/* Tear-off calendar page (à la the legacy iOS/macOS Calendar icon): a white
   1:1 square, flame month-header on top, big dark day numeral on the page. */
.stamp {
  flex-shrink: 0; width: 76px; aspect-ratio: 1; text-align: center;
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-radius: 13px; background: #fff;
}
.stamp .m { font-size: .62rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #fff; background: var(--flame); padding: .28rem 0; }
.stamp .d {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding-top: .12rem; font-weight: 700; font-size: 2rem; line-height: 1;
  color: #241A20; font-variant-numeric: tabular-nums;
}

.stamp.lg { width: 122px; border-radius: 16px; }
.stamp.lg .m { font-size: .74rem; padding: .38rem 0; }
.stamp.lg .d { font-size: 3.4rem; }

.tile {
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 0; border-bottom: 1px solid var(--line);
}
.tile .who-name { font-family: var(--display); font-weight: 700; font-size: 1.1rem; }
.tile .meta { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.tile .grow { flex: 1; min-width: 0; }
a.tile { text-decoration: none; color: inherit; }

.hero-tile { display: flex; align-items: center; gap: 1.4rem; margin: .4rem 0 1rem; }
.hero-tile .who-name { font-size: 1.7rem; }

/* ---------- Tables (admin, calm) ---------- */
table { width: 100%; border-collapse: collapse; margin-top: .75rem; font-size: .95rem; }
th { text-align: left; font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
td { padding: .6rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.actions form { margin: 0; }

/* ---------- Flash ---------- */
.flash {
  border: 1px solid var(--line); background: var(--flame-soft);
  border-left: 3px solid var(--flame); padding: .6rem .85rem;
  border-radius: 10px; margin: .75rem 0; font-size: .92rem;
}
.flash.success { background: color-mix(in srgb, var(--ok) 12%, var(--paper)); border-left-color: var(--ok); }

/* ---------- Badges / pills ---------- */
.badge {
  display: inline-block; font-family: var(--mono); font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  padding: .12rem .5rem; border-radius: 999px; border: 1px solid var(--line);
  vertical-align: middle;
}
.badge.pending { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.badge.approved { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.badge.rejected { color: var(--stop); border-color: color-mix(in srgb, var(--stop) 45%, var(--line)); }
.badge.hidden { color: var(--muted); }
.badge.on { color: #fff; background: var(--flame); border-color: var(--flame); }
td.changed { background: var(--flame-soft); font-weight: 600; }

/* admin statusline */
.statusline {
  display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; align-items: center;
  margin: .5rem 0 1rem; padding: .55rem .75rem; font-size: .8rem; color: var(--muted);
  background: var(--field); border: 1px solid var(--line); border-radius: 10px;
}
.statusline b { color: var(--ink); font-weight: 600; }

/* pill filter toggle row */
.pills { display: flex; gap: .4rem; flex-wrap: wrap; margin: .6rem 0 1rem; }
.pills a {
  font-family: var(--mono); font-size: .78rem; text-decoration: none;
  color: var(--muted); padding: .3rem .7rem; border: 1px solid var(--line);
  border-radius: 999px;
}
.pills a.active { color: var(--ink); background: var(--flame-soft); border-color: var(--flame); }

/* ---------- Avatars ---------- */
.avatar { border-radius: 50%; object-fit: cover; vertical-align: middle; flex-shrink: 0; }
.avatar-fallback { display: inline-flex; align-items: center; justify-content: center; background: var(--flame); color: #fff; font-family: var(--display); font-weight: 700; line-height: 1; }
.who { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; color: inherit; }
.who:hover { color: var(--flame); }

/* ---------- People contact sheet ---------- */
.sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; margin-top: 1rem; }
.card {
  display: flex; align-items: center; gap: .75rem; text-decoration: none; color: inherit;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem .9rem; transition: transform .08s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-1px); border-color: var(--muted); }
.card .nm { font-family: var(--display); font-weight: 700; }
.card .ct { font-family: var(--mono); font-size: .74rem; color: var(--muted); }

/* ---------- Feed URL / QR ---------- */
.feedbox { font-family: var(--mono); font-size: .82rem; word-break: break-all; }
.qr { width: 210px; height: 210px; background: #fff; padding: .6rem; border-radius: var(--radius); border: 1px solid var(--line); }

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }
.rise-1 { animation-delay: .05s; } .rise-2 { animation-delay: .12s; } .rise-3 { animation-delay: .19s; }
@media (prefers-reduced-motion: reduce) {
  .rise, .rise-1, .rise-2, .rise-3 { animation: none; }
  button, .btn, .card, .tile .stamp { transition: none; }
}

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  h1 { font-size: 1.6rem; }
  .hero-tile { gap: 1rem; }
  .stamp.lg { width: 96px; } .stamp.lg .d { font-size: 2.6rem; }
  .masthead { padding-top: 1rem; }
  table { font-size: .88rem; } th, td { padding: .5rem .4rem; }
  /* Compact the per-row edit control to a pencil so it stops squeezing the name/meta */
  .tile .edit-btn { padding: .5rem .62rem; }
  .tile .edit-btn .edit-txt { display: none; }
  .tile .edit-btn .edit-ico { display: inline; font-size: 1.05rem; line-height: 1; }
}
