:root {
  --ink: #172a2d;
  --muted: #657376;
  --accent: #176b72;
  --accent-dark: #0e4f55;
  --accent-soft: #e6f1ef;
  --warm: #d85f45;
  --site-accent: #a96824;
  --violet: #8b6aa8;
  --line: #d8dfdc;
  --line-dark: #bbc8c4;
  --paper: #fff;
  --background: #f7f8f5;
  --code: #183033;
  --radius: 14px;
  --shadow: 0 14px 38px rgba(23, 42, 45, .07);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; background: var(--background); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.65; }
a { color: var(--accent-dark); text-decoration-color: #8fb6b5; text-underline-offset: .18em; }
a:hover { text-decoration-color: currentColor; }
img { max-width: 100%; }
.skip-link { background: var(--ink); border-radius: 0 0 8px 8px; color: white; font-weight: 700; left: 1rem; padding: .55rem .8rem; position: fixed; top: 0; transform: translateY(-120%); transition: transform .15s ease; z-index: 100; }
.skip-link:focus { transform: translateY(0); }
.site-header { align-items: center; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); display: flex; gap: 2rem; justify-content: space-between; padding: .92rem max(1.2rem, calc((100vw - 1180px) / 2)); position: sticky; top: 0; z-index: 30; backdrop-filter: blur(10px); }
.site-name { align-items: center; color: var(--ink); display: inline-flex; font-size: .98rem; font-weight: 760; gap: .65rem; letter-spacing: -.02em; text-decoration: none; }
.site-mark { background: var(--accent); border-radius: 50%; box-shadow: 8px 0 0 -2px #93b8b4, 4px 7px 0 -2px #d0ded9; height: 9px; margin-right: 8px; width: 9px; }
.site-header nav { display: flex; gap: .35rem; }
.site-header nav a { border-radius: 999px; color: var(--muted); font-size: .9rem; font-weight: 650; padding: .38rem .8rem; text-decoration: none; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-dark); }
.page-shell { margin: 0 auto; padding: 4.5rem 0 6rem; width: min(calc(100% - 2.5rem), 1120px); }
.site-footer { align-items: start; border-top: 1px solid var(--line); color: var(--muted); display: flex; font-size: .84rem; gap: 2rem; justify-content: space-between; margin: 0 auto; padding: 1.4rem max(1.2rem, calc((100vw - 1180px) / 2)); }
.footer-brand { display: grid; gap: .08rem; }
.footer-brand strong { color: var(--ink); font-size: .88rem; }
.site-credit { margin-left: auto; max-width: 540px; text-align: right; }
.site-credit summary { color: var(--muted); cursor: pointer; list-style: none; outline-offset: 4px; }
.site-credit summary::-webkit-details-marker { display: none; }
.site-credit summary::after { color: #91aaa6; content: " +"; font-weight: 750; }
.site-credit[open] summary::after { content: " −"; }
.site-credit summary:hover, .site-credit summary:focus-visible { color: var(--accent-dark); }
.credit-details { border-right: 2px solid #c8ddda; display: grid; gap: .12rem; margin-top: .75rem; padding: .15rem .8rem .15rem 0; }
.credit-details > strong { color: var(--ink); }
.credit-details > strong span { color: var(--muted); font-weight: 500; }
.credit-details nav { display: flex; flex-wrap: wrap; gap: .35rem .8rem; justify-content: flex-end; margin-top: .3rem; }
.credit-details a { font-size: .8rem; }
h1, h2, h3 { letter-spacing: -.035em; line-height: 1.13; text-wrap: balance; }
h1 { font-size: clamp(2.5rem, 6vw, 4.9rem); margin: .15rem 0 1.1rem; }
h2 { font-size: clamp(1.55rem, 3vw, 2.15rem); margin: 3.5rem 0 1rem; }
h3 { font-size: 1.17rem; margin: 2rem 0 .65rem; }
p, ul, ol { max-width: 72ch; }
.lede { color: #3f5659; font-size: clamp(1.08rem, 2vw, 1.3rem); line-height: 1.55; max-width: 65ch; }
.eyebrow, .kicker { color: var(--accent); font-size: .74rem; font-weight: 780; letter-spacing: .12em; margin: 0 0 .55rem; text-transform: uppercase; }
.quiet { color: var(--muted); font-size: .94rem; }
.back-link { color: var(--muted); display: inline-block; font-size: .88rem; font-weight: 680; margin-bottom: 1.8rem; text-decoration: none; }
.back-link:hover { color: var(--accent); }
.button { background: var(--accent); border: 1px solid var(--accent); border-radius: 999px; color: white; display: inline-flex; font-size: .9rem; font-weight: 720; padding: .65rem 1rem; text-decoration: none; }
.button:hover { background: var(--accent-dark); }
.button.secondary { background: transparent; color: var(--accent-dark); }

/* Home */
.home-hero { align-items: end; display: grid; gap: 3rem; grid-template-columns: minmax(0, 1.15fr) minmax(310px, .85fr); min-height: 480px; padding: 2rem 0 5rem; }
.home-hero h1 { max-width: 760px; }
.home-hero .lede { max-width: 630px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.6rem; }
.lattice-motif {
  aspect-ratio: 1;
  margin-inline: auto;
  max-width: 420px;
  position: relative;
  width: 100%;
}

.lattice-motif svg {
  inset: 0;
  overflow: visible;
  position: absolute;
  width: 100%;
}

.lattice-motif polygon,
.lattice-motif line {
  fill: none;
  stroke: #b8cbc7;
  stroke-width: 0.35;
  vector-effect: non-scaling-stroke;
}

.lattice-motif span {
  background: var(--paper);
  border: 2px solid #779795;
  border-radius: 50%;
  box-shadow: 0 7px 18px rgba(23, 42, 45, 0.13);
  height: clamp(30px, 9%, 38px);
  left: var(--x);
  position: absolute;
  top: var(--y);
  transform: translate(-50%, -50%);
  width: clamp(30px, 9%, 38px);
}

.lattice-motif .central-atom {
  background: var(--accent);
  border-color: var(--accent);
}
.home-sections { border-top: 1px solid var(--line); display: grid; gap: 1.2rem; grid-template-columns: 1fr 1fr; padding-top: 1.4rem; }
.home-card { border-radius: var(--radius); padding: 1.5rem; text-decoration: none; transition: background .2s ease, transform .2s ease; }
.home-card:hover { background: var(--paper); box-shadow: var(--shadow); transform: translateY(-2px); }
.home-card small { color: var(--accent); font-weight: 750; text-transform: uppercase; letter-spacing: .1em; }
.home-card h2 { color: var(--ink); margin: .5rem 0; }
.home-card p { color: var(--muted); margin-bottom: 0; }

/* Atlas */
.atlas-intro { display: grid; gap: 2.5rem; grid-template-columns: 1.15fr .85fr; margin-bottom: 4rem; }
.atlas-intro h1 { margin-top: 0; }
.atlas-note { align-self: end; border-left: 2px solid var(--accent); color: var(--muted); font-size: .94rem; padding-left: 1.2rem; }
.surface-group-heading { align-items: baseline; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; margin: 3.5rem 0 1rem; }
.surface-group-heading h2 { margin: 0 0 .8rem; }
.surface-group-heading span { color: var(--muted); font-size: .85rem; }
.atlas-explainer { border-top: 1px solid var(--line); margin-top: 4rem; max-width: 800px; padding-top: 2.6rem; }
.surface-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.surface-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; display: block; overflow: hidden; text-decoration: none; transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.surface-card:hover { border-color: var(--line-dark); box-shadow: var(--shadow); transform: translateY(-3px); }
.surface-card img { aspect-ratio: 3 / 2; background: #f0f4f1; display: block; object-fit: cover; width: 100%; }
.surface-card-body { padding: 1.1rem 1.2rem 1.25rem; }
.surface-card h3 { display: flex; justify-content: space-between; margin: 0 0 .45rem; }
.surface-card h3 span { color: var(--accent); font-size: .9rem; }
.surface-card p { color: var(--muted); font-size: .89rem; line-height: 1.5; margin: 0; }
.site-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .9rem; }
.site-tags span { background: var(--accent-soft); border-radius: 999px; color: var(--accent-dark); font-size: .72rem; font-weight: 670; padding: .18rem .5rem; }
.site-tags span.more { background: #f1f2ef; color: var(--muted); }

/* Interactive builder */
.builder-hero { margin-bottom: 3.2rem; max-width: 850px; }
.builder-hero h1 { margin-top: 0; }
.builder-controls { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 0; grid-template-columns: 1.05fr .9fr 1.3fr; overflow: hidden; }
.builder-controls fieldset { border: 0; border-right: 1px solid var(--line); margin: 0; min-width: 0; padding: 1.2rem 1.25rem 1.35rem; }
.builder-controls fieldset:last-of-type { border-right: 0; }
.builder-controls legend { color: var(--accent); float: left; font-size: .72rem; font-weight: 780; letter-spacing: .1em; margin-bottom: .9rem; text-transform: uppercase; width: 100%; }
.lattice-selector { display: grid; gap: .45rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lattice-selector legend { grid-column: 1 / -1; }
.lattice-selector > label { cursor: pointer; display: block; position: relative; }
.lattice-selector > label > input { opacity: 0; position: absolute; }
.lattice-selector label > span { border: 1px solid var(--line); border-radius: 9px; display: grid; padding: .55rem .7rem; transition: background .15s ease, border-color .15s ease; }
.lattice-selector label > span strong { font-size: .82rem; }
.lattice-selector label > span small { color: var(--muted); font-size: .68rem; }
.lattice-selector > label > input:checked + span { background: var(--accent-soft); border-color: #8eb8b2; color: var(--accent-dark); }
.lattice-selector > label > input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.lattice-parameter-inputs { border-top: 1px solid var(--line); display: flex; gap: .55rem; grid-column: 1 / -1; margin-top: .35rem; padding-top: .75rem; }
.lattice-parameter-inputs label { align-items: center; display: flex; flex: 1; gap: .4rem; }
.lattice-parameter-inputs label[hidden] { display: none; }
.lattice-parameter-inputs label > span { border: 0; color: var(--muted); display: block; font-size: .68rem; padding: 0; white-space: nowrap; }
.lattice-parameter-inputs input { background: var(--background); border: 1px solid var(--line-dark); border-radius: 7px; color: var(--ink); font: 700 .78rem/1 ui-monospace, monospace; min-width: 0; padding: .42rem; width: 100%; }
.lattice-parameter-inputs input:focus { border-color: var(--accent); outline: 2px solid #b9d6d1; }
.lattice-parameter-note { color: var(--muted); font-size: .64rem; grid-column: 1 / -1; line-height: 1.4; margin: .15rem 0 0; }
.index-inputs { clear: both; display: flex; gap: .45rem; }
.index-inputs label { align-items: center; display: grid; gap: .2rem; justify-items: center; }
.index-inputs label > span { font-size: .78rem; font-style: italic; font-weight: 750; }
.index-inputs input { appearance: textfield; background: var(--background); border: 1px solid var(--line-dark); border-radius: 8px; color: var(--ink); font: 720 1rem/1 ui-monospace, monospace; height: 43px; text-align: center; width: 50px; }
.index-inputs input:focus { border-color: var(--accent); outline: 2px solid #b9d6d1; }
.index-inputs input[readonly] { background: #e8eeeb; color: var(--muted); }
.index-inputs small { color: var(--muted); font-size: .58rem; }
.index-selector > p { clear: both; color: var(--muted); font-size: .7rem; line-height: 1.45; margin: .75rem 0 0; }
.offset-selector > label { align-items: center; clear: both; display: flex; font-size: .78rem; gap: 1rem; justify-content: space-between; }
.offset-selector output { color: var(--accent-dark); font-family: ui-monospace, monospace; font-weight: 750; }
.offset-selector input[type="range"] { accent-color: var(--accent); cursor: pointer; margin: 1rem 0 .35rem; width: 100%; }
.offset-labels { color: var(--muted); display: flex; font-size: .58rem; justify-content: space-between; }
.builder-error { background: #fff0ec; border-top: 1px solid #efc2b8; color: #993d2d; font-size: .8rem; grid-column: 1 / -1; margin: 0; max-width: none; padding: .65rem 1.2rem; }
.builder-summary { align-items: stretch; display: grid; gap: .7rem; grid-template-columns: repeat(5, 1fr); margin: 1rem 0 3.5rem; }
.builder-summary > div { border-left: 1px solid var(--line); display: grid; padding: .35rem .8rem; }
.builder-summary span { color: var(--muted); font-size: .66rem; text-transform: uppercase; }
.builder-summary strong { font-size: .82rem; }
.builder-summary > a { align-items: center; background: var(--accent-soft); border-radius: 9px; display: flex; font-size: .75rem; font-weight: 720; grid-column: 1 / -1; justify-content: center; padding: .55rem; text-align: center; text-decoration: none; }
.builder-visuals { align-items: start; display: grid; gap: 1.2rem; grid-template-columns: minmax(320px, .72fr) minmax(500px, 1.28fr); }
.builder-panel { min-width: 0; }
.builder-panel-heading { align-items: end; display: flex; gap: 1rem; justify-content: space-between; margin-bottom: .75rem; }
.builder-panel-heading h2 { font-size: 1.45rem; margin: 0; }
.builder-panel-heading > p { color: var(--muted); font-size: .7rem; margin: 0; max-width: 220px; text-align: right; }
.live-cut-stage { background: radial-gradient(circle at 50% 42%, #fff, #edf2ef); border: 1px solid var(--line); border-radius: var(--radius); height: 520px; overflow: hidden; }
.live-cut-stage canvas { display: block; height: 100%; width: 100%; }
.surface-builder-panel .viewer-stage { height: 520px; }
.builder-viewer-toolbar { align-items: flex-start; flex-direction: column; }
.builder-viewer-toolbar .viewer-toggles { justify-content: flex-start; }
.candidate-toggles .ontop-toggle { color: #a84733; }
.candidate-toggles .bridge-toggle { color: #9a651c; }
.candidate-toggles .hollow-toggle { color: #72518f; }
.builder-site-results { margin-top: 4rem; }
.builder-site-results .section-heading { margin-bottom: .55rem; }
.builder-site-summary { margin: 0 0 1rem; max-width: 88ch; }
.builder-site-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.builder-site-cards li { min-height: 0; }
.builder-site-cards .candidate-ontop::before { background: #d85f45; }
.builder-site-cards .candidate-bridge::before { background: #c98a32; }
.builder-site-cards .candidate-hollow::before { background: #8b6aa8; }
.builder-site-cards .site-math > span { white-space: normal; }
.builder-site-cards .site-support { align-items: flex-start; flex-direction: column; }
.builder-site-cards .site-support code { overflow-wrap: anywhere; }
.builder-site-cards .support-badge.automatic { background: #f1f4f1; color: var(--muted); }
.candidate-note { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: .55rem; grid-template-columns: repeat(3, 1fr); margin-top: 2rem; padding: 1.2rem 1.35rem; }
.candidate-note h2 { font-size: 1rem; grid-column: 1 / -1; margin: 0 .0 .2rem; }
.candidate-note > div { align-items: start; display: grid; gap: .55rem; grid-template-columns: 12px 1fr; }
.candidate-note p { color: var(--muted); font-size: .75rem; line-height: 1.45; margin: 0; }
.candidate-note > p:last-child { border-top: 1px solid var(--line); grid-column: 1 / -1; padding-top: .7rem; }
.candidate-dot { border-radius: 50%; display: block; height: 10px; margin-top: .25rem; width: 10px; }
.candidate-dot.ontop { background: #d85f45; }
.candidate-dot.bridge { background: #c98a32; }
.candidate-dot.hollow { background: #8b6aa8; }

/* Surface detail */
.surface-header { align-items: end; display: grid; gap: 3rem; grid-template-columns: 1fr 340px; margin-bottom: 5rem; }
.surface-header h1 { font-size: clamp(3rem, 8vw, 6.5rem); }
.surface-facts { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); margin: 0; padding: .5rem 1.2rem; }
.surface-facts div { align-items: baseline; border-bottom: 1px solid var(--line); display: flex; gap: 1rem; justify-content: space-between; padding: .75rem 0; }
.surface-facts div:last-child { border: 0; }
.surface-facts dt { color: var(--muted); font-size: .8rem; }
.surface-facts dd { font-size: .9rem; font-weight: 700; margin: 0; text-align: right; }
.cut-section { border-bottom: 1px solid var(--line); margin-bottom: 4.5rem; padding-bottom: 4.5rem; }
.cut-grid { align-items: stretch; display: grid; gap: 1.2rem; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); }
.cut-figure { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cut-figure img { aspect-ratio: 8 / 5.4; display: block; object-fit: contain; width: 100%; }
.cut-copy { background: var(--accent-soft); border: 1px solid #c7dcd8; border-radius: var(--radius); padding: 1.4rem 1.5rem; }
.cut-index { color: var(--accent-dark); font-size: clamp(2.2rem, 5vw, 4rem); font-weight: 780; letter-spacing: -.06em; line-height: 1; margin: 0 0 1.2rem; }
.cut-copy > p:not(.cut-index) { font-size: .91rem; }
.cut-copy dl { border-top: 1px solid #bdd4d0; margin: 1.2rem 0; }
.cut-copy dl div { border-bottom: 1px solid #c8dcd8; display: flex; gap: 1rem; justify-content: space-between; padding: .55rem 0; }
.cut-copy dt { color: var(--muted); font-size: .76rem; }
.cut-copy dd { font-size: .8rem; font-weight: 720; margin: 0; text-align: right; }
.section-heading { align-items: end; display: flex; gap: 2rem; justify-content: space-between; margin: 4.5rem 0 1.2rem; }
.section-heading h2 { margin: 0; }
.layer-key { align-items: center; color: var(--muted); display: flex; flex-wrap: wrap; font-size: .75rem; gap: .38rem; justify-content: flex-end; }
.layer-key span { border: 1px solid #fff; border-radius: 50%; display: inline-block; height: 11px; margin-left: .35rem; width: 11px; }
.layer-one { background: #176b72; }
.layer-two { background: #91aaa6; }
.layer-three { background: #d4dfda; }
.surface-visual { align-items: start; display: grid; gap: 1.2rem; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); }
.surface-visual.many-sites { grid-template-columns: 1fr; }
.surface-visual.many-sites .hero-figure { justify-self: center; max-width: 850px; width: 100%; }
.surface-visual.many-sites .site-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); justify-self: center; max-width: 1000px; width: 100%; }
figure { margin: 0; }
.hero-figure, .profile-grid figure { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.hero-figure img { aspect-ratio: 3 / 2; display: block; object-fit: contain; width: 100%; }
figcaption { border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; padding: .6rem .85rem; }
.site-cards { counter-reset: site; display: grid; gap: .65rem; list-style: none; margin: 0; padding: 0; }
.site-cards li { background: var(--paper); border: 1px solid var(--line); border-radius: 11px; min-height: 91px; padding: .8rem .9rem .75rem 3.25rem; position: relative; }
.site-cards li::before { align-items: center; background: var(--site-accent); border-radius: 50%; color: white; content: attr(value); display: flex; font-size: .78rem; font-weight: 800; height: 25px; justify-content: center; left: .9rem; position: absolute; top: .85rem; width: 25px; }
.site-cards li > div { align-items: baseline; display: flex; gap: .6rem; justify-content: space-between; }
.site-cards li strong { font-size: .9rem; text-transform: capitalize; }
.site-cards li span { color: var(--muted); font-size: .7rem; white-space: nowrap; }
.site-cards li p { color: var(--muted); font-size: .78rem; line-height: 1.4; margin: .25rem 0 0; }
.site-cards .site-math { background: #f5f7f4; border-radius: 7px; display: grid; gap: .24rem; justify-content: stretch; margin-top: .55rem; padding: .55rem .65rem; }
.site-math > code { color: var(--accent-dark); font-size: .72rem; font-weight: 720; }
.site-math > span { color: var(--ink); font-size: .68rem; }
.site-cards .site-math p { font-size: .7rem; margin: .05rem 0 0; }
.site-cards .site-support { align-items: center; display: flex; justify-content: flex-start; gap: .4rem; margin-top: .5rem; }
.site-cards .site-support code { font-size: .7rem; }
.support-badge { border: 1px solid var(--line); border-radius: 999px; font-size: .64rem !important; font-weight: 750; letter-spacing: .02em; line-height: 1; padding: .25rem .48rem; }
.support-badge.ase { background: var(--accent-soft); border-color: #b9d5d0; color: var(--accent-dark); }
.support-badge.manual { background: #f4f5f2; color: var(--muted); }
.ase-site-note { margin: -.2rem 0 1rem; }
.site-coordinate-note { margin: -1.1rem 0 1.1rem; max-width: 78ch; }
.viewer-hint { margin: 0; text-align: right; }
.surface-viewer { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.viewer-stage { background: radial-gradient(circle at 50% 42%, #ffffff 0, #eef3f0 72%); height: clamp(430px, 58vw, 650px); position: relative; touch-action: none; }
.viewer-stage canvas { cursor: grab; display: block; height: 100%; outline: none; width: 100%; }
.viewer-stage canvas:active { cursor: grabbing; }
.viewer-loading { color: var(--muted); font-size: .84rem; left: 50%; position: absolute; top: 50%; transform: translate(-50%, -50%); }
.viewer-loading[hidden] { display: none; }
.viewer-error { max-width: 330px; text-align: center; }
.viewer-tooltip { background: rgba(23,42,45,.94); border-radius: 6px; color: white; font-size: .75rem; padding: .35rem .5rem; pointer-events: none; position: absolute; transform: translate(10px, calc(-100% - 10px)); white-space: nowrap; z-index: 4; }
.viewer-toolbar { align-items: center; border-top: 1px solid var(--line); display: flex; gap: 1rem; justify-content: space-between; padding: .8rem 1rem; }
.viewer-views { display: flex; gap: .35rem; }
.viewer-views button { background: var(--paper); border: 1px solid var(--line-dark); border-radius: 999px; color: var(--ink); cursor: pointer; font: inherit; font-size: .75rem; font-weight: 700; padding: .38rem .65rem; }
.viewer-views button:hover { background: var(--accent-soft); border-color: #9dbdb8; }
.viewer-toggles { color: var(--muted); display: flex; flex-wrap: wrap; font-size: .75rem; gap: .75rem; justify-content: flex-end; }
.viewer-toggles label { align-items: center; cursor: pointer; display: inline-flex; gap: .3rem; }
.viewer-toggles input { accent-color: var(--accent); }
.viewer-status { border-top: 1px solid var(--line); color: var(--muted); font-size: .7rem; margin: 0; max-width: none; padding: .35rem 1rem; text-align: right; }
.profile-grid { display: grid; gap: 1.2rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.profile-grid img { aspect-ratio: 8 / 5; display: block; object-fit: contain; width: 100%; }
.two-column-section { border-top: 1px solid var(--line); display: grid; gap: 4rem; grid-template-columns: .75fr 1.25fr; margin-top: 5rem; padding-top: 2.2rem; }
.two-column-section h2 { margin: 0 0 1rem; }
code { background: #e8efec; border-radius: 4px; font-family: "SFMono-Regular", Consolas, monospace; font-size: .83em; padding: .12em .33em; }
pre { background: var(--code); border-radius: 10px; color: #edf5f3; font-size: .85rem; line-height: 1.55; overflow-x: auto; padding: 1.2rem 1.35rem; }
pre code { background: transparent; color: inherit; padding: 0; }
.mistakes { background: #f0f3ef; border: 1px solid var(--line); border-radius: 10px; margin: 3rem 0; padding: .85rem 1rem; }
.mistakes summary { cursor: pointer; font-size: .9rem; font-weight: 720; }
.mistakes ul { color: var(--muted); font-size: .88rem; margin-bottom: .4rem; }
.surface-switcher, .page-switcher { border-top: 1px solid var(--line); display: grid; gap: 2rem; grid-template-columns: 1fr 1fr; margin-top: 4rem; padding-top: 1.5rem; }
.surface-switcher a, .page-switcher a { border-radius: 10px; color: var(--ink); padding: .75rem; text-decoration: none; }
.surface-switcher a:hover, .page-switcher a:hover { background: var(--paper); }
.surface-switcher .next, .page-switcher .next { text-align: right; }
.surface-switcher small, .page-switcher small { color: var(--muted); display: block; font-size: .7rem; margin-bottom: .15rem; text-transform: uppercase; }
.surface-switcher strong, .page-switcher strong { font-size: .9rem; }

/* Concepts */
.concept-index-header { max-width: 800px; margin-bottom: 3.5rem; }
.concept-index-header h1 { margin-top: 0; }
.concept-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.concept-path { list-style: none; margin: 0; max-width: none; padding: 0; }
.concept-path > li { display: flex; min-width: 0; }
.concept-path .concept-card { width: 100%; }
.concept-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; min-height: 210px; padding: 1.5rem; position: relative; text-decoration: none; transition: box-shadow .2s ease, transform .2s ease; }
.concept-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.concept-card > span { color: var(--accent); font-size: .75rem; font-weight: 780; letter-spacing: .1em; }
.concept-card h2 { margin: .5rem 0; }
.concept-card p { color: var(--muted); font-size: .9rem; margin-bottom: 0; }
.concept-card b { bottom: 1.2rem; color: var(--accent); position: absolute; right: 1.3rem; }
.concept-builder-link { border-top: 1px solid var(--line); color: var(--muted); margin-top: 2.5rem; padding-top: 1.2rem; }
.concept-layout { align-items: start; display: grid; gap: clamp(2rem, 7vw, 6rem); grid-template-columns: 210px minmax(0, 1fr); }
.concept-sidebar { position: sticky; top: 6rem; }
.concept-home { color: var(--ink); display: inline-block; font-size: .8rem; font-weight: 800; letter-spacing: .09em; margin-bottom: .75rem; text-decoration: none; text-transform: uppercase; }
.concept-sidebar nav { border-left: 1px solid var(--line); display: grid; }
.concept-sidebar nav a { color: var(--muted); display: block; font-size: .85rem; margin-left: -1px; padding: .65rem .8rem; text-decoration: none; }
.concept-sidebar nav a:hover, .concept-sidebar nav a[aria-current="page"] { border-left: 2px solid var(--accent); color: var(--accent-dark); }
.concept-sidebar nav a[aria-current="page"] { background: linear-gradient(90deg, var(--accent-soft), transparent); font-weight: 700; }
.concept-article { max-width: 820px; min-width: 0; }
.concept-masthead { border-bottom: 1px solid var(--line); margin-bottom: 1.2rem; padding-bottom: 1.6rem; }
.concept-masthead h1 { font-size: clamp(2.5rem, 5vw, 4.25rem); margin-top: 0; }
.concept-masthead .lede { margin-bottom: 0; }
.page-contents { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(23, 42, 45, .035); margin: 1.4rem 0 3.2rem; padding: .9rem 1rem 1rem; }
.page-contents-title { color: var(--muted); display: block; font-size: .68rem; font-weight: 780; letter-spacing: .08em; text-transform: uppercase; }
.page-contents ol { counter-reset: page-section; display: flex; flex-wrap: wrap; gap: .45rem; list-style: none; margin: .65rem 0 0; max-width: none; padding: 0; }
.page-contents li { counter-increment: page-section; min-width: 0; }
.page-contents a { align-items: center; background: #f3f6f3; border: 1px solid transparent; border-radius: 8px; color: var(--ink); display: inline-flex; font-size: .79rem; font-weight: 650; gap: .48rem; line-height: 1.25; min-height: 38px; padding: .45rem .65rem; text-decoration: none; transition: background .16s ease, border-color .16s ease, color .16s ease; }
.page-contents a::before { color: var(--accent); content: counter(page-section, decimal-leading-zero); font-size: .63rem; font-weight: 800; letter-spacing: .03em; }
.page-contents a:hover { background: var(--accent-soft); border-color: #c4dcd7; color: var(--accent-dark); }
.page-contents a:focus-visible { border-color: var(--accent); outline: 2px solid rgba(23, 107, 114, .2); outline-offset: 2px; }
.citation { font-size: .72em; line-height: 0; margin-left: .12em; vertical-align: super; }
.citation a { color: var(--accent-dark); font-weight: 750; text-decoration: none; }
.citation a:hover { text-decoration: underline; }
.citation-missing { color: var(--warm); }
.concept-article h2 { scroll-margin-top: 6rem; }
.concept-article h2:first-of-type { margin-top: 2.7rem; }
.formula-strip { background: var(--accent-soft); border: 1px solid #c8ddda; border-radius: var(--radius); margin: 1.5rem 0 2rem; padding: .85rem 1.25rem; text-align: center; }
.plane-demo { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 0; grid-template-columns: 1.35fr .85fr; margin: 2rem 0 3rem; overflow: hidden; }
.plane-stage { align-items: center; background: #edf2ee; display: flex; justify-content: center; min-height: 440px; padding: 1rem; }
.plane-stage svg { height: auto; max-width: 520px; width: 100%; }
.cube-edge { fill: none; stroke: #78918e; stroke-linecap: round; stroke-width: 2; }
.cube-back { stroke: #b5c4c0; stroke-dasharray: 5 6; }
.atom { fill: white; stroke: #527873; stroke-width: 2; }
.face-atom { fill: #dbe8e4; }
.axis { stroke: #445c5f; stroke-width: 1.5; }
.axis-label { fill: #445c5f; font: 700 13px Inter, sans-serif; }
.cut-plane { fill: var(--plane-colour); fill-opacity: .25; stroke: var(--plane-colour); stroke-width: 2.5; transition: points .3s ease; }
.plane-guides line { stroke: var(--plane-colour); stroke-dasharray: 4 4; stroke-width: 1.4; }
.plane-controls { display: flex; flex-direction: column; padding: 1.5rem; }
.plane-buttons { display: flex; gap: .4rem; }
.plane-buttons button { background: transparent; border: 1px solid var(--line-dark); border-radius: 999px; color: var(--muted); cursor: pointer; font: inherit; font-size: .82rem; font-weight: 750; padding: .38rem .7rem; }
.plane-buttons button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: white; }
.plane-controls h3 { font-size: 1.7rem; margin: auto 0 .6rem; }
.plane-equation { color: var(--accent-dark); font-size: .82rem; font-weight: 700; line-height: 1.5; }
.plane-description { color: var(--muted); font-size: .88rem; }
.steps { counter-reset: steps; display: grid; gap: .8rem; list-style: none; padding: 0; }
.steps li { border-top: 1px solid var(--line); counter-increment: steps; display: grid; gap: 1rem; grid-template-columns: 34px 1fr; padding: 1rem 0; }
.steps li::before { align-items: center; background: var(--accent-soft); border-radius: 50%; color: var(--accent-dark); content: counter(steps); display: flex; font-size: .78rem; font-weight: 800; height: 30px; justify-content: center; width: 30px; }
.steps li strong { display: block; margin-bottom: .15rem; }
.steps li p { color: var(--muted); font-size: .9rem; margin: 0; }
.comparison { display: grid; gap: .8rem; grid-template-columns: repeat(3, 1fr); margin: 1.5rem 0; }
.comparison > div { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.comparison strong { display: block; }
.comparison span { color: var(--muted); font-size: .8rem; }
.concept-callout { background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; display: block; margin: 2rem 0; padding: 1rem 1.2rem; }
.concept-callout.warning { background: #fff1ed; border-left-color: var(--warm); }
.concept-callout strong { color: var(--ink); }
.concept-callout p { color: var(--muted); font-size: .88rem; margin: .25rem 0 0; }
.concept-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 2rem 0; }
.concept-references { border-top: 1px solid var(--line); margin-top: 4.5rem; padding-top: 2rem; }
.concept-references h2 { font-size: 1.65rem; margin: 0 0 1rem; }
.concept-references ol { color: var(--muted); font-size: .83rem; line-height: 1.6; margin: 0; max-width: none; padding-left: 1.5rem; }
.concept-references li { padding: .42rem .6rem; scroll-margin-top: 6rem; }
.concept-references li:target { background: var(--accent-soft); border-radius: 7px; color: var(--ink); }
.concept-references .reference-authors { color: var(--ink); font-weight: 700; }
.concept-references cite { color: var(--ink); }
.concept-references a { overflow-wrap: anywhere; }
.reference-accessed { white-space: nowrap; }
.structure-definitions { display: grid; gap: .8rem; grid-template-columns: repeat(3, 1fr); margin: 1.5rem 0 2.2rem; }
.structure-definitions section { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.structure-definitions h3 { color: var(--accent-dark); margin: 0 0 .45rem; }
.structure-definitions p { color: var(--muted); font-size: .8rem; margin: .35rem 0; }
.structure-definitions code { display: block; font-size: .72rem; line-height: 1.7; overflow-wrap: anywhere; }
.site-geometry-figure { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); margin: 2rem 0 2.5rem; overflow: hidden; }
.site-geometry-figure svg { background: #edf2ee; display: block; width: 100%; }
.site-geometry-figure figcaption { color: var(--muted); font-size: .78rem; padding: .65rem 1rem; }
.site-net.bonds { fill: none; stroke: #bfd0cb; stroke-width: 5; }
.site-net.atoms circle { fill: var(--accent); r: 24px; stroke: white; stroke-width: 4; }
.site-net.markers circle { fill: var(--site-accent); r: 12px; stroke: white; stroke-width: 4; }
.site-net.labels { fill: var(--ink); font: 700 16px Inter, sans-serif; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; font-size: .9rem; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: .7rem .8rem; text-align: left; vertical-align: top; }
th { font-weight: 720; }
thead th { color: var(--muted); font-size: .75rem; text-transform: uppercase; }

@media (max-width: 900px) {
  .home-hero, .atlas-intro, .surface-header, .cut-grid { grid-template-columns: 1fr; }
  .home-hero { min-height: auto; }
  .lattice-motif { max-width: 300px; }
  .surface-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .surface-visual { grid-template-columns: 1fr; }
  .site-cards { grid-template-columns: repeat(2, 1fr); }
  .plane-demo { grid-template-columns: 1fr; }
  .plane-stage { min-height: 360px; }
  .plane-controls h3 { margin-top: 2rem; }
  .builder-controls { grid-template-columns: 1fr 1fr; }
  .builder-controls .offset-selector { border-right: 0; border-top: 1px solid var(--line); grid-column: 1 / -1; }
  .builder-visuals { grid-template-columns: 1fr; }
  .live-cut-stage, .surface-builder-panel .viewer-stage { height: 500px; }
}

@media (max-width: 680px) {
  .site-header { flex-wrap: wrap; gap: .45rem; padding-inline: .9rem; }
  .site-name { font-size: .88rem; }
  .site-header nav { gap: .1rem; }
  .site-header nav a { font-size: .82rem; padding-inline: .55rem; }
  .page-shell { padding-top: 2.8rem; width: min(calc(100% - 1.4rem), 1120px); }
  .site-footer { align-items: center; flex-direction: column; text-align: center; }
  .site-credit { margin: 0 auto; text-align: center; }
  .credit-details { border-left: 2px solid #c8ddda; border-right: 0; padding: .15rem 0 .15rem .8rem; }
  .credit-details nav { justify-content: center; }
  .home-sections, .surface-grid, .profile-grid, .two-column-section, .concept-grid, .comparison { grid-template-columns: 1fr; }
  .page-contents { margin-bottom: 2.6rem; padding: .85rem; }
  .page-contents ol { display: grid; grid-template-columns: 1fr; margin-top: .55rem; }
  .page-contents a { justify-content: flex-start; width: 100%; }
  .structure-definitions { grid-template-columns: 1fr; }
  .surface-visual.many-sites .site-cards { grid-template-columns: 1fr; }
  .site-geometry-figure { overflow-x: auto; }
  .site-geometry-figure svg { min-width: 620px; }
  .surface-header { margin-bottom: 3rem; }
  .section-heading { align-items: start; flex-direction: column; }
  .layer-key { justify-content: flex-start; }
  .site-cards { grid-template-columns: 1fr; }
  .viewer-stage { height: 430px; }
  .viewer-toolbar { align-items: flex-start; flex-direction: column; }
  .viewer-toggles { justify-content: flex-start; }
  .viewer-hint { text-align: left; }
  .builder-controls { display: block; }
  .builder-controls fieldset { border-bottom: 1px solid var(--line); border-right: 0; }
  .builder-controls .offset-selector { border-bottom: 0; }
  .builder-summary { grid-template-columns: repeat(2, 1fr); }
  .builder-panel-heading { align-items: start; flex-direction: column; }
  .builder-panel-heading > p { text-align: left; }
  .live-cut-stage, .surface-builder-panel .viewer-stage { height: 410px; }
  .candidate-note { grid-template-columns: 1fr; }
  .candidate-note h2, .candidate-note > p:last-child { grid-column: 1; }
  .concept-layout { display: block; }
  .concept-sidebar { background: var(--background); margin: -1rem 0 2.2rem; overflow-x: auto; padding: 1rem 0 .5rem; position: static; }
  .concept-home { display: none; }
  .concept-sidebar nav { border: 0; display: flex; min-width: max-content; }
  .concept-sidebar nav a { border: 1px solid var(--line); border-radius: 999px; display: block; margin: 0 .35rem 0 0; padding: .38rem .7rem; }
  .concept-sidebar nav a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: white; }
  .plane-stage { min-height: 300px; }
  .surface-switcher, .page-switcher { gap: .5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
