/* ---------------------------------------------------------------------------
   ANEMONE explainer — project-owned styles.

   Self-contained on purpose: this page never imports from ../assets/, so the
   folder can be copied or opened from disk on its own. Palette and type match
   the rest of the collection deliberately.
--------------------------------------------------------------------------- */

:root {
  --ink: #f3eedf;
  --muted: #aaa99f;
  --dim: #7d8078;
  --space: #070a09;
  --panel: #101512;
  --panel-2: #151b17;
  --line: #ffffff1c;
  --green: #a5d66f;
  --amber: #f2b84b;
  --coral: #ef715e;
  --ice: #d9edf2;
  --violet: #c8a6f0;
  --max: 1180px;
  --narrow: 46rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--space);
  color: var(--ink);
  font-family: Manrope, system-ui, sans-serif;
  font-weight: 300;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  line-height: 1.7;
}

body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 60; opacity: .1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.24'/%3E%3C/svg%3E");
}

.stars {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(circle at 80% 8%, #16302a 0, transparent 34%),
    radial-gradient(circle at 8% 92%, #33231a 0, transparent 34%),
    var(--space);
}
.stars::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(#fff .7px, transparent .7px);
  background-size: 46px 46px; opacity: .13;
}

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 clamp(20px, 4vw, 40px); }
.narrow { max-width: var(--narrow); margin-left: auto; margin-right: auto; }
.wrap > .narrow { margin-left: 0; margin-right: auto; }
.wrap.narrow { max-width: calc(var(--narrow) + 80px); }

/* ---- reading progress ---- */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 30; background: transparent; }
.progress span { display: block; height: 100%; width: 0; background: var(--green); box-shadow: 0 0 10px #a5d66f88; }

/* ---- nav ---- */
.nav {
  position: fixed; inset: 2px 0 auto 0; height: 62px; z-index: 25;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 48px);
  background: linear-gradient(#070a09f0, #070a09aa 60%, transparent);
  font-family: "DM Mono", ui-monospace, monospace; font-size: 12.5px; letter-spacing: .12em;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; text-transform: uppercase; }
.mark {
  width: 20px; height: 20px; border: 2px solid var(--green); border-radius: 50%;
  display: grid; place-items: center; box-shadow: 0 0 12px #a5d66f55; flex: none;
}
.mark::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.nav-links a { color: var(--muted); text-decoration: none; text-transform: uppercase; }
.nav-links a:hover { color: var(--green); }

/* ---- hero ---- */
.hero { min-height: 88vh; display: flex; align-items: center; padding: 130px 0 70px; }
.eyebrow {
  font-family: "DM Mono", ui-monospace, monospace; font-size: 12.5px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--green); display: flex; align-items: center; gap: 14px; margin: 0 0 24px;
}
.eyebrow::before { content: ""; width: 40px; height: 1px; background: var(--green); }
h1 {
  font-family: Fraunces, Georgia, serif; font-weight: 300;
  font-size: clamp(3rem, 8.5vw, 6.2rem); line-height: .95; margin: 0 0 30px; letter-spacing: -.02em;
}
h1 em { display: block; font-style: italic; font-weight: 500; color: var(--green); }
.lede { font-size: clamp(1.08rem, 2vw, 1.3rem); line-height: 1.65; max-width: 44ch; margin: 0 0 18px; }
.lede-sub { color: var(--muted); max-width: 46ch; margin: 0 0 34px; }
.meta-row {
  display: flex; flex-wrap: wrap; gap: 30px;
  font-family: "DM Mono", ui-monospace, monospace; font-size: 11.5px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}

/* ---- sections ---- */
.sec { padding: clamp(70px, 10vh, 120px) 0; border-top: 1px solid var(--line); }
.sec.alt { background: #0a0e0c66; }
.secnum {
  font-family: "DM Mono", ui-monospace, monospace; font-size: 11.5px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--green); margin: 0 0 14px;
}
h2 {
  font-family: Fraunces, Georgia, serif; font-weight: 400;
  font-size: clamp(1.9rem, 4.2vw, 3rem); line-height: 1.1; margin: 0 0 30px; letter-spacing: -.015em;
}
h3 { font-family: Fraunces, Georgia, serif; font-weight: 400; font-size: 1.2rem; margin: 0 0 10px; }
.sec p { margin: 0 0 20px; }
.sec .narrow > p, .wrap.narrow > p { font-size: 1.03rem; }
em { font-style: italic; }
b { font-weight: 500; color: var(--ink); }

.aside {
  border-left: 2px solid var(--line); padding-left: 20px;
  color: var(--muted); font-size: .97rem !important;
}
.callout {
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--green);
  border-radius: 10px; padding: 22px 26px; margin: 30px 0 !important; font-size: 1.02rem !important;
}
.callout.warn { border-left-color: var(--amber); }

