/* Family wishlist: pine ink, frost paper, kraft gift tags, one cranberry accent. */
:root {
  --frost: #F2F4F3;
  --paper: #FFFFFF;
  --pine: #18332D;
  --pine-2: #2E4A43;
  --muted: #56655F;
  --line: #D6DCD9;
  --line-strong: #B9C3BE;
  --cranberry: #A3243B;
  --cranberry-dark: #861C30;
  --cranberry-tint: #F7E6E9;
  --kraft: #D9BC93;
  --kraft-light: #EFE2CC;
  --kraft-ink: #4A3420;
  --ok: #2B6A4C;
  --ok-tint: #E3F0E8;
  --warn: #8A5A0B;
  --warn-tint: #FBF0DA;

  --font: 'Atkinson Hyperlegible Next', 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --hand: 'Kalam', 'Bradley Hand', 'Segoe Print', cursive;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1240px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--frost);
  color: var(--pine);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: var(--cranberry); text-underline-offset: 3px; }
a:hover { color: var(--cranberry-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(28px, 4.2vw, 40px); }
h2 { font-size: 24px; }
h3 { font-size: 19px; }
p { margin: 0 0 0.8em; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.tiny { font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--cranberry); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.site-header .inner { max-width: var(--maxw); margin: 0 auto; padding: 10px var(--gutter); display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; flex: none; min-width: 0; padding: 4px 0; }
.brand img { height: 44px; width: auto; display: block; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: var(--pine-2); text-decoration: none; padding: 8px 12px; border-radius: var(--r-sm); font-size: 16px; white-space: nowrap; }
.nav a:hover { background: var(--frost); color: var(--pine); }
.nav a[aria-current="page"] { background: var(--pine); color: #fff; }
@media (max-width: 640px) {
  .site-header .inner { flex-wrap: wrap; gap: 6px 12px; padding-top: 8px; padding-bottom: 8px; }
  .brand { flex: 1 1 100%; justify-content: center; }
  .brand img { height: 34px; }
  .nav { margin-left: 0; width: 100%; }
  .nav a { flex: 1; text-align: center; padding: 8px 6px; font-size: 15px; }
}

main { max-width: var(--maxw); margin: 0 auto; padding: 28px var(--gutter) 80px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 24px; }
.page-head p { margin: 8px 0 0; max-width: 62ch; color: var(--muted); }

/* ---------- gift tag ---------- */
.tag {
  --tag-bg: var(--kraft);
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45em;
  background: var(--tag-bg);
  color: var(--kraft-ink);
  padding: 0.28em 1.2em 0.28em 2.15em;
  clip-path: polygon(0.95em 0, 100% 0, 100% 100%, 0.95em 100%, 0 calc(100% - 0.95em), 0 0.95em);
  border-radius: 0 6px 6px 0;
  max-width: 100%;
}
.tag::before {
  content: '';
  position: absolute;
  left: 0.85em; top: 50%;
  width: 0.5em; height: 0.5em;
  border-radius: 50%;
  background: var(--frost);
  box-shadow: inset 0 0 0 2px rgba(74, 52, 32, 0.28);
  transform: translateY(-50%);
}
.tag .pre { font-size: 0.8em; }
.tag .name { font-family: var(--hand); font-weight: 700; font-size: 1.6em; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tag.on-paper::before { background: var(--paper); }
.tag.tilt { transform: rotate(-1.6deg); transform-origin: left center; }

/* ---------- buttons and fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 16px; font-weight: 700;
  min-height: 44px; padding: 9px 18px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--pine);
  background: var(--paper); color: var(--pine);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--frost); color: var(--pine); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--cranberry); border-color: var(--cranberry); color: #fff; }
.btn.primary:hover { background: var(--cranberry-dark); border-color: var(--cranberry-dark); color: #fff; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--pine-2); padding-left: 10px; padding-right: 10px; }
.btn.quiet:hover { background: var(--frost); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 15px; }
.btn.danger { border-color: var(--cranberry); color: var(--cranberry); }
.btn.danger:hover { background: var(--cranberry-tint); }
.btn[aria-busy="true"] { opacity: .7; cursor: progress; }
.btn.added { border-color: var(--ok); color: var(--ok); background: var(--ok-tint); }
.btn svg, .icon { width: 18px; height: 18px; flex: none; }

label { display: block; font-weight: 700; font-size: 15px; margin: 0 0 6px; }
.field { margin-bottom: 16px; }
.hint { font-size: 14px; color: var(--muted); margin-top: 5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="url"], select, textarea {
  font: inherit; font-size: 17px; color: var(--pine);
  width: 100%; min-height: 46px;
  padding: 10px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--paper);
}
textarea { min-height: 96px; resize: vertical; }
select { padding-right: 36px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2318332D' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
input:hover, select:hover, textarea:hover { border-color: var(--pine-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pine); box-shadow: 0 0 0 3px rgba(24, 51, 45, .15); }
.error-text { color: var(--cranberry); font-size: 15px; margin-top: 6px; }
input.invalid, textarea.invalid { border-color: var(--cranberry); }

.notice { border-radius: var(--r); padding: 14px 16px; font-size: 16px; margin-bottom: 18px; }
.notice.ok { background: var(--ok-tint); color: #1F4F38; }
.notice.warn { background: var(--warn-tint); color: #5E3D07; }
.notice.info { background: var(--paper); border: 1px solid var(--line); }
.notice.error { background: var(--cranberry-tint); color: var(--cranberry-dark); }
.notice p:last-child { margin-bottom: 0; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; }

/* ---------- product cards ---------- */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 14px; }
.product { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.product .pic { position: relative; display: block; aspect-ratio: 1 / 1; height: auto; min-height: 0; overflow: hidden; background: #fff; border-bottom: 1px solid var(--line); }
.product .pic img { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); max-width: none; object-fit: contain; }
.product .pic .ph { position: absolute; left: 28%; top: 28%; width: 44%; height: 44%; color: var(--line-strong); }
.product .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product .shop { font-size: 14px; color: var(--muted); }
.product .title { font-size: 15.5px; line-height: 1.35; color: var(--pine); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.product a.title:hover { text-decoration: underline; }
.product .price { font-size: 18px; font-weight: 700; margin-top: auto; padding-top: 4px; }
.product .checked { font-size: 13px; color: var(--muted); }
.product .note { font-size: 14px; color: var(--pine-2); background: var(--frost); border-radius: 6px; padding: 4px 8px; }
.product .actions { display: flex; gap: 6px; margin-top: 8px; }
.product .actions .btn { flex: 1; padding-left: 8px; padding-right: 8px; }

/* ---------- toast ---------- */
.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 460px); }
.toast { background: var(--pine); color: #fff; padding: 12px 18px; border-radius: var(--r); font-size: 16px; pointer-events: auto; box-shadow: 0 6px 24px rgba(24, 51, 45, .25); }
.toast.error { background: var(--cranberry-dark); }
@media (max-width: 900px) { .has-sheet .toast-wrap { bottom: 96px; } }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.products > .empty { grid-column: 1 / -1; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--pine); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

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

/* ---------- everyone's lists ---------- */
.draw-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.draw-banner p { margin: 0; flex: 1 1 280px; }
.people { display: flex; flex-direction: column; gap: 34px; margin-top: 8px; }
.person { padding-top: 26px; border-top: 1px solid var(--line); }
.person:first-child { border-top: 0; padding-top: 4px; }
.person-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 16px; }
.person-head .tag { font-size: 18px; }
.person-head .btn { margin-left: auto; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; color: var(--muted); }
.status.done { color: var(--ok); font-weight: 700; }
.you { font-size: 14px; color: var(--kraft-ink); background: var(--kraft-light); border-radius: 999px; padding: 2px 10px; }
.person-empty { margin: 0; }
@media (min-width: 1100px) { .people .products { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.person-notes { display: flex; flex-direction: column; gap: 8px; margin: -4px 0 14px; }
.pill-combine { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; color: #1F4F38; background: var(--ok-tint); border-radius: 999px; padding: 4px 12px; }
.person-note { margin: 0; max-width: 70ch; color: var(--pine-2); font-style: italic; }
