/* EDRS project website: slate and rust, with strata (ranked layers) motifs */

@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 800; font-style: normal; font-display: swap; src: url("fonts/inter-latin-800-normal.woff2") format("woff2"); }

:root
{
  --bg: #F5F6F7;
  --card: #FFFFFF;
  --ink: #23272E;
  --muted: #5F6672;
  --rule: #DADDE2;
  --slate: #2E3440;
  --s0: #C9CED6;
  --s1: #8C95A3;
  --s2: #5A6372;
  --rust: #B4532A;
  --rust-dark: #8C3D1E;
  --rust-light: #F0A27C;
  --sans: "Inter", Helvetica, Arial, sans-serif;
  --serif: Charter, "Bitstream Charter", Georgia, "Times New Roman", serif;
  --gut: max(20px, calc((100% - 960px) / 2));
}

html { scroll-behavior: smooth; }

body
{
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
}

a { color: var(--rust); }
a:hover { color: var(--rust-dark); }
:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }

h1, h2, h3, nav, th, caption, figcaption, .card strong { font-family: var(--sans); }

/* ---------- Header (individual pages): slate block with a strata staircase ---------- */

header
{
  position: relative;
  overflow: hidden;
  background: var(--slate);
  color: #fff;
  padding: 28px var(--gut) 0;
}

header > * { position: relative; z-index: 1; }

