/*
  Dokpa Garment, Kathmandu Workroom study.
  Documentary newsprint. Warm cream stock, ink black, one vermilion accent.
  Shared by index.html, contact-sheet.html, garment-notes.html, visit.html.

  Deliberately unlike the Himalayan Craft study in this repo: greyer pulp
  cream instead of golden paper, slab plus grotesque instead of Fraunces over
  Karla, a fixed contact sheet grid instead of magazine compositions, and a
  caption led hierarchy rather than a headline led one.
*/

:root {
  --stock: #e7dfcb;
  --stock-deep: #dbd2b8;
  --plate: #fbf8f0;
  --ink: #16130e;
  --ink-soft: #4f4a3e;
  --rule: #b8ae95;
  --rule-fine: #ccc3aa;
  --vermilion: #cf3a12;
  --vermilion-deep: #a52c08;

  --slab: "Zilla Slab", Rockwell, Georgia, serif;
  --grot: "Barlow", "Helvetica Neue", Arial, sans-serif;

  /* The React reference container is max-w-screen-2xl, 1536px, with 20px
     side padding. This sheet is narrower so three proof frames land at a
     readable caption measure instead of five thin ones. */
  --sheet: min(94vw, 1360px);
  --plate-h: 340px;

  --s1: 0.4rem;
  --s2: 0.8rem;
  --s3: 1.3rem;
  --s4: 2rem;
  --s5: 3rem;
  --s6: 4.5rem;
  --s7: 6.5rem;
}

* { box-sizing: border-box; }

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--stock);
  color: var(--ink);
  font-family: var(--grot);
  font-size: 1.0625rem;
  line-height: 1.62;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

p { margin: 0 0 var(--s3); }

h1, h2, h3, h4 {
  font-family: var(--slab);
  font-weight: 700;
  line-height: 1.06;
  margin: 0 0 var(--s2);
  letter-spacing: -0.005em;
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--s5) 0;
}

.sheet {
  width: var(--sheet);
  margin-inline: auto;
}

.measure { max-width: 74ch; }
.measure-tight { max-width: 58ch; }

/* ---------- skip link ---------- */

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 200;
  background: var(--ink);
  color: var(--stock);
  padding: 0.7rem 1.1rem;
  font-family: var(--grot);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

.skip-link:focus { top: 0.75rem; }

/* ---------- focus, never removed without a replacement ---------- */

a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--vermilion);
  outline-offset: 2px;
}

/* Scoped so it cannot reach keyboard focus: a click into main loses the ring,
   a skip link landing on it never does. */
main:focus:not(:focus-visible) { outline: none; }
main:focus-visible { outline: 3px solid var(--vermilion); outline-offset: -3px; }

/* ---------- study stamp ---------- */

.stamp {
  background: var(--ink);
  color: var(--stock);
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  line-height: 1.5;
  padding: 0.55rem 0;
}

.stamp .sheet {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  align-items: baseline;
}

.stamp b {
  color: var(--stock);
  background: var(--vermilion);
  padding: 0.1rem 0.45rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- masthead and nav ---------- */

.masthead {
  border-bottom: 3px solid var(--ink);
  padding-top: var(--s3);
}

.masthead__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s3);
  padding-bottom: var(--s2);
}

.wordmark {
  text-decoration: none;
  display: block;
}

.wordmark__name {
  display: block;
  font-family: var(--slab);
  font-weight: 700;
  font-size: clamp(1.9rem, 4.6vw, 2.7rem);
  letter-spacing: 0.16em;
  line-height: 0.95;
}

.wordmark__sub {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.nav-toggle {
  display: none;
  font-family: var(--grot);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: var(--stock);
  color: var(--ink);
  border: 2px solid var(--ink);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
}

.sitenav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  border-top: 1px solid var(--rule);
}

.sitenav li { flex: 0 0 auto; }

.sitenav a {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  text-decoration: none;
  padding: 0.7rem 1.4rem 0.7rem 0;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.sitenav a:hover { color: var(--vermilion-deep); }

.sitenav__no {
  font-family: var(--slab);
  font-size: 0.75rem;
  color: var(--vermilion-deep);
  letter-spacing: 0.04em;
}

.sitenav a[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -4px 0 0 var(--vermilion);
}

/* ---------- page furniture ---------- */

main { display: block; }

.band { padding: var(--s6) 0; }
.band--tight { padding: var(--s5) 0; }
.band--ink { background: var(--ink); color: var(--stock); }
.band--ink h2, .band--ink h3 { color: var(--stock); }
.band + .band { border-top: 1px solid var(--rule); }
.band--ink + .band { border-top: 0; }

.eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--vermilion-deep);
  margin: 0 0 var(--s2);
}

