/* ==========================================================================
   TopDollar Price Guide — "Field Guide" direction
   ========================================================================== */

/* MUST be the first rule in the file. The index rows and tab panels carry an
   author-level `display:flex`/`display:block`, and author rules beat the UA
   stylesheet's `[hidden]{display:none}` on specificity. Without this the entire
   filter/tab layer silently no-ops: JS sets the attribute, nothing disappears. */
[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------------ fonts */
/* Self-hosted latin subsets (both OFL). */
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/instrument-serif-400.woff2") format("woff2");
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/instrument-serif-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/plus-jakarta-sans-var.woff2") format("woff2");
}

/* Metric-matched fallbacks. `font-display:swap` on a clamp(40px,7vw,80px) serif
   H1 is a guaranteed layout shift unless the fallback occupies the same box —
   these overrides are computed from the real font tables (Instrument Serif
   x-height 510/1000 vs Times 916/2048; Jakarta 536/1000 vs Arial 1062/2048),
   not eyeballed. */
@font-face {
  font-family: "Instrument Fallback";
  src: local("Times New Roman"), local("Times"), local("Georgia"), local("serif");
  size-adjust: 114%;
  ascent-override: 86.8%;
  descent-override: 27.2%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Jakarta Fallback";
  src: local("Helvetica Neue"), local("Helvetica"), local("Arial"), local("sans-serif");
  size-adjust: 103.4%;
  ascent-override: 100.4%;
  descent-override: 21.5%;
  line-gap-override: 0%;
}

/* ----------------------------------------------------------------- tokens */
:root {
  --paper: #f5f1e8;
  --shade: #ece6d8;
  --cream: #fffdf8;
  --row-hover: #efe8d9;

  --ink: #26221c;
  --muted-1: #5c5340; /* 6.73:1 on paper — AA */
  /* Handoff value was #7c7460, which lands at 4.12:1 on paper and 3.73:1 on the
     footer shade — under AA for the nav links and idle tab labels that use it.
     Darkened to the smallest value clearing 4.5:1 on both (5.05 / 4.57). */
  --muted-2: #6e6654;
  /* Decorative/meta text. These are BELOW AA on paper (2.86, 2.40, 2.02) and are
     the handoff's values, kept as-is deliberately — raising them flattens the
     tonal hierarchy the whole direction rests on. Flagged for a design call. */
  --muted-3: #9a8e76;
  --muted-4: #a89c83;
  --gold: #b6ab90;

  --rule-faint: rgba(38, 34, 28, 0.1);
  --rule-soft: rgba(38, 34, 28, 0.12);
  --rule: rgba(38, 34, 28, 0.13);
  --rule-mid: rgba(38, 34, 28, 0.15);
  --rule-card: rgba(38, 34, 28, 0.16);
  --rule-strong: rgba(38, 34, 28, 0.18);
  /* Handoff had rgba(38,34,28,.42) — 2.49:1, far under AA for a control label
     the visitor has to read to operate the page. */
  --tab-idle: #6e6654;

  --accent: #27775f;
  --on-accent: #f5f1e8;

  --serif: "Instrument Serif", "Instrument Fallback", Georgia, "Times New Roman", serif;
  --sans: "Plus Jakarta Sans", "Jakarta Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;

  --shell: 1120px;
  --column: 760px;
  --gutter: 24px;
  --card-shadow: 0 14px 40px -22px rgba(60, 50, 35, 0.5);
}

/* ------------------------------------------------------------------ reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
figure {
  margin: 0;
}

img {
  max-width: 100%;
}

::selection {
  background: var(--accent);
  color: var(--paper);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: var(--on-accent);
  padding: 12px 18px;
  border-radius: 0 0 11px 0;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
}

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(245, 241, 232, 0.88);
  border-bottom: 1px solid var(--rule-soft);
}

@supports (backdrop-filter: blur(10px)) {
  .topbar {
    backdrop-filter: blur(10px);
  }
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 14px;
}

.wordmark {
  display: flex;
  align-items: baseline;
  gap: 9px;
  text-decoration: none;
  color: inherit;
}
.wordmark:hover {
  opacity: 0.7;
}

.wordmark__name {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1;
}

.wordmark__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-2);
}
.topnav a {
  color: inherit;
  text-decoration: none;
}
.topnav a:hover {
  opacity: 0.7;
}

/* ------------------------------------------------------------------- hero */
.hero {
  padding-block: clamp(34px, 6vw, 72px) clamp(20px, 3vw, 32px);
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 7vw, 80px);
  line-height: 0.98;
  margin: 14px 0 16px;
  max-width: 14ch;
}

.hero__lede {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(16px, 2.2vw, 20px);
  line-height: 1.45;
  color: var(--muted-1);
  max-width: 54ch;
  margin-bottom: 28px;
}
.hero__lede strong {
  color: var(--ink);
  font-weight: 400;
}

/* ----------------------------------------------------------------- search */
.search {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--cream);
  border: 1.5px solid var(--rule-strong);
  border-radius: 13px;
  padding: 14px 18px;
  max-width: 480px;
  box-shadow: 0 1px 0 rgba(38, 34, 28, 0.04);
}
.search:focus-within {
  border-color: var(--accent);
}

