/* ============ tokens ============ */
:root {
  --bg: #0a1612;
  --bg-2: #0f221c;
  --text: #f3eee4;
  --muted: #a6b3ab;
  --faint: rgba(243, 238, 228, .55);
  --gold: #d9b878;
  --gold-2: #f2deb0;
  --gold-ink: #241a08;
  --berry: #c2414f;
  --pine: #5fa585;
  --glass: rgba(255, 255, 255, .055);
  --glass-strong: rgba(255, 255, 255, .085);
  --line: rgba(255, 255, 255, .11);
  --line-strong: rgba(255, 255, 255, .2);
  --radius: 20px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, sans-serif;
  --c: var(--gold); /* person accent, overridden by .m-* */
  color-scheme: dark;
}

.m-fabienne { --c: #d6a756; }
.m-henri    { --c: #5fa585; }
.m-lucy     { --c: #9a8ce0; }
.m-solene   { --c: #d9849a; }
.m-clement  { --c: #6c9be0; }
.m-chloe    { --c: #cf9466; }
.m-alexis   { --c: #5db6ba; }
.m-marylou  { --c: #bb8ad2; }
.m-thomas   { --c: #d0606a; }

/* ============ base ============ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: linear-gradient(180deg, #0b1a24 0%, var(--bg) 45%, var(--bg-2) 100%) fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
::selection { background: var(--gold); color: var(--gold-ink); }

.wrap {
  position: relative;
  z-index: 3;
  max-width: 540px;
  margin: 0 auto;
  padding: max(28px, calc(env(safe-area-inset-top) + 16px)) 16px 40px;
}
body.has-tabs .wrap { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }

.display {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 500;
  font-size: clamp(2.4rem, 11vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -.02em;
  margin: 0;
}
.display em { font-style: italic; font-weight: 400; color: var(--gold-2); }
.display.small { font-size: 1.9rem; margin-bottom: 4px; }
.eyebrow {
  margin: 0 0 10px;
  font-size: .78rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold);
}
.sub { margin: 10px 0 0; color: var(--muted); }
.hint { margin: 26px 8px 0; text-align: center; font-size: .9rem; color: var(--faint); }

/* ============ animated backdrop ============ */
.sky, .forest, .scene { position: fixed; inset: 0; pointer-events: none; }
.sky { z-index: 0; overflow: hidden; }
.aurora {
  position: absolute;
  width: 80vmax; height: 50vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .32;
  mix-blend-mode: screen;
  will-change: transform;
}
.a1 { top: -22vmax; left: -25vmax; background: radial-gradient(closest-side, #2f8f74, transparent); animation: drift1 26s ease-in-out infinite alternate; }
.a2 { top: -18vmax; right: -30vmax; background: radial-gradient(closest-side, #3a5fa0, transparent); animation: drift2 32s ease-in-out infinite alternate; opacity: .26; }
.a3 { top: 10vmax; left: 10vmax; background: radial-gradient(closest-side, #8a5a3a, transparent); animation: drift3 38s ease-in-out infinite alternate; opacity: .14; }
@keyframes drift1 { to { transform: translate(18vmax, 8vmax) rotate(12deg) scale(1.1); } }
@keyframes drift2 { to { transform: translate(-16vmax, 10vmax) rotate(-10deg) scale(1.15); } }
@keyframes drift3 { to { transform: translate(-12vmax, -6vmax) scale(.9); } }

.forest {
  z-index: 1;
  top: auto; height: 190px;
  background: url("/static/forest.svg") center bottom / auto 100% repeat-x;
  opacity: .95;
}
.forest::before { /* mist above the trees */
  content: ""; position: absolute; inset: -60px 0 auto; height: 160px;
  background: linear-gradient(180deg, transparent, rgba(150, 190, 175, .07) 60%, transparent);
}
.scene { z-index: 2; width: 100%; height: 100%; }

/* ============ hero ============ */
.hero { text-align: center; padding: 20px 0 30px; }
.hero.home { padding-top: 8px; }
.countdown {
  display: inline-flex; align-items: center; gap: 14px;
  margin-top: 4px;
}
.countdown .num {
  font-family: var(--serif); font-weight: 400; font-style: italic;
  font-size: clamp(4.2rem, 22vw, 5.6rem); line-height: .9;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.countdown .cap {
  text-align: left; font-size: .95rem; line-height: 1.3; color: var(--muted);
  padding-left: 14px; border-left: 1px solid var(--line-strong);
}

/* ============ glass surfaces ============ */
.card, .tile, .gift, .empty {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  backdrop-filter: blur(16px) saturate(130%);
}
.card { padding: 22px 20px; }

/* ============ member grid ============ */
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.grid > li { display: flex; min-width: 0; }
.grid > li.wide { grid-column: 1 / -1; }
.tile {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 20px 8px 16px;
  text-decoration: none;
  transition: transform .2s ease, background-color .2s ease, border-color .2s ease;
}
.tile:active { transform: scale(.97); }
@media (hover: hover) { .tile:hover { background: var(--glass-strong); border-color: var(--line-strong); } }
.tile .name { font-weight: 600; font-size: .95rem; text-align: center; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tile .count { margin-top: -6px; font-size: .78rem; color: var(--muted); }

.tile.me { flex-direction: row; justify-content: flex-start; gap: 16px; padding: 16px 18px; }
.tile.me .name { flex: 1; text-align: left; font-family: var(--serif); font-weight: 500; font-size: 1.35rem; }
.tile.me .name small { display: block; font-family: var(--sans); font-size: .82rem; font-weight: 500; color: var(--muted); }
.arrow { width: 10px; height: 10px; border-top: 2px solid var(--gold); border-right: 2px solid var(--gold); transform: rotate(45deg); margin-right: 6px; }

.avatar {
  display: grid; place-items: center; flex: none;
  width: 52px; height: 52px;
  font-family: var(--serif); font-size: 1.5rem; font-weight: 500;
  color: var(--c);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--c) 35%, transparent), color-mix(in srgb, var(--c) 10%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 55%, transparent);
}
.avatar.big { width: 84px; height: 84px; font-size: 2.4rem; margin: 0 auto 18px; }

/* ============ forms ============ */
label { display: block; margin: 16px 0 0; font-size: .85rem; font-weight: 600; color: var(--muted); }
label small { font-weight: 500; color: var(--faint); margin-left: 4px; }
input:not([type=checkbox]):not([type=file]), textarea {
  display: block; width: 100%;
  margin-top: 7px; padding: 13px 14px;
  font-size: 16px; /* no iOS zoom */
  color: var(--text);
  background: rgba(0, 0, 0, .22);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: rgba(243, 238, 228, .3); }
input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217, 184, 120, .18); }
textarea { resize: vertical; min-height: 84px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; margin-top: 20px; padding: 14px 18px;
  font-weight: 700; font-size: 1rem; letter-spacing: .01em;
  color: var(--gold-ink);
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border: 0; border-radius: 14px;
  box-shadow: 0 8px 24px -8px rgba(217, 184, 120, .55), inset 0 1px 0 rgba(255, 255, 255, .5);
  cursor: pointer;
  transition: transform .1s ease, filter .15s ease;
}
.btn:active { transform: scale(.98); filter: brightness(.95); }

.back {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 14px; padding: 6px 0;
  font-size: .9rem; font-weight: 600; color: var(--muted); text-decoration: none;
}
.back::before { content: ""; width: 8px; height: 8px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }

.error {
  margin: 16px 0 0; padding: 12px 14px;
  font-size: .92rem; font-weight: 600;
  color: #ffd9dc;
  background: rgba(194, 65, 79, .18);
  border: 1px solid rgba(194, 65, 79, .45);
  border-radius: 12px;
}

.login-card { text-align: center; margin-top: 8px; padding-top: 30px; }
.pw-field { position: relative; margin-top: 7px; }
.pw-field input:not([type=checkbox]):not([type=file]) { margin-top: 0; padding-right: 92px; }
.pw-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  min-height: 36px; padding: 0 12px;
  font-size: .82rem; font-weight: 600; color: var(--gold);
  background: transparent; border: 0; border-radius: 8px; cursor: pointer;
}
.pw-toggle:active { background: rgba(255, 255, 255, .06); }
.login-card .display { font-size: 2.3rem; }
.login-card form { text-align: left; margin-top: 8px; }

/* ============ person page ============ */
.person-head { text-align: center; padding: 6px 0 26px; }
.person-head .sub { max-width: 36ch; margin-left: auto; margin-right: auto; }

details.add { margin-bottom: 8px; }
details.add > summary { list-style: none; margin: 0; }
details.add > summary::-webkit-details-marker { display: none; }
.plus { position: relative; width: 12px; height: 12px; transition: transform .25s ease; }
.plus::before, .plus::after { content: ""; position: absolute; background: currentColor; border-radius: 2px; }
.plus::before { left: 0; right: 0; top: 5px; height: 2px; }
.plus::after { top: 0; bottom: 0; left: 5px; width: 2px; }
details.add[open] .plus { transform: rotate(45deg); }
details.add > .card { margin-top: 10px; animation: rise .3s ease-out; }
details.add > .card > .sub:first-child { margin-top: 0; }

h2 {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 34px 2px 12px;
  font-size: .78rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold);
}
h2 small { font-size: .78rem; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--faint); }
#ideas > :first-child:not(h2) { margin-top: 20px; }

.gift {
  position: relative;
  margin: 10px 0;
  padding: 18px 18px 16px 22px;
  overflow: hidden;
  animation: rise .4s ease-out both;
}
.gift::before { /* accent ribbon */
  content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--c);
}
.gift-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.gift h3 { margin: 0; font-size: 1.06rem; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.price { margin: 4px 0 0; font-family: var(--serif); font-style: italic; color: var(--gold-2); }
.note { margin: 8px 0 0; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }
.link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 10px;
  font-size: .9rem; font-weight: 600; color: var(--gold); text-decoration: none;
  border-bottom: 1px solid rgba(217, 184, 120, .35);
}
.link::after { content: ""; width: 6px; height: 6px; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg); }
.by { margin: 10px 0 0; font-size: .82rem; color: var(--faint); }

.tag {
  flex: none;
  padding: 3px 9px;
  font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(217, 184, 120, .45);
  border-radius: 999px;
}

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.actions form { margin: 0; }
.spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px; padding: 7px 14px;
  font-size: .85rem; font-weight: 600;
  color: var(--text); text-decoration: none;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line-strong); border-radius: 999px;
  cursor: pointer; list-style: none;
  transition: background-color .15s, transform .1s;
}
.chip::-webkit-details-marker { display: none; }
.chip:active { transform: scale(.96); }
.chip.ghost { color: var(--muted); background: transparent; border-color: transparent; padding: 7px 8px; }
.chip.danger { color: white; background: var(--berry); border-color: var(--berry); }
details.del { display: inline-flex; align-items: center; gap: 6px; }
details.del[open] > summary { color: var(--text); }

.empty {
  margin: 10px 0; padding: 22px 18px;
  text-align: center; font-size: .92rem; color: var(--muted);
  background: transparent;
  border-style: dashed; border-color: var(--line-strong);
  -webkit-backdrop-filter: none; backdrop-filter: none;
}

/* ============ photos ============ */
.gift-photo {
  display: block; margin: -4px -4px 14px;
  aspect-ratio: 16 / 10; overflow: hidden;
  border-radius: 12px;
  background: rgba(0, 0, 0, .25);
}
.gift-photo img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
@media (hover: hover) { .gift-photo:hover img { transform: scale(1.03); } }

.photo-field { margin-top: 16px; }
.field-label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); }
.field-label small { font-weight: 500; color: var(--faint); margin-left: 4px; }
.photo-preview, .photo-current img {
  display: block; width: 100%; max-height: 240px; margin-top: 8px;
  object-fit: cover; border-radius: 12px;
}
.check { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-weight: 500; color: var(--text); }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--gold); }
.file { display: block; margin: 8px 0 0; }
.file input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 10px 14px;
  font-size: .92rem; font-weight: 600; color: var(--text);
  background: rgba(0, 0, 0, .18);
  border: 1px dashed var(--line-strong); border-radius: 12px;
  cursor: pointer;
}
.file-btn::before { /* minimal camera-less "+" glyph, drawn in CSS */
  content: ""; width: 14px; height: 14px;
  background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
              linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat;
  opacity: .7;
}
.file input:focus-visible + .file-btn { border-color: var(--gold); }

dialog.lightbox { padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100dvh; width: 100vw; height: 100dvh; }
dialog.lightbox[open] { display: grid; place-items: center; }
dialog.lightbox::backdrop { background: rgba(5, 12, 10, .85); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
dialog.lightbox img {
  max-width: calc(100vw - 32px); max-height: calc(100dvh - 80px);
  border-radius: 14px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8);
  animation: rise .25s ease-out;
}

/* ============ tab bar ============ */
.tabs {
  position: fixed; z-index: 10;
  left: 50%; bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 32px), 420px);
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  padding: 6px;
  background: rgba(14, 28, 23, .72);
  border: 1px solid var(--line);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .6);
}
.tab, .tab button {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 44px; margin: 0; padding: 0 6px;
  font-size: .85rem; font-weight: 600;
  color: var(--muted); text-decoration: none;
  background: none; border: 0; border-radius: 999px; cursor: pointer;
  transition: color .2s, background-color .2s;
}
.tab.on { color: var(--gold-ink); background: linear-gradient(180deg, var(--gold-2), var(--gold)); }

