/* elklotusled.com — engineering reference styling.
   Design intent: this reads like a specification sheet, not a blog. Data is the
   protagonist: tables get real borders and monospace figures, prose measures
   ~68 characters, and colour is used only to mark state (accent, warning,
   pending) rather than for decoration. */

:root {
  --ink: #14181d;
  --ink-2: #4a545f;
  --ink-3: #6d7883;
  --paper: #ffffff;
  --paper-2: #f4f6f8;
  --paper-3: #e9edf1;
  --rule: #d3dae1;
  --rule-2: #b9c3cc;
  --accent: #a8560c;
  --accent-soft: #fdf3e8;
  --warn: #8a5a00;
  --warn-soft: #fff8e6;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e6ebf0;
    --ink-2: #a9b4bf;
    --ink-3: #8c98a4;
    --paper: #12161a;
    --paper-2: #1a2026;
    --paper-3: #222a31;
    --rule: #2e373f;
    --rule-2: #3d4852;
    --accent: #e0a15c;
    --accent-soft: #221a10;
    --warn: #d9ae5a;
    --warn-soft: #211c10;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.65 var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

.wrap { width: min(100% - 2.5rem, 74rem); margin-inline: auto; }

/* Full-bleed band escaping the .wrap column. body{overflow-x:clip} absorbs the
   scrollbar-width overshoot of 100vw. */
.bleed { width: 100vw; margin-left: calc(50% - 50vw); }

/* ---------- photographic heroes ---------- */

.homehero, .pagehero { position: relative; display: flex; align-items: flex-end; overflow: hidden; }
.homehero { min-height: clamp(26rem, 62vh, 40rem); }
.pagehero { min-height: clamp(16rem, 40vh, 24rem); }
.homehero > img, .pagehero > img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.homehero::after, .pagehero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10, 14, 18, .16) 0%, rgba(10, 14, 18, .4) 55%, rgba(7, 10, 14, .84) 100%);
}
.homehero .inner, .pagehero .inner {
  position: relative; z-index: 1; padding: 3.5rem 0 2.75rem; color: #eef2f6;
}
.homehero .inner .kicker, .pagehero .inner .kicker { color: #ffc077; margin-top: 0; }
.homehero h1, .pagehero h1 {
  color: #fff; max-width: 24ch; margin-bottom: 1rem;
  font-size: clamp(2rem, 1.25rem + 2.9vw, 3.4rem);
  text-shadow: 0 2px 28px rgba(0, 0, 0, .45);
}
.pagehero h1 { font-size: clamp(1.8rem, 1.2rem + 2.2vw, 2.8rem); }
.homehero .inner p:not(.kicker), .pagehero .lead {
  max-width: 64ch; font-size: 1.06rem; line-height: 1.62; color: #dbe2e9;
  margin: 0; text-shadow: 0 1px 18px rgba(0, 0, 0, .5);
}
.pagehero .lead { font-size: .98rem; }

/* ---------- cover & diagram figures ---------- */

figure.cover { margin: 0 0 2.25rem; }
figure.cover img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); }
figure.cover figcaption { font: .72rem/1.5 var(--mono); color: var(--ink-3); padding-top: .45rem; }
figure.cover.pagecover { margin: 1.5rem 0 2rem; }