/* ---- equations ---- */
.eq {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 24px 26px; margin: 30px 0;
}
.eq-math {
  font-family: "DM Mono", ui-monospace, monospace; font-size: clamp(1rem, 2.4vw, 1.3rem);
  color: var(--ice); letter-spacing: .01em; margin-bottom: 18px; overflow-x: auto; padding-bottom: 4px;
}
.eq-math sub, .eq-math sup { font-size: .7em; }
/* Two-step reactions (section 11): a path is only balanced if you show both
   halves, so each gets its own line with the place it happens. */
.eq-title {
  font-family: "DM Mono", ui-monospace, monospace; font-size: 11px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--green);
  margin-bottom: 16px;
}
.eq-step {
  color: var(--dim); font-size: .58em; letter-spacing: .14em;
  text-transform: uppercase; display: inline-block; min-width: 6.4em;
}
.eq-gloss { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.eq-gloss li {
  color: var(--muted); font-size: .95rem; line-height: 1.55;
  padding-left: 18px; position: relative;
}
.eq-gloss li::before { content: ""; position: absolute; left: 0; top: .7em; width: 8px; height: 1px; background: var(--dim); }
.eq-gloss b { color: var(--ice); font-family: "DM Mono", ui-monospace, monospace; font-weight: 400; }

/* ---- figures ---- */
.fig { margin: 34px 0; }
.fig canvas { width: 100%; display: block; border-radius: 10px; background: #0b0f0d; border: 1px solid var(--line); }
figcaption {
  font-family: "DM Mono", ui-monospace, monospace; font-size: 11.5px; letter-spacing: .04em;
  color: var(--dim); margin-top: 12px; line-height: 1.6;
}

/* ---- interactive labs ---- */
.lab {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 24px; margin: 34px 0;
}
.lab.wide { margin: 34px 0; }
.lab-head { margin-bottom: 18px; }
.lab-head h3 { margin: 0 0 4px; }
.lab-head p { color: var(--muted); font-size: .93rem; margin: 0 !important; }
.lab-body canvas { width: 100%; display: block; border-radius: 8px; background: #0b0f0d; }
.lab-body.split { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }

.controls { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.controls.row { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 28px; }
/* The unit must never be uppercased: "MMOL/KG" reads as millimoles. */
.controls label {
  display: flex; flex-direction: column; gap: 4px;
  font-family: "DM Mono", ui-monospace, monospace; font-size: 11.5px;
  color: var(--muted); min-width: 220px;
}
.controls .lbl { letter-spacing: .1em; text-transform: uppercase; }
.controls .val { display: flex; align-items: baseline; gap: 6px; }
.controls output { color: var(--green); font-weight: 500; font-size: 13px; }
.controls .val i { font-style: normal; color: var(--dim); font-size: 11px; }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 3px;
  background: #2a332c; border-radius: 2px; outline: none; margin: 6px 0 0;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: var(--green); cursor: pointer; box-shadow: 0 0 8px #a5d66f66;
}
input[type=range]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%; background: var(--green);
  cursor: pointer; border: none; box-shadow: 0 0 8px #a5d66f66;
}
input[type=range]:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }

.btn {
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line);
  padding: 9px 16px; border-radius: 7px; cursor: pointer;
  font-family: "DM Mono", ui-monospace, monospace; font-size: 11.5px;
  letter-spacing: .12em; text-transform: uppercase; align-self: flex-start;
}
.btn:hover { border-color: var(--green); color: var(--green); }
.btn.small { padding: 7px 13px; }

.readout { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.readout.inline { flex-direction: row; gap: 32px; margin-top: 0; }
.readout > div { display: flex; flex-direction: column; gap: 2px; }
.readout span {
  font-family: "DM Mono", ui-monospace, monospace; font-size: 10.5px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--dim);
}
.readout b { font-family: Fraunces, Georgia, serif; font-size: 1.6rem; font-weight: 400; color: var(--ink); line-height: 1.1; }
.readout i { font-family: "DM Mono", ui-monospace, monospace; font-size: 10.5px; color: var(--dim); font-style: normal; }
.readout .hi b { color: var(--amber); }

