/* Fitsource — tokens and layout per DESIGN.md */
:root {
  --paper: #f5f2ec;
  --surface: #fbfaf7;
  --ink: #141412;
  --graphite: #5e5b55;
  --ash: #a6a29a;
  --hairline: rgba(20, 20, 18, 0.14);
  --accent: #c8461b;
  --bone: #e8e3d9;
  --serif: "Instrument Serif", ui-serif, serif;
  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --gutter: clamp(16px, 3vw, 24px);
  --section: clamp(3rem, 8vw, 6rem);
  --rail: 300px;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 1rem/1.55 var(--sans);
  background: var(--paper);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 400; }
p { margin: 0 0 1rem; }
em { font-style: italic; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.display {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 6vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}
.section-title { font-family: var(--serif); font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1; letter-spacing: -0.01em; margin-bottom: 1.5rem; }
.lede { font-size: 1.125rem; color: var(--graphite); max-width: 62ch; }
.meta {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ash);
}
.meta a { color: var(--graphite); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.link { text-decoration: underline; text-underline-offset: 3px; color: var(--graphite); text-transform: none; letter-spacing: 0; font-weight: 400; }

/* Nav / footer */
.nav {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 20px var(--gutter);
  border-bottom: 1px solid var(--hairline);
}
.nav__brand { font-family: var(--serif); font-size: 1.5rem; letter-spacing: -0.01em; }
.nav__links { display: flex; gap: 24px; }
.nav__links a { font-size: 0.8125rem; color: var(--graphite); }
.footer { margin-top: auto; padding: 32px var(--gutter); border-top: 1px solid var(--hairline); }
.footer .meta { margin: 0 0 8px; text-transform: none; letter-spacing: 0.02em; font-weight: 400; font-size: 0.75rem; }

/* Frame with ad rails */
.frame { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 var(--gutter); flex: 1; }
.content { min-width: 0; container-type: inline-size; }
.rail { display: none; }
@media (min-width: 1200px) {
  .frame--ads { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr) var(--rail); gap: 40px; }
  .rail { display: block; }
  .rail > .ad { position: sticky; top: 96px; }
}

/* Ads */
.ad { padding-top: 40px; }
.ad__label { display: block; margin-bottom: 8px; }
.ad--rail a, .ad--inline a { display: block; border: 1px solid var(--hairline); background: var(--surface); }
.ad--rail img { width: 300px; height: 600px; object-fit: cover; }
.ad--inline { display: none; margin: var(--section) 0; }
.ad--inline img { width: 100%; max-width: 320px; height: auto; margin: 0 auto; }
.ad__house {
  display: flex !important; flex-direction: column; justify-content: center; align-items: flex-start; gap: 12px;
  padding: 32px 24px; min-height: 600px; width: 300px;
}
.ad--inline .ad__house { min-height: 100px; width: 100%; max-width: 100%; flex-direction: row; justify-content: space-between; align-items: center; padding: 20px 24px; }
.ad__house em { font-family: var(--serif); font-size: 1.75rem; line-height: 1.05; }
.ad--inline .ad__house em { font-size: 1.25rem; }
.ad__house span { font-size: 0.8125rem; color: var(--graphite); }
@media (max-width: 1199px) { .ad--inline { display: block; } }

