/* ============================================================
   Forma — visual system
   Thesis: a working studio's specimen index. Warm paper stock,
   ink serif display (Fraunces), dot-leader ledger lines, clay
   registration accents, photographs mounted like prints.
   ============================================================ */

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/fraunces-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url("assets/fonts/fraunces-italic-latin.woff2") format("woff2");
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/dmsans-latin.woff2") format("woff2");
}

:root {
  /* colour roles */
  --paper: #efe8db;
  --paper-deep: #e5dbc9;
  --surface: #faf6ee;
  --surface-2: #f3ecdf;
  --ink: #1f1b15;
  --ink-soft: #5d554985;
  --muted: #6c6355;
  --line: #cabca5;
  --line-strong: #a99a80;
  --clay: #bc4327;
  --clay-deep: #94301a;
  --clay-tint: #f0d9cf;
  --cobalt: #2b4b94;
  --sage: #5f6f52;
  --on-dark: #f8f3e9;
  --focus: #1f4fd8;

  /* type */
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  /* space + measure */
  --gutter: clamp(20px, 4vw, 44px);
  --max: 1300px;
  --radius: 3px;
  --radius-lg: 6px;
  --rule: 1px solid var(--line);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

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

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

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* paper grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: var(--grain);
  opacity: 0.05;
  mix-blend-mode: multiply;
}

body > * { position: relative; z-index: 1; }

img { display: block; max-width: 100%; }

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

button, input, select { font: inherit; color: inherit; }

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 50;
  background: var(--ink);
  color: var(--on-dark);
  padding: 10px 16px;
  text-decoration: none;
  border-radius: var(--radius);
  transition: top 0.18s var(--ease);
}
.skip-link:focus { top: 12px; }

/* ---------- shared type roles ---------- */

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--clay-deep);
}
.eyebrow::before {
  content: "◆";
  font-size: 0.6em;
  margin-right: 0.7em;
  vertical-align: 0.15em;
  color: var(--clay);
}

.section-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.9rem, 1.2rem + 2.4vw, 3rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 120;
}

/* ---------- masthead ---------- */

.masthead {
  border-bottom: var(--rule);
}
.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px var(--gutter);
  max-width: var(--max);
  margin-inline: auto;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
}
.wordmark-glyph {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--clay);
  color: var(--on-dark);
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  border-radius: 50%;
  letter-spacing: 0;
  flex: none;
}
.wordmark-text {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.masthead-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.masthead-sep { color: var(--clay); }

.masthead-count {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 22px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), transform 0.16s var(--ease);
}
.btn-primary {
  background: var(--ink);
  color: var(--on-dark);
}
.btn-primary:hover { background: var(--clay); border-color: var(--clay); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface); border-color: var(--ink); }

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  align-items: center;
  gap: clamp(28px, 5vw, 76px);
  max-width: var(--max);
  margin-inline: auto;
  padding: clamp(44px, 6vw, 76px) var(--gutter) clamp(40px, 5vw, 68px);
}

.hero-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3rem, 1.4rem + 6.2vw, 5.9rem);
  line-height: 0.94;
  letter-spacing: -0.035em;
  margin-top: 18px;
  font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 1;
}
.hero-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--clay);
}

.lede {
  max-width: 34ch;
  margin-top: 24px;
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
  line-height: 1.55;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 22px;
  margin-top: 34px;
}
.hero-note {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* mounted print frame + registration marks */
.frame {
  position: relative;
  border: 1px solid var(--ink);
  background: var(--surface);
  padding: 10px;
  box-shadow: 10px 10px 0 var(--paper-deep);
}
.frame > img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  filter: saturate(0.92) contrast(1.03);
}

