/* Saucr — app styles.
   Identity: a collector's shelf under bar light. Espresso near-black, label
   cream, chili crimson. The motif is the bottle LABEL: cream panels, mono
   uppercase eyebrows, and a heat band that walks green -> amber -> red. */

:root{
  --ink:#120D0B;          /* espresso near-black */
  --ink-2:#1C1410;        /* raised surface */
  --ink-3:#2C201A;        /* card border / input */
  --paper:#F4EBD9;        /* label cream */
  --paper-soft:#D4C9B2;
  --muted:#93887A;
  --accent:#D7263D;       /* chili crimson */
  --amber:#F4A259;
  --green:#74A57F;
  --line:rgba(244,235,217,.12);
  --sans:"Inter",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  --display:"Archivo","Inter",sans-serif;
  --mono:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;
  --field-h:46px;         /* inputs AND selects share one height */
  /* The shell runs contentInset:"never" per .Process CONVENTIONS.md, so the web
     owns BOTH safe areas. --safe-t is not optional decoration: without it the
     appbar sits at y=0, which on a notched iPhone is behind the clock. */
  --safe-t:env(safe-area-inset-top,0px);
  --safe-b:env(safe-area-inset-bottom,0px);
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--ink); color:var(--paper);
  font-family:var(--sans); font-size:16px; line-height:1.5;
  -webkit-font-smoothing:antialiased;
  padding-bottom:calc(72px + var(--safe-b));
}
img{max-width:100%;display:block;height:auto}
button{font-family:inherit}
a{color:inherit}

.wrap{max-width:720px;margin:0 auto;padding:0 18px}
.hidden{display:none !important}

/* ---------- type ---------- */
h1,h2,h3{font-family:var(--display);font-weight:700;letter-spacing:-.015em;line-height:1.1;margin:0}
h1{font-size:1.75rem}
h2{font-size:1.3rem}
h3{font-size:1.05rem}
.eyebrow{
  font-family:var(--mono);font-size:11px;font-weight:600;
  letter-spacing:.2em;text-transform:uppercase;color:var(--accent);
}
.muted{color:var(--muted)}
.small{font-size:14px}

/* ---------- app bar ---------- */
.appbar{
  position:sticky;top:0;z-index:40;background:rgba(18,13,11,.9);
  backdrop-filter:blur(12px);border-bottom:1px solid var(--line);
  /* Sticky = in flow, so the bar owns its own height and the inset simply
     grows it upward. Do NOT also pad the content below by this amount. */
  padding-top:var(--safe-t);
}
.appbar .row{display:flex;align-items:center;gap:11px;height:58px}
.appbar-mark{width:32px;height:32px;border-radius:9px;flex:none}
.appbar h1{font-size:1.25rem;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.iconbtn{
  width:38px;height:38px;flex:none;display:grid;place-items:center;
  background:transparent;border:1px solid var(--line);border-radius:11px;
  color:var(--paper);cursor:pointer;transition:.15s ease;
}
.iconbtn:hover{border-color:var(--accent);color:var(--accent)}
.iconbtn svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}