/* Hero */
.hero {
  display: grid; grid-template-columns: 7fr 5fr; gap: 48px; align-items: stretch;
  padding: var(--section) 0 calc(var(--section) * 0.6);
}
.hero__note { margin-top: 24px; }
.drop {
  position: relative; min-height: 380px;
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  border: 1px solid var(--hairline); background: var(--surface); padding: 32px;
  transition: border-color 160ms;
}
.drop.is-over { border-color: var(--ink); }
.drop--closed { color: var(--graphite); }
.drop__prompt { font-family: var(--serif); font-size: 1.9rem; line-height: 1.05; margin-bottom: 8px; }
.drop__idle .meta { margin-bottom: 24px; }
.drop__busy { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.drop__busy img { max-height: 260px; width: auto; opacity: 0.55; }
.drop__error { color: var(--accent); font-size: 0.875rem; margin: 16px 0 0; }
.drop .cf-turnstile { margin-top: 16px; }
/* The hero splits only when its own column is wide enough — with both ad
   rails present that's a ~1600px viewport; below, the dropzone goes first. */
@container (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .drop { order: -1; min-height: 280px; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .drop { order: -1; min-height: 280px; }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; height: 48px; padding: 0 22px;
  font-weight: 500; font-size: 0.875rem; letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid var(--ink); transition: transform 80ms;
}
.btn:active { transform: translateY(1px); }
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover span, .btn--primary:hover { text-decoration: underline; text-underline-offset: 4px; }

/* How */
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; padding: var(--section) 0; border-top: 1px solid var(--hairline); }
.how__step h2 { font-family: var(--serif); font-size: 1.6rem; margin: 8px 0 12px; }
.how__step p { color: var(--graphite); }
@media (max-width: 900px) { .how { grid-template-columns: 1fr; gap: 32px; } }

/* Result */
.result { display: grid; grid-template-columns: 5fr 7fr; gap: 56px; padding: calc(var(--section) * 0.6) 0 var(--section); }
.result__photo { position: sticky; top: 96px; align-self: start; }
.result__img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: var(--surface); }
.result__noimg { aspect-ratio: 4 / 5; border: 1px solid var(--hairline); background: var(--surface); display: flex; align-items: center; justify-content: center; padding: 32px; text-align: center; font-family: var(--serif); font-size: 1.4rem; color: var(--graphite); }
.result__share { margin-top: 16px; }
.result__title { font-family: var(--serif); font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1; letter-spacing: -0.02em; text-transform: none; }
.result__title::first-letter { text-transform: uppercase; }
.result__sub { margin: 12px 0 0; }
.item { padding: 40px 0; border-top: 1px solid var(--hairline); }
.item:first-of-type { margin-top: 40px; }
.item__head { margin-bottom: 20px; }
.item__name { font-family: var(--serif); font-size: clamp(1.6rem, 2.6vw, 2.2rem); line-height: 1; }
.item__desc { color: var(--graphite); margin: 6px 0 0; font-size: 0.9375rem; }
.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.pick { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pick:hover { text-decoration: none; }
.pick:hover .pick__title { text-decoration: underline; text-underline-offset: 3px; }
.pick__tier { margin-bottom: 4px; }
.pick--hot .pick__price { color: var(--accent); }
.plate { display: block; aspect-ratio: 4 / 5; background: var(--surface); padding: 12px; }
.plate img { width: 100%; height: 100%; object-fit: contain; }
.plate--sm { aspect-ratio: 1; width: 56px; flex: 0 0 56px; padding: 4px; }
.pick__title { font-size: 0.9375rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-height: 2.7em; }
.pick__price { font-size: 0.9375rem; }
.pick--empty .pick__none { color: var(--ash); font-family: var(--serif); font-size: 1.1rem; }
.pick--empty .plate { display: none; }
.more { margin-top: 24px; }
.more summary { cursor: pointer; list-style: none; display: inline-flex; gap: 8px; align-items: center; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: "↓"; font-size: 0.75rem; }
.more[open] summary::after { content: "↑"; }
.more__list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.more__list a { display: grid; grid-template-columns: 56px 1fr auto; gap: 16px; align-items: center; padding: 8px 0; border-top: 1px solid var(--hairline); font-size: 0.875rem; }
.more__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.more__text span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) {
  .result { grid-template-columns: 1fr; gap: 32px; }
  .result__photo { position: static; }
  .result__noimg { aspect-ratio: auto; padding: 20px 24px; font-size: 1.1rem; }
  .tiers { grid-template-columns: 1fr; gap: 24px; }
  .pick {
    display: grid; grid-template-columns: 96px 1fr; column-gap: 16px; row-gap: 4px; align-content: start;
    grid-template-areas: "tier tier" "plate merchant" "plate title" "plate price";
  }
  .pick__tier { grid-area: tier; }
  .pick .plate { grid-area: plate; aspect-ratio: 4 / 5; padding: 8px; }
  .pick__merchant { grid-area: merchant; }
  .pick__title { grid-area: title; }
  .pick__price { grid-area: price; }
  .pick--empty { display: flex; flex-direction: column; }
}

/* Motion */
@media (prefers-reduced-motion: no-preference) {
  .page-result .item, .result--live .item { animation: rise 420ms cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 60ms); }
  @keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
}

/* Skeleton */
.sk { background: var(--bone); position: relative; overflow: hidden; }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent); animation: shimmer 1.6s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk--photo { aspect-ratio: 4 / 5; }
.sk--title { height: 48px; width: 70%; margin-bottom: 40px; }
.sk--h2 { height: 28px; width: 45%; margin-bottom: 20px; }
.sk--plate { aspect-ratio: 4 / 5; }
.sk--line { display: block; height: 14px; width: 90%; margin-top: 4px; }
.sk--short { width: 40%; }
.item__searching { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .sk::after { animation: none; } }

/* Generic pages */
.page { padding: var(--section) 0; max-width: 72ch; }
.page--narrow { max-width: 56ch; }
.prose h2 { font-family: var(--serif); font-size: 1.6rem; margin: 2rem 0 0.75rem; }
.prose p { color: var(--graphite); }
.prose a { text-decoration: underline; text-underline-offset: 3px; color: var(--ink); }