.regmarks i {
  position: absolute;
  width: 15px;
  height: 15px;
  pointer-events: none;
}
.regmarks i::before,
.regmarks i::after {
  content: "";
  position: absolute;
  background: rgba(248, 243, 233, 0.82);
}
.regmarks i::before { left: 50%; top: 0; width: 1px; height: 100%; transform: translateX(-50%); }
.regmarks i::after { top: 50%; left: 0; height: 1px; width: 100%; transform: translateY(-50%); }
.regmarks i:nth-child(1) { top: 14px; left: 14px; }
.regmarks i:nth-child(2) { top: 14px; right: 14px; }
.regmarks i:nth-child(3) { bottom: 14px; left: 14px; }
.regmarks i:nth-child(4) { bottom: 14px; right: 14px; }

.specimen-tag {
  position: absolute;
  left: 22px;
  bottom: 22px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px 7px 9px;
  background: var(--surface);
  border: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}
.specimen-tag__no {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  background: var(--clay);
  color: var(--on-dark);
  font-size: 0.62rem;
  border-radius: 50%;
}

.hero-caption {
  margin-top: 16px;
  max-width: 42ch;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- index section ---------- */

.index {
  background: var(--surface-2);
  border-top: 1px solid var(--ink);
  padding: clamp(48px, 6vw, 84px) 0 clamp(56px, 7vw, 96px);
  scroll-margin-top: 12px;
}

.index-head,
.toolbar,
.list,
.empty-state,
.glance {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.index-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: 20px 48px;
  margin-bottom: 34px;
}
.index-head .section-title { margin-top: 12px; }
.index-intro {
  max-width: 46ch;
  color: var(--muted);
  justify-self: end;
  padding-bottom: 6px;
}

/* toolbar */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 14px 16px 12px;
  box-shadow: 0 10px 24px -18px rgba(31, 27, 21, 0.8);
}
.toolbar-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}
.toolbar .field { display: flex; flex-direction: column; gap: 6px; }
.toolbar label {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.field-search { flex: 1 1 auto; min-width: 0; }
.field-category { flex: 0 0 190px; }

.input-wrap,
.select-wrap { position: relative; display: flex; align-items: center; }
.input-icon,
.select-arrow {
  position: absolute;
  color: var(--muted);
  pointer-events: none;
}
.input-icon { left: 12px; }
.select-arrow { right: 12px; }

input[type="text"],
select {
  width: 100%;
  padding: 11px 36px 11px 36px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 0.95rem;
  appearance: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
select { padding-left: 14px; padding-right: 34px; cursor: pointer; }
input[type="text"]::placeholder { color: #9a9080; }
input[type="text"]:hover,
select:hover { border-color: var(--ink); }

.input-clear {
  position: absolute;
  right: 6px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
}
.input-clear[hidden] { display: none; }
.input-clear:hover { background: var(--paper-deep); color: var(--ink); }

.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.saved-toggle:hover { border-color: var(--ink); }
.saved-toggle__count {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  background: var(--paper-deep);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
}
.saved-toggle[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-dark);
}
.saved-toggle[aria-pressed="true"] .saved-toggle__count {
  background: var(--clay);
  color: var(--on-dark);
}

.result-count {
  margin-top: 11px;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- list / cards ---------- */

.list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 30px 26px;
  margin-top: 30px;
}
.list[hidden] { display: none; }

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  transition: box-shadow 0.18s var(--ease), transform 0.18s var(--ease), border-color 0.18s var(--ease);
}
.card:hover { border-color: var(--ink); box-shadow: 7px 7px 0 var(--paper-deep); transform: translateY(-2px); }

.card-open {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.card-open:focus-visible { outline-offset: 3px; }

.card-media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-bottom: 1px solid var(--line-strong);
  background: var(--paper-deep);
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.92) contrast(1.03);
  transition: transform 0.5s var(--ease);
}
.card:hover .card-media img { transform: scale(1.035); }
.card-media .regmarks i::before,
.card-media .regmarks i::after { background: rgba(255, 255, 255, 0.85); }
.card-media .regmarks i:nth-child(1) { top: 10px; left: 10px; }
.card-media .regmarks i:nth-child(2) { top: 10px; right: 10px; }
.card-media .regmarks i:nth-child(3) { bottom: 10px; left: 10px; }
.card-media .regmarks i:nth-child(4) { bottom: 10px; right: 10px; }

