/* The Economics of Catan: site styles, in the language of the home page's stage.
   Near-black ground, a serif for the author's voice, mono for the machine's,
   and amber as this act's light. */

:root {
  --ground: #050607;
  --panel: #0b0d10;
  --panel-2: #101317;
  --ink: #ecebe4;
  --ink-2: #c9c8bf;
  --dim: #92978f;
  --faint: #7b807a;
  --rule: #1f2328;
  --rule-2: #2a2f35;
  --star: #cfe0f2;
  --light: #e3b25b;
  --light-14: color-mix(in srgb, var(--light) 14%, transparent);
  --light-25: color-mix(in srgb, var(--light) 25%, transparent);
  --light-55: color-mix(in srgb, var(--light) 55%, transparent);
  --wood: #199e70; --brick: #d95926; --sheep: #9085e9; --wheat: #c98500; --ore: #3987e5;
  --serif: Newsreader, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-sys: clamp(0.7rem, 0.62rem + 0.25vmin, 0.8rem);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 64px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 1.1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-bottom: 5rem;
}
.paper { max-width: 58rem; margin: 0 auto; }
.col { max-width: 41rem; margin-inline: auto; }

a { color: var(--light); text-underline-offset: 4px; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--light); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 30; padding: 6px 10px; background: var(--panel); border: 1px solid var(--rule-2); font-family: var(--mono); font-size: .8rem; }
.skip:focus { left: 8px; }

/* The HUD: name mark left, the publication's parts right. */
.site-bar {
  position: sticky; top: 0; z-index: 20;
  margin: 0 calc(-1 * max(16px, env(safe-area-inset-left, 0px))) 0 calc(-1 * max(16px, env(safe-area-inset-right, 0px)));
  padding: 0 max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(to bottom, var(--ground) 0%, color-mix(in srgb, var(--ground) 86%, transparent) 70%, transparent 100%);
  font-family: var(--mono); font-size: .72rem; letter-spacing: .06em;
}
.site-bar .in { max-width: 58rem; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 52px; }
.site-bar .who { color: var(--dim); text-decoration: none; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; }
.site-bar .who:hover { color: var(--ink); }
.site-bar .who span { color: var(--faint); }
.site-bar nav { display: flex; }
.site-bar nav a { color: var(--faint); text-decoration: none; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; padding: 0 .5rem; letter-spacing: .08em; }
.site-bar nav a:hover { color: var(--ink); }
.site-bar nav a[aria-current="page"] { color: var(--light); }
@media (max-width: 560px) { .site-bar .who span { display: none; } .site-bar nav a { padding: 0 .35rem; font-size: .68rem; } }

/* Title block, with the board drawn in thin lines of light behind it */
header.title { position: relative; padding-block: 4.5rem 2rem; border-bottom: 1px solid var(--rule); margin-bottom: 2.5rem; }
header.title .hexboard { display: block; width: 7.5rem; height: auto; margin: 0 0 1.4rem; pointer-events: none; opacity: .75; }
header.title .hexboard polygon { fill: none; stroke: var(--light); stroke-width: 1; opacity: .34; }
header.title .hexboard circle { fill: var(--light); opacity: .8; }
header.title .hexboard .glow { fill: var(--light); opacity: .05; }
/* Wide screens: the words on the left, the board in its own column on the right */
@media (min-width: 900px) {
  header.title.col { max-width: 58rem; display: grid; grid-template-columns: minmax(0, 1fr) clamp(11rem, 24vw, 15rem); column-gap: clamp(2rem, 5vw, 4rem); align-items: center; }
  header.title > :not(.hexboard) { grid-column: 1; }
  header.title .hexboard { grid-column: 2; grid-row: 1 / span 5; width: 100%; margin: 0; opacity: .9; }
}
.kicker { font-family: var(--mono); font-size: var(--fs-sys); letter-spacing: .08em; color: var(--light); margin: 0 0 1rem; }
h1 { font-family: var(--serif); font-weight: 300; font-size: clamp(2.3rem, 1rem + 5vmin, 4.2rem); line-height: 1.02; letter-spacing: -.015em; margin: 0 0 .9rem; text-wrap: balance; max-width: 14ch; position: relative; }
.subtitle { font-size: clamp(1.15rem, .9rem + 1vmin, 1.5rem); line-height: 1.3; font-weight: 340; font-style: italic; color: var(--ink-2); margin: 0 0 1.2rem; max-width: 34ch; text-wrap: balance; position: relative; }
.byline { font-family: var(--mono); font-size: var(--fs-sys); letter-spacing: .06em; color: var(--dim); margin: 0; position: relative; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; position: relative; }
.btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 1.15rem; border-radius: 999px;
  font-family: var(--mono); font-size: calc(var(--fs-sys) * 1.05); letter-spacing: .06em; text-decoration: none;
  background: transparent; color: var(--ink); border: 1px solid var(--light-55);
  transition: background-color .25s ease, border-color .25s ease;
}
.btn:hover, .btn:focus-visible { background: var(--light-14); border-color: var(--light); color: var(--ink); }
.btn.primary { background: var(--light-14); border-color: var(--light); }