figure.fig { margin: 1.9rem 0; }
figure.fig .panel { border: 1px solid var(--rule); background: #f7f9fb; padding: .6rem; }
figure.fig img, figure.fig svg { display: block; width: 100%; height: auto; }
figure.fig figcaption { font-size: .8rem; color: var(--ink-3); padding-top: .55rem; line-height: 1.55; }

.skip {
  position: absolute; left: -9999px; top: 0; padding: .6rem 1rem;
  background: var(--accent); color: #fff; z-index: 10;
}
.skip:focus { left: 0; }

/* ---------- masthead ---------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
  position: sticky; top: 0; z-index: 5;
}
.bar {
  display: flex; align-items: center; gap: 1.5rem;
  min-height: 4rem; flex-wrap: wrap; padding-block: .5rem;
}
.brand {
  display: flex; align-items: center; gap: .65rem;
  text-decoration: none; color: inherit; flex: 0 0 auto;
}
.brand svg { color: var(--accent); flex: none; }
.brand span { display: flex; flex-direction: column; line-height: 1.25; }
.brand strong { font-size: 1.02rem; letter-spacing: -.01em; }
.brand em {
  font-style: normal; font-size: .72rem; color: var(--ink-3);
  letter-spacing: .01em;
}
.mainnav { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-left: auto; }
.mainnav a {
  color: var(--ink-2); text-decoration: none; font-size: .85rem;
  padding-block: .35rem; border-bottom: 2px solid transparent;
}
.mainnav a:hover { color: var(--ink); }
.mainnav a.here { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- document ---------- */

.crumbs {
  font-size: .75rem; color: var(--ink-3); padding: 1.25rem 0 0;
  display: flex; gap: .4rem; flex-wrap: wrap;
}
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

/* Prose is held to a readable measure, but the data — tables, formulae,
   calculators — is allowed to run wider. On a spec-sheet site the table is the
   point, and forcing it to scroll inside a 68ch column to protect line length
   gets the priority backwards. */
.doc { padding: 1.25rem 0 5rem; max-width: 58rem; }
.doc > p, .doc > ul, .doc > ol, .doc > h1, .doc > h2, .doc > h3,
.doc > .standfirst, .doc > .byline, .doc > .kicker,
.doc > .note, .doc > .warnbox, .doc > .pendingbox, .doc > .source {
  max-width: var(--measure);
}
.doc.wide { max-width: none; }

.kicker {
  font: 600 .7rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin: 1.5rem 0 .75rem;
}
h1 {
  font-size: clamp(1.7rem, 1.2rem + 1.9vw, 2.5rem); line-height: 1.15;
  letter-spacing: -.02em; margin: 0 0 .75rem; font-weight: 650;
}
h2 {
  font-size: 1.3rem; line-height: 1.3; letter-spacing: -.01em;
  margin: 2.75rem 0 .75rem; padding-top: 1.1rem; border-top: 1px solid var(--rule);
}
h3 { font-size: 1.05rem; margin: 1.9rem 0 .5rem; }
p, li { color: var(--ink); }
.standfirst {
  font-size: 1.1rem; line-height: 1.55; color: var(--ink-2); margin: 0 0 1.1rem;
}
.byline {
  font: .78rem/1.5 var(--mono); color: var(--ink-3);
  padding-bottom: 1.5rem; border-bottom: 1px solid var(--rule); margin: 0 0 2rem;
}
a { color: var(--accent); text-underline-offset: .18em; }
ul, ol { padding-left: 1.15rem; }
li { margin-block: .4rem; }
strong { font-weight: 640; }

/* ---------- data ---------- */

.tablewrap { overflow-x: auto; margin: 1.5rem 0; }
table { border-collapse: collapse; width: 100%; font-size: .89rem; }
caption {
  caption-side: bottom; text-align: left; font-size: .78rem; color: var(--ink-3);
  padding-top: .6rem; line-height: 1.5;
}
th, td {
  border: 1px solid var(--rule); padding: .5rem .7rem; text-align: left;
  vertical-align: top;
}
thead th { background: var(--paper-3); font-weight: 620; font-size: .82rem; }
td.num, th.num { font-family: var(--mono); text-align: right; white-space: nowrap; }
tbody tr:nth-child(even) td { background: var(--paper-2); }

code, kbd, samp { font-family: var(--mono); font-size: .88em; }
:not(pre) > code {
  background: var(--paper-3); padding: .1em .35em; border-radius: 3px;
}
pre {
  background: var(--paper-2); border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  padding: .9rem 1rem; overflow-x: auto; font-size: .85rem; line-height: 1.55;
}
.formula {
  background: var(--paper-2); border: 1px solid var(--rule);
  padding: 1rem 1.1rem; margin: 1.5rem 0; font-family: var(--mono);
  font-size: .9rem; overflow-x: auto;
}
.formula b { display: block; font: 600 .72rem/1 var(--sans); letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: .6rem; }

.note, .warnbox, .pendingbox {
  border: 1px solid var(--rule); border-left: 3px solid var(--ink-3);
  background: var(--paper-2); padding: .9rem 1.1rem; margin: 1.5rem 0;
  font-size: .93rem;
}
.note > :first-child, .warnbox > :first-child, .pendingbox > :first-child { margin-top: 0; }
.note > :last-child, .warnbox > :last-child, .pendingbox > :last-child { margin-bottom: 0; }
.warnbox { border-left-color: var(--warn); background: var(--warn-soft); }
.pendingbox { border-left-color: var(--accent); background: var(--accent-soft); }
.note b, .warnbox b, .pendingbox b { display: block; margin-bottom: .35rem; }

.source {
  font-size: .82rem; color: var(--ink-3); border-top: 1px solid var(--rule);
  margin-top: 3rem; padding-top: 1rem;
}
.source li { margin-block: .35rem; }

/* ---------- section index ---------- */

.sectionlist { padding: 2.25rem 0 4.5rem; }
.cards {
  list-style: none; padding: 0; margin: 0; display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
}
.cards a {
  display: flex; flex-direction: column; height: 100%;
  text-decoration: none; color: inherit; overflow: hidden;
  border: 1px solid var(--rule); background: var(--paper-2);
}
.cards a:hover { border-color: var(--accent); }
.cards .thumb {
  display: block; aspect-ratio: 16 / 10; overflow: hidden;
  border-bottom: 1px solid var(--rule); background: var(--paper-3);
}
.cards .thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .35s ease;
}
.cards a:hover .thumb img { transform: scale(1.04); }
.cards .body { display: block; padding: 1rem 1.15rem 1.25rem; }
.cards .t { display: block; font-weight: 600; color: var(--ink); margin-bottom: .3rem; }
.cards .d { display: block; font-size: .88rem; color: var(--ink-2); line-height: 1.5; }
.pending {
  display: inline-block; margin-top: .5rem; font: 600 .68rem/1 var(--mono);
  letter-spacing: .08em; text-transform: uppercase; color: var(--accent);
  border: 1px solid var(--accent); padding: .25rem .45rem;
}