/* ============ toast ============ */
.toast {
  position: fixed; z-index: 20; left: 50%; top: max(16px, env(safe-area-inset-top));
  padding: 11px 20px;
  font-size: .92rem; font-weight: 600; white-space: nowrap;
  color: var(--text);
  background: rgba(14, 28, 23, .85);
  border: 1px solid rgba(217, 184, 120, .4);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .6);
  animation: toast 3.2s cubic-bezier(.2, .8, .2, 1) forwards;
}
@keyframes toast {
  0%   { transform: translate(-50%, -140%); opacity: 0; }
  10%  { transform: translate(-50%, 0); opacity: 1; }
  85%  { transform: translate(-50%, 0); opacity: 1; }
  100% { transform: translate(-50%, -140%); opacity: 0; }
}

/* ============ motion ============ */
@keyframes rise { from { transform: translateY(6px); opacity: 0; } }
.shake { animation: shake .4s ease; }
@keyframes shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-2px); } }
.grid > li { animation: rise .45s ease-out both; }
.grid > li:nth-child(2) { animation-delay: .03s; } .grid > li:nth-child(3) { animation-delay: .06s; }
.grid > li:nth-child(4) { animation-delay: .09s; } .grid > li:nth-child(5) { animation-delay: .12s; }
.grid > li:nth-child(6) { animation-delay: .15s; } .grid > li:nth-child(7) { animation-delay: .18s; }
.grid > li:nth-child(8) { animation-delay: .21s; } .grid > li:nth-child(9) { animation-delay: .24s; }
.grid > li:nth-child(10) { animation-delay: .27s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition: none !important; }
}
