/* NFA Wishlist share page. Phone-first; neutral black/white; cards match the extension popup. */
:root {
  /* Chrome's default palette, matching the extension popup */
  --ink: #202124;
  --muted: #5f6368;
  --line: #dadce0;
  --bg: #f1f3f4;
  --card: #ffffff;
  --placeholder: #686d72; /* ≥4.5:1 on the page and on cards */
  --brand-soft: #9aa0a6;
  --btn: #202124;
  --on-btn: #ffffff;
  --hover: rgba(32, 33, 36, .06);
  --badge-bg: rgba(255, 255, 255, .94);
  --shadow: 0 1px 2px rgba(60, 64, 67, .2), 0 2px 8px rgba(60, 64, 67, .12);
  --head-shadow: 0 2px 8px rgba(60, 64, 67, .12);
  --toast-bg: #202124;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8eaed;
    --muted: #bdc1c6;
    --line: #3c4043;
    --bg: #202124;
    --card: #35363a;
    --placeholder: #9aa0a6;
    --brand-soft: #9aa0a6;
    --btn: #e8eaed;
    --on-btn: #202124;
    --hover: rgba(232, 234, 237, .08);
    --badge-bg: rgba(53, 54, 58, .94);
    --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 4px 14px rgba(0, 0, 0, .35);
    --head-shadow: 0 2px 10px rgba(0, 0, 0, .5);
    --toast-bg: #3c4043;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
}
a { color: inherit; }
button { font: inherit; cursor: pointer; color: inherit; }

