:root {
  --ink: #1a1a1a;
  --ink-2: #3b3b3b;
  --mute: #6b6b6b;
  --faint: #9a9a9a;
  --line: #e3e3e3;
  --key: #efefef;
  --key-hover: #e4e4e4;
  --zebra: #fafafa;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  min-height: 100svh;
}
[hidden] { display: none !important; }
a { color: inherit; }
::selection { background: #1a1a1a; color: #fff; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: #c4c4c4 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c4c4c4; border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #9a9a9a; background-clip: content-box; }

#tissue {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  image-rendering: pixelated;
  z-index: 0;
  pointer-events: none;
}

/* ---------- home ---------- */
.home {
  position: relative; z-index: 1;
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 28px 16px 36px;
  gap: 10px;
}
.slide {
  width: min(660px, 100vw - 32px);
  height: min(440px, 54svh);
  position: relative;
}
.specimen {
  margin: 0;
  position: absolute; inset: 0;
  font-family: var(--mono);
  font-size: 7px;
  line-height: 7.5px;
  letter-spacing: 0;
  font-weight: 500;
  color: #141414;
  white-space: pre;
  overflow: hidden;
  user-select: none;
  cursor: grab;
  touch-action: pan-y;
}
.specimen.grab { cursor: grabbing; }

.caption {
  font-size: 8.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--mute);
  text-decoration: none;
  text-align: center;
  min-height: 12px;
  max-width: min(660px, 100vw - 32px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.caption:hover { color: var(--ink); }
.caption.in { animation: cap-in .9s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes cap-in { from { opacity: 0; transform: translateY(3px); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }

.block {
  width: min(318px, 100vw - 32px);
  margin-top: 6px;
}
.lede {
  margin: 0;
  font-size: 9.5px;
  line-height: 14px;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: #2a2a2a;
  text-align: justify;
  hyphens: none;
}
.lede b { font-weight: 600; color: var(--ink); }

.keys {
  display: flex; gap: 3px;
  margin-top: 12px;
}
.keys a {
  flex: 1;
  height: 19px;
  display: flex; align-items: center; justify-content: center;
  background: var(--key);
  border-radius: 2px;
  font-size: 7.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  color: #444;
  transition: background .15s, color .15s;
}
.keys a:hover { background: var(--key-hover); color: var(--ink); }

.open { margin-top: 10px; }
.open .row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 8px;
  padding: 3px 0;
  font-size: 7.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #555;
  text-decoration: none;
  border-top: 1px solid #f0f0f0;
}
.open .row:last-child { border-bottom: 1px solid #f0f0f0; }
.open .row span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.open .row:hover { color: var(--ink); background: #fafafa; }

/* ---------- inner pages ---------- */
.page {
  position: relative; z-index: 1;
  padding: 48px 16px 64px;
}
.page.enter .card { animation: card-in .5s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  width: min(720px, 100%);
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  padding: 30px 36px 26px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid #efefef;
  margin-bottom: 26px;
}
.wm { font-size: 12px; text-decoration: none; letter-spacing: .01em; }
.tabs { display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; }
.tab {
  height: 21px; padding: 0 12px;
  display: inline-flex; align-items: center;
  background: var(--key);
  border-radius: 2px;
  font-size: 9.5px;
  text-decoration: none;
  color: #555;
  transition: background .15s, color .15s;
}
.tab:hover { background: var(--key-hover); color: var(--ink); }
.tab.on { background: #d9d9d9; color: var(--ink); font-weight: 500; }

#content h1 { font-size: 13px; font-weight: 500; margin: 0 0 14px; letter-spacing: .01em; }
#content h2 { font-size: 12px; font-weight: 500; margin: 30px 0 10px; letter-spacing: .01em; }
#content p, #content td, .stages .t {
  font-size: 11px;
  line-height: 17.5px;
  color: var(--ink-2);
}
#content p { margin: 0 0 12px; text-align: justify; hyphens: auto; text-transform: lowercase; }
#content a { text-underline-offset: 2px; text-decoration-color: #bbb; }
#content a:hover { text-decoration-color: var(--ink); }

.kv { width: 100%; border-collapse: collapse; margin: 6px 0 4px; }
.kv td { padding: 6px 10px; vertical-align: top; text-align: left; text-transform: lowercase; }
.kv tr:nth-child(odd) td { background: var(--zebra); }
.kv td:first-child { width: 120px; color: var(--faint); white-space: nowrap; }
.kv a { text-transform: none; word-break: break-all; }

/* method diagram */
.figure {
  margin: 22px 0 8px;
  border: 1px solid #efefef;
  padding: 20px 10px;
  display: flex; justify-content: center;
  overflow-x: auto;
}
.diagram {
  margin: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 13px;
  color: #7a7a7a;
}
.diagram b { font-weight: 400; }
.diagram b.lit { color: var(--ink); }
.diagram b.inv { background: var(--ink); color: #fff; }

.stages { margin: 10px 0 6px; }
.st {
  display: grid;
  grid-template-columns: 28px 120px 1fr;
  gap: 10px;
  padding: 7px 10px;
  cursor: pointer;
  transition: background .25s;
}
.st:nth-child(odd) { background: var(--zebra); }
.st .n { font-size: 10px; color: var(--faint); line-height: 17.5px; }
.st .h { font-size: 11px; color: var(--mute); line-height: 17.5px; }
.st .t { text-transform: lowercase; text-align: justify; hyphens: auto; }
.st.on { background: #f0f0f0; }
.st.on .h, .st.on .n { color: var(--ink); }

/* models */
.model { margin: 22px 0 6px; }
.mhead { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.mname { font-size: 12px; font-weight: 500; }
.mmaker { font-size: 10px; color: var(--faint); }

/* competitions */
.filters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 20px 0 6px;
}
.flt {
  appearance: none; border: 1px solid #efefef; background: #fff;
  border-radius: 2px;
  padding: 6px 4px 7px;
  font: inherit; color: var(--mute);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: background .15s, border-color .15s, color .15s;
  min-width: 0;
}
.flt:hover { background: #fafafa; border-color: #e0e0e0; color: var(--ink); }
.flt[aria-pressed="true"] { background: #f0f0f0; border-color: #cfcfcf; color: var(--ink); }
.flt.txt { justify-content: flex-end; }
.flt.txt::before { content: ''; flex: 1; }
.mini {
  margin: 0;
  width: 100%; height: 92px;
  font-family: var(--mono);
  font-size: 5px; line-height: 5.3px;
  font-weight: 600;
  color: #111;
  overflow: hidden;
  white-space: pre;
  pointer-events: none;
}
.fl { font-size: 8px; line-height: 10px; text-align: center; min-height: 20px; display: flex; align-items: center; }
.fc { font-size: 8px; color: var(--faint); }
.flt-reset { margin-top: 6px; text-align: right; }
.flt-reset button { appearance: none; border: 0; background: none; font: inherit; font-size: 9.5px; color: var(--mute); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.grp { color: var(--mute); }
.comps { border-top: 1px solid #efefef; }
.comp { border-bottom: 1px solid #efefef; }
.comp summary {
  list-style: none;
  display: grid;
  grid-template-columns: 10px 1fr auto;
  grid-template-areas: "dot name prize" "dot stat stat";
  column-gap: 10px; row-gap: 2px;
  padding: 9px 8px;
  cursor: pointer;
  transition: background .15s;
}
.comp summary::-webkit-details-marker { display: none; }
.comp summary:hover { background: #fafafa; }
.comp[open] summary { background: #f5f5f5; }
.comp.hl summary { animation: hl 2.4s ease-out; }
@keyframes hl { 0%, 30% { background: #e6e6e6; } 100% { background: #f5f5f5; } }
.dot { grid-area: dot; width: 7px; height: 7px; margin-top: 5px; border: 1px solid #8a8a8a; border-radius: 50%; }
.dot.open { background: var(--ink); border-color: var(--ink); }
.dot.progress, .dot.judging { background: linear-gradient(90deg, #8a8a8a 50%, transparent 50%); }
.dot.unconfirmed { border-style: dashed; }
.cn { grid-area: name; font-size: 11px; line-height: 16px; text-transform: lowercase; }
.cp { grid-area: prize; font-size: 10.5px; line-height: 16px; color: var(--ink-2); white-space: nowrap; text-transform: lowercase; }
.cs { grid-area: stat; font-size: 9.5px; color: var(--faint); text-transform: lowercase; }
.comp .kv { margin: 0 0 10px; }
.note { margin-top: 22px !important; color: var(--faint) !important; font-size: 10px !important; }

.card-foot {
  margin-top: 34px; padding-top: 14px;
  border-top: 1px solid #efefef;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 9px; color: var(--faint);
}

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .slide { height: min(360px, 46svh); }
  .caption { white-space: normal; line-height: 13px; max-width: 300px; }
  .specimen { font-size: 6px; line-height: 6.4px; }
  .page { padding: 16px 16px 40px; }
  .card { padding: 20px 18px 18px; }
  .card-head { flex-direction: column; align-items: flex-start; }
  .tabs { justify-content: flex-start; }
  .tab { padding: 0 9px; }
  .filters { grid-template-columns: repeat(2, 1fr); }
  .st { grid-template-columns: 22px 1fr; }
  .st .t { grid-column: 1 / -1; }
  .kv td:first-child { width: 78px; }
  .comp summary { grid-template-columns: 10px 1fr; grid-template-areas: "dot name" "dot prize" "dot stat"; }
  .figure { justify-content: flex-start; }
  .diagram { font-size: 8.5px; line-height: 10.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