.band--ink .eyebrow { color: var(--vermilion); }

.page-title {
  font-size: clamp(2.3rem, 6.6vw, 4.1rem);
  line-height: 0.98;
  margin-bottom: var(--s3);
}

.standfirst {
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 66ch;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  border-bottom: 2px solid var(--ink);
  padding-bottom: var(--s2);
  margin-bottom: var(--s4);
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: clamp(1.5rem, 3.2vw, 2.25rem);
  margin: 0;
}

.section-head .tally {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- the contact sheet grid ---------- */

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s4) var(--s3);
}

.frame {
  display: flex;
  flex-direction: column;
}

.frame[hidden] { display: none; }

.frame__plate {
  border: 1px solid var(--ink);
  background: var(--plate);
  padding: 10px 10px 0;
}

.frame__shot {
  height: var(--plate-h);
  background: var(--stock-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.frame__shot img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}

/* The reference pins a solid label bar over the bottom of each tile image.
   Here the bar sits below the picture instead, so no part of the photograph
   is covered. */
.frame__bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2);
  margin: 10px -10px 0;
  padding: 0.45rem 0.7rem;
  background: var(--ink);
  color: var(--stock);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.frame__no { color: var(--vermilion); font-family: var(--slab); letter-spacing: 0.08em; }

.frame__caption { padding-top: var(--s2); }

.frame__caption h3 {
  font-size: 1.3125rem;
  margin: 0 0 0.45rem;
}

.frame__caption p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.58;
  color: var(--ink-soft);
}

.frame__file {
  margin: 0.6rem 0 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  border-top: 1px solid var(--rule-fine);
  padding-top: 0.4rem;
}

/* ---------- evidence disclosure ---------- */

.evidence {
  margin-top: var(--s2);
  border-top: 1px solid var(--rule-fine);
}

.evidence > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--vermilion-deep);
}

.evidence > summary::-webkit-details-marker { display: none; }

.evidence > summary::after {
  content: "+";
  font-family: var(--slab);
  font-size: 1.25rem;
  line-height: 1;
  color: var(--ink);
}

.evidence[open] > summary::after { content: "x"; font-size: 1rem; }

.ev-list {
  list-style: none;
  margin: 0 0 0.7rem;
  padding: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.ev-list li {
  padding: 0.4rem 0;
  border-top: 1px dotted var(--rule-fine);
}

.ev-tag {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.05rem 0.4rem;
  background: var(--ink);
  color: var(--stock);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.ev-tag--flag { background: var(--vermilion); }
.ev-tag--none { background: transparent; color: var(--ink-soft); border: 1px solid var(--rule); }

/* ---------- filter controls ---------- */

.controls {
  border: 2px solid var(--ink);
  padding: var(--s3);
  margin-bottom: var(--s4);
  background: var(--plate);
}

.no-js .controls { display: none; }
.js .controls-fallback { display: none; }

.controls-fallback {
  border: 2px solid var(--ink);
  padding: var(--s3);
  margin-bottom: var(--s4);
  background: var(--plate);
  font-size: 0.9375rem;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--rule-fine);
}

.control-row:first-of-type { border-top: 0; padding-top: 0; }

.control-row > .control-label {
  flex: 0 0 8.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.filter-btn {
  font-family: var(--grot);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  background: var(--stock);
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 0.35rem 0.8rem;
  cursor: pointer;
}

.filter-btn:hover { background: var(--stock-deep); }

.filter-btn[aria-pressed="true"] {
  background: var(--vermilion);
  border-color: var(--vermilion);
  color: var(--plate);
}

.tally-live {
  margin: var(--s3) 0 0;
  padding-top: var(--s2);
  border-top: 2px solid var(--ink);
  font-family: var(--slab);
  font-size: 1.125rem;
  font-weight: 600;
}

.tally-live b { color: var(--vermilion-deep); }

.sheet-empty {
  border: 1px dashed var(--rule);
  padding: var(--s4);
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- surface tiles ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s3);
}

.tile {
  display: block;
  text-decoration: none;
  border: 1px solid var(--ink);
  background: var(--plate);
  padding: 10px 10px 0;
}

.tile:hover .tile__bar { background: var(--vermilion); }

.tile__shot {
  height: 220px;
  background: var(--stock-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.tile__shot img { width: auto; height: auto; max-width: 100%; max-height: 100%; }

.tile__bar {
  display: block;
  margin: 10px -10px 0;
  padding: 0.6rem 0.7rem;
  background: var(--ink);
  color: var(--stock);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tile__note {
  display: block;
  margin: 0;
  padding: 0.7rem 0 0.9rem;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

/* ---------- garment notes ---------- */

.note {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--s4);
  align-items: start;
  padding: var(--s5) 0;
  border-top: 1px solid var(--rule);
}

.note:first-of-type { border-top: 0; padding-top: var(--s2); }

.note__index {
  font-family: var(--slab);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--vermilion-deep);
  margin: 0 0 0.4rem;
}

.note h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin-bottom: var(--s2);
}

.note ul.plain {
  list-style: none;
  margin: 0 0 var(--s3);
  padding: 0;
}

.note ul.plain li {
  padding: 0.5rem 0;
  border-top: 1px solid var(--rule-fine);
  font-size: 1rem;
}

.note ul.plain li:first-child { border-top: 2px solid var(--ink); }

/* ---------- key / data rows ---------- */

.rows {
  border-top: 2px solid var(--ink);
  margin: var(--s3) 0 0;
}

.rows > div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule-fine);
}

