/* ==========================================================================
   My wishes — wish.twometerman.dk
   Quiet, off-white and near-black; Space Grotesk; soft cards and pill buttons
   (in the family of Bible Bit By Bit). Self-contained: the subdomain is served
   from this folder alone.
   ========================================================================== */

@font-face {
  font-family: 'Space Grotesk';
  src: url('fonts/space-grotesk-latin-ext-wght-normal.woff2') format('woff2-variations');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: 'Space Grotesk';
  src: url('fonts/space-grotesk-latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  --bg: #FAFAF8;
  --ink: #1C1C1C;
  --muted: #6B6B66;
  --faint: #767670;
  --soft: #F0F0EC;
  --soft-2: #E9E9E5;
  --line: #E4E4E0;
  --card: #FFFFFF;
  --taken: #D6D6D1;
  --danger: #A8321B;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
  --radius: 20px;
  --pill: 999px;
  --font: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { background: var(--bg); scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 40px 40px;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* --- Header ------------------------------------------------------------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.wordmark { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; text-decoration: none; }

.nav-pill {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
  background: var(--card);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.nav-pill:empty { display: none; }

.nav-pill a,
.nav-pill button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border: 0;
  border-radius: var(--pill);
  background: transparent;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.nav-pill a:hover, .nav-pill button:hover { background: var(--soft); }
.nav-pill .is-active { background: var(--soft-2); font-weight: 600; }

.badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--pill);
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --- Page --------------------------------------------------------------- */

.page {
  width: 100%;
  max-width: 860px;
  margin: 72px auto 0;
  display: flex;
  flex-direction: column;
  gap: 32px;
  flex-grow: 1;
}

/* only when a view opens (the scripts add .enter), not on every re-render */
.page.enter > * { animation: up 0.45s ease both; }
@keyframes up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.intro { display: flex; flex-direction: column; gap: 12px; }

.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

a.eyebrow { text-decoration: none; align-self: flex-start; padding: 8px 0; }
a.eyebrow:hover { color: var(--ink); }

.title {
  font-size: 72px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

.title.is-long { font-size: 48px; line-height: 1.05; }

.lead { font-size: 18px; color: var(--muted); max-width: 640px; overflow-wrap: anywhere; }
.lead strong { color: var(--ink); font-weight: 600; }

.small { font-size: 14px; color: var(--muted); }
.small a { color: var(--ink); font-weight: 500; }

.section-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.section { display: flex; flex-direction: column; }

.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.section-head .section-label { margin: 0; }

/* --- Buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 22px;
  border: 2px solid var(--ink);
  border-radius: var(--pill);
  background: var(--ink);
  color: var(--bg);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:hover { transform: scale(1.04); }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.5; cursor: wait; transform: none; }

.btn-outline { background: transparent; color: var(--ink); }
.btn-quiet { background: var(--soft); border-color: var(--soft); color: var(--ink); }
.btn-quiet:hover { background: var(--soft-2); border-color: var(--soft-2); }
.btn-small { min-height: 38px; padding: 0 16px; font-size: 14px; }
.btn-wide { width: 100%; min-height: 52px; font-size: 16px; }

.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* --- Banner, notices, panels ------------------------------------------- */

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 28px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--bg);
}

.banner .eyebrow { color: #B9B9B3; font-size: 12px; }
.banner-text { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.banner a { font-weight: 600; }

.notice {
  padding: 16px 20px;
  border-radius: 16px;
  background: var(--soft);
  font-size: 15px;
}

.notice.is-error { background: #F8E4DF; color: var(--danger); }
.notice a { font-weight: 600; }

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }

.steps { display: flex; flex-direction: column; }
.step { display: flex; gap: 20px; padding: 18px 0; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; padding-top: 0; }
.step-no { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; color: var(--muted); padding-top: 4px; }
.step h3 { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.step p { font-size: 15px; color: var(--muted); }

/* --- Forms -------------------------------------------------------------- */

form { display: flex; flex-direction: column; gap: 18px; }

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.field > label, .field-label { font-size: 14px; font-weight: 600; }

.field input:not([type=checkbox]):not([type=radio]),
.field textarea,
.field select,
.input {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 12px 16px;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--soft);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.field textarea { min-height: 96px; resize: vertical; }

.field input:not([type=checkbox]):not([type=radio]):focus, .field textarea:focus, .field select:focus, .input:focus { border-color: var(--ink); background: var(--card); }

.field-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px; gap: 12px; }
.field-inline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }

.hint { font-size: 14px; color: var(--muted); }

.status { font-size: 15px; font-weight: 500; }
.status.is-error { color: var(--danger); }

.check { display: flex; align-items: flex-start; gap: 12px; font-size: 15px; font-weight: 500; cursor: pointer; }
.check small { display: block; font-size: 14px; font-weight: 400; color: var(--muted); }

.check input {
  appearance: none;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  flex-shrink: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.check input:checked { background: var(--ink); }
.check input:checked::after { content: ""; width: 10px; height: 6px; border: solid var(--bg); border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg) translateY(-1px); }
.check input:disabled { opacity: 0.4; cursor: not-allowed; }

.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }

.choice span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: 100%;
  padding: 14px 16px;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--soft);
  font-size: 15px;
  font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.choice small { font-size: 13px; font-weight: 400; color: var(--muted); }
.choice input:checked + span { border-color: var(--ink); background: var(--card); }
.choice input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 3px; }

/* --- Toolbar ------------------------------------------------------------ */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--pill);
  background: var(--soft);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.chip:hover { background: var(--soft-2); }
.chip.active { background: var(--ink); color: var(--bg); font-weight: 600; }

.sort { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }

