/* Giwi web — gift-tag design. Cold paper, ink-blue type, raspberry ribbon for reservations, gold seal for pins. */
:root {
  --paper: #EEF1F8;
  --card: #FFFFFF;
  --ink: #17204A;
  --muted: #5E678F;
  --line: #D3D9EA;
  --rasp: #D9305C;
  --rasp-ink: #FFFFFF;
  --gold: #F2B33D;
  --ok: #1F8A68;
  --focus: #3B5BFF;
  --display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --body: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --notch: 16px;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10142B; --card: #1A2044; --ink: #EDF0FB; --muted: #9AA3CB; --line: #2C3463;
    --rasp: #FF5A84; --rasp-ink: #1A0710; --gold: #F5C35A; --ok: #49C99E; --focus: #8EA2FF;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #10142B; --card: #1A2044; --ink: #EDF0FB; --muted: #9AA3CB; --line: #2C3463;
  --rasp: #FF5A84; --rasp-ink: #1A0710; --gold: #F5C35A; --ok: #49C99E; --focus: #8EA2FF;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 17px/1.5 var(--body); min-height: 100dvh;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; border-radius: 6px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- header / nav ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  max-width: 1040px; margin: 0 auto; padding: 14px 24px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.wordmark {
  font: 700 26px/1 var(--display); letter-spacing: -0.04em; text-decoration: none;
  display: inline-flex; align-items: center; gap: 2px;
}
.wordmark::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--rasp); margin-left: 3px; transform: translateY(-9px); }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a { position: relative; display: flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: 15px; }
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--ink); background: var(--card); }
.nav a.add { color: var(--rasp); }
.nav .ic { display: inline-flex; }
.nav.guest { gap: 12px; }
.nav-text { color: var(--ink) !important; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--rasp); color: var(--rasp-ink); font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; }
.settings-link { color: var(--muted); display: inline-flex; padding: 8px; border-radius: 8px; }
.settings-link:hover { color: var(--ink); }

main { max-width: 760px; margin: 0 auto; padding: 16px 24px 96px; }
main:focus, main:focus-visible { outline: none; }

@media (max-width: 760px) {
  .top { padding: 12px 16px; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--paper); }
  .settings-link { margin-left: auto; }
  main { padding: 8px 16px calc(96px + env(safe-area-inset-bottom)); }
  .nav:not(.guest) {
    position: fixed; left: 0; right: 0; bottom: 0; margin: 0; gap: 0; justify-content: space-around;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--card); border-top: 1px solid var(--line); z-index: 20;
  }
  .nav:not(.guest) a { flex-direction: column; gap: 2px; font-size: 10.5px; padding: 6px 4px; flex: 1; text-align: center; background: none; }
  .nav:not(.guest) a.on { color: var(--ink); }
  .nav:not(.guest) a.on .ic { color: var(--rasp); }
  .nav:not(.guest) a.add .ic { background: var(--rasp); color: var(--rasp-ink); border-radius: 50%; padding: 6px; margin-top: -4px; }
  .nav:not(.guest) a.add { color: var(--muted); }
  .nav .badge { position: absolute; top: 2px; left: 50%; margin-left: 6px; }
  .nav.guest { margin-left: auto; }
  .nav.guest .nav-text { padding: 8px 6px; }
}

