/* Snap & List: boutique hang tag.
   Petal ground, white tag stock, aubergine ink, berry accent, champagne-gold string.
   Items hang on a gold rail as garment tags; the PIN screen is one large tag. */
:root {
  --ground: #F7EEEE;        /* petal / rose quartz */
  --surface: #FFFFFF;       /* tag stock */
  --ink: #3B1F2B;           /* aubergine */
  --muted: #5E3B4A;         /* rose-biased grey ink, captions only (9.5:1 on tag stock) */
  --accent: #AE4069;        /* berry: fills, rings, rules */
  --accent-ink: #8E2F55;    /* berry for small text */
  --gold: #C9A96E;          /* champagne hairline, tag string */
  --gold-soft: #E7D6B8;
  --line: #EAD9DD;          /* rose-tinted rule */
  --btn: #3B1F2B;
  --on-btn: #FBF1F3;
  --on-accent: #FFFFFF;
  --alert: #A3361B;         /* brick red: clearly warmer than the berry */
  --on-alert: #FFFFFF;
  --alert-tint: #F8E3DF;
  --alert-ink: #8A2A14;
  --accent-tint: #F6E2EA;
  --champagne: #F1E4D2;
  --champagne-hi: #FBF5EC;
  --scrim: rgba(59, 31, 43, .62);
  --band: #3B1F2B;          /* fills the iOS status-bar area */
  --tag-shadow: rgba(122, 64, 88, .16);

  --display: "Bodoni Moda", "Bodoni 72", "Didot", "Bodoni MT", Georgia, serif;
  --sans: "Jost", "Futura", "Century Gothic", "Avenir Next", -apple-system, "Segoe UI", sans-serif;

  /* Bodoni italic, bold and at its smallest optical size (thick hairlines), for the wordmark and
     big titles only (>=26px). Jost carries every word you have to read. */
  --display-axes: "opsz" 8;
  --w-body: 430;
  --w-strong: 600;

  --r-sm: 3px;
  --r-md: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #1E1218; --surface: #2E1D26; --ink: #F6E4EA; --muted: #D4B9C4; --accent: #EC93B5; --accent-ink: #F2A9C5;
    --gold: #B89A68; --gold-soft: #5A4733; --line: #432C38; --btn: #F0CFDA; --on-btn: #2A1A22;
    --on-accent: #1E1218; --alert: #EE7B62; --on-alert: #1E1218; --alert-tint: #3D1D1E; --alert-ink: #FFB4A6;
    --accent-tint: #42232F; --champagne: #3D2D29; --champagne-hi: #54403A; --scrim: rgba(20, 10, 15, .7);
    --band: #140B10; --tag-shadow: rgba(0, 0, 0, .45);
    --w-body: 470; /* light-on-dark blooms thin: a touch heavier */
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #1E1218; --surface: #2E1D26; --ink: #F6E4EA; --muted: #D4B9C4; --accent: #EC93B5; --accent-ink: #F2A9C5;
  --gold: #B89A68; --gold-soft: #5A4733; --line: #432C38; --btn: #F0CFDA; --on-btn: #2A1A22;
  --on-accent: #1E1218; --alert: #EE7B62; --on-alert: #1E1218; --alert-tint: #3D1D1E; --alert-ink: #FFB4A6;
  --accent-tint: #42232F; --champagne: #3D2D29; --champagne-hi: #54403A; --scrim: rgba(20, 10, 15, .7);
  --band: #140B10; --tag-shadow: rgba(0, 0, 0, .45);
    --w-body: 470; /* light-on-dark blooms thin: a touch heavier */
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: var(--w-body) 17px/1.5 var(--sans);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
/* The status bar (black-translucent) sits on an aubergine band so its white text always reads. */
body::before {
  content: ""; position: fixed; inset: 0 0 auto; z-index: 20;
  height: env(safe-area-inset-top, 0px); background: var(--band);
}
[hidden] { display: none !important; }
a { color: var(--accent-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }

.masthead {
  padding-top: calc(env(safe-area-inset-top, 0px) + 14px);
  padding-bottom: 12px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  text-align: center;
  border-bottom: 1px solid var(--gold);
}
.wordmark {
  margin: 0;
  font: italic 700 30px/1 var(--display);
  font-variation-settings: var(--display-axes);
  letter-spacing: -.005em;
  color: var(--ink);
}
/* The one flourish: an oversized Didone ampersand in berry. */
.wordmark .amp {
  font-size: 1.75em; font-weight: 600; color: var(--accent);
  line-height: 0; vertical-align: -.16em; margin: 0 -.04em 0 -.02em;
}

main {
  max-width: 560px; margin: 0 auto;
  padding-top: 20px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px));
}
.screen { display: flex; flex-direction: column; gap: 16px; }
.center { text-align: center; align-items: center; }