/* Header: sticks to the top; hairline + shadow once the cards scroll under it */
.head {
  position: sticky; top: 0; z-index: 10; background: var(--bg);
  border-bottom: 1px solid transparent; transition: box-shadow .15s, border-color .15s;
}
.head.scrolled { border-bottom-color: var(--line); box-shadow: var(--head-shadow); }
.top, .wrap-x, .wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.top { padding-top: 14px; padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { display: block; width: 28px; height: 28px; }
/* Logo: NFA = white on black square, WISHLIST = black on white square (same in both modes), flush together */
.logo { font-weight: 800; letter-spacing: .5px; background: #111; color: #fff; padding: 2px 8px; font-size: 14px; line-height: 1.4; border: 1px solid #111; }
.brand-name { font-weight: 700; font-size: 14px; line-height: 1.4; letter-spacing: .08em; text-transform: uppercase; background: #fff; color: #111; padding: 3px 9px; margin-left: -8px; }

.intro { padding-top: 8px; padding-bottom: 12px; }
.title-row { display: flex; align-items: center; gap: 2px; }
.title { flex: 1; min-width: 0; margin: 0; font-size: 26px; line-height: 1.15; overflow-wrap: anywhere; }
.explainer { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; max-width: 62ch; }

/* Header icon buttons: no circle until hover */
.icon {
  width: 36px; height: 36px; display: grid; place-items: center; padding: 0; flex: none;
  border: 0; border-radius: 50%; background: none; color: var(--ink);
}
.icon:hover, .icon[aria-expanded="true"] { background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.icon:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

.rename { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-width: 420px; font-size: 14px; font-weight: 600; }

.wrap { flex: 1; padding-top: 12px; padding-bottom: 32px; }
.state { color: var(--muted); padding: 24px 0; margin: 0; }

/* Cards: 2 columns on phones, more on wider screens */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; align-items: start; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 20px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card { min-width: 0; display: flex; flex-direction: column; }
.card.dragging { opacity: .35; }
.owner .card { cursor: grab; }
.media {
  position: relative; aspect-ratio: 4 / 5; border-radius: 14px; overflow: hidden;
  background: var(--card); box-shadow: var(--shadow);
}
.media-link { position: absolute; inset: 0; cursor: pointer; -webkit-user-drag: none; }
.owner .media-link { cursor: grab; }
.media-link:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; border-radius: 14px; }
.img { width: 100%; height: 100%; object-fit: cover; display: block; }
.noimg {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 12px; text-align: center; color: var(--muted); font-size: 13px;
}
.noimg-store { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
/* Amazon item card (Figma "NFA card", 262×324): grey card, Sean's scribble + NFA mark cropped by the
   card, "no Amazon links" badge, links to Etsy / other shops. Sizes scale with the card (cqw = % of
   card width), so it looks the same in the popup, side panel and website. Fixed light colors in both
   themes, like a photo. */
.media { container-type: inline-size; }
.alt { position: absolute; inset: 0; background: #ebebeb; color: #000; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: 700; }
.alt-art { position: absolute; left: -76.8%; top: -16.25%; width: 314.5%; height: auto; max-width: none; pointer-events: none; user-select: none; }
.alt-badge {
  position: absolute; left: 50%; top: 65.1%; transform: translateX(-50%); white-space: nowrap;
  background: #000; color: #fff; font-size: 6.49cqw; line-height: 1.24; padding: 1.53cqw 3.05cqw;
}
.alt-etsy, .alt-web { position: absolute; top: 81.2%; color: #000; font-size: 6.1cqw; line-height: 1.2; text-decoration: none; white-space: nowrap; }
.alt-etsy { left: 5.73%; }
.alt-web { right: 8%; }
.alt .u { text-decoration: underline; }
.alt a:focus-visible { outline: 2px solid #000; outline-offset: 2px; }
.badge {
  position: absolute; left: 8px; top: 8px; background: var(--badge-bg); color: var(--ink);
  border: 1px solid var(--line); font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}

/* Hover overlay (always on for touch screens, which can't hover) */
.overlay {
  position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity .15s;
  background: linear-gradient(to bottom, transparent 55%, rgba(0, 0, 0, .55));
}
/* The overlay never catches clicks itself (the photo link underneath does); only its buttons do. */
.ov-btn { pointer-events: none; }
.media:hover .overlay, .media:focus-within .overlay, .card.menu-open .overlay { opacity: 1; }
.media:hover .ov-btn, .media:focus-within .ov-btn, .card.menu-open .ov-btn { pointer-events: auto; }
@media (hover: none) {
  .overlay { opacity: 1; background: none; }
  .ov-btn { pointer-events: auto; }
  .ov-store { display: none; }
}
.card.dragging .overlay { opacity: 0; }
.ov-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; padding: 0;
  background: rgba(40, 36, 32, .72); color: #fff; cursor: pointer;
}
.ov-btn:hover, .ov-btn[aria-expanded="true"] { background: rgba(40, 36, 32, .9); }
.ov-btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.del { position: absolute; top: 8px; right: 8px; }
.ov-bottom { position: absolute; left: 10px; right: 8px; bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ov-bottom .more { margin-left: auto; }
.ov-store { color: #fff; font-weight: 700; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.card.claimed .ov-store { display: none; }

/* Text lines; click to edit on the owner's edit link */
.txt { padding: 8px 2px 0; display: flex; flex-direction: column; gap: 1px; }
.t-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-desc { font-size: 13.5px; color: var(--muted); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.t-price { font-size: 15px; font-weight: 700; }
.friend .t-desc:empty, .friend .t-price:empty { display: none; }
.owner .txt > div { border-radius: 4px; padding: 0 3px; margin: 0 -3px; cursor: text; outline: none; }
.owner .txt > div:hover { background: var(--hover); }
.owner .txt > div:focus-visible { box-shadow: 0 0 0 2px var(--ink); }
.owner .txt > div:empty::before { content: attr(data-placeholder); color: var(--placeholder); font-weight: 400; }
.txt > .editing { background: var(--card); box-shadow: 0 0 0 2px var(--ink); white-space: normal !important; display: block !important; }

/* Buttons: pills */
.pill {
  display: inline-flex; align-items: center; justify-content: center; min-height: 38px;
  padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; text-decoration: none;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
.pill-solid { background: var(--btn); color: var(--on-btn); border-color: var(--btn); }
.pill-ghost:hover { background: var(--hover); }
.pill-solid:hover { filter: brightness(1.15); }
.pill:disabled { opacity: .6; cursor: default; }
.pill:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ink); }
/* Friends' purchase buttons: small white pills */
.pill-small { min-height: 30px; padding: 4px 12px; font-size: 13px; }
.buy, .unbuy { align-self: flex-start; margin-top: 8px; }
.buy:hover, .unbuy:hover { background: var(--hover); }
/* "✓ I gifted/own this": a "Click to undo" tooltip on hover or keyboard focus (the button's
   aria-label says it too). Phones can't hover, so they show a small underlined "Undo" instead. */
.unbuy { position: relative; gap: 6px; }
.unbuy-touch { display: none; text-decoration: underline; }
.tip {
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translate(-50%, 2px);
  background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 600; line-height: 1.3;
  padding: 4px 9px; border-radius: 6px; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .12s, transform .12s; z-index: 5;
}
.tip::after { /* little arrow */
  content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--ink);
}
.unbuy:hover .tip, .unbuy:focus-visible .tip { opacity: 1; transform: translate(-50%, 0); transition-delay: .25s; }
@media (hover: none) {
  .unbuy-touch { display: inline; }
  .tip { display: none; }
}
.section-h { font-size: 18px; font-weight: 700; margin: 40px 0 14px; padding-top: 18px; border-top: 1px solid var(--line); }
.row-end { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* Rename input */
#renameInput {
  font: inherit; font-size: 16px; /* 16px stops iOS zooming in */
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); width: 100%;
}
#renameInput:focus { outline: none; box-shadow: 0 0 0 2px var(--ink); }

/* "Did you buy it?" prompt (bottom sheet) */
.ask {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 45;
  width: min(460px, calc(100% - 24px)); display: flex; gap: 12px; align-items: center;
  padding: 12px; border-radius: 18px; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); box-shadow: 0 12px 36px rgba(0, 0, 0, .22);
}
.ask-img { width: 64px; height: 80px; object-fit: cover; border-radius: 10px; flex: none; background: var(--bg); }
.ask-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.ask-text { margin: 0; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.ask-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Claimed: greyed out for friends (the person who marked it can still Undo) */
.card.claimed .media img, .card.claimed .noimg { filter: grayscale(1); opacity: .45; }
.card.claimed .txt > div { color: var(--muted); } /* faded but still ≥4.5:1 (was opacity, which failed contrast) */

/* Menus */
.menu {
  position: fixed; z-index: 40; min-width: 200px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; border-radius: 999px;
  padding: 9px 12px; color: var(--ink); font-size: 14.5px; text-align: left;
}
.menu-item svg { color: var(--muted); flex: none; }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--ink); }
.menu-hint { color: var(--placeholder); margin-left: -4px; }

/* Footer */
.foot { border-top: 1px solid var(--line); padding: 18px 16px 28px; text-align: center; color: var(--muted); font-size: 13px; }
.foot p { margin: 0 auto; max-width: 60ch; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px);
  padding: 10px 10px 10px 18px; border-radius: 16px; background: var(--toast-bg); color: #fff;
  font-size: 14.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
}
.toast-msg { min-width: 0; }
.toast-undo { background: none; border: 0; padding: 4px 6px; border-radius: 999px; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; flex: none; }
.toast-close { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; background: none; border: 0; border-radius: 50%; color: inherit; flex: none; }
.toast-undo:hover, .toast-close:hover { background: rgba(255, 255, 255, .12); }

/* Tagline next to the logo */
.tagline { margin-left: 4px; font-size: 10px; letter-spacing: .02em; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ---- Accessibility ---- */
/* Text only screen readers hear (announcements). */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Editable lines on the owner's page are at least 24px tall (touch target size). */
.owner .t-name, .owner .t-price { line-height: 24px; }
.owner .t-desc { min-height: 24px; }
/* Respect "reduce motion": no fades, slides or smooth scrolling. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