/* ---- provenance ---- */
.prov {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; align-items: center;
  margin: 36px 0;
}
.prov-col { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; }
.prov-col h3 {
  font-family: "DM Mono", ui-monospace, monospace; font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--green); margin-bottom: 16px;
}
.prov-col:last-of-type h3 { color: var(--amber); }
.prov-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.prov-list li { font-size: .93rem; line-height: 1.45; color: var(--muted); }
.prov-list .pv { display: block; font-family: "DM Mono", ui-monospace, monospace; color: var(--ink); font-size: .95rem; }
.prov-list .pn { font-size: .85rem; color: var(--dim); }
/* ---- the geologic budget table (section 11) ---- */
.budget {
  width: 100%; border-collapse: collapse; margin: 30px 0;
  font-family: "DM Mono", ui-monospace, monospace; font-size: 12.5px;
}
.budget th {
  text-align: left; font-weight: 400; color: var(--dim);
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  padding: 0 12px 10px 0; border-bottom: 1px solid var(--line);
}
.budget th.n, .budget td.n { text-align: right; padding-right: 0; white-space: nowrap; }
.budget td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.budget td.n { color: var(--ink); font-size: 13.5px; }
.budget .what { color: var(--ink); }
/* The net column carries the whole argument, so it gets the colour. */
.budget .sink td.n { color: var(--green); }
.budget .wash td.n { color: var(--dim); }
.budget .src td.n { color: var(--amber); }
.budget tr.total td { border-bottom: none; padding-top: 14px; color: var(--ink); }
.budget tr.total td.n { font-size: 15px; }
.budget .gloss { display: block; font-family: Manrope, sans-serif; font-size: 11.5px; color: var(--dim); margin-top: 3px; }

.prov-arrow {
  display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--dim);
  font-family: "DM Mono", ui-monospace, monospace; font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
}

/* ---- reveal ---- */
.reveal { margin: 30px 0; }
.reveal-body {
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height .6s ease, opacity .5s ease .1s;
}
.reveal.open .reveal-body { max-height: 600px; opacity: 1; margin-top: 26px; }
.reveal.open > .btn { display: none; }
.big-num {
  font-family: Fraunces, Georgia, serif; font-size: clamp(3rem, 9vw, 5rem);
  color: var(--coral); line-height: 1; margin: 0 0 18px !important; font-weight: 300;
}
.big-num span {
  display: block; font-family: Manrope, sans-serif; font-size: 1rem;
  color: var(--muted); letter-spacing: 0; margin-top: 10px;
}

/* ---- legend ---- */
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.legend button {
  display: flex; align-items: center; gap: 8px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 100px; padding: 7px 14px 7px 10px;
  cursor: pointer; font-family: "DM Mono", ui-monospace, monospace; font-size: 11px;
  letter-spacing: .06em; color: var(--dim); transition: color .2s, border-color .2s;
}
.legend button .sw { width: 10px; height: 10px; border-radius: 50%; background: currentColor; opacity: .35; }
.legend button.on { color: var(--ink); border-color: #ffffff33; }
.legend button.on .sw { opacity: 1; }

/* ---- paper citation ---- */
.sec.paper .citation {
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--amber);
  border-radius: 10px; padding: 24px 26px; margin: 0 0 30px;
}
.cite-authors {
  font-family: "DM Mono", ui-monospace, monospace; font-size: 12px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--amber); margin: 0 0 10px !important;
}
.cite-title { font-family: Fraunces, Georgia, serif; font-size: 1.25rem; line-height: 1.35; margin: 0 0 10px !important; }
.cite-where { font-family: "DM Mono", ui-monospace, monospace; font-size: 11.5px; color: var(--dim); margin: 0 !important; }

/* ---- limits ---- */
.limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin: 34px 0; }
.limit { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; }
.limit h3 { font-size: 1.02rem; margin-bottom: 8px; color: var(--ink); }
.limit p { color: var(--muted); font-size: .92rem !important; margin: 0 !important; line-height: 1.6; }

/* ---- sources ---- */
.srcgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 34px; margin: 30px 0; }
.srcgrid h3 {
  font-family: "DM Mono", ui-monospace, monospace; font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--green); margin-bottom: 16px;
}
.srclist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.srclist li { font-size: .93rem; color: var(--muted); line-height: 1.55; }
.srclist i { font-style: italic; color: var(--ink); }
.srclist b { font-weight: 500; }


/* ---- inline citations ---- */
a.ref {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: .68em; vertical-align: super; line-height: 0;
  color: var(--green); text-decoration: none;
  padding: 0 1px; margin-left: 1px;
  border-bottom: none;
}
a.ref::before { content: "["; opacity: .55; }
a.ref::after { content: "]"; opacity: .55; }
a.ref:hover { color: var(--amber); }

