/* THE FLAT FILE: components. Consumes tokens only. */

@font-face {
  font-family: "Besley";
  src: url("/assets/fonts/besley.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Besley";
  src: url("/assets/fonts/besley-italic.woff2") format("woff2");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Host Grotesk";
  src: url("/assets/fonts/host-grotesk.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Host Grotesk";
  src: url("/assets/fonts/host-grotesk-italic.woff2") format("woff2");
  font-weight: 300 800;
  font-style: italic;
  font-display: swap;
}

* { box-sizing: border-box; margin: 0; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--grotesk);
  font-size: var(--body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--carbon); color: var(--bone); }

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

a { color: inherit; }

:focus-visible {
  outline: var(--ring) solid var(--focus);
  outline-offset: 3px;
}

.wrap { max-width: 1240px; margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2.5rem); }

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

.skip {
  position: absolute; left: -100vw; top: 0; z-index: var(--z-skip);
  background: var(--carbon); color: var(--bone);
  padding: var(--s-3) var(--s-4); font-weight: 600; text-decoration: none;
}
.skip:focus { left: 0; }

/* ------------------------------------------------------------ label roles */
.tag {
  font-family: var(--grotesk);
  font-size: var(--label);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.fine { font-size: var(--fine); color: var(--muted); }

/* ------------------------------------------------------------ header */
.cabinet-head {
  position: sticky; top: 0; z-index: var(--z-header);
  background: color-mix(in srgb, var(--bone) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.cabinet-head .wrap {
  display: flex; align-items: center; gap: var(--s-4);
  min-height: 3.25rem;
}
.wordmark {
  font-family: var(--serif); font-weight: 800; font-size: 1.05rem;
  letter-spacing: 0.02em; text-decoration: none; white-space: nowrap;
}
.wordmark i { font-style: normal; color: var(--muted); font-weight: 500; }
.head-tally { margin-left: auto; white-space: nowrap; }
@media (max-width: 620px) { .head-tally { display: none; } }

/* ------------------------------------------------------------ hero */
.top-sheet { padding-block: var(--s-6) var(--s-4); border-bottom: 1px solid var(--line); }
.top-sheet h1 {
  font-family: var(--serif); font-weight: 850;
  font-size: var(--masthead); line-height: 0.98; letter-spacing: -0.015em;
  max-width: 18ch;
}
.top-sheet .standfirst {
  margin-top: var(--s-4);
  font-size: clamp(1.05rem, 1rem + 0.5vw, 1.3rem);
  max-width: 58ch; text-wrap: pretty;
}
.top-sheet .standfirst em { font-family: var(--serif); }

.file-tally {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr));
  gap: var(--s-3) var(--s-6);
  margin-top: var(--s-4); padding-top: var(--s-3);
  border-top: 1px solid var(--line);
  list-style: none; padding-left: 0;
}
.file-tally b { font-family: var(--serif); font-weight: 800; font-size: 1.4rem; display: block; }
.file-tally span { display: block; }

/* ------------------------------------------------------------ file tabs (drawer nav) */
.tab-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
  /* block-only: a padding shorthand here would wipe .wrap's side gutter */
  padding-block: var(--s-4);
}
.file-tabs {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
}
.file-tab {
  display: inline-flex; align-items: baseline; gap: 0.45em;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.4em 0.95em;
  text-decoration: none;
  font-weight: 600; font-size: 0.9rem;
  background: var(--surface);
  transition: background var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}
.file-tab small { color: var(--muted); font-size: var(--fine); font-weight: 700; }
.file-tab:hover { background: var(--bg-2); border-color: var(--fg); }

/* the finder arrives by script; it has no resting HTML */
.finder {
  display: inline-flex; align-items: center; gap: var(--s-2);
  margin-left: auto;
}
.finder input {
  font: inherit; color: inherit;
  background: var(--surface);
  border: 1px solid var(--line-control);
  border-radius: 999px;
  padding: 0.4em 1em;
  width: clamp(9rem, 22vw, 15rem);
}
.finder input::placeholder { color: var(--muted); }
.finder-count:not(:empty) { min-width: 7.5rem; text-align: right; }