.sort select {
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 4px;
  cursor: pointer;
  border-radius: 8px;
}

.toolbar .check { font-size: 14px; align-items: center; }
.toolbar .check input { width: 20px; height: 20px; border-radius: 6px; margin: 0; }

/* --- Meter: one small card per wish ------------------------------------- */

.meter { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.meter-text { display: flex; flex-direction: column; gap: 2px; }
.meter-text strong { font-size: 17px; font-weight: 600; }
.meter-text span { font-size: 14px; color: var(--muted); }
.meter-cards { display: flex; flex-wrap: wrap; gap: 8px; max-width: 520px; }

.meter-cards span {
  width: 30px;
  height: 40px;
  border-radius: 9px;
  background: var(--ink);
  animation: pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.page:not(.enter) .meter-cards span { animation: none; }
.meter-cards span.is-taken { background: var(--taken); }
@keyframes pop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }

/* --- Rows (wishes, lists, friends) -------------------------------------- */

.rows { display: flex; flex-direction: column; }

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.row + .row::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: 0;
  height: 1px;
  background: var(--line);
}

.row:hover { background: var(--card); }
a.row:hover, .row.is-open:hover { transform: translateX(4px); }
.row:hover::before, .row:hover + .row::before, .row.is-card::before, .row.is-card + .row::before { opacity: 0; }

.row.is-card { background: var(--card); box-shadow: var(--shadow); }

.thumb {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 16px;
  background: var(--soft-2);
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 600;
  color: var(--muted);
  overflow: hidden;
  text-transform: uppercase;
}

.thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }

.row-main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-title { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; overflow-wrap: anywhere; }
.row-sub { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.row-sub a { color: var(--ink); font-weight: 500; }
.row-note { font-size: 15px; color: var(--ink); white-space: pre-line; overflow-wrap: anywhere; }
.row-price { font-size: 17px; font-weight: 600; flex-shrink: 0; white-space: nowrap; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; flex-shrink: 0; }

.row.is-taken .row-title { color: var(--faint); text-decoration: line-through; }
.row.is-taken .row-price { color: var(--faint); }
.row.is-taken .thumb { opacity: 0.55; }

.done {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--ink);
  display: grid;
  place-items: center;
}

.done svg, .arrow svg { width: 20px; height: 20px; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.done svg { stroke: var(--bg); stroke-width: 2.5; }

.arrow { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; background: var(--soft); display: grid; place-items: center; transition: background 0.2s ease; }
.arrow svg { stroke: var(--ink); stroke-width: 2; }
.row:hover .arrow { background: var(--ink); }
.row:hover .arrow svg { stroke: var(--bg); }

.progress { height: 6px; border-radius: var(--pill); background: var(--line); overflow: hidden; margin-top: 6px; max-width: 320px; }
.progress span { display: block; height: 100%; border-radius: var(--pill); background: var(--ink); transition: width 0.6s ease; }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--pill);
  background: var(--soft-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  vertical-align: 2px;
  margin-left: 6px;
}

.empty { padding: 32px; border-radius: var(--radius); background: var(--soft); display: flex; flex-direction: column; align-items: flex-start; gap: 16px; color: var(--muted); }

/* --- Share -------------------------------------------------------------- */

.share-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; }
.share-row .input { min-height: 44px; font-size: 14px; }
.split .share-row { grid-template-columns: repeat(3, auto); justify-content: start; }
.split .share-row .input { grid-column: 1 / -1; }

/* --- Dialogs ------------------------------------------------------------ */

dialog {
  margin: auto;
  width: min(540px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  border: 0;
  border-radius: 24px;
  background: var(--bg);
  color: var(--ink);
  padding: 32px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
}

dialog[open] { animation: up 0.25s ease both; }
dialog::backdrop { background: rgba(28, 28, 28, 0.4); }

.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.dialog-head h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; overflow-wrap: anywhere; }

.dialog-close {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: var(--soft);
  font-size: 18px;
  cursor: pointer;
  margin: -6px -6px 0 0;
}

.dialog-close:hover { background: var(--soft-2); }

.image-preview { width: 72px; height: 72px; object-fit: contain; background: #fff; border-radius: 16px; }

/* --- Footer, prose ------------------------------------------------------ */

.site-footer {
  width: 100%;
  max-width: 860px;
  margin: 72px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
  color: var(--muted);
}

.site-footer a { padding: 10px 0; }

.prose h2 { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.prose p, .prose ul { font-size: 17px; max-width: 640px; }
.prose ul { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.prose a { font-weight: 600; }

/* --- Smaller screens ---------------------------------------------------- */

@media (max-width: 760px) {
  body { padding: 16px 16px 28px; }
  .page { margin-top: 40px; gap: 24px; }
  .title { font-size: 44px; }
  .title.is-long { font-size: 34px; }
  .nav-pill a, .nav-pill button { padding: 10px 14px; font-size: 14px; }
  .split { grid-template-columns: 1fr; }
  .banner { padding: 20px; }
  .banner-text { font-size: 17px; }
  .row { flex-wrap: wrap; gap: 12px 14px; padding: 14px 10px; }
  .row + .row::before { left: 10px; right: 10px; }
  .thumb { width: 56px; height: 56px; border-radius: 14px; }
  .row-main { flex-basis: calc(100% - 72px); }
  .row-price { margin-left: 70px; }
  .row-actions { margin-left: auto; }
  .share-row { grid-template-columns: 1fr 1fr 1fr; }
  .share-row .input { grid-column: 1 / -1; }
  .choices { grid-template-columns: 1fr; }
  .field-inline { grid-template-columns: 1fr; }
  dialog { padding: 24px 20px; }
  .site-footer { margin-top: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