.reflist {
  counter-reset: none; margin: 26px 0 0; padding-left: 0; list-style: none;
  columns: 2; column-gap: 44px;
}
.reflist li {
  counter-increment: ref; font-size: .9rem; line-height: 1.55;
  color: var(--muted); margin-bottom: 14px; padding-left: 34px;
  position: relative; break-inside: avoid;
}
.reflist li::before {
  content: "[" counter(ref) "]"; position: absolute; left: 0; top: 0;
  font-family: "DM Mono", ui-monospace, monospace; font-size: .82rem; color: var(--green);
}
.reflist li i { font-style: italic; color: var(--ink); }
.reflist li b { font-weight: 500; }
.reflist li:target {
  color: var(--ink);
  background: #a5d66f14; border-radius: 6px;
  box-shadow: 0 0 0 8px #a5d66f14;
}
.reflist { counter-reset: ref; }
.hint-p { color: var(--muted); font-size: .95rem !important; }

/* ---- glossary terms ---- */
.term {
  border-bottom: 1px dotted #a5d66f88; cursor: help;
  color: inherit; text-decoration: none;
}
.term:hover, .term:focus-visible { color: var(--green); border-bottom-color: var(--green); }
.term:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 2px; }

.tip {
  position: fixed; z-index: 70; max-width: 320px;
  background: #131a16; border: 1px solid #ffffff2e; border-radius: 9px;
  padding: 13px 15px; font-size: .88rem; line-height: 1.55; color: var(--ink);
  box-shadow: 0 12px 34px #000000b0;
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
  pointer-events: none;
}
.tip.on { opacity: 1; visibility: visible; transform: none; }
.tip b {
  display: block; font-family: "DM Mono", ui-monospace, monospace;
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--green); margin-bottom: 6px; font-weight: 400;
}

/* ---- validation scorecards ---- */
.scorecard {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; margin: 28px 0;
}
.score { background: var(--panel); padding: 16px 18px; }
.score .k {
  font-family: "DM Mono", ui-monospace, monospace; font-size: 10.5px;
  letter-spacing: .13em; text-transform: uppercase; color: var(--dim);
  display: block; margin-bottom: 8px;
}
.score .row { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; }
.score .row + .row { margin-top: 4px; }
.score .row span { color: var(--dim); }
.score .row b { font-family: "DM Mono", ui-monospace, monospace; font-weight: 400; }
.score .mod b { color: var(--green); }
.score .obs b { color: var(--ink); }
.score.warn { border-left: 2px solid var(--amber); }
.score.warn .mod b { color: var(--amber); }

/* ---- pull quote ---- */
.quote {
  font-family: Fraunces, Georgia, serif; font-size: clamp(1.3rem, 3vw, 1.75rem);
  line-height: 1.4; color: var(--ink); margin: 0 0 26px !important;
  padding-left: 24px; border-left: 3px solid var(--amber);
}
.quote span {
  display: block; font-family: "DM Mono", ui-monospace, monospace;
  font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--dim); margin-top: 14px;
}

@media (max-width: 760px) {
  .reflist { columns: 1; }
}

a.link {
  color: var(--green); text-decoration: none;
  border-bottom: 1px solid #a5d66f55; transition: border-color .2s;
}
a.link:hover { border-bottom-color: var(--green); }

.repo {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  margin: 22px 0 0 !important; padding: 16px 20px;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--green); border-radius: 10px;
}
.repo a {
  font-family: "DM Mono", ui-monospace, monospace; font-size: .95rem;
  color: var(--green); text-decoration: none; border-bottom: 1px solid #a5d66f55;
}
.repo a:hover { border-bottom-color: var(--green); }
.repo span { color: var(--muted); font-size: .9rem; }

/* ---- footer ---- */
footer {
  border-top: 1px solid var(--line); padding: 36px 0 56px;
  font-family: "DM Mono", ui-monospace, monospace; font-size: 11.5px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--dim);
}
.foot-row { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
footer a { color: var(--dim); text-decoration: none; }
footer a:hover { color: var(--green); }

/* ---- scroll-in ---- */
.sec .wrap > *, .sec .narrow > * { transition: opacity .7s ease, transform .7s ease; }
.sec:not(.seen) .wrap > *, .sec:not(.seen) .narrow > * { opacity: 0; transform: translateY(14px); }
.sec.seen .wrap > *, .sec.seen .narrow > * { opacity: 1; transform: none; }

/* ---- responsive ---- */
@media (max-width: 860px) {
  .lab-body.split { grid-template-columns: 1fr; }
  .prov { grid-template-columns: 1fr; gap: 16px; }
  .prov-arrow { flex-direction: row; }
  .prov-arrow svg { transform: rotate(90deg); }
  .controls.row { flex-direction: column; align-items: stretch; gap: 18px; }
  .readout.inline { gap: 22px; }
  .readout b { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
  .sec:not(.seen) .wrap > *, .sec:not(.seen) .narrow > * { opacity: 1; transform: none; }
}