h2 { font-family: var(--serif); font-weight: 320; font-size: clamp(1.6rem, 1rem + 2vmin, 2.3rem); line-height: 1.12; letter-spacing: -.012em; margin: 3.2rem 0 .8rem; text-wrap: balance; }
h2 .n { font-family: var(--mono); font-size: .8rem; font-weight: 400; color: var(--light); letter-spacing: .08em; margin-right: .6rem; vertical-align: .35em; }
h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.2rem, 1rem + 1vmin, 1.45rem); line-height: 1.25; margin: 2rem 0 .5rem; text-wrap: balance; }
h4 { font-family: var(--mono); font-weight: 400; font-size: var(--fs-sys); letter-spacing: .08em; color: var(--light); margin: 1.5rem 0 .5rem; }
p { margin: 0 0 1rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.3rem; }
li { margin-bottom: .45rem; }
strong, b { font-weight: 500; color: var(--ink); }
em, i { font-style: italic; }
.note { font-size: .95rem; color: var(--dim); }
.wb { font-family: var(--mono); font-size: var(--fs-sys); letter-spacing: .04em; color: var(--faint); }
sub { font-size: .75em; }

.abstract { background: rgba(5, 6, 7, .8); border: 1px solid var(--light-25); border-radius: 2px; padding: 1.2rem 1.4rem; margin-bottom: 1.5rem; }
.abstract h2 { margin: 0 0 .5rem; font-family: var(--mono); font-weight: 400; font-size: var(--fs-sys); letter-spacing: .12em; color: var(--light); }
.abstract p:last-child { margin-bottom: 0; }
.takeaway { border-left: 1px solid var(--light); padding: .3rem 0 .3rem 1rem; margin: 0 0 1.25rem; color: var(--ink-2); }
.takeaway b { font-family: var(--mono); font-weight: 400; letter-spacing: .1em; font-size: var(--fs-sys); color: var(--light); display: block; margin-bottom: .25rem; }

/* Lists with a tick of light, as on the stage */
.findings { list-style: none; margin: 0 0 1.2rem; padding: 0; display: grid; gap: .7em; }
.findings li { position: relative; padding-left: 1.2em; margin: 0; color: var(--ink-2); }
.findings li::before { content: ""; position: absolute; left: 0; top: .72em; width: .5em; height: 1px; background: var(--light); }
.findings li b { color: var(--ink); font-weight: 500; }
ol.findings { counter-reset: f; }
ol.findings li::before { content: counter(f); counter-increment: f; width: auto; height: auto; top: .18em; background: none; font-family: var(--mono); font-size: .72rem; color: var(--light); letter-spacing: .06em; }
ol.findings li { padding-left: 1.5em; }

/* Resource chips: a small hexagon of the resource's light before its name */
.r { white-space: nowrap; font-family: var(--mono); font-weight: 500; font-size: .82em; letter-spacing: .03em; color: var(--ink); }
.r::before { content: ""; display: inline-block; width: .7em; height: .8em; margin-right: .3em; vertical-align: -.05em; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: var(--c); }
.r.wood { --c: var(--wood); } .r.brick { --c: var(--brick); } .r.sheep { --c: var(--sheep); } .r.wheat { --c: var(--wheat); } .r.ore { --c: var(--ore); }
.num { font-family: var(--mono); font-size: .9em; }