h2 { margin: 0; text-wrap: balance; }
.screen-title {
  font: italic 700 36px/1.05 var(--display);
  font-variation-settings: var(--display-axes);
}
.eyebrow {
  margin: 0;
  font: var(--w-strong) 13px/1.2 var(--sans);
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.lead { margin: 0; font-size: 18px; line-height: 1.5; color: var(--ink); }
.muted { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }

.banner {
  background: var(--champagne);
  color: var(--ink);
  border-bottom: 1px solid var(--gold-soft);
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  font-size: 15px; font-weight: 500; text-align: center;
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; min-height: 56px; padding: 12px 20px;
  border-radius: var(--r-md);
  border: 1.5px solid transparent;
  font: var(--w-strong) 18px/1.25 var(--sans);
  letter-spacing: .01em;
  text-decoration: none; text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: transform .12s ease, background-color .2s ease;
}
.btn svg { width: 26px; height: 26px; fill: currentColor; flex: none; }
.btn-primary { background: var(--btn); color: var(--on-btn); }
.btn-secondary {
  background: var(--surface); color: var(--ink); border-color: var(--ink);
}
.btn-huge { min-height: 68px; font-size: 19px; }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .38; cursor: default; transform: none; }

:is(.btn, .link, .tab, .item, summary, .thumbs button, a):focus-visible,
:is(input, select, textarea):focus-visible {
  outline: 2.5px solid var(--accent); outline-offset: 3px;
}

.link {
  background: none; border: 0; color: var(--accent-ink);
  font: var(--w-strong) 17px/1.2 var(--sans);
  padding: 12px 0; min-height: 48px; cursor: pointer;
}
.back { align-self: flex-start; color: var(--ink); }
.danger-link { color: var(--alert-ink); align-self: center; padding-inline: 12px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------------------------------------------------------------- form fields */
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; font: var(--w-strong) 17px/1.35 var(--sans); color: var(--ink); }
.field em { font-style: normal; font-weight: var(--w-body); color: var(--muted); }
input, select, textarea {
  font: var(--w-body) 18px/1.4 var(--sans); /* >=16px stops iOS zooming on focus */
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-bottom: 1.5px solid var(--gold);
  border-radius: var(--r-sm);
  padding: 12px 14px; width: 100%; min-height: 52px;
}
textarea { resize: vertical; }
::placeholder { color: var(--muted); opacity: .75; }

/* ---------------------------------------------------------------- Snap */
.thumbs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.thumbs:empty { display: none; }
.thumbs li {
  position: relative; aspect-ratio: 3 / 4; max-width: 100%;
  border-radius: var(--r-sm); overflow: hidden;
  background: var(--line);
  box-shadow: 0 0 0 4px var(--surface), 0 2px 10px 2px var(--tag-shadow);
  margin: 4px;
}
.thumbs img, .strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs button {
  position: absolute; top: 4px; right: 4px;
  width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: var(--scrim); color: #FFFFFF;
  font: 400 26px/40px var(--sans); cursor: pointer; padding: 0;
}
.thumbs li.uploading img { opacity: .55; }
.thumbs li.failed img { opacity: .3; filter: grayscale(.6); }
.thumb-state {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 4px;
  font: var(--w-strong) 13px/1.2 var(--sans); text-align: center;
  background: var(--scrim); color: #FFFFFF;
}
.thumbs li.failed .thumb-state { background: var(--alert); color: var(--on-alert); }
#photo-count { font: var(--w-strong) 13px/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; }