.card-no {
  position: absolute;
  top: 0;
  left: 0;
  padding: 6px 10px;
  background: var(--surface);
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.card-head {
  display: block;
  padding: 18px 20px 6px;
}
.card-cat {
  display: block;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--clay-deep);
}
.card-title {
  display: block;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.55rem;
  line-height: 1.06;
  letter-spacing: -0.015em;
  margin-top: 8px;
}
.card-sum {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 10px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--muted);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 20px 20px;
  margin-top: auto;
}

.ledger { display: grid; gap: 7px; }
.ledger-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.8rem;
}
.ledger-row dt {
  color: var(--muted);
  white-space: nowrap;
}
.ledger-row .dots {
  flex: 1 1 auto;
  border-bottom: 1px dotted var(--line-strong);
  transform: translateY(-3px);
  min-width: 12px;
}
.ledger-row dd {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--ink);
  white-space: nowrap;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.price {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.price small {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  vertical-align: 0.45em;
  margin-left: 4px;
}

.save-mini {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.save-mini:hover { border-color: var(--ink); background: var(--surface-2); }
.save-mini svg { flex: none; }
.save-mini[aria-pressed="true"] {
  background: var(--clay-tint);
  border-color: var(--clay);
  color: var(--clay-deep);
}
.save-mini[aria-pressed="true"] svg { fill: var(--clay); }

/* ---------- empty state ---------- */

.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 72px 24px;
  border: 1px dashed var(--line-strong);
  background: var(--surface);
}
.empty-state.is-visible { display: flex; }
.empty-state[hidden] { display: none; }
.empty-state__mark {
  font-family: var(--serif);
  font-size: 3rem;
  color: var(--clay);
  line-height: 1;
}
.empty-state__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.7rem;
  margin-top: 16px;
  letter-spacing: -0.01em;
}
.empty-state__body {
  max-width: 44ch;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}
.empty-state .btn { margin-top: 22px; }

/* ---------- glance ---------- */

.glance {
  padding-top: clamp(56px, 7vw, 96px);
  padding-bottom: clamp(56px, 7vw, 96px);
}
.glance .section-title { margin-top: 12px; }
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  margin-top: 40px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.stats > div {
  padding: 26px 20px 24px;
  border-right: var(--rule);
}
.stats > div:last-child { border-right: 0; }
.stats dt {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.stats dd {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 1.2rem + 1.6vw, 2.7rem);
  font-weight: 500;
  line-height: 1;
  margin-top: 12px;
  letter-spacing: -0.02em;
}
.glance-note {
  max-width: 60ch;
  margin-top: 26px;
  color: var(--muted);
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: 20px;
  border-top: 1px solid var(--ink);
}
.site-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  max-width: var(--max);
  margin-inline: auto;
  padding: 32px var(--gutter) 40px;
}
.footer-brand { display: flex; align-items: center; gap: 13px; }
.footer-name {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.footer-tag {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.footer-fine {
  flex: 1 1 320px;
  max-width: 46ch;
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--muted);
}
.footer-top {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
}
.footer-top:hover { border-color: var(--clay); color: var(--clay-deep); }

/* ---------- detail dialog ---------- */

.detail {
  width: min(1060px, calc(100vw - 40px));
  max-height: min(90vh, 840px);
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
  box-shadow: 0 30px 80px -30px rgba(20, 16, 10, 0.7);
}
.detail::backdrop {
  background: rgba(28, 23, 16, 0.58);
  backdrop-filter: blur(3px);
}

.detail-shell {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  max-height: inherit;
}
.detail-media {
  position: relative;
  display: flex;
  align-items: stretch;
  background: var(--paper-deep);
  border-right: 1px solid var(--ink);
  min-height: 100%;
}
.detail-media img {
  width: 100%;
  height: 100%;
  min-height: 340px;
  object-fit: cover;
  filter: saturate(0.92) contrast(1.03);
}
.detail-media .specimen-tag { left: 18px; bottom: 18px; }

.detail-body {
  padding: clamp(56px, 5vw, 64px) clamp(28px, 4vw, 52px) clamp(28px, 4vw, 52px);
  overflow-y: auto;
  max-height: min(90vh, 840px);
}
.detail-body .eyebrow { color: var(--clay-deep); }
.detail-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3.2rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin-top: 14px;
}
.detail-lede {
  margin-top: 20px;
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.18rem);
  line-height: 1.55;
  color: #403a30;
}