/* ---------- type ---------- */
.display { font: 700 clamp(30px, 6vw, 46px)/1.08 var(--display); letter-spacing: -0.03em; margin: 24px 0 16px; text-wrap: balance; }
.display.small { font-size: clamp(24px, 4.6vw, 32px); margin: 16px 0 20px; }
.lead { font-size: 19px; color: var(--muted); max-width: 34em; margin: 0 0 24px; }
.section-title { font: 600 18px/1.3 var(--display); letter-spacing: -0.01em; margin: 36px 0 14px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; margin: 10px 0 0; max-width: 32em; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink); font-weight: 600; font-size: 15px;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, background-color .12s ease;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--rasp)); }
.btn.danger { color: var(--rasp); border-color: color-mix(in srgb, var(--rasp) 40%, var(--line)); }
.btn.danger:hover { border-color: var(--rasp); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.apple { background: #000; color: #fff; border-color: #000; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn.file { cursor: pointer; }
.linkish { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 8px 0; justify-self: start; }
.chip { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 13px; font-weight: 500; color: var(--muted); }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.hero-actions, .stack { display: flex; flex-wrap: wrap; gap: 10px; }
.stack { flex-direction: column; align-items: flex-start; }

/* ---------- the gift tag ---------- */
.tags { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 14px; }
.tag, .wish-card {
  position: relative; display: flex; align-items: stretch; gap: 14px;
  background: var(--card); color: var(--ink); text-decoration: none;
  clip-path: polygon(var(--notch) 0, 100% 0, 100% 100%, var(--notch) 100%, 0 calc(100% - var(--notch)), 0 var(--notch));
  border-radius: 0 var(--r) var(--r) 0;
  padding: 14px 18px 14px 40px; min-height: 96px;
}
.tag { transition: transform .15s ease; }
.tag:hover { transform: translateX(3px); }
.tag:focus-visible { outline: none; box-shadow: inset 0 0 0 2.5px var(--focus); }
.tag-hole {
  position: absolute; left: 14px; top: 50%; width: 12px; height: 12px; margin-top: -6px;
  border-radius: 50%; background: var(--paper); box-shadow: inset 0 0 0 2px var(--line);
}
.tag-img { width: 76px; height: 76px; flex: none; object-fit: cover; border-radius: 6px; background: var(--line); align-self: center; }
.tag-text { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; padding-right: 28px; }
.tag-owner { font-size: 13px; color: var(--muted); font-weight: 500; }
.tag-title { font-weight: 600; font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.tag-desc { color: var(--muted); font-size: 14.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag-link, .tag-date { font-size: 13px; color: var(--muted); }
.tag-link::before { content: "↗ "; }

.seal {
  position: absolute; right: 10px; bottom: 10px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--gold); color: #3B2600; font-size: 13px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 30%, transparent);
}
.ribbon {
  position: absolute; top: 15px; right: -44px; width: 160px; transform: rotate(35deg);
  background: var(--rasp); color: var(--rasp-ink); text-align: center;
  font: 600 11px/1 var(--body); padding: 6px 0; letter-spacing: .01em; pointer-events: none;
}
.tag.is-mine .ribbon { background: var(--ink); color: var(--paper); }
.tag.is-done .ribbon { background: var(--ok); color: #fff; }
.tag.is-done .tag-title { text-decoration: line-through; text-decoration-thickness: 1.5px; text-decoration-color: var(--muted); }
.tag.is-taken { background: color-mix(in srgb, var(--card) 70%, var(--paper)); }

/* ---------- profile ---------- */
.hero-profile { display: grid; grid-template-columns: auto 1fr; column-gap: 20px; align-items: end; margin: 20px 0 28px; }
.hero-profile .avatar { grid-row: span 2; }
.nick { font: 700 clamp(30px, 7.5vw, 56px)/1 var(--display); letter-spacing: -0.04em; margin: 0; overflow-wrap: anywhere; }
.count { margin: 6px 0 0; color: var(--muted); }
.hero-profile .hero-actions { grid-column: 1 / -1; margin-top: 20px; }
@media (max-width: 480px) { .hero-profile { grid-template-columns: 1fr; } .hero-profile .avatar { grid-row: auto; margin-bottom: 14px; } }

.avatar { border-radius: 50%; object-fit: cover; flex: none; background: var(--line); }
.avatar.noimg { display: inline-grid; place-items: center; background: var(--ink); color: var(--paper); font: 700 1em/1 var(--display); }
.avatar.s { width: 28px; height: 28px; font-size: 12px; }
.avatar.m { width: 40px; height: 40px; font-size: 16px; }
.avatar.xl { width: 92px; height: 92px; font-size: 38px; }

.guest-note { background: var(--card); border-radius: var(--r); padding: 18px 20px; margin: 0 0 28px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; border-left: 4px solid var(--rasp); }
.guest-note p { margin: 0 0 4px; flex-basis: 100%; }

.tabs { display: flex; gap: 22px; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.tabs a { text-decoration: none; padding: 10px 0; color: var(--muted); font-weight: 500; border-bottom: 2.5px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-color: var(--rasp); }
.tabs .n { font-size: 12px; background: var(--line); border-radius: 9px; padding: 1px 7px; margin-left: 4px; color: var(--ink); }

.owner-line { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600; margin: 0 0 12px; }
.owner-line:hover { text-decoration: underline; }
.feed-group { margin: 0 0 34px; }
.more { display: inline-block; margin-top: 10px; color: var(--muted); font-size: 15px; }

/* ---------- wish page ---------- */
.wish-page { margin-top: 12px; }
.wish-card { flex-direction: column; padding: 24px 24px 24px 48px; --notch: 22px; }
.wish-card .tag-hole { left: 18px; top: 50%; width: 14px; height: 14px; margin-top: -7px; }
.wish-img { width: 100%; max-height: 440px; object-fit: cover; border-radius: 8px; background: var(--line); }
.wish-title { font: 700 clamp(24px, 5vw, 34px)/1.15 var(--display); letter-spacing: -0.025em; margin: 0; overflow-wrap: anywhere; }
.wish-body { display: flex; flex-direction: column; gap: 12px; }
.wish-desc { margin: 0; white-space: pre-line; max-width: 36em; }
.wish-link { font-weight: 600; color: var(--rasp); text-underline-offset: 3px; }
.wish-meta { margin: 0; color: var(--muted); font-size: 15px; }
.wish-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; align-items: center; }
.state { margin: 0; flex-basis: 100%; padding: 14px 16px; border-radius: var(--r); font-weight: 500; }
.state.taken { background: color-mix(in srgb, var(--rasp) 12%, var(--card)); }
.state.mine { background: var(--card); border-left: 4px solid var(--ink); }
.state.done { background: color-mix(in srgb, var(--ok) 14%, var(--card)); color: var(--ok); }

/* ---------- forms ---------- */
.auth, .form-page { max-width: 460px; }
.form { display: grid; gap: 16px; }
.form label, .form fieldset { display: grid; gap: 6px; font-weight: 500; font-size: 15px; }
.form fieldset { border: 0; padding: 0; margin: 0; }
.form legend { font-weight: 500; margin-bottom: 6px; padding: 0; }
.form small { color: var(--muted); font-weight: 400; font-size: 13px; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea, select {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--card); font-size: 16px;
}
input:focus, textarea:focus, select:focus { border-color: var(--ink); outline: none; }
textarea { resize: vertical; }
.prefixed { display: flex; align-items: center; background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; }
.prefixed:focus-within { border-color: var(--ink); }
.prefixed > span { padding-left: 14px; color: var(--muted); font-weight: 600; }
.prefixed input { border: 0 !important; padding-left: 4px !important; background: transparent !important; }
.form-error { margin: 0; color: var(--rasp); font-weight: 500; }
.check { display: flex !important; align-items: center; gap: 10px; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--ink); flex: none; }
.seg { display: flex !important; gap: 0; background: var(--card); border: 1.5px solid var(--line) !important; border-radius: 999px; padding: 4px !important; }
.seg label { flex: 1; display: block; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 8px 0; border-radius: 999px; cursor: pointer; color: var(--muted); }
.seg input:checked + span { background: var(--ink); color: var(--paper); }
.seg input:focus-visible + span { outline: 2.5px solid var(--focus); }
.photo-field { display: grid; gap: 8px; justify-items: start; }
.photo-field .label { font-weight: 500; font-size: 15px; }
.preview { max-height: 220px; border-radius: 8px; }
.avatar-edit { display: flex; align-items: center; gap: 16px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 20px 0; font-size: 14px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.switch { margin-top: 20px; }
.pick { display: grid; gap: 6px; }
.pick-row { display: flex !important; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card); border-radius: 10px; border: 1.5px solid var(--line); cursor: pointer; font-weight: 500; }
.pick-row:has(input:checked) { border-color: var(--ink); }

.find { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 0 0 20px; }
.find label { grid-column: 1 / -1; font-weight: 500; font-size: 15px; }
.found, .people a { display: flex; align-items: center; gap: 12px; }
.found { justify-content: space-between; background: var(--card); padding: 12px 14px; border-radius: var(--r); margin-bottom: 24px; }
.found a { text-decoration: none; font-weight: 600; }
.found-msg { color: var(--muted); }
.people { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.people a { padding: 10px 4px; text-decoration: none; font-weight: 600; border-bottom: 1px solid var(--line); }
.people .chip { margin-left: auto; }

/* ---------- notifications ---------- */
.notifs { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.notifs li { background: var(--card); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 6px; }
.notifs li.unread { border-left: 4px solid var(--rasp); }
.notifs p { margin: 0; }
.notifs .when { font-size: 13px; color: var(--muted); }
.notifs .row { display: flex; flex-wrap: wrap; gap: 8px; }
.notifs .row:empty { display: none; }

/* ---------- santa ---------- */
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.santa-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.santa-list a { display: grid; gap: 2px; padding: 16px 18px; background: var(--card); border-radius: var(--r); text-decoration: none; }
.santa-date { color: var(--rasp); font-weight: 600; font-size: 14px; }
.santa-date.big { font-size: 16px; margin: 16px 0 0; }
.santa-title { font: 600 19px/1.25 var(--display); }
.santa-meta { color: var(--muted); font-size: 14px; }

/* ---------- landing ---------- */
.landing { padding-top: 12px; }
.landing .display { max-width: 15em; }
.landing-tag {
  position: relative; width: min(100%, 340px); margin: 12px 0 8px; padding: 22px 22px 22px 50px;
  background: var(--card); display: grid; gap: 12px; overflow: hidden;
  clip-path: polygon(22px 0, 100% 0, 100% 100%, 22px 100%, 0 calc(100% - 22px), 0 22px);
  border-radius: 0 var(--r) var(--r) 0; transform: rotate(-2.5deg); transform-origin: left center;
  animation: swing 1.6s cubic-bezier(.3,1.6,.5,1) both;
}
.landing-tag .tag-hole { left: 18px; }
.lt-line { font-weight: 600; font-size: 18px; border-bottom: 1.5px dashed var(--line); padding-bottom: 10px; position: relative; }
.lt-line:last-child { border: 0; padding: 0; }
.lt-line.struck { color: var(--muted); }
.landing-tag .ribbon { top: auto; bottom: 22px; right: -46px; }
@keyframes swing { from { transform: rotate(-12deg); } to { transform: rotate(-2.5deg); } }
.landing .find { margin-top: 40px; max-width: 460px; }

/* ---------- misc ---------- */
.empty { text-align: left; padding: 28px 0; max-width: 30em; }
.empty-title { font: 600 20px/1.3 var(--display); margin: 0 0 6px; }
.empty p { margin: 0 0 16px; color: var(--muted); }
.loading { color: var(--muted); padding: 40px 0; }
#toast {
  position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: min(92vw, 480px); padding: 12px 18px; border-radius: 12px; z-index: 40;
  background: var(--ink); color: var(--paper); font-weight: 500; font-size: 15px;
  animation: toast-in .2s ease-out;
}
#toast[data-kind="err"] { background: var(--rasp); color: var(--rasp-ink); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
@media (min-width: 761px) { #toast { bottom: 28px; } }

dialog.sheet { border: 0; border-radius: 16px; padding: 22px; width: min(92vw, 440px); background: var(--card); color: var(--ink); }
dialog.sheet::backdrop { background: rgb(10 14 35 / .45); }
dialog.sheet h2 { font: 600 20px/1.3 var(--display); margin: 0 0 10px; }
.sheet-body { color: var(--muted); margin-bottom: 16px; }
.sheet-body p { margin: 0 0 12px; }
.sheet-body .pick-row { color: var(--ink); }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.date-field { display: grid; gap: 6px; }
.date-field label { font-weight: 500; font-size: 15px; }
.date-row { display: flex; gap: 8px; align-items: center; }
.date-row input { flex: 1; }