.view-lift {
  font: inherit; font-weight: 600; font-size: 0.9rem;
  border: 1px solid var(--line-control); border-radius: 999px;
  background: var(--surface); color: inherit;
  padding: 0.4em 0.95em; cursor: pointer;
}
.view-lift:hover { background: var(--bg-2); border-color: var(--fg); }
.view-lift[aria-pressed="true"] { background: var(--carbon); color: var(--bone); border-color: var(--carbon); }

@media (max-width: 700px) {
  .finder { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .finder input { flex: 1; width: auto; min-width: 0; }
  .finder-count { flex-basis: 100%; min-width: 0; text-align: left; }
}

/* ------------------------------------------------------------ drawers */
.file-drawer { padding: var(--section-pad) 0 0; scroll-margin-top: 4.5rem; }
.file-drawer:last-of-type { padding-bottom: var(--section-pad); }

.drawer-front {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-2) var(--s-4);
  border-top: 2px solid var(--fg);
  padding-top: var(--s-3);
}
.drawer-front h2 {
  font-family: var(--serif); font-weight: 700;
  font-size: var(--drawer-title); letter-spacing: -0.01em;
}
.drawer-front .tag { transform: translateY(-0.15em); }
.drawer-front p { flex-basis: 100%; max-width: 62ch; color: var(--muted); text-wrap: pretty; }
.file-drawer:target .drawer-front h2 { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; }

.file {
  list-style: none; padding: 0;
  margin-top: var(--s-5);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: var(--s-5);
}

/* ------------------------------------------------------------ prints */
.print { position: relative; }
.print > a {
  display: block; height: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--edge);
  text-decoration: none;
  transition: transform var(--dur-2) var(--ease-lift), box-shadow var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}
.print-sheet {
  display: block;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  aspect-ratio: 16 / 10;
  background: var(--bg-2);
}
.print-sheet img {
  width: 100%; height: 100%; object-fit: cover; object-position: top;
  transition: transform var(--dur-3) var(--ease-out);
}
.print-label { padding: var(--s-4); display: grid; gap: var(--s-2); }
.print-topline { display: flex; align-items: center; gap: var(--s-2); }
.print-topline .tag { color: var(--muted); }
.jacket-dot {
  width: 0.85em; height: 0.85em; flex: none;
  border-radius: 50%;
  background: var(--jacket-dot);
  border: 1px solid color-mix(in srgb, var(--fg) 25%, transparent);
}
.print-name {
  font-family: var(--serif); font-weight: 700; font-size: var(--print-name);
  line-height: 1.25;
  text-decoration: underline transparent;
  text-decoration-thickness: 2px; text-underline-offset: 4px;
  transition: text-decoration-color var(--dur-2) var(--ease-out);
}
.print-line { color: var(--muted); font-size: 0.9rem; text-wrap: pretty; }
.print-foot {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-2);
  border-top: 1px solid var(--line);
  padding-top: var(--s-2); margin-top: var(--s-1);
}
.print-foot .lift { font-weight: 700; font-size: var(--label); letter-spacing: 0.1em; text-transform: uppercase; }
.print-foot .lift::after { content: " \2197"; }

@media (hover: hover) {
  .print > a:hover {
    transform: translateY(-3px);
    border-color: var(--jacket);
    box-shadow: 0 0 0 1px var(--jacket), 0 14px 28px -18px color-mix(in srgb, var(--jacket) 55%, var(--carbon));
  }
  .print > a:hover .print-sheet img { transform: scale(1.025); }
  .print > a:hover .print-name { text-decoration-color: var(--jacket); }
}
/* the ring stays carbon so it always clears 3:1; the jacket rides inside it,
   so a pale jacket like Latitude's gold can never weaken the focus indicator */
.print > a:focus-visible {
  border-color: var(--jacket);
  box-shadow: inset 0 0 0 2px var(--jacket);
}
.print > a:focus-visible .print-name { text-decoration-color: var(--jacket); }