.detail-ledger {
  margin-top: 30px;
  border-top: 1px solid var(--ink);
  padding-top: 8px;
}
.detail-ledger .ledger-row {
  padding: 11px 0;
  font-size: 0.86rem;
  border-bottom: var(--rule);
}
.detail-ledger .ledger-row:last-child { border-bottom: 0; }
.detail-ledger .ledger-row dt {
  flex: 0 0 108px;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.detail-ledger .ledger-row dd { font-size: 0.9rem; }
.detail-ledger .ledger-row dd.dd-lead { font-family: var(--sans); }

.detail-actions {
  margin-top: 30px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.save-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  background: var(--ink);
  color: var(--on-dark);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease);
}
.save-btn:hover { background: var(--clay); border-color: var(--clay); }
.save-btn svg { flex: none; }
.save-btn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--clay-deep);
  border-color: var(--clay);
}
.save-btn[aria-pressed="true"] svg { fill: var(--clay); }
.save-note {
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 24ch;
}

.detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}
.detail-close:hover { background: var(--ink); color: var(--on-dark); }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-shell { grid-template-columns: 1fr; }
  .detail-media { border-right: 0; border-bottom: 1px solid var(--ink); min-height: 0; }
  .detail-media img { min-height: 0; max-height: 34vh; }
  .detail-body { max-height: min(56vh, 560px); }
}

@media (max-width: 860px) {
  .masthead-line { display: none; }
  .hero { grid-template-columns: 1fr; gap: 34px; padding-top: 40px; }
  .hero-copy { max-width: 620px; }
  .hero-media { max-width: 620px; }
  .index-head { grid-template-columns: 1fr; }
  .index-intro { justify-self: start; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats > div { border-bottom: var(--rule); }
  .stats > div:nth-child(2n) { border-right: 0; }
  .stats > div:last-child { border-bottom: 0; }
  .toolbar-row { flex-wrap: wrap; align-items: flex-end; }
  .field-search { flex: 1 1 100%; }
  .field-category { flex: 1 1 160px; }
  .saved-toggle { flex: 0 0 auto; }
}

@media (max-width: 620px) {
  body { font-size: 1rem; }
  .masthead-inner { padding-block: 14px; }
  .masthead-count { display: none; }
  .hero { padding-top: 30px; }
  .hero-title { font-size: clamp(2.7rem, 13vw, 3.6rem); }
  .hero-title em { display: inline; }
  .list { grid-template-columns: 1fr; gap: 24px; }
  .toolbar { padding: 12px; }
  .field-category { flex: 1 1 100%; }
  .saved-toggle { flex: 1 1 100%; justify-content: center; }
  .detail {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
  }
  .detail-shell { grid-template-rows: auto 1fr; height: 100%; }
  .detail-media img { height: 32vh; min-height: 0; }
  .detail-body { max-height: none; height: 100%; padding: 26px 22px 40px; }
  .detail-close { position: fixed; top: 12px; right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .card:hover { transform: none; }
  .card:hover .card-media img { transform: none; }
}
