:root {
  --bg: #fff4e0;
  --surface: #ffffff;
  --ink: #17120e;
  --muted: #6b5f55;
  --accent: #ff4f1a;
  --yellow: #ffd23f;
  --pink: #ff8fc7;
  --mint: #7ee0b5;
  --sky: #8ec5ff;
  --danger: #d7263d;
  --line: 2.5px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --shadow-lg: 6px 6px 0 var(--ink);
  --radius: 16px;
  --tabbar-h: 70px;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  color-scheme: light;

  /* FullCalendar theming */
  --fc-border-color: #e9dcc6;
  --fc-today-bg-color: #fff0b3;
  --fc-button-bg-color: var(--surface);
  --fc-button-border-color: var(--ink);
  --fc-button-text-color: var(--ink);
  --fc-button-hover-bg-color: var(--yellow);
  --fc-button-hover-border-color: var(--ink);
  --fc-button-active-bg-color: var(--ink);
  --fc-button-active-border-color: var(--ink);
  --fc-page-bg-color: var(--surface);
  --fc-neutral-bg-color: var(--bg);
  --fc-list-event-hover-bg-color: #fff0b3;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background-color: var(--bg);
  background-image: radial-gradient(rgb(23 18 14 / 0.09) 1.2px, transparent 1.2px);
  background-size: 18px 18px;
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

a { color: var(--ink); text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 3px; font-weight: 700; }

h1, h2 { margin: 0; line-height: 1.05; font-family: var(--display); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.35rem; }

.muted { color: var(--muted); font-size: 0.92rem; }

/* --- buttons & forms --- */

.btn {
  font: inherit;
  font-weight: 800;
  padding: 0.6rem 1.05rem;
  border-radius: 12px;
  border: var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { background: #ffe1e5; color: var(--danger); }
.btn.small { padding: 0.35rem 0.75rem; font-size: 0.85rem; box-shadow: 2px 2px 0 var(--ink); }
.btn.small:active { transform: translate(2px, 2px); }
.btn.wide { width: 100%; margin-top: 0.5rem; }

label { display: block; font-size: 0.85rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.9rem; }
label.check { display: flex; align-items: center; gap: 0.6rem; text-transform: none; letter-spacing: 0; font-size: 1rem; }

input, textarea, select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  font: inherit;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  padding: 0.65rem 0.75rem;
  border: var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
}
input[type="checkbox"] { width: 1.4rem; height: 1.4rem; margin: 0; accent-color: var(--accent); }
input:focus, textarea:focus, select:focus { outline: none; box-shadow: 3px 3px 0 var(--accent); }

.location-row { display: flex; gap: 0.5rem; align-items: center; }
.location-row input { flex: 1; min-width: 0; }
.location-row .btn { margin-top: 0.35rem; white-space: nowrap; text-decoration: none; text-transform: none; letter-spacing: 0; }
.event-location { display: block; font-weight: 500; font-size: 0.85em; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; }

.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.75rem; }
.row input, .row select { min-width: 0; }
@media (max-width: 420px) {
  /* Date + time pickers don't fit side by side on a phone. */
  .row:has(input[type="datetime-local"]) { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
.error { color: var(--danger); font-weight: 700; font-size: 0.9rem; }

/* --- login --- */

.login { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; }
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: var(--line);
  border-radius: 22px;
  padding: 2rem 1.5rem;
  box-shadow: 8px 8px 0 var(--ink);
  text-align: center;
}
.login-card .brand { font-size: 4.4rem; margin: 0.8rem 0 0.2rem; }
.login-card form { text-align: left; margin-top: 1.5rem; }
.login-card .btn { width: 100%; }
.logo {
  width: 5.5rem;
  height: 5.5rem;
  border: var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  transform: rotate(-8deg);
}

.legal-links { text-align: center; font-size: 0.85rem; margin-top: 1.25rem; }
.legal-links a { font-weight: 600; color: var(--muted); text-decoration-thickness: 1.5px; }

/* --- legal pages --- */

.legal {
  max-width: 680px;
  margin: 2rem auto;
  padding: 1.75rem 1.5rem;
  background: var(--surface);
  border: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.legal h1 { font-size: clamp(1.8rem, 6vw, 2.4rem); margin: 0.75rem 0 0.25rem; }
.legal h2 { margin: 1.6rem 0 0.4rem; }
.legal ul { padding-left: 1.2rem; }
.legal li { margin-bottom: 0.35rem; }
.legal-back { font-size: 0.9rem; }
@media (max-width: 720px) { .legal { margin: 1rem; } }

/* --- wordmark --- */

.brand { line-height: 1; letter-spacing: 0; }

/* 3D wordmark: each letter sits on a solid ink block (stacked shadows) and, in a wave,
   sinks into it and pops back up. The pressed block has the same layer count so it animates. */
.wordmark {
  --ext: 0.003em 0.010em 0 var(--ink), 0.006em 0.020em 0 var(--ink), 0.009em 0.030em 0 var(--ink), 0.012em 0.040em 0 var(--ink), 0.015em 0.050em 0 var(--ink), 0.018em 0.060em 0 var(--ink), 0.021em 0.070em 0 var(--ink), 0.024em 0.080em 0 var(--ink), 0.027em 0.090em 0 var(--ink), 0.030em 0.100em 0 var(--ink), 0.033em 0.110em 0 var(--ink), 0.036em 0.120em 0 var(--ink), 0.039em 0.130em 0 var(--ink), 0.042em 0.140em 0 var(--ink);
  --ext-pressed: 0.001em 0.003em 0 var(--ink), 0.002em 0.006em 0 var(--ink), 0.003em 0.009em 0 var(--ink), 0.003em 0.011em 0 var(--ink), 0.004em 0.014em 0 var(--ink), 0.005em 0.017em 0 var(--ink), 0.006em 0.020em 0 var(--ink), 0.007em 0.023em 0 var(--ink), 0.008em 0.026em 0 var(--ink), 0.009em 0.029em 0 var(--ink), 0.009em 0.031em 0 var(--ink), 0.010em 0.034em 0 var(--ink), 0.011em 0.037em 0 var(--ink), 0.012em 0.040em 0 var(--ink);
  --press: 0.1em;
  display: inline-flex;
  font-family: "Funnel Display", var(--display);
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--accent);
  padding-bottom: 0.14em;
}
.topbar .wordmark { color: var(--bg); }
.wordmark > span {
  display: inline-block;
  -webkit-text-stroke: 0.065em var(--ink);
  paint-order: stroke fill;
  text-shadow: var(--ext);
  animation: press 4s cubic-bezier(0.3, 0.7, 0.4, 1) infinite;
}
.wordmark > span:nth-child(2) { animation-delay: 0.07s; }
.wordmark > span:nth-child(3) { animation-delay: 0.14s; }
.wordmark > span:nth-child(4) { animation-delay: 0.21s; }
.wordmark > span:nth-child(5) { animation-delay: 0.28s; }
.wordmark > span:nth-child(6) { animation-delay: 0.35s; }
.wordmark > span:nth-child(7) { animation-delay: 0.42s; }
.wordmark > span:hover { animation: press-once 0.45s cubic-bezier(0.3, 0.7, 0.4, 1); }

@keyframes press {
  0%, 16%, 100% { transform: translate(0, 0); text-shadow: var(--ext); }
  5% { transform: translate(calc(var(--press) * 0.3), var(--press)); text-shadow: var(--ext-pressed); }
  10% { transform: translate(0, -0.04em); text-shadow: var(--ext); }
}
@keyframes press-once {
  0%, 100% { transform: translate(0, 0); text-shadow: var(--ext); }
  30% { transform: translate(calc(var(--press) * 0.3), var(--press)); text-shadow: var(--ext-pressed); }
  65% { transform: translate(0, -0.04em); text-shadow: var(--ext); }
}
@media (prefers-reduced-motion: reduce) {
  .wordmark > span { animation: none !important; }
}

/* The dot on the i is a little holographic heart sticker, stuck on askew. */
.wordmark .i { position: relative; display: inline-block; z-index: 1; }
.wordmark .i::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -0.16em;
  width: 0.5em;
  height: 0.46em;
  transform: translateX(-45%) rotate(14deg);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 36 33'%3E%3Cdefs%3E%3ClinearGradient id='h' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23ff9fdc'/%3E%3Cstop offset='.35' stop-color='%23c9b5ff'/%3E%3Cstop offset='.65' stop-color='%2399e6ff'/%3E%3Cstop offset='1' stop-color='%23fff0a0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M14 24.5C6.4 18.8 2 15 2 9.6 2 5.6 5.1 2.5 9 2.5c2.1 0 4 1.1 5 2.8 1-1.7 2.9-2.8 5-2.8 3.9 0 7 3.1 7 7.1 0 5.4-4.4 9.2-12 14.9z' fill='%23fff' stroke='%23fff' stroke-width='8' stroke-linejoin='round'/%3E%3Cpath d='M14 24.5C6.4 18.8 2 15 2 9.6 2 5.6 5.1 2.5 9 2.5c2.1 0 4 1.1 5 2.8 1-1.7 2.9-2.8 5-2.8 3.9 0 7 3.1 7 7.1 0 5.4-4.4 9.2-12 14.9z' fill='url(%23h)' stroke='%2317120e' stroke-width='2.6' stroke-linejoin='round'/%3E%3Cpath d='M6.5 9.2c0-1.9 1.3-3.3 3-3.5' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round'/%3E%3Ccircle cx='6.6' cy='12.4' r='1.2' fill='%23fff'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 0.03em 0.03em rgb(23 18 14 / 0.3));
  transition: transform 0.2s cubic-bezier(0.3, 1.8, 0.5, 1);
}
.wordmark:hover .i::after { transform: translateX(-45%) rotate(-6deg) scale(1.15); }

/* --- layout --- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(0.8rem + env(safe-area-inset-top)) 1rem 0.8rem;
  background: var(--accent);
  border-bottom: var(--line);
  color: #fff;
}
.topbar .brand { font-size: clamp(2.2rem, 9vw, 2.6rem); padding-top: 0.15em; }

.me-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  border: var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.8rem 0.3rem 0.45rem;
  box-shadow: 2px 2px 0 var(--ink);
}
.me-chip::before { content: ""; width: 1rem; height: 1rem; border-radius: 50%; background: var(--c); border: 2px solid var(--ink); }

.view {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.1rem 1rem calc(var(--tabbar-h) + 2.5rem + env(safe-area-inset-bottom));
}

.banner {
  max-width: 928px;
  margin: 1rem auto 0;
  margin-inline: max(1rem, calc((100% - 928px) / 2));
  padding: 0.8rem 1rem;
  background: var(--yellow);
  border: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-weight: 600;
}
.banner.party {
  background: repeating-linear-gradient(-45deg, var(--pink) 0 22px, var(--yellow) 22px 44px, var(--sky) 44px 66px, var(--mint) 66px 88px);
  text-align: center;
  font-family: var(--display);
  font-size: 1.2rem;
}
.banner.party strong {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #fff;
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  text-shadow: 3px 3px 0 var(--ink);
}

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem calc(0.5rem + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: var(--line);
}
.tabbar button {
  flex: 1;
  height: calc(var(--tabbar-h) - 1rem);
  border: 2.5px solid transparent;
  border-radius: 14px;
  background: none;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  cursor: pointer;
}
.tabbar button span { font-size: 1.35rem; filter: grayscale(1); opacity: 0.6; }
.tabbar button.active { color: var(--ink); background: var(--yellow); border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.tabbar button.active span { filter: none; opacity: 1; }

.fab {
  position: fixed;
  right: max(1.25rem, calc((100% - 960px) / 2 + 1.25rem));
  bottom: calc(var(--tabbar-h) + 1.5rem + env(safe-area-inset-bottom));
  z-index: 6;
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  border: var(--line);
  background: var(--accent);
  color: #fff;
  font-family: var(--display);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
.fab:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }

.card {
  background: var(--surface);
  border: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem;
  margin-bottom: 1.25rem;
}
.card h2 { margin-bottom: 0.35rem; }
.card p { margin: 0.3rem 0 0.7rem; }
.card details { border-top: 2px dashed #d9cbb3; padding: 0.65rem 0; }
.card summary { cursor: pointer; font-weight: 800; }
.card.soon { background: var(--mint); }
.card.soon .muted { color: var(--ink); }

.copy-row, .inline-form { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.copy-row input, .inline-form input { margin: 0; font-size: 0.85rem; }

.swatches { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.swatch { width: 2.6rem; height: 2.6rem; border-radius: 50%; border: var(--line); cursor: pointer; }
.swatch.active { box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--ink); }

.muted.small { font-size: 0.8rem; }
.qr-wrap { display: flex; justify-content: center; padding: 0.5rem 0; }
.qr { width: 220px; height: 220px; border: var(--line); border-radius: 12px; box-shadow: var(--shadow); background: #fff; padding: 6px; }
#install-btn { margin: 0.4rem 0 0.6rem; }

.or { display: flex; align-items: center; gap: 0.75rem; margin: 1.1rem 0; color: var(--muted); font-weight: 700; font-family: var(--display); }
.or::before, .or::after { content: ""; flex: 1; border-top: 2px dashed #d9cbb3; }
.btn.google { display: flex; align-items: center; justify-content: center; gap: 0.6rem; width: 100%; text-decoration: none; }

/* --- calendar --- */

#calendar {
  background: var(--surface);
  border: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.85rem;
}
.fc .fc-toolbar-title { font-family: var(--display); font-weight: 800; font-size: 1.6rem; text-transform: capitalize; letter-spacing: -0.02em; }
.fc .fc-button { font-weight: 800; text-transform: capitalize; border-width: 2.5px; border-radius: 10px; box-shadow: 2px 2px 0 var(--ink); }
.fc .fc-button:focus { box-shadow: 2px 2px 0 var(--ink) !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active { color: #fff; }
.fc .fc-button-primary:disabled { opacity: 0.5; }
.fc .fc-button-group { gap: 0.35rem; }
.fc .fc-button-group > .fc-button { border-radius: 10px !important; }
.fc .fc-col-header-cell-cushion { font-weight: 800; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.06em; color: var(--muted); text-decoration: none; }
.fc .fc-daygrid-day-number { font-weight: 700; text-decoration: none; color: var(--ink); }
.fc .fc-day-today .fc-daygrid-day-number {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  min-width: 1.8em;
  text-align: center;
  margin: 2px;
}
.fc .fc-daygrid-day { cursor: pointer; }
.fc .fc-event { cursor: pointer; border-radius: 6px; font-weight: 700; }
.fc .fc-daygrid-block-event, .fc .fc-timegrid-event { border: 2px solid var(--ink) !important; }
.fc .birthday { box-shadow: 2px 2px 0 var(--ink); }
.fc .fc-list-day-cushion { background: var(--yellow) !important; font-weight: 800; }
.fc a { text-decoration: none; }
@media (max-width: 640px) {
  #calendar { padding: 0.5rem; box-shadow: var(--shadow); }
  .fc .fc-toolbar { gap: 0.4rem; }
  .fc .fc-toolbar-title { font-size: 1.25rem; }
  .fc .fc-button { padding: 0.35rem 0.6rem; font-size: 0.85rem; }
  .fc .fc-daygrid-event { font-size: 0.72rem; }
}

/* --- wishlists --- */

.people { display: flex; gap: 0.6rem; overflow-x: auto; padding: 0.15rem 0.3rem 0.7rem 0.1rem; margin-bottom: 0.75rem; scrollbar-width: none; }
.person {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font: inherit;
  font-weight: 800;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}
.person .dot { width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--c); border: 2px solid var(--ink); }
.person.active { background: var(--c); color: #fff; box-shadow: 3px 3px 0 var(--ink); text-shadow: 1px 1px 0 var(--ink); }
.person.active .dot { background: #fff; }

.list-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.list-head h2 { font-size: clamp(1.6rem, 6vw, 2.2rem); }
.hint { margin: 0.5rem 0 1.1rem; }
.empty { text-align: center; font-weight: 700; color: var(--muted); padding: 2.5rem 1rem; border: 2.5px dashed var(--ink); border-radius: var(--radius); background: rgb(255 255 255 / 0.6); }

.item {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: flex-start;
  background: var(--surface);
  border: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.95rem 1rem;
  margin-bottom: 0.9rem;
}
.item:nth-child(4n + 1) { border-left: 10px solid var(--pink); }
.item:nth-child(4n + 2) { border-left: 10px solid var(--sky); }
.item:nth-child(4n + 3) { border-left: 10px solid var(--mint); }
.item:nth-child(4n) { border-left: 10px solid var(--yellow); }
.item.taken { background: #f3ede4; box-shadow: none; }
.item.taken .item-title { text-decoration: line-through; text-decoration-thickness: 2px; }
.item-main { min-width: 0; }
.item-title { font-family: var(--display); font-size: 1.15rem; font-weight: 800; overflow-wrap: anywhere; }
.item-title a { font-weight: 800; }
.item-meta { display: flex; gap: 0.75rem; font-size: 0.88rem; font-weight: 700; color: var(--muted); margin-top: 0.15rem; }
.stars { color: var(--accent); letter-spacing: 1px; }
.item-note { margin: 0.4rem 0 0; font-size: 0.92rem; white-space: pre-wrap; }
.item-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0.45rem; flex: none; }
.badge { font-size: 0.8rem; font-weight: 800; padding: 0.25rem 0.65rem; border-radius: 999px; border: 2px solid var(--ink); background: var(--surface); white-space: nowrap; }
.badge.mine { background: var(--mint); }

/* --- dialogs --- */

dialog {
  width: min(480px, calc(100% - 2rem));
  border: var(--line);
  border-radius: 20px;
  padding: 1.35rem;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
}
dialog::backdrop { background: rgb(23 18 14 / 0.55); }
dialog h2 { margin-bottom: 1.1rem; font-size: 1.8rem; }
.actions { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.spacer { flex: 1; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 1.5rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--accent);
}

/* Display font for UI chrome; declared last so it wins over the `font: inherit` resets above. */
.btn, label, .tabbar button, .person, .me-chip, .badge, .banner, .empty, .item-meta, .fc { font-family: var(--display); }