/* ---------- buttons ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  height:var(--field-h);padding:0 20px;border-radius:12px;border:1px solid transparent;
  font-weight:600;font-size:15px;cursor:pointer;transition:.15s ease;white-space:nowrap;
}
.btn-primary{background:var(--accent);color:#fff}
.btn-primary:hover{filter:brightness(1.08)}
.btn-ghost{background:transparent;border-color:var(--ink-3);color:var(--paper)}
.btn-ghost:hover{border-color:var(--accent);color:var(--accent)}
.btn-block{width:100%}
.btn-danger{background:transparent;border-color:rgba(215,38,61,.5);color:var(--accent)}
.btn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.linkbtn{background:none;border:0;color:var(--muted);text-decoration:underline;text-underline-offset:3px;cursor:pointer;font-size:14px;padding:0}
.linkbtn:hover{color:var(--paper)}

/* ---------- fields. Selects match input height exactly. ---------- */
label.field{display:block;margin:0 0 14px}
label.field > span{display:block;font-size:13px;color:var(--muted);margin:0 0 6px}
input[type=text],input[type=email],input[type=password],input[type=tel],select,textarea{
  width:100%;background:var(--ink-2);border:1px solid var(--ink-3);border-radius:12px;
  /* 16px is a hard floor, not a taste call: Safari on iOS auto-zooms any focused
     field under 16px, and the zoom leaves the whole page horizontally pannable
     afterwards. */
  color:var(--paper);font-family:inherit;font-size:16px;padding:0 14px;
  height:var(--field-h);   /* shared by inputs AND selects */
  appearance:none;-webkit-appearance:none;
}
textarea{height:auto;min-height:104px;padding:12px 14px;line-height:1.5;resize:vertical}
select{
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393887A' stroke-width='2' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat:no-repeat;background-position:right 12px center;background-size:18px;padding-right:38px;
}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--accent)}
::placeholder{color:#6E6355}
input[type=range]{width:100%;accent-color:var(--accent);height:32px;padding:0;background:transparent;border:0}

/* ---------- easy-add suggestions ---------- */
.suggest{
  position:absolute;left:0;right:0;top:calc(var(--field-h) + 6px);z-index:5;
  background:var(--ink-3);border:1px solid #3D2E24;border-radius:12px;overflow:hidden;
  box-shadow:0 18px 40px -16px rgba(0,0,0,.8);max-height:264px;overflow-y:auto;
}
.suggest-item{
  display:flex;align-items:center;gap:10px;width:100%;text-align:left;background:none;border:0;cursor:pointer;
  padding:11px 14px;color:var(--paper);border-bottom:1px solid rgba(244,235,217,.07);
}
.suggest-item:last-child{border-bottom:0}
.suggest-item:hover,.suggest-item:focus{background:rgba(215,38,61,.16);outline:none}
.suggest-item .pip{width:9px;height:9px;border-radius:50%;flex:none}
.suggest-item .grow{flex:1;min-width:0}
.suggest-name{font-size:15px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.suggest-where{font-size:12.5px;color:var(--muted);margin-top:2px}

/* ---------- cards / rows ---------- */
.card{background:var(--ink-2);border:1px solid var(--ink-3);border-radius:16px;padding:16px}
.row-item{
  display:flex;align-items:center;gap:14px;width:100%;text-align:left;
  background:var(--ink-2);border:1px solid var(--ink-3);border-radius:16px;
  padding:14px 16px;color:var(--paper);cursor:pointer;transition:.15s ease;
}
.row-item:hover{border-color:var(--accent);transform:translateY(-1px)}
.row-item .grow{flex:1;min-width:0}
.row-item .name{font-weight:600;font-size:16px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.row-item .sub{font-size:13.5px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.row-item .chev{color:var(--muted);flex:none}
.row-item .chev svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* ---------- filter chips ---------- */
.chips{display:flex;flex-wrap:wrap;gap:9px;margin:16px 0}
.chip{
  display:inline-flex;align-items:center;gap:8px;height:36px;padding:0 14px;
  border-radius:999px;border:1px solid var(--ink-3);background:var(--ink-2);
  color:var(--muted);font-size:13.5px;font-weight:600;cursor:pointer;transition:.15s ease;
}
.chip.on{color:var(--paper);border-color:var(--accent);background:rgba(215,38,61,.14)}

/* ---------- the shelf grid ---------- */
.shelf{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;margin:6px 0 20px}
@media(min-width:520px){.shelf{grid-template-columns:repeat(3,1fr)}}
.bottle{
  background:var(--ink-2);border:1px solid var(--ink-3);border-radius:16px;overflow:hidden;
  text-align:left;padding:0;color:var(--paper);cursor:pointer;transition:.15s ease;display:block;width:100%;
}
.bottle:hover{border-color:var(--accent);transform:translateY(-2px)}
.bottle .shot{aspect-ratio:3/4;background:var(--ink-3);position:relative;overflow:hidden}
.bottle .shot img{width:100%;height:100%;object-fit:cover}
/* No photo yet: a drawn bottle. Neck + shoulder via pseudo elements, label
   band colored by heat. Distinct on purpose — a grid of these still reads as
   a shelf, not as a grid of broken images. */
.bottle .ph{position:absolute;inset:0;display:grid;place-items:center}
.bottle .ph .glass{
  width:44%;height:74%;border-radius:10px 10px 12px 12px;position:relative;
  background:linear-gradient(160deg,rgba(244,235,217,.16),rgba(244,235,217,.05));
  border:1px solid rgba(244,235,217,.22);
}
.bottle .ph .glass::before{ /* neck */
  content:"";position:absolute;left:50%;top:-16%;transform:translateX(-50%);
  width:34%;height:17%;background:inherit;border:1px solid rgba(244,235,217,.22);
  border-bottom:0;border-radius:5px 5px 0 0;
}
.bottle .ph .glass::after{ /* cap */
  content:"";position:absolute;left:50%;top:-24%;transform:translateX(-50%);
  width:40%;height:9%;background:var(--cap,#D7263D);border-radius:3px;
}
.bottle .ph .label{
  position:absolute;left:8%;right:8%;top:34%;bottom:16%;background:var(--paper);
  border-radius:6px;display:grid;place-items:center;color:var(--ink);
  font-family:var(--display);font-weight:800;font-size:clamp(15px,4.2vw,22px);
  letter-spacing:.02em;text-align:center;padding:4px;overflow:hidden;
}
.bottle .ph .label::after{ /* heat band across the label */
  content:"";position:absolute;left:0;right:0;bottom:0;height:22%;
  background:var(--band,var(--accent));opacity:.9;
}
.bottle .meta{padding:10px 12px 12px}
.bottle .meta .name{font-weight:600;font-size:14.5px;line-height:1.25;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.bottle .meta .maker{font-size:12px;color:var(--muted);margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bottle .meta .gauges{display:flex;align-items:center;justify-content:space-between;margin-top:8px;gap:8px}

/* the heat pip bar: 10 ticks, filled portion colored by heat */
.heatbar{display:flex;gap:2px;flex:1;min-width:0}
.heatbar i{flex:1;height:5px;border-radius:2px;background:var(--ink-3)}
.heatbar i.f{background:var(--hc,var(--accent))}
/* rating: 1..5 small diamonds, mono feel */
.stars{display:flex;gap:2.5px;flex:none}
.stars i{width:7px;height:7px;border-radius:2px;background:var(--ink-3);transform:rotate(45deg)}
.stars i.f{background:var(--amber)}

/* status tag on the photo */
.tag{
  position:absolute;top:8px;left:8px;font-family:var(--mono);font-size:10px;
  letter-spacing:.14em;text-transform:uppercase;padding:3px 8px;border-radius:999px;
  background:rgba(18,13,11,.78);color:var(--paper-soft);backdrop-filter:blur(4px);
}
.tag.finished{color:var(--muted)}
.tag.unopened{color:var(--amber)}

/* ---------- empty state ---------- */
.empty{text-align:center;padding:56px 20px;color:var(--muted)}
.empty svg{width:44px;height:44px;stroke:var(--ink-3);fill:none;stroke-width:1.4;margin:0 auto 16px}
.empty h3{color:var(--paper);margin-bottom:8px}
.empty p{margin:0 auto 20px;max-width:34ch;font-size:15px}

/* ---------- the shelf card (share) ---------- */
.cardview{margin:18px 0}
.cardview canvas{display:none}
.cardview .preview{
  width:100%;border-radius:16px;border:1px solid var(--ink-3);display:block;
  box-shadow:0 24px 60px -22px rgba(0,0,0,.7);
}
.cardview .actions{display:flex;gap:10px;margin:16px 0 8px}
.cardview .actions .btn{flex:1}

/* ---------- tab bar ---------- */
.tabbar{
  position:fixed;left:0;right:0;bottom:0;z-index:45;
  background:rgba(18,13,11,.95);backdrop-filter:blur(12px);
  border-top:1px solid var(--line);
  padding-bottom:var(--safe-b);
  display:flex;
}
.tabbar button{
  flex:1;background:none;border:0;color:var(--muted);cursor:pointer;
  padding:9px 0 10px;display:flex;flex-direction:column;align-items:center;gap:4px;
  font-size:11px;font-weight:600;letter-spacing:.02em;transition:.15s ease;
}
.tabbar button svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.tabbar button.on{color:var(--accent)}

/* ---------- sheet ---------- */
.sheet-back{position:fixed;inset:0;z-index:60;background:rgba(0,0,0,.6);display:grid;align-items:end}
.sheet{
  background:var(--ink-2);border-top-left-radius:22px;border-top-right-radius:22px;
  border-top:1px solid var(--ink-3);padding:10px 18px calc(24px + var(--safe-b));
  max-height:88vh;overflow-y:auto;
}
.sheet .grab{width:38px;height:4px;border-radius:2px;background:var(--ink-3);margin:0 auto 16px}
.sheet h2{margin-bottom:16px}
.sheet-actions{display:flex;gap:10px;margin-top:20px}
.sheet-actions .btn{flex:1}
@media(min-width:640px){
  .sheet-back{align-items:center;justify-items:center}
  .sheet{border-radius:22px;border:1px solid var(--ink-3);width:min(520px,92vw);padding-bottom:24px}
}

/* segmented control (status, would-buy-again) */
.seg{display:flex;background:var(--ink);border:1px solid var(--ink-3);border-radius:12px;padding:3px;gap:3px;margin-bottom:14px}
.seg button{
  flex:1;height:38px;border:0;border-radius:9px;background:transparent;color:var(--muted);
  font-weight:600;font-size:14px;cursor:pointer;transition:.15s ease;
}
.seg button.on{background:var(--ink-3);color:var(--paper)}

/* heat slider readout + big rating stars in the editor */
.heat-read{display:flex;align-items:center;gap:12px;margin:2px 0 10px}
.heat-read .num{font-family:var(--mono);font-size:1.3rem;font-weight:600;min-width:2ch;text-align:center}
.bigstars{display:flex;gap:10px;margin:2px 0 14px}
.bigstars button{
  width:40px;height:40px;border-radius:11px;border:1px solid var(--ink-3);background:var(--ink);
  display:grid;place-items:center;cursor:pointer;color:var(--ink-3);transition:.15s ease;
}
.bigstars button.f{color:var(--amber);border-color:var(--amber)}
.bigstars svg{width:20px;height:20px;fill:currentColor;stroke:none}

/* photo picker strip in the editor */
.photo-strip{display:flex;align-items:center;gap:14px;margin-bottom:16px}
.photo-strip .thumb{
  width:64px;height:84px;border-radius:10px;background:var(--ink-3);overflow:hidden;flex:none;
  display:grid;place-items:center;color:var(--muted);
}
.photo-strip .thumb img{width:100%;height:100%;object-fit:cover}
.photo-strip .thumb svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.6}

/* ---------- auth ---------- */
.auth{max-width:400px;margin:0 auto;padding:calc(56px + var(--safe-t)) 0 40px}
.auth .brand{display:flex;align-items:center;justify-content:center;margin-bottom:14px}
.auth .brand-mark{width:78px;height:78px;border-radius:19px}
.auth h1{text-align:center;font-size:2rem}
.auth .lede{text-align:center;color:var(--muted);margin:10px 0 30px;font-size:15px}
.social{display:flex;flex-direction:column;gap:10px;margin-bottom:6px}
.divider{display:flex;align-items:center;gap:12px;color:var(--muted);font-size:12.5px;
  letter-spacing:.14em;text-transform:uppercase;font-family:var(--mono);margin:20px 0}
.divider::before,.divider::after{content:"";flex:1;height:1px;background:var(--ink-3)}
#apple-btn{
  height:44px;width:100%;border-radius:12px;border:0;background:#fff;color:#000;
  font-weight:600;font-size:15px;display:flex;align-items:center;justify-content:center;gap:8px;cursor:pointer;
}
#google-btn{min-height:44px;display:flex;justify-content:center}
.authswap{text-align:center;margin-top:18px;font-size:14.5px;color:var(--muted)}
.authswap button{background:none;border:0;color:var(--accent);font-weight:600;cursor:pointer;
  text-decoration:underline;text-underline-offset:3px;font-size:inherit;padding:0}

.err{background:rgba(215,38,61,.12);border:1px solid rgba(215,38,61,.4);color:#F2A0A9;
  border-radius:12px;padding:11px 14px;font-size:14px;margin-bottom:14px}
.ok{background:rgba(116,165,127,.12);border:1px solid rgba(116,165,127,.4);color:#AFD8B8;
  border-radius:12px;padding:11px 14px;font-size:14px;margin-bottom:14px}

.toast{
  position:fixed;left:50%;bottom:calc(86px + var(--safe-b));transform:translateX(-50%);
  background:var(--paper);color:var(--ink);border-radius:999px;padding:10px 20px;
  font-size:14px;font-weight:600;z-index:80;box-shadow:0 12px 30px -10px rgba(0,0,0,.6);
}

:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:8px}
@media (prefers-reduced-motion:reduce){*{transition:none !important}}