/* ---------------------------------------------------------------- Today: tags on a rail */
.items {
  list-style: none; margin: 4px 0 0; padding: 4px 0 4px 18px;
  display: flex; flex-direction: column; gap: 14px;
  position: relative;
}
/* the rail: one gold string running down the list */
.items::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  border-left: 1px solid var(--gold);
}
.items:empty { display: none; }
.items > li { position: relative; filter: drop-shadow(0 1px 1px var(--tag-shadow)) drop-shadow(0 4px 10px var(--tag-shadow)); }
/* each tag's string loops from the rail through its eyelet */
.items > li::before {
  content: ""; position: absolute; left: -18px; top: 50%; width: 38px;
  border-top: 1px solid var(--gold);
}
.item {
  --hole-x: 20px;
  width: 100%; min-height: 96px;
  display: grid;
  grid-template-columns: 64px 1fr;
  grid-template-areas: "img pill" "img text";
  align-items: start; column-gap: 14px; row-gap: 6px;
  padding: 14px 14px 14px 38px;
  text-align: left; font: inherit; color: var(--ink);
  background: var(--surface); border: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  /* garment-tag outline: chamfered at the eyelet end */
  clip-path: polygon(16px 0, 100% 0, 100% 100%, 16px 100%, 0 calc(100% - 16px), 0 16px);
  -webkit-mask: radial-gradient(circle at var(--hole-x) 50%, transparent 4.5px, #000 5px);
          mask: radial-gradient(circle at var(--hole-x) 50%, transparent 4.5px, #000 5px);
  position: relative;
}
/* reinforcement ring around the punched hole */
.item::before {
  content: ""; position: absolute; left: calc(var(--hole-x) - 8px); top: calc(50% - 8px);
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--gold); box-sizing: border-box;
}
.item-attention::before { border-color: var(--alert); }
.item-ready::before { border-color: var(--accent); }
.item:active { transform: translateX(2px); }
.item:focus-visible { outline: 2.5px solid var(--accent); outline-offset: -4px; }
.item img {
  grid-area: img; align-self: center;
  width: 64px; height: 80px; border-radius: var(--r-sm); object-fit: cover; background: var(--line);
}
.item-text { grid-area: text; display: flex; flex-direction: column; min-width: 0; gap: 3px; }
.item-title {
  font: var(--w-strong) 17px/1.3 var(--sans);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.item-sub {
  font-size: 15px; line-height: 1.4; color: var(--muted);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* status pills: tiny tags of their own */
.pill {
  grid-area: pill; justify-self: start;
  display: inline-flex; align-items: center; gap: 6px;
  font: var(--w-strong) 13px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase;
  padding: 6px 10px 6px 14px; white-space: nowrap;
  clip-path: polygon(6px 0, 100% 0, 100% 100%, 6px 100%, 0 50%);
  background: var(--champagne); color: var(--ink);
}
.pill::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .55; margin-left: -4px; }
.pill.pill-ready { background: var(--accent); color: var(--on-accent); }
.pill.pill-attention { background: var(--alert); color: var(--on-alert); }
.pill.pill-collecting { background: var(--accent-tint); color: var(--ink); }
.pill.pill-sending { background: var(--champagne); color: var(--ink); }
.pill.pill-researching {
  background: linear-gradient(100deg, var(--champagne) 30%, var(--champagne-hi) 50%, var(--champagne) 70%) 0 0 / 250% 100%;
  animation: shimmer 2.4s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }
@media (prefers-reduced-motion: reduce) {
  .pill.pill-researching { animation: none; background: var(--champagne); }
  .btn, .item { transition: none; }
}

.badge {
  position: absolute; top: 8px; left: calc(50% + 10px);
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent);
  font: var(--w-strong) 13px/20px var(--sans); letter-spacing: 0; text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- one item */
.strip { list-style: none; margin: 0; padding: 4px 4px 8px; display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; }
.strip li {
  flex: none; width: 108px; height: 136px; border-radius: var(--r-sm); overflow: hidden; background: var(--line);
  box-shadow: 0 0 0 3px var(--surface), 0 2px 8px var(--tag-shadow);
}
#item-title { font: italic 700 26px/1.2 var(--display); font-variation-settings: var(--display-axes); overflow-wrap: anywhere; }
.status-line {
  margin: 0; padding: 12px 14px; border-radius: var(--r-sm);
  font-size: 17px; line-height: 1.5;
  background: var(--champagne); color: var(--ink);
}
.status-line strong {
  font-weight: var(--w-strong); font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
  margin-right: 2px;
}
.status-line.pill-ready { background: var(--accent-tint); }
.status-line.pill-ready strong { color: var(--accent-ink); }
.status-line.pill-attention { background: var(--alert-tint); color: var(--ink); }
.status-line.pill-attention strong { color: var(--alert-ink); }

/* the spec card: label / value pairs ruled in gold */
.facts {
  display: grid; grid-template-columns: auto 1fr; margin: 4px 0 0;
  border-top: 1px solid var(--gold);
}
.facts dt, .facts dd { padding: 11px 0; border-bottom: 1px solid var(--line); }
.facts dt {
  padding-right: 18px;
  font: var(--w-strong) 13px/25px var(--sans); padding-top: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.facts dd { margin: 0; font-size: 17px; font-weight: 500; line-height: 25px; overflow-wrap: anywhere; }
.facts:empty { display: none; }

.why { font-size: 17px; color: var(--ink); border-bottom: 1px solid var(--line); }
.why summary {
  cursor: pointer; padding: 14px 0; min-height: 48px; list-style: none;
  display: flex; align-items: center; justify-content: space-between;
  font: var(--w-strong) 17px/1.2 var(--sans); color: var(--accent-ink);
}
.why summary::-webkit-details-marker { display: none; }
.why summary::after { content: "+"; font: 400 24px/1 var(--sans); }
.why[open] summary::after { content: "\2212"; }
.why p { margin: 0 0 12px; line-height: 1.5; }
.why p:empty { display: none; }
.comps { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.comps:empty { display: none; }
.comps li { font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; padding-left: 14px; position: relative; }
.comps li::before { content: ""; position: absolute; left: 0; top: .62em; width: 6px; border-top: 1px solid var(--gold); }
.comps .tag {
  display: inline-block; margin-left: 6px;
  font: 500 14px/1.4 var(--sans); color: var(--muted);
}

/* ---------------------------------------------------------------- errors */
.error {
  margin-top: 16px; padding: 16px; border-radius: var(--r-sm);
  background: var(--alert-tint); color: var(--alert-ink);
  border-top: 2px solid var(--alert);
  display: flex; flex-direction: column; gap: 12px; font-size: 17px;
}
.error p { margin: 0; }

/* ---------------------------------------------------------------- PIN: one large hang tag */
#screen-pin { padding-top: 34px; position: relative; }
/* string rising from the eyelet to the masthead rule */
#screen-pin::before {
  content: ""; position: absolute; top: -20px; left: 50%; height: 78px;
  border-left: 1px solid var(--gold);
}
.hangtag {
  --hole-y: 30px;
  position: relative; width: 100%; max-width: 340px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 62px 26px 30px;
  background: var(--surface);
  clip-path: polygon(30% 0, 70% 0, 100% 16%, 100% 100%, 0 100%, 0 16%);
  -webkit-mask: radial-gradient(circle at 50% var(--hole-y), transparent 6.5px, #000 7px);
          mask: radial-gradient(circle at 50% var(--hole-y), transparent 6.5px, #000 7px);
}
.hangtag::before {
  content: ""; position: absolute; left: calc(50% - 11px); top: calc(var(--hole-y) - 11px);
  width: 22px; height: 22px; border-radius: 50%; box-sizing: border-box;
  border: 2px solid var(--gold);
}
.hangtag .lead { font: italic 700 30px/1.15 var(--display); font-variation-settings: var(--display-axes); }
.pin-form { width: 100%; display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.pin {
  font: 400 34px/1 var(--sans); letter-spacing: .5em; text-indent: .5em; text-align: center;
  min-height: 68px; padding: 8px 12px;
  border: 0; border-bottom: 1.5px solid var(--gold); border-radius: 0;
  background: transparent;
}
.pin:focus-visible { outline: none; border-bottom: 2.5px solid var(--accent); }
.pin-error { margin: 0; color: var(--alert-ink); font-size: 17px; font-weight: var(--w-strong); }
.hangtag .muted { font-size: 15px; max-width: 26ch; }
/* soft shadow for the clipped tag lives on the section */
#screen-pin { filter: drop-shadow(0 2px 2px var(--tag-shadow)) drop-shadow(0 12px 24px var(--tag-shadow)); }

/* ---------------------------------------------------------------- tab bar */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--surface); border-top: 1px solid var(--gold);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  min-height: 66px; border: 0; background: none; color: var(--muted);
  font: var(--w-strong) 14px/1 var(--sans); letter-spacing: .01em;
  cursor: pointer; position: relative;
  -webkit-tap-highlight-color: transparent;
}
.tab svg { width: 24px; height: 24px; fill: currentColor; }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"]::after {
  content: ""; position: absolute; top: -1px; left: calc(50% - 18px); width: 36px;
  border-top: 2px solid var(--accent);
}