/* Figures: a panel with a hairline of light */
figure { margin: 1.75rem auto 2rem; max-width: 52rem; background: rgba(5, 6, 7, .8); border: 1px solid var(--light-14); border-radius: 6px; padding: 1.1rem 1.2rem 1rem; }
.fig-title { font-family: var(--mono); font-size: var(--fs-sys); letter-spacing: .08em; color: var(--light); margin: 0 0 .9rem; }
figcaption { font-size: .98rem; color: var(--dim); margin-top: .8rem; line-height: 1.45; }
figcaption b { color: var(--ink); font-weight: 500; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1rem 1.5rem; }
.grid2 > * { min-width: 0; }
svg.viz { width: 100%; height: auto; display: block; overflow: visible; font-family: var(--mono); }
svg.viz .smtitle { font-size: 12.5px; fill: var(--ink-2); letter-spacing: .04em; }
svg.viz .cat { font-size: 12.5px; fill: var(--ink); }
svg.viz .vlab { font-size: 12px; fill: var(--ink); }
svg.viz .tick { font-size: 11px; fill: var(--faint); }
svg.viz .reflab { font-size: 11px; fill: var(--faint); }
svg.viz .base { stroke: var(--rule-2); stroke-width: 1; }
svg.viz .refline { stroke: var(--faint); stroke-width: 1; }
svg.viz .bar { fill: var(--c); }
svg.viz g.row:hover .bar, svg.viz g.row:focus .bar { filter: brightness(1.12); }
details { margin: .6rem 0 0; font-family: var(--mono); font-size: var(--fs-sys); letter-spacing: .04em; color: var(--dim); }
details summary { cursor: pointer; color: var(--light); min-height: 44px; display: flex; align-items: center; }

/* Tables: the machine's voice */
.tbl, .tablewrap { overflow-x: auto; margin: .25rem 0 1.2rem; }
table { border-collapse: collapse; width: 100%; font-family: var(--mono); font-size: .8rem; letter-spacing: .02em; line-height: 1.45; }
th, td { padding: .5rem .6rem .5rem 0; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; font-variant-numeric: tabular-nums; color: var(--ink-2); }
th { font-weight: 400; color: var(--dim); letter-spacing: .06em; border-bottom: 1px solid var(--rule-2); }
td.n { text-align: right; white-space: nowrap; color: var(--ink); }
td strong { color: var(--ink); }

/* Stat tiles: a serif number, a mono label */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem; margin: 1.25rem 0; }
.stat { background: var(--panel); border: 1px solid var(--rule); border-radius: 2px; padding: .95rem 1rem 1rem; }
.stat .v { display: block; font-family: var(--serif); font-weight: 300; font-size: 1.9rem; line-height: 1.05; letter-spacing: -.01em; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat .l { display: block; font-family: var(--mono); font-size: calc(var(--fs-sys) * .95); letter-spacing: .04em; color: var(--dim); margin-top: .5rem; line-height: 1.4; }

.eq { font-family: var(--mono); font-size: .88rem; background: var(--panel); border: 1px solid var(--rule); border-radius: 2px; padding: .7rem .9rem; overflow-x: auto; margin: 0 0 1rem; white-space: pre; color: var(--ink); }
pre { font-family: var(--mono); font-size: .8rem; background: var(--panel); border: 1px solid var(--rule); border-radius: 2px; padding: .8rem .95rem; overflow-x: auto; color: var(--ink-2); line-height: 1.5; }

/* Contents */
nav.toc, ul.toc { font-family: var(--mono); font-size: calc(var(--fs-sys) * 1.05); letter-spacing: .04em; columns: 2 14rem; column-gap: 2rem; margin: 0 0 1.5rem; padding: 0; list-style: none; }
nav.toc li, ul.toc li { break-inside: avoid; padding: .3rem 0; margin: 0; }
nav.toc a, ul.toc a { text-decoration: none; color: var(--ink-2); }
nav.toc a:hover, ul.toc a:hover { color: var(--light); }
nav.toc a .n, ul.toc a .n { color: var(--light); margin-right: .4rem; }

/* Author card */
.author { background: var(--panel); border: 1px solid var(--rule); border-radius: 2px; padding: 1.2rem 1.4rem; margin-top: .5rem; display: grid; gap: .5rem; }
.author p { margin: 0; }
.author .name { font-family: var(--serif); font-weight: 300; font-size: 1.5rem; letter-spacing: -.01em; }
.author .contact { font-family: var(--mono); font-size: var(--fs-sys); letter-spacing: .05em; color: var(--dim); }

footer.site { margin-top: 3.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-family: var(--mono); font-size: var(--fs-sys); letter-spacing: .05em; color: var(--faint); }
footer.site a { color: var(--dim); text-decoration: none; }
footer.site a:hover { color: var(--ink); }
@media (max-width: 30rem) { figure { padding: .8rem .7rem; } .abstract { padding: 1rem; } }
