/* Invisible Fund. One printed plate per section: full width bands, one 1120 column, flat ink.
   Every colour, every pitch and every ratio is measured off art/ref/poster.jpg (NOTE.md > teardown). */

@font-face { font-family: "Panchang"; src: url("/fonts/panchang-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Panchang"; src: url("/fonts/panchang-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("/fonts/plex-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("/fonts/plex-mono-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --green: #114a0e;          /* his ground, 39.3% of the reference frame */
  --green-deep: #0c3a0a;
  --green-line: #2d6426;     /* hairline on green */
  --mint: #c4d8c2;           /* his panel, 25.9% */
  --mint-line: #8ea58c;
  --paper: #f5f5f3;          /* his white ink, 9.4:1 on the ground */
  --paper-dim: #9ebd9b;      /* 5.1:1 on the ground */
  --ink: #06120a;            /* ink on the mint panel, 12.9:1 */
  --ink-dim: #41553f;        /* 5.3:1 on the mint */
  --acid: #9ace96;           /* his lit keystone, 5.8:1 on the ground */

  --display: "Panchang", "Trebuchet MS", sans-serif;
  --mono: "Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --t-xs: 14px; --t-s: 15px; --t-m: 17px; --t-l: 22px; --t-xl: 28px;
  --t-display: clamp(28px, 7.2vw, 68px);

  --page: 1120px;
  --rail: 236px;
  --pad: 32px;
  --s1: 8px; --s2: 14px; --s3: 22px; --s4: 34px; --s5: 56px;
  --track: 0.11em;
}

* { box-sizing: border-box; }
html { background: var(--green); }
body {
  margin: 0;
  background: var(--green);
  color: var(--paper);
  font-family: var(--mono);
  font-size: var(--t-s);
  line-height: 1.6;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
.ground {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: url("/img/grid-tile.png") repeat top left;
  opacity: 0.55;
}
p, ul, ol, h1, table, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }

/* ---------------------------------------------------------------- the sheet */
.sheet {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 44px;
  width: min(1420px, 100% - 64px);
  margin: 0 auto;
  padding: 44px 0 72px;
  align-items: start;
}
.plate { max-width: var(--page); width: 100%; }

/* ---------------------------------------------------------------- the rail */
.rail { position: sticky; top: 44px; }
.rail-head {
  font-size: var(--t-xs); letter-spacing: var(--track); text-transform: uppercase;
  color: var(--paper-dim);
}
.rail-head { padding: 10px 18px 12px; border-bottom: 1px solid var(--green-line); }

.rail-list { margin: 0; }
.rail-row {
  display: grid; grid-template-columns: 46px 1fr; align-items: center; gap: 12px;
  min-height: 52px; padding: 11px 18px;
  border-bottom: 1px solid var(--green-line);
  color: var(--paper); text-decoration: none;
  font-size: var(--t-xs); letter-spacing: var(--track); text-transform: uppercase;
  transition: background 0.12s linear, color 0.12s linear;
}
.rail-row .rn { color: var(--paper-dim); font-variant-numeric: tabular-nums; }
.rail-row:hover { background: #17591340; }
.rail-row[aria-current="page"] { background: var(--mint); color: var(--ink); }
.rail-row[aria-current="page"] .rn { color: var(--ink-dim); }
.rail-row:focus-visible, .key:focus-visible, .input:focus-visible, a:focus-visible, button:focus-visible {
  outline: 2px solid var(--acid); outline-offset: 2px;
}

/* ---------------------------------------------------------------- meta line */
.meta {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3);
  font-size: var(--t-xs); letter-spacing: var(--track); text-transform: uppercase;
  padding-bottom: var(--s3);
}
.meta-k { color: var(--paper-dim); display: block; }
.meta-v { color: var(--paper); display: block; }
.meta-n { color: var(--paper); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- the field */
.field { display: block; }
#field { display: block; width: 100%; height: 300px; }
.field-legend {
  display: flex; flex-wrap: wrap; gap: var(--s3);
  padding-top: var(--s2);
  font-size: var(--t-xs); color: var(--paper-dim); letter-spacing: 0.04em;
}
.lg { display: inline-flex; align-items: center; gap: 9px; }
.lg-r { margin-left: auto; color: var(--paper); }
.sw { width: 12px; height: 12px; display: inline-block; }
.sw-on { background: var(--acid); }
.sw-tick { background: var(--paper-dim); width: 6px; height: 6px; margin: 0 3px; }

/* ---------------------------------------------------------------- headline */
.display {
  font-family: var(--display); font-weight: 800;
  font-size: var(--t-display); line-height: 0.95; letter-spacing: -0.005em;
  text-transform: uppercase; word-spacing: 0.06em;
  padding: var(--s4) 0 var(--s3);
  color: var(--paper);
}
.rule { border: 0; border-top: 1px solid var(--paper); margin: 0; }
.rule-ink { border-top-color: var(--mint-line); margin: var(--s4) 0 var(--s3); }
.undertitle {
  display: flex; justify-content: space-between; gap: var(--s3);
  padding-top: var(--s2);
  font-size: var(--t-xs); letter-spacing: var(--track); text-transform: uppercase; color: var(--paper-dim);
}
.undertitle-r { color: var(--paper); white-space: nowrap; }

/* ---------------------------------------------------------------- mint panel */
.panel {
  background: var(--mint); color: var(--ink);
  margin-top: var(--s4);
  padding: var(--pad);
}
.panel-in { display: block; }
.c-l {
  font-size: var(--t-xs); letter-spacing: var(--track); text-transform: uppercase;
  color: var(--ink-dim);
}
.c-v {
  font-family: var(--display); font-weight: 700; font-size: var(--t-xl); line-height: 1.1;
  padding-top: var(--s2); color: var(--ink); font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.c-s { padding-top: var(--s1); font-size: var(--t-xs); color: var(--ink-dim); line-height: 1.55; }

.grid2 {
  display: grid; grid-template-columns: 1fr 1fr;
  border: 1px solid var(--mint-line);
}
.cell {
  padding: var(--s3) 28px var(--s4);
  border-right: 1px solid var(--mint-line);
  border-bottom: 1px solid var(--mint-line);
  min-height: 150px;
}
.grid2 .cell:nth-child(2n) { border-right: 0; }
.grid2 .cell:nth-last-child(1), .grid2 .cell:nth-last-child(2):nth-child(2n+1) { border-bottom: 0; }

.note {
  margin-top: var(--s3); padding: var(--s3);
  border: 1px solid var(--mint-line);
  font-size: var(--t-s); line-height: 1.6; color: var(--ink);
}
.stack { display: grid; gap: var(--s3); }
.stack:not(:empty) { padding-top: var(--s3); }

/* ---------------------------------------------------------------- week block (keys, split, mine) */
.wk { border: 1px solid var(--mint-line); }
.wk-head {
  display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: space-between; align-items: baseline;
  padding: var(--s3);
  border-bottom: 1px solid var(--mint-line);
}
.wk-n { font-family: var(--display); font-weight: 700; font-size: var(--t-l); text-transform: uppercase; }
.wk-dates { font-size: var(--t-xs); letter-spacing: var(--track); text-transform: uppercase; color: var(--ink-dim); }
.wk-rows { display: grid; grid-template-columns: 1fr 1fr; }
.wk-row { padding: var(--s3) 28px; border-right: 1px solid var(--mint-line); border-bottom: 1px solid var(--mint-line); }
.wk-rows .wk-row:nth-child(2n) { border-right: 0; }
.wk-rows .wk-row:nth-last-child(1), .wk-rows .wk-row:nth-last-child(2):nth-child(2n+1) { border-bottom: 0; }
.wk-key { padding: var(--s3); border-bottom: 1px solid var(--mint-line); }
.wk-key:last-child { border-bottom: 0; }
.keyline {
  display: flex; flex-wrap: wrap; gap: var(--s2); align-items: stretch; margin-top: var(--s2);
}
.keyval {
  flex: 1 1 180px; min-width: 0; max-width: 100%;
  padding: 12px var(--s3);
  border: 1px solid var(--mint-line); background: #d2e3d0;
  font-size: var(--t-xs); line-height: 1.6; color: var(--ink);
  overflow-wrap: anywhere; user-select: all;
}
.sig { font-size: var(--t-xs); color: var(--ink-dim); overflow-wrap: anywhere; }
.sig a { color: var(--ink); text-underline-offset: 3px; }

/* ---------------------------------------------------------------- steps, moves */
.check { margin-top: var(--s3); padding: var(--s3); border: 1px solid var(--mint-line); }
.steps { display: grid; gap: var(--s2); padding-top: var(--s2); }
.steps li { display: grid; grid-template-columns: 34px 1fr; gap: var(--s2); align-items: start; }
.st-n {
  font-family: var(--display); font-weight: 700; font-size: var(--t-m);
  background: var(--ink); color: var(--mint); text-align: center; line-height: 34px; height: 34px;
}
.st-t { font-size: var(--t-s); line-height: 1.6; }

.moves { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--mint-line); }
.move { padding: var(--s3); border-right: 1px solid var(--mint-line); }
.move:last-child { border-right: 0; }
.move-art { display: block; width: 100%; height: auto; margin-bottom: var(--s3); }
.m-t { padding-top: var(--s2); font-size: var(--t-s); line-height: 1.6; }

.seen { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--mint-line); border-top: 0; }
.seen-col { padding: var(--s3); border-right: 1px solid var(--mint-line); }
.seen-col:last-child { border-right: 0; }
.bul { display: grid; gap: var(--s1); padding-top: var(--s2); }
.bul li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; font-size: var(--t-s); line-height: 1.6; }
.bul li::before { content: ""; width: 9px; height: 9px; background: var(--ink); margin-top: 8px; }

/* ---------------------------------------------------------------- table */
.table { width: 100%; border-collapse: collapse; }
.table caption { text-align: left; padding-bottom: var(--s2); }
.table th, .table td {
  text-align: left; padding: var(--s3); border: 1px solid var(--mint-line);
  font-size: var(--t-s); line-height: 1.5;
}
.table th { font-size: var(--t-xs); letter-spacing: var(--track); text-transform: uppercase; color: var(--ink-dim); font-weight: 400; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .pct { font-family: var(--display); font-weight: 700; font-size: var(--t-l); }

/* ---------------------------------------------------------------- form */
.form { padding: var(--s3); border: 1px solid var(--mint-line); }
.form-row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; padding-top: var(--s2); }
.field-label {
  font-size: var(--t-xs); letter-spacing: var(--track); text-transform: uppercase; color: var(--ink-dim);
  align-self: center;
}
.input {
  flex: 0 1 240px; min-width: 0; height: 48px;
  padding: 0 18px; border: 1px solid var(--ink); background: #d2e3d0; color: var(--ink);
  font-family: var(--display); font-weight: 700; font-size: var(--t-l);
  font-variant-numeric: tabular-nums;
}
.state { padding-top: var(--s2); font-size: var(--t-s); line-height: 1.6; color: var(--ink); min-height: 24px; }
.state[data-tone="bad"] { color: #6c1b12; }
.state[data-tone="good"] { color: #184f12; }

/* ---------------------------------------------------------------- keys (buttons) */
.key {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
  font-family: var(--mono); font-size: var(--t-xs); letter-spacing: var(--track); text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  transition: transform 0.08s linear, background 0.12s linear, color 0.12s linear;
}
.key:hover { background: var(--ink); color: var(--mint); }
.key:active { transform: translateY(1px); }
.key-primary { background: var(--ink); color: var(--mint); }
.key-primary:hover { background: #163a13; }
.key-wide { min-width: 190px; }
.key[disabled], .key[aria-disabled="true"] { opacity: 0.74; cursor: default; pointer-events: none; }
.key.key-primary[disabled] { background: transparent; color: var(--ink-dim); border-color: var(--ink-dim); opacity: 1; }
.key-link img { width: 22px; height: 22px; object-fit: contain; }

/* ---------------------------------------------------------------- imprint */
.imprint { display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: space-between; align-items: baseline; }
.statement { font-size: var(--t-s); color: var(--ink); }
.statement-dim { color: var(--ink-dim); padding-top: 4px; }
.wordmark { font-family: var(--display); font-weight: 800; font-size: var(--t-l); color: var(--ink); white-space: nowrap; }
.mintrow {
  margin-top: var(--s3); padding: var(--s3);
  border: 1px solid var(--mint-line);
}
.mintline { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: stretch; margin-top: var(--s2); }
.mint { flex: 1 1 200px; }
.mint {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center;
  padding: 12px var(--s3);
  border: 1px solid var(--mint-line); background: #d2e3d0;
  font-size: var(--t-m); line-height: 1.45; color: var(--ink);
  overflow-wrap: anywhere; user-select: all;
}
.links { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); margin-top: var(--s2); }
.links .key { width: 100%; }

/* ---------------------------------------------------------------- widths */
@media (max-width: 1239px) {
  .sheet { grid-template-columns: minmax(0, 1fr); gap: var(--s4); width: min(1120px, 100% - 48px); }
  .rail { position: static; display: grid; gap: var(--s2); }
  .rail-head { border-bottom: 0; padding-bottom: 0; }
  .rail-list { display: grid; grid-template-columns: repeat(6, 1fr); border-top: 1px solid var(--green-line); }
  .rail-row { grid-template-columns: 1fr; gap: 2px; justify-items: start; align-content: center; border-bottom: 0; border-right: 1px solid var(--green-line); }
  .rail-list li:last-child .rail-row { border-right: 0; }
  .rail-foot { padding-top: 0; }
}
@media (max-width: 900px) {
  .moves { grid-template-columns: 1fr 1fr; }
  .move:nth-child(2n) { border-right: 0; }
  .move:nth-child(-n+2) { border-bottom: 1px solid var(--mint-line); }
  #field { height: 240px; }
}
@media (max-width: 760px) {
  :root { --pad: 20px; --t-xl: 24px; }
  .field-legend { display: grid; gap: var(--s1); }
  .lg-r { margin-left: 0; }
  .undertitle { flex-direction: column; gap: 4px; }
  .table, .table tbody, .table tr, .table th, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr { border: 1px solid var(--mint-line); margin-top: -1px; padding: var(--s3); }
  .table th, .table td { border: 0; padding: 0; }
  .table .pct { padding-bottom: var(--s1); }
  .table .num { text-align: left; padding-top: var(--s2); }
  .sheet { width: min(100% - 32px, 760px); padding: 24px 0 48px; gap: var(--s3); }
  .rail-list { grid-template-columns: 1fr 1fr; }
  .rail-row { grid-template-columns: auto 1fr; gap: 10px; align-items: center; justify-items: start; min-height: 48px; }
  .rail-list li:nth-child(2n) .rail-row { border-right: 0; }
  .rail-list li:nth-child(-n+4) .rail-row { border-bottom: 1px solid var(--green-line); }
  .grid2, .wk-rows, .seen { grid-template-columns: 1fr; }
  .cell, .wk-row { padding: 20px 24px 26px; }
  .cell, .wk-row, .seen-col { border-right: 0; }
  .grid2 .cell:nth-last-child(2):nth-child(2n+1) { border-bottom: 1px solid var(--mint-line); }
  .seen-col:first-child { border-bottom: 1px solid var(--mint-line); }
  .moves { grid-template-columns: 1fr; }
  .move { border-right: 0; border-bottom: 1px solid var(--mint-line); }
  .move:last-child { border-bottom: 0; }
  .move-art { max-width: 180px; }
  .links { grid-template-columns: 1fr 1fr; }
  .mintrow { grid-template-columns: 1fr; }
  .mintrow .key-copy { justify-self: start; }
  #field { height: 260px; }
  .display { padding-top: var(--s3); }
}
@media (max-width: 400px) {
  .sheet { width: min(100% - 24px, 400px); }
  .rail-list { grid-template-columns: 1fr 1fr; }
  /* the number over the name: six rows of one height, so the block stays square at 320 */
  .rail-row { grid-template-columns: 1fr; gap: 2px; min-height: 62px; align-content: center; }
  .rail-row .rname { white-space: nowrap; }
  .links { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