header:not(.home)::after
{
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 34%;
  height: 100%;
  background:
    linear-gradient(var(--s0), var(--s0)) right bottom / 100% 25% no-repeat,
    linear-gradient(var(--s1), var(--s1)) right bottom / 75% 50% no-repeat,
    linear-gradient(var(--s2), var(--s2)) right bottom / 50% 75% no-repeat,
    linear-gradient(#3B4250, #3B4250) right bottom / 25% 100% no-repeat;
}

.back { margin: 0; }
.back a { font: 15px var(--sans); color: var(--s0); text-decoration: none; }
.back a:hover { color: #fff; }

header h1
{
  max-width: none;
  margin: 30px 0 10px;
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.byline { margin: 0; font: 15px var(--sans); color: var(--s0); }
.byline a { color: var(--rust-light); }

nav
{
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  max-width: 56%;
  margin-top: 28px;
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 15px;
  font-weight: 500;
}

nav a
{
  color: var(--s0);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  padding-bottom: 11px;
  margin-bottom: -14px;
}

nav a:hover, nav a:focus-visible { color: #fff; border-bottom-color: var(--rust); }

/* ---------- Header (project page): hero with a worked Rational Closure example ---------- */

header.home { padding: 0; background: var(--bg); color: var(--ink); }

.hero
{
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 20px;
}

.hero-text
{
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}

.kicker { margin: 0; font: 600 14px var(--sans); color: var(--rust); }

header.home h1
{
  max-width: none;
  margin: 12px 0 16px;
  color: var(--slate);
  font-size: clamp(36px, 5vw, 60px);
}

.summary { margin: 0; max-width: 36em; font-size: 19px; }
.members { margin: 0; font: 14px var(--sans); color: var(--muted); }

header.home nav
{
  max-width: none;
  margin: 0;
  padding: 14px var(--gut);
  border: 0;
  background: var(--slate);
}

/* ---------- Page body ---------- */

main
{
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 20px 40px;
}

section { padding: 28px 0; border-bottom: 1px solid var(--rule); }
section section { padding: 16px 0 0; border-bottom: 0; }

h2
{
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 0 14px;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--slate);
}

h2::before
{
  content: "";
  flex: none;
  width: 26px;
  height: 26px;
  background: linear-gradient(var(--s1) 0 33.3%, var(--s2) 33.3% 66.6%, var(--slate) 66.6%);
}

h3 { margin: 28px 0 8px; font-size: 20px; font-weight: 700; color: var(--slate); }

p, li { max-width: 46em; }

.lead
{
  margin: 0 0 22px;
  font-size: 21px;
  line-height: 1.55;
}

.note { font-size: 0.9em; color: var(--muted); }
.tag { font-size: 0.85em; color: var(--muted); }
.punchline { font-size: 1.1em; color: var(--slate); }

dt { font-family: var(--sans); font-weight: 700; margin-top: 12px; }
dd { margin: 4px 0 0 20px; }
code { font-family: "Courier New", monospace; }

/* Lists of rules, statements and closures: small strata markers */

ul.rules, ul.closures { list-style: none; padding: 0; margin: 16px 0; }

ul.rules > li, ul.closures > li
{
  position: relative;
  padding: 5px 0 5px 22px;
}

ul.rules > li::before, ul.closures > li::before
{
  content: "";
  position: absolute;
  left: 0;
  top: 0.85em;
  width: 10px;
  height: 10px;
  background: var(--s2);
}

/* Contribution bullets become tiles */

#contribution ul.rules
{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

#contribution ul.rules > li
{
  max-width: none;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--s2);
  font-size: 16px;
}

#contribution ul.rules > li::before { content: none; }
#contribution ul.rules > li b { display: block; margin-bottom: 4px; font: 700 16px var(--sans); color: var(--slate); }

/* Step-by-step formulas: stacked like ranks */

.steps
{
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 16px 0;
  background: var(--card);
  border: 1px solid var(--rule);
}

.step
{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
}

.step:last-child { border-bottom: 0; }

.step .what { flex: 0 1 300px; }
.step strong { font: 700 16px var(--sans); color: var(--slate); }
.step p { margin: 6px 0 0; font-size: 16px; color: var(--muted); }
.step > span { flex: 1; min-width: 0; max-width: 100%; }
.step .katex-display { margin: 0; }
.katex-display { max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.step ul.closures { flex: 1; margin: 0; }

.step .n
{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  background: var(--slate);
  color: #fff;
  font: 700 13px var(--sans);
}

/* Worked traces */

.trace
{
  list-style: none;
  padding: 0;
  margin: 16px 0;
  max-width: 46em;
  background: var(--card);
  border: 1px solid var(--rule);
}

.trace li { padding: 8px 16px; border-bottom: 1px solid var(--rule); }
.trace li:last-child { border-bottom: 0; }

.trace .k
{
  display: inline-block;
  min-width: 90px;
  font: 700 13px var(--sans);
  color: var(--rust);
}

.trace li.answer { background: var(--slate); color: #fff; font-weight: bold; font-size: 1.1em; }
.trace li.answer .k { color: var(--rust-light); }

/* Tables */

table
{
  width: 100%;
  margin: 20px 0;
  border-collapse: collapse;
  background: var(--card);
  font-size: 16px;
}

caption
{
  caption-side: top;
  padding-bottom: 8px;
  font-size: 14px;
  color: var(--muted);
  text-align: left;
}

th
{
  padding: 9px 12px;
  background: var(--slate);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

td { padding: 8px 12px; border-bottom: 1px solid var(--rule); text-align: left; }
tbody tr:hover td { background: #F0F2F4; }

/* Big-number results strip */

.stats { display: flex; flex-wrap: wrap; gap: 20px 56px; margin: 8px 0 24px; }

.stat
{
  margin: 0;
  font: 800 clamp(36px, 5vw, 48px)/1 var(--sans);
  letter-spacing: -0.03em;
  color: var(--slate);
}

.stat small { display: block; margin-top: 8px; font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.stat.hot { color: var(--rust); }

/* Team cards */

.cards
{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  background: var(--card);
  border: 1px solid var(--rule);
}

.card
{
  display: block;
  padding: 18px 20px;
  border-top: 5px solid var(--s1);
  border-right: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}

.card:nth-child(2) { border-top-color: var(--s2); }
.card:nth-child(3) { border-top-color: var(--slate); border-right: 0; }
.card:hover { background: #F0F2F4; color: var(--ink); }
.card:hover strong { color: var(--rust); }
.card strong { display: block; font-size: 17px; font-weight: 700; color: var(--slate); }
.card span { display: block; font-size: 15px; color: var(--muted); }

/* Documents */

#documents ul { list-style: none; padding: 0; display: grid; gap: 10px; max-width: 46em; }

#documents li
{
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--rule);
  color: var(--muted);
}

#documents li a { font: 600 16px var(--sans); text-decoration: none; }
#documents li a:hover { text-decoration: underline; }

/* Figures and the workbench diagram */

figure { margin: 20px 0; }
figure img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
figcaption { font-size: 14px; color: var(--muted); text-align: center; }

.wb { display: block; width: 100%; height: auto; }
.wb .lines { fill: none; stroke: var(--slate); stroke-width: 1.6; }
.wb marker path { fill: var(--slate); }
.wb rect { stroke: var(--slate); stroke-width: 1.6; transition: fill 0.15s; }
.wb a text { font: 600 17px var(--sans); text-anchor: middle; dominant-baseline: central; fill: var(--slate); pointer-events: none; }
.wb a { cursor: pointer; }
.wb a:hover rect, .wb a:focus rect { fill: #F6E3DA; }
.wb .lbl { font: italic 13px var(--serif); fill: var(--muted); }

/* Footer with a strata rule */

footer
{
  max-width: 960px;
  margin: 0 auto;
  padding: 30px 20px 40px;
  background: linear-gradient(to right, var(--s0) 0 25%, var(--s1) 25% 50%, var(--s2) 50% 75%, var(--slate) 75%) top / 100% 6px no-repeat;
  font: 14px var(--sans);
  color: var(--muted);
}

footer p { margin: 0; max-width: none; }

/* ---------- Small screens ---------- */

@media (max-width: 760px)
{
  body { font-size: 17px; }

  header:not(.home)::after { width: 30%; opacity: 0.5; }
  header h1 { max-width: none; }
  nav { max-width: none; gap: 4px 20px; }

  .hero { padding: 32px 20px; }


  h2 { font-size: 26px; }
  .lead { font-size: 19px; }

  table { display: block; overflow-x: auto; }

  .card { border-right: 0; border-bottom: 1px solid var(--rule); }
}

@media (prefers-reduced-motion: reduce)
{
  html { scroll-behavior: auto; }
  .wb rect { transition: none; }
}