/* Typographic magnifier — the design ships no icon assets. */
.search__glyph {
  width: 15px;
  height: 15px;
  border: 2px solid var(--muted-4);
  border-radius: 999px;
  flex: none;
  position: relative;
}
.search__glyph::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  background: var(--muted-4);
  transform: rotate(45deg);
  right: -5px;
  bottom: -1px;
  border-radius: 2px;
}

.search__input {
  border: none;
  background: transparent;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  width: 100%;
  padding: 0;
}
.search__input::placeholder {
  color: var(--muted-4);
}
.search__input:focus {
  outline: none;
}

.search__clear {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--muted-4);
  padding: 2px 4px;
  font-family: var(--sans);
}
.search__clear:hover {
  opacity: 0.7;
}

/* ------------------------------------------------------------ filter rows */
.filters {
  display: flex;
  flex-direction: column;
  /* Without this the column's default `stretch` blows the pill-shaped type
     toggle out to the full 1120px shell. */
  align-items: flex-start;
  gap: 10px;
  padding-top: 14px;
}

.chiprow {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
}

.chip {
  padding: 8px 15px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s, color 0.12s, border-color 0.12s;
  border: 1.5px solid var(--rule-strong);
  background: transparent;
  color: var(--muted-2);
}
.chip:hover {
  border-color: var(--muted-4);
}
.chip[aria-checked="true"],
.chip[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* The type toggle is a two-state segmented control, distinct from the series
   chips below it — the two rows do different jobs and shouldn't read alike. */
.typetoggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1.5px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--cream);
}
.typetoggle .chip {
  border-color: transparent;
  background: transparent;
}
.typetoggle .chip[aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
}

/* ------------------------------------------------------------ index table */
.indexhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 0 10px;
  border-bottom: 2px solid var(--ink);
}

.indexhead__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-3);
}

.indexhead__count {
  font-size: 12px;
  color: var(--muted-3);
}

.indexgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0 36px;
  padding: 8px 0 clamp(40px, 6vw, 72px);
}

.devrow {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 12px;
  margin: 0 -12px;
  border-bottom: 1px solid var(--rule);
  border-radius: 8px;
  transition: background-color 0.12s;
  text-decoration: none;
  color: inherit;
}
.devrow:hover {
  background: var(--row-hover);
}

/* Pre-paint default for the scripted index: iPhones only. Set by an inline
   script in <head> and removed by guide.js as it takes over the filtering, so
   with scripting off the class never lands and all 78 rows stay visible. */
.filter-boot .devrow[data-type="ipad"] {
  display: none;
}

/* The row is an <a>, so its parts are spans — they need to be made block-level
   explicitly or the name, meta and price all run together on one line. */
.devrow__main {
  flex: 1;
  min-width: 0;
}

.devrow__name {
  display: block;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.05;
}

.devrow__meta {
  display: block;
  font-size: 12px;
  color: var(--muted-3);
  margin-top: 3px;
}

.devrow__price {
  display: block;
  text-align: right;
  flex: none;
}

.devrow__upto {
  display: block;
  font-size: 10px;
  color: var(--muted-3);
  letter-spacing: 0.04em;
}

.devrow__amount {
  display: block;
  font-family: var(--serif);
  font-size: 22px;
  color: var(--ink);
}

.devrow__arrow {
  /* U+2192 is absent from all three self-hosted faces (and from Plus Jakarta
     Sans), so this glyph always resolves through the fallback chain to a system
     UI font. Naming the sans stack keeps it consistent with the "Sell →" arrows
     rather than landing on Times' extra-long variant. */
  font-family: var(--sans);
  font-size: 20px;
  line-height: 1;
  color: var(--accent);
  flex: none;
}

.emptystate {
  padding: 60px 12px;
  text-align: center;
}

.emptystate__msg {
  font-family: var(--serif);
  font-style: italic;
  font-size: 24px;
  color: var(--muted-1);
}

.linky {
  display: inline-block;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  background: none;
  border: none;
  border-bottom: 1px solid var(--accent);
  padding: 0 0 1px;
  font-family: var(--sans);
  text-decoration: none;
}
.linky:hover {
  opacity: 0.7;
}

/* ------------------------------------------------------------ device page */
.device {
  max-width: var(--column);
  margin: 0 auto;
  padding: clamp(20px, 3vw, 30px) var(--gutter) clamp(48px, 7vw, 80px);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted-3);
  font-weight: 600;
  margin-bottom: 22px;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
}
/* The crumb text is decorative muted grey, but the crumb LINK is an interactive
   control and has to clear AA like the nav links do — inheriting --muted-3 left
   it at 2.86:1. */
.breadcrumb a {
  color: var(--muted-2);
  text-decoration: none;
}
.breadcrumb a:hover {
  opacity: 0.7;
}
.breadcrumb li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.breadcrumb li::before {
  content: "/";
  opacity: 0.5;
}
.breadcrumb li:first-child::before {
  content: none;
}
.breadcrumb [aria-current="page"] {
  color: var(--ink);
}

