@font-face {
  font-family: "Schibsted Grotesk";
  src: url("/static/fonts/schibsted-grotesk.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

/* Monotone: the only colour on screen should come from the clothes. */
:root {
  --bg: #ebebeb;
  --surface: #f7f7f7;
  --ink: #1c1c1c;
  --ink-2: #5e5e5e;
  --ink-3: #8f8f8f;
  --line: #d3d3d3;
  --fill: #dedede;
  --on-ink: #f7f7f7;
  --font: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151515; --surface: #1e1e1e; --ink: #ececec; --ink-2: #a3a3a3; --ink-3: #6e6e6e;
    --line: #333; --fill: #282828; --on-ink: #151515;
  }
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
.hidden { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.error { color: var(--ink); font-weight: 600; min-height: 1.2em; margin: 0; }

main { max-width: 620px; margin: 0 auto; padding: 0 20px calc(88px + env(safe-area-inset-bottom)); }

/* ---------- header ---------- */
.topbar { display: flex; align-items: flex-end; justify-content: space-between; padding: calc(28px + env(safe-area-inset-top)) 0 18px; }
h1 { font-size: 2.25rem; font-weight: 750; letter-spacing: -.035em; line-height: 1; margin: 0; }
.icon-btn { background: none; border: 0; width: 40px; height: 40px; display: grid; place-items: center; margin-right: -8px; color: var(--ink); border-radius: 50%; }
.icon-btn:hover { background: var(--fill); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- section labels ---------- */
.label { font-size: .875rem; font-weight: 600; margin: 28px 0 10px; color: var(--ink); }
.label .muted { font-weight: 400; }

/* ---------- buttons ---------- */
.primary { background: var(--ink); color: var(--on-ink); border: 0; border-radius: 999px; padding: 12px 22px; font-weight: 600; }
.primary:disabled { opacity: .45; cursor: default; }
.primary.big { width: 100%; padding: 17px; font-size: 1.05rem; margin-top: 28px; letter-spacing: -.01em; }
.primary.small { padding: 9px 18px; font-size: .9rem; }
.ghost { background: transparent; border: 1px solid var(--ink); border-radius: 999px; padding: 10px 18px; font-weight: 500; }
.ghost:disabled { opacity: .45; }
.ghost.wide { width: 100%; margin-top: 8px; }
.link { background: none; border: 0; padding: 0; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

/* ---------- pills ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -20px; padding: 0 20px 16px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 8px 15px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; font-size: .95rem; transition: background .12s, color .12s, border-color .12s; }
.chip:hover { border-color: var(--ink-3); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.chip .count { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip.on .count { color: var(--ink-3); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 7px 16px; font-size: .95rem; color: var(--ink-2); }
.seg button.on { background: var(--ink); color: var(--on-ink); }

/* ---------- weather ---------- */
.weather { border-top: 1px solid var(--ink); padding-top: 14px; }
.w-top { display: flex; justify-content: space-between; align-items: baseline; }
.w-place { font-weight: 600; }
.w-days { display: flex; gap: 16px; }
.w-days button { background: none; border: 0; padding: 0 0 2px; color: var(--ink-3); font-weight: 500; border-bottom: 1.5px solid transparent; }
.w-days button.on { color: var(--ink); border-color: var(--ink); }
.w-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 14px 0 12px; }
.w-temp { font-size: 4.75rem; font-weight: 700; letter-spacing: -.06em; line-height: .82; font-variant-numeric: tabular-nums; }
.w-cond { text-align: right; padding-bottom: 2px; }
.w-cond strong { display: block; font-size: 1.1rem; font-weight: 600; letter-spacing: -.01em; }
.w-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: .9rem; color: var(--ink-2); font-variant-numeric: tabular-nums; border-top: 1px solid var(--line); padding-top: 10px; }
.w-meta .link { margin-left: auto; color: var(--ink); font-size: .9rem; }
.w-warn { margin: 10px 0 0; font-size: .9rem; }
.w-empty p { margin: 6px 0; }
.w-empty .row { margin-top: 14px; }

textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); resize: vertical; line-height: 1.4; }
textarea::placeholder, input::placeholder { color: var(--ink-3); }

/* ---------- outfits (lookbook) ---------- */
#notes { margin-top: 18px; }
.note { border-left: 2px solid var(--ink); padding: 2px 0 2px 12px; margin: 10px 0; font-size: .925rem; color: var(--ink-2); }
#results { margin-top: 40px; display: grid; gap: 48px; }
.outfit-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.outfit-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.outfit-n { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: .9rem; flex-shrink: 0; }
.collage { display: grid; gap: 3px; grid-template-columns: repeat(2, 1fr); border-radius: 6px; overflow: hidden; }
.collage.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.collage.n3 .tile:first-child { grid-row: span 2; aspect-ratio: auto; }
.collage.n4 .tile:first-child { grid-column: span 2; aspect-ratio: 2 / 1.1; }
.collage.n4 { grid-template-columns: repeat(3, 1fr); }
.collage.n4 .tile:first-child { grid-column: span 3; }
.collage.n5 { grid-template-columns: repeat(6, 1fr); }
.collage.n5 .tile { grid-column: span 2; }
.collage.n5 .tile:nth-child(1), .collage.n5 .tile:nth-child(2) { grid-column: span 3; }
.collage.n2 .tile { aspect-ratio: 3 / 4; }
.tile { margin: 0; position: relative; background: var(--fill); aspect-ratio: 1; overflow: hidden; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pieces { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: .9rem; }
.pieces li { color: var(--ink); }
.pieces li span { color: var(--ink-3); }
.reasons { margin: 14px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.reasons li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.tip { margin: 12px 0 0; font-size: .95rem; color: var(--ink-2); }
.tip b { color: var(--ink); font-weight: 600; }
.outfit .row.end { margin-top: 16px; }
.more { margin-bottom: 8px; }

/* ---------- closet grid ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin: 0 -20px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(4, 1fr); margin: 0; border-radius: 6px; overflow: hidden; } }
.g-item { position: relative; border: 0; padding: 0; aspect-ratio: 3 / 4; background: var(--fill); border-radius: 0; }
.g-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .15s; }
.g-item:hover img { opacity: .88; }
.g-item .fav { position: absolute; top: 7px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 1.5px var(--ink); }
.g-dots { position: absolute; left: 7px; bottom: 7px; display: flex; gap: 3px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(255,255,255,.85), 0 0 0 2.5px rgba(0,0,0,.08); }
.chip .dot { width: 11px; height: 11px; box-shadow: 0 0 0 1px rgba(0,0,0,.18); }
.c-black{background:#18181a}.c-white{background:#f4f4f2}.c-grey{background:#87878a}.c-beige{background:#d4c0a0}.c-cream{background:#f0e6cd}
.c-brown{background:#704a2e}.c-navy{background:#1e284e}.c-denim{background:#4a688c}.c-blue{background:#2c68c8}.c-green{background:#3e804a}
.c-red{background:#c0222c}.c-pink{background:#ec96b6}.c-orange{background:#ea822a}.c-yellow{background:#eece40}.c-purple{background:#763e96}
.c-pattern{background:repeating-linear-gradient(45deg,#1c1c1c 0 2px,#f4f4f2 2px 4px)}
.empty { padding: 56px 0 24px; max-width: 34ch; }
.empty p { margin: 0 0 8px; }
.empty strong { font-size: 1.35rem; letter-spacing: -.02em; }
.fab { position: fixed; right: max(20px, calc(50% - 290px)); bottom: calc(80px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--on-ink); border: 0; border-radius: 999px; padding: 14px 22px; font-weight: 600; z-index: 6; box-shadow: 0 6px 18px rgba(0,0,0,.18); }

/* ---------- tab bar ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 40px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); z-index: 7; }
.tabbar button { border: 0; background: none; padding: 6px 2px; font-size: 1rem; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; }
.tabbar button.active { color: var(--ink); border-color: var(--ink); }

/* ---------- sheets ---------- */
dialog { border: 0; padding: 0; background: transparent; max-width: 620px; width: 100%; max-height: 100dvh; margin: auto auto 0; color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog[open] .sheet { animation: rise .22s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { transform: translateY(24px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { dialog[open] .sheet { animation: none; } }
.sheet { background: var(--surface); border-radius: 18px 18px 0 0; padding: 18px 20px calc(18px + env(safe-area-inset-bottom)); max-height: 92dvh; overflow-y: auto; }
@media (min-width: 680px) { dialog { margin: auto; } .sheet { border-radius: 18px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sheet-head strong { font-size: 1.15rem; letter-spacing: -.02em; }
.sheet input:not([type=range]):not([type=checkbox]), .login input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.sheet .row input { flex: 1; width: auto; }
#itemDesc { margin-top: 8px; background: var(--bg); }
.preview { background: var(--fill); border-radius: 6px; overflow: hidden; margin-bottom: 14px; display: flex; justify-content: center; }
.preview img { max-height: 36vh; max-width: 100%; display: block; object-fit: contain; }
input[type=range] { width: 100%; accent-color: var(--ink); height: 28px; }
.toggle { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.toggle input { width: 20px; height: 20px; accent-color: var(--ink); margin: 0; }
.sheet-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); background: var(--surface); padding: 12px 0 calc(18px + env(safe-area-inset-bottom)); margin-bottom: calc(-18px - env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.sheet-actions .primary { flex: 1; }
.list { display: grid; margin: 8px 0; border-top: 1px solid var(--line); }
.list:empty { border: 0; }
.list-item { text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 12px 2px; }
.list-item:hover { background: var(--fill); }
#geoBtn { margin-top: 8px; }
.stats { margin-top: 24px; }
#logoutBtn { margin-top: 16px; }
#describeBtn { margin-bottom: 8px; }

/* status line while photos are being tagged */
.ai-pill { font-size: .875rem; color: var(--ink-2); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.ai-pill.busy::before { content: ""; width: 12px; height: 12px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.ai-pill[style*="pointer"] { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 340px; display: grid; gap: 14px; }
.login-card h1 { font-size: 3rem; }
.login-card p { margin: 0 0 6px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(140px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); background: var(--ink); color: var(--on-ink); padding: 11px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; font-size: .925rem; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