.rows dt, .rows .k {
  flex: 0 0 12rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0;
}

.rows dd, .rows .v { margin: 0; flex: 1 1 16rem; }

.band--ink .rows { border-top-color: var(--stock); }
.band--ink .rows > div { border-bottom-color: rgba(231, 223, 203, 0.25); }
.band--ink .rows dt, .band--ink .rows .k { color: var(--stock-deep); }

/* ---------- conflict block ---------- */

.conflict {
  border: 2px solid var(--vermilion);
  padding: var(--s3) var(--s4);
  background: var(--plate);
}

.conflict h2, .conflict h3 { color: var(--vermilion-deep); margin-bottom: var(--s2); }
.conflict p:last-child { margin-bottom: 0; }

.band--ink .conflict { background: transparent; }
.band--ink .conflict h2, .band--ink .conflict h3 { color: var(--vermilion); }

/* ---------- buttons and links ---------- */

.linkrow {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-top: var(--s3);
}

.btn {
  display: inline-block;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.75rem 1.4rem;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--stock);
}

.btn--ghost { background: transparent; color: var(--ink); }
.btn:hover { background: var(--vermilion); border-color: var(--vermilion); color: var(--plate); }

.band--ink .btn { background: var(--stock); color: var(--ink); border-color: var(--stock); }
.band--ink .btn--ghost { background: transparent; color: var(--stock); }

.inline-link { color: var(--vermilion-deep); text-underline-offset: 3px; }
.band--ink .inline-link { color: var(--stock); }

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

.site-footer {
  border-top: 3px solid var(--ink);
  padding: var(--s5) 0 var(--s4);
  font-size: 0.9375rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s4);
}

.site-footer h2 {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--vermilion-deep);
  font-family: var(--grot);
  margin-bottom: var(--s2);
}

.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { padding: 0.2rem 0; }

.colophon {
  margin: var(--s4) 0 0;
  padding-top: var(--s2);
  border-top: 1px solid var(--rule);
  font-size: 0.8125rem;
  color: var(--ink-soft);
  max-width: 88ch;
}

/* ---------- fail safe reveals ---------- */

.js .reveal { opacity: 0; transform: translateY(16px); }

.js .reveal.in {
  opacity: 1;
  transform: none;
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.js .sheet-grid > .reveal:nth-child(3n + 2).in { transition-delay: 0.07s; }
.js .sheet-grid > .reveal:nth-child(3n + 3).in { transition-delay: 0.14s; }

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

@media (max-width: 1040px) {
  .sheet-grid { grid-template-columns: repeat(2, 1fr); }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  :root { --plate-h: 300px; }
}

@media (max-width: 760px) {
  :root { --plate-h: 260px; }

  .nav-toggle { display: inline-block; }

  .js .sitenav { display: none; }
  .js .sitenav.is-open { display: block; }

  .sitenav ul { display: block; border-top: 0; }

  .sitenav a {
    padding: 0.85rem 0;
    border-top: 1px solid var(--rule);
  }

  .sheet-grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .note { grid-template-columns: 1fr; gap: var(--s3); }
  .rows dt, .rows .k { flex: 1 1 100%; }
  .control-row > .control-label { flex: 1 1 100%; }
  .band { padding: var(--s5) 0; }
}

@media (max-width: 380px) {
  :root { --sheet: 92vw; --plate-h: 230px; }
  body { font-size: 1rem; }
  .wordmark__name { letter-spacing: 0.1em; }
  .conflict { padding: var(--s3); }
  .filter-btn { font-size: 0.8125rem; padding: 0.35rem 0.6rem; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .js .reveal,
  .js .reveal.in {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .js .sheet-grid > .reveal:nth-child(3n + 2).in,
  .js .sheet-grid > .reveal:nth-child(3n + 3).in { transition-delay: 0s; }

  * { scroll-behavior: auto; }
}