/* Forms */
.form, .inline-form { display: grid; gap: 20px; margin-top: 24px; }
.field { display: grid; gap: 6px; }
input, select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 0; border-bottom: 1px solid var(--hairline); border-radius: 0; height: 48px; padding: 0 12px; width: 100%;
}
input[type="file"] { padding: 10px 12px; height: auto; }
input:focus, select:focus { outline: none; border-bottom-color: var(--accent); }
.inline-form__row { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.flash { padding: 12px 16px; border: 1px solid var(--hairline); background: var(--surface); }
.flash--err { color: var(--accent); }

/* Advertise board */
.board { display: grid; gap: 40px; margin: var(--section) 0; }
.board__head { margin-bottom: 12px; }
.board__head h2 { font-family: var(--serif); font-size: 1.6rem; }
.board__rows { list-style: none; margin: 0; padding: 0; }
.board__row { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 16px; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--hairline); }
.board__slot { display: flex; flex-direction: column; }
.board__bid { color: var(--accent); }
.bidform { border-top: 1px solid var(--hairline); padding-top: 40px; max-width: 560px; }
@media (max-width: 600px) { .board__row { grid-template-columns: 1fr; gap: 4px; } }

/* Result intro + per-piece notes */
.result__intro { font-family: var(--serif); font-size: 1.35rem; line-height: 1.3; color: var(--graphite); margin: 20px 0 0; max-width: 40ch; }
.item__note { color: var(--graphite); font-size: 0.9375rem; margin: 8px 0 0; max-width: 62ch; }

/* Looks index */
.page--wide { max-width: none; }
.looks__head { max-width: 72ch; margin-bottom: var(--section); }
.looks { display: grid; gap: var(--section) 48px; }
.lookcard { display: grid; grid-template-columns: 5fr 7fr; gap: 40px; align-items: center; }
.lookcard:nth-child(even) { grid-template-columns: 7fr 5fr; }
.lookcard:nth-child(even) .lookcard__media { order: 2; }
.lookcard__media { display: block; }
.lookcard__media:hover { text-decoration: none; }
.lookcard__title { font-family: var(--serif); font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1; letter-spacing: -0.02em; margin: 8px 0 12px; }
.lookcard__dek { color: var(--graphite); max-width: 52ch; }
.look__hero { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: var(--surface); }
.look__hero--card { aspect-ratio: 4 / 5; }
.collage { display: grid; gap: 8px; background: var(--paper); }
.collage .plate { aspect-ratio: 4 / 5; padding: 12px; }
.collage--card { grid-template-columns: repeat(3, 1fr); }
.collage--card .plate { aspect-ratio: 3 / 4; padding: 8px; }
.collage--hero { grid-template-columns: repeat(2, 1fr); }
.collage--hero[data-n="3"] .plate:first-child { grid-column: 1 / -1; aspect-ratio: 16 / 10; }
.collage--empty { aspect-ratio: 4 / 5; display: flex; align-items: center; justify-content: center; border: 1px solid var(--hairline); font-family: var(--serif); color: var(--ash); }
.pager { display: flex; justify-content: space-between; align-items: center; padding-top: 16px; border-top: 1px solid var(--hairline); margin-top: var(--section); }
.pager a { font-size: 0.875rem; }
@media (max-width: 900px) {
  .lookcard, .lookcard:nth-child(even) { grid-template-columns: 1fr; gap: 20px; }
  .lookcard:nth-child(even) .lookcard__media { order: 0; }
}

/* Look page */
.look { padding: calc(var(--section) * 0.6) 0 var(--section); max-width: 72ch; }
.look__head { margin-bottom: 32px; }
.look__title { font-size: clamp(2.2rem, 5vw, 4rem); }
.look__figure { margin: 0 0 40px; }
.look__figure figcaption { margin-top: 8px; }
.look__hero--hero { aspect-ratio: 4 / 5; max-height: 80vh; object-fit: cover; }
.look__body { margin-bottom: var(--section); }
.look__picks .item:first-of-type { margin-top: 24px; }
.look__cta { margin-top: 40px; }
.prose code { font-family: var(--mono); font-size: 0.875em; background: var(--surface); padding: 1px 5px; }

/* Market control */
.market { position: relative; }
.market__summary { list-style: none; cursor: pointer; font-size: 0.8125rem; color: var(--graphite); display: inline-flex; gap: 6px; align-items: center; }
.market__summary::-webkit-details-marker { display: none; }
.market__summary:hover { color: var(--ink); }
.market__menu { position: absolute; right: 0; top: calc(100% + 12px); z-index: 20; width: 280px; max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--hairline); padding: 12px 0; }
.market__menu .meta { padding: 0 16px 8px; }
.market__menu ul { list-style: none; margin: 0; padding: 0; }
.market__menu button { width: 100%; text-align: left; padding: 8px 16px; font-size: 0.875rem; display: flex; justify-content: space-between; gap: 12px; }
.market__menu button:hover, .market__menu button[aria-current="true"] { background: var(--paper); }
.hero__market { margin-top: 8px; }
.hero__market a { text-decoration: underline; text-underline-offset: 3px; }
.pick__closest { color: var(--accent); margin-left: 8px; }
.pick__market { margin-left: 6px; }
@media (max-width: 600px) { .market__menu { position: fixed; left: 16px; right: 16px; top: 72px; width: auto; } }