/* ---------- home ---------- */

.grid {
  display: grid; gap: 1.25rem; padding: 3rem 0 3.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
}
.grid section {
  border: 1px solid var(--rule); background: var(--paper-2);
  display: flex; flex-direction: column; overflow: hidden;
}
.grid section:hover { border-color: var(--accent); }
.grid .cardimg {
  display: block; aspect-ratio: 16 / 9; overflow: hidden;
  border-bottom: 1px solid var(--rule); background: var(--paper-3);
}
.grid .cardimg img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .35s ease;
}
.grid section:hover .cardimg img { transform: scale(1.04); }
.grid h2 { margin: 1.1rem 1.25rem .5rem; padding: 0; border: 0; font-size: 1.05rem; }
.grid p { font-size: .9rem; color: var(--ink-2); margin: 0 1.25rem .9rem; }
.grid a.more { font: 600 .8rem/1 var(--sans); text-decoration: none; margin: auto 1.25rem 1.2rem; }
.grid a.more::after { content: " →"; }

/* ---------- calculators ---------- */

.calc {
  border: 1px solid var(--rule-2); background: var(--paper-2);
  padding: 1.25rem 1.35rem; margin: 2rem 0;
}
.calc h2 { margin-top: 0; padding-top: 0; border-top: 0; }
.fields { display: grid; gap: .85rem 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field label { font-size: .82rem; font-weight: 600; }
.field .hint { font-size: .74rem; color: var(--ink-3); line-height: 1.45; }
.field input, .field select {
  font: inherit; font-family: var(--mono); font-size: .9rem; padding: .45rem .55rem;
  border: 1px solid var(--rule-2); background: var(--paper); color: var(--ink);
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.out {
  margin-top: 1.25rem; border-top: 1px solid var(--rule); padding-top: 1rem;
  display: grid; gap: .6rem;
}
.out .row { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.out .row span { font-size: .87rem; color: var(--ink-2); }
.out .row b { font-family: var(--mono); font-size: 1.05rem; }
.out .row.lead b { font-size: 1.5rem; color: var(--accent); }
.out .note { margin: .5rem 0 0; }

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

.foot {
  border-top: 1px solid var(--rule); background: var(--paper-2);
  padding: 2.5rem 0 3rem; font-size: .87rem; color: var(--ink-2);
}
.footgrid { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.footbrand { font-weight: 650; color: var(--ink); margin: 0 0 .5rem; }
.foothead {
  font: 600 .7rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 .7rem;
}
.footgrid a { display: block; color: var(--ink-2); text-decoration: none; margin-block: .35rem; }
.footgrid a:hover { color: var(--accent); }
.fineprint {
  margin: 2rem 0 0; padding-top: 1.25rem; border-top: 1px solid var(--rule);
  font-size: .8rem; color: var(--ink-3); max-width: var(--measure);
}

@media (max-width: 640px) {
  .masthead { position: static; }
  .mainnav { margin-left: 0; gap: .9rem; width: 100%; }
  .mainnav a { font-size: .8rem; }
}