.devhead {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 20px;
}

.devhead__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(36px, 6.5vw, 60px);
  line-height: 0.98;
}

.devhead__sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(16px, 2.4vw, 20px);
  color: var(--muted-1);
  margin-top: 8px;
}

/* -------------------------------------------------------------- controls */
.connectivity {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding-top: 18px;
  margin: 0;
  border: 0;
}

.connectivity__legend {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-3);
  padding: 0;
  margin-right: 3px;
}

.tabs {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding-top: 18px;
  border-bottom: 1px solid var(--rule-mid);
}

.tab {
  padding: 10px 0;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--tab-idle);
}
.tab:hover {
  color: var(--muted-1);
}
.tab[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* -------------------------------------------------------------- hero card */
.tierpanel:focus {
  outline: none;
}

.offercard {
  margin-top: 28px;
  padding: 26px;
  border-radius: 16px;
  background: var(--cream);
  border: 1.5px solid var(--rule-card);
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
}

.offercard::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: var(--accent);
}

.offercard__eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.offercard__flag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.offercard__tier {
  font-size: 11px;
  color: var(--muted-3);
}

.offercard__body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.offercard__buyer {
  font-family: var(--serif);
  font-size: clamp(28px, 5vw, 38px);
  line-height: 1;
  font-weight: 400;
}

.offercard__perks {
  font-size: 13px;
  color: var(--muted-2);
  margin-top: 8px;
}

.offercard__price {
  font-family: var(--serif);
  font-size: clamp(48px, 9vw, 68px);
  line-height: 0.85;
  color: var(--accent);
}

.sellbtn {
  display: block;
  text-align: center;
  margin-top: 20px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 16px;
  padding: 16px;
  border-radius: 11px;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: filter 0.12s;
}
.sellbtn:hover {
  filter: brightness(1.06);
}

/* ----------------------------------------------------------- other buyers */
.sectionlabel {
  margin: 30px 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-3);
}

.offerlist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.offerrow {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--rule-soft);
}

.offerrow__rank {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--gold);
  width: 30px;
  flex: none;
}

.offerrow__main {
  flex: 1;
  min-width: 0;
}

/* Spans inside the row, so block display has to be explicit — otherwise the
   buyer name and its delta share a line. */
.offerrow__buyer {
  display: block;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.15;
}

.offerrow__delta {
  display: block;
  font-size: 12px;
  color: var(--muted-3);
  margin-top: 2px;
}

.offerrow__price {
  font-family: var(--serif);
  font-size: 26px;
  flex: none;
}

.offerrow__link {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
  white-space: nowrap;
  flex: none;
}
.offerrow__link:hover {
  opacity: 0.7;
}

/* The 29 single-offer tiers get a note instead of an empty "Other buyers"
   heading with nothing under it. */
.solonote {
  margin-top: 26px;
  padding: 18px 20px;
  border: 1.5px dashed var(--rule-strong);
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted-1);
  background: var(--cream);
}

.howwerank {
  margin-top: 40px;
  padding: 24px;
  background: var(--shade);
  border-radius: 14px;
}

.howwerank__title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 8px;
}

.howwerank p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted-1);
}
.howwerank p + p {
  margin-top: 10px;
}
.howwerank strong {
  color: var(--ink);
  font-weight: 600;
}

/* ----------------------------------------------------------------- footer */
.footer {
  border-top: 1px solid rgba(38, 34, 28, 0.14);
  background: var(--shade);
}

.footer__inner {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 34px 0 44px;
}

.footer__brand {
  max-width: 46ch;
}

.footer__name {
  font-family: var(--serif);
  font-size: 22px;
}

.footer__disclosure {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted-2);
  margin-top: 10px;
}
.footer__disclosure strong {
  color: var(--muted-1);
  font-weight: 600;
}

.footer__buyers {
  font-size: 12.5px;
  color: var(--muted-3);
  line-height: 1.9;
}

.footer__buyers-label {
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--gold);
  margin-bottom: 6px;
}

.footer__buyers ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer__bottom {
  border-top: 1px solid var(--rule-faint);
}

.footer__bottom-inner {
  padding: 14px 0;
  font-size: 11px;
  color: var(--muted-4);
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 560px) {
  .topbar__inner {
    gap: 10px;
  }
  .topnav {
    gap: 14px;
  }
  /* At 390px the label and both nav items each wrap to two lines and the bar
     doubles in height. The wordmark still reads without the kicker. */
  .topnav a {
    white-space: nowrap;
  }
  .wordmark__label {
    display: none;
  }
  .offercard {
    padding: 22px 20px;
  }
  .offerrow {
    flex-wrap: wrap;
    gap: 10px 12px;
  }
  .offerrow__main {
    flex-basis: calc(100% - 42px);
  }
  .offerrow__price {
    margin-left: 46px;
  }
  .offerrow__link {
    margin-left: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media print {
  .topbar,
  .filters,
  .search,
  .tabs {
    display: none;
  }
}