/* ------------------------------------------------------------ index view */
body[data-view="index"] .file { display: block; margin-top: var(--s-4); }
body[data-view="index"] .print { border-bottom: 1px solid var(--line); }
body[data-view="index"] .print > a {
  display: grid;
  grid-template-columns: auto minmax(9rem, 14rem) minmax(0, 1fr) minmax(0, 14rem) auto;
  align-items: baseline; gap: var(--s-4);
  border: 0; border-radius: 0; background: none;
  padding: var(--s-3) var(--s-1);
}
body[data-view="index"] .print-sheet,
body[data-view="index"] .print-line { display: none; }
body[data-view="index"] .print-foot .fine { order: 4; text-align: right; }
body[data-view="index"] .print-label { display: contents; }
body[data-view="index"] .print-topline { display: contents; }
body[data-view="index"] .print-topline .tag { order: 3; }
body[data-view="index"] .jacket-dot { order: 1; align-self: center; }
body[data-view="index"] .print-name { order: 2; font-size: 1rem; }
body[data-view="index"] .print-foot { display: contents; }
body[data-view="index"] .print-foot .lift { order: 5; }
body[data-view="index"] .print > a:hover { transform: none; box-shadow: none; background: var(--surface); }
@media (max-width: 860px) {
  body[data-view="index"] .print > a { grid-template-columns: auto 1fr auto; }
  body[data-view="index"] .print-topline .tag,
  body[data-view="index"] .print-foot .fine { display: none; }
}

.no-match {
  max-width: 1240px; margin: 0 auto var(--s-7);
  padding-inline: clamp(1rem, 4vw, 2.5rem);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3);
  color: var(--muted);
}

/* ------------------------------------------------------------ bones */
.bones { background: var(--carbon); color: var(--bone); padding: var(--section-pad) 0; }
.bones .tag { color: color-mix(in srgb, var(--bone) 62%, var(--carbon)); }
.bones h2 {
  font-family: var(--serif); font-weight: 700; font-size: var(--drawer-title);
  max-width: 22ch; margin-top: var(--s-2);
}
.bones-list {
  list-style: none; padding: 0; margin-top: var(--s-6);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: var(--s-5) var(--s-6);
}
.bones-list b { font-family: var(--serif); font-size: 1.05rem; display: block; margin-bottom: var(--s-1); }
.bones-list li { border-top: 1px solid color-mix(in srgb, var(--bone) 25%, var(--carbon)); padding-top: var(--s-3); font-size: 0.95rem; }
.bones-list a { color: inherit; }
.bones :focus-visible { outline-color: var(--bone); }

/* ------------------------------------------------------------ footer */
.foot { border-top: 1px solid var(--line); padding: var(--s-6) 0 var(--s-7); }
.foot .wrap { display: grid; gap: var(--s-3); }
.foot p { max-width: 62ch; }
.foot-ask { max-width: 62ch; }
.foot-ask a { font-weight: 700; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.foot nav { display: flex; flex-wrap: wrap; gap: var(--s-4); }
.foot a { font-weight: 600; }

/* ------------------------------------------------------------ reveals */
html.js .reveal { opacity: 0; transform: translateY(10px); }
html.js .reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out);
}
@media (prefers-reduced-motion: reduce) {
  html.js .reveal { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------ 404 */
.empty-drawer { min-height: 70vh; display: grid; place-content: center; text-align: center; gap: var(--s-4); padding-block: var(--s-7); }
.empty-drawer h1 { font-family: var(--serif); font-weight: 800; font-size: clamp(2.2rem, 6vw, 4rem); }
.empty-drawer p { max-width: 44ch; margin-inline: auto; }
.empty-drawer nav { display: flex; gap: var(--s-4); justify-content: center; flex-wrap: wrap; }
.empty-drawer a { font-weight: 700; }

/* ------------------------------------------------------------ print stylesheet: the file prints as a catalog sheet */
@media print {
  .cabinet-head, .tab-row, .file-tabs, .bones, .skip { display: none; }
  .reveal, html.js .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .file { display: block; }
  .print { break-inside: avoid; border-bottom: 1px solid #000; }
  .print > a { border: 0; }
  .print-sheet { display: none; }
  .print-foot .lift { display: none; }
  /* on paper the link cannot be clicked, so the address is printed instead */
  .print > a::after { content: " " attr(href); font-size: 0.7rem; word-break: break-all; }
  body { background: #fff; color: #000; }
}
