/* neuron.bazyl.net – the book's own palette and type (styles/book.css), on screen. */

@font-face { font-family: Manrope; font-weight: 400; font-display: swap; src: url(/fonts/Manrope-400.woff2) format("woff2"); }
@font-face { font-family: Manrope; font-weight: 500; font-display: swap; src: url(/fonts/Manrope-500.woff2) format("woff2"); }
@font-face { font-family: Manrope; font-weight: 600; font-display: swap; src: url(/fonts/Manrope-600.woff2) format("woff2"); }
@font-face { font-family: Manrope; font-weight: 700; font-display: swap; src: url(/fonts/Manrope-700.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url(/fonts/JetBrainsMono-500.woff2) format("woff2"); }

:root {
  --navy: #1c2b37;      /* covers and title page */
  --ink: #253746;       /* headings */
  --text: #414e5a;      /* body */
  --muted: #5e6b77;     /* captions */
  --green: #1a6b57;     /* links, numbers */
  --mint: #b9dcd2;      /* accents on navy */
  --paper: #f7f6f3;     /* panels */
  --rule: #d9dfe3;
  --rule-warm: #e3e1dc;
  --on-navy: #dfe8e5;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --gutter: clamp(16px, 4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: #fff; color: var(--text);
  font: 400 1.0625rem/1.62 Manrope, Arial, sans-serif;
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.hero :focus-visible, .buy :focus-visible, .topbar :focus-visible { outline-color: var(--mint); }
h1, h2, h3, h4 { color: var(--ink); font-weight: 600; letter-spacing: -.03em; line-height: 1.1; margin: 0; }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.6rem); margin-bottom: .6em; }
p { margin: 0 0 1em; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 760px; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--gutter); background: rgba(28, 43, 55, .96); color: #fff;
  backdrop-filter: blur(6px);
}
.wordmark { color: #fff; text-decoration: none; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wordmark:hover { color: var(--mint); }
.topbar nav { display: flex; align-items: center; gap: clamp(12px, 2.4vw, 28px); font-size: .95rem; }
.topbar nav a { color: var(--on-navy); text-decoration: none; }
.topbar nav a:hover { color: #fff; }
.topbar .lang { border: 1px solid rgba(185, 220, 210, .5); padding: 2px 8px; border-radius: 2px; font-size: .85rem; }
@media (max-width: 640px) {
  .home .topbar nav a:not(.lang) { display: none; }
  .home .topbar nav a[href$="kup"], .home .topbar nav a[href$="buy"] { display: inline; }
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; flex-direction: column; justify-content: center;
  min-height: 52px; padding: 12px 22px; border-radius: 2px;
  font-weight: 600; font-size: 1rem; line-height: 1.25; text-decoration: none; letter-spacing: -.01em;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn small { display: block; margin-top: 3px; font-weight: 400; font-size: .8rem; opacity: .8; letter-spacing: 0; }
.btn-sample { background: var(--mint); color: var(--navy); }
.btn-sample:hover { background: #fff; color: var(--navy); }
.btn-sample.on-light { background: var(--navy); color: #fff; }
.btn-sample.on-light:hover { background: var(--green); color: #fff; }
.btn-ghost { border: 1px solid rgba(255, 255, 255, .45); color: #fff; }
.btn-ghost:hover { border-color: var(--mint); color: var(--mint); }
.btn-buy { background: var(--mint); color: var(--navy); }
.btn-buy:hover { background: #fff; color: var(--navy); }
.btn.is-disabled { opacity: .45; pointer-events: none; }

/* ---------------------------------------------------------------- hero */
.hero { position: relative; overflow: hidden; background: var(--navy); color: var(--on-navy); }
.hero-photo {
  position: absolute; inset: 0;
  background: url(/img/gtx580_die.jpg) center 40% / cover no-repeat;
  opacity: .32; filter: saturate(.6);
}
.hero-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(28, 43, 55, .96) 0%, rgba(28, 43, 55, .78) 45%, rgba(28, 43, 55, .45) 100%); }
.hero-grid {
  position: relative; display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(32px, 6vw, 88px); align-items: center;
  padding-top: clamp(56px, 9vw, 120px); padding-bottom: clamp(56px, 9vw, 120px);
}
.kicker { color: var(--mint); font-weight: 500; margin-bottom: 1.4em; }
.hero h1 { color: #fff; font-size: clamp(2.6rem, 6.4vw, 5rem); line-height: 1; letter-spacing: -.045em; max-width: 11ch; }
.subtitle { margin: .9em 0 0; max-width: 34ch; font-size: clamp(1.1rem, 1.6vw, 1.3rem); line-height: 1.5; color: #fff; }
.byline { margin: 1.6em 0 2.2em; color: var(--mint); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-cover img { width: 100%; max-width: 380px; margin-left: auto; box-shadow: 0 30px 60px -10px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .06); }
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-cover { order: -1; }
  .hero-cover img { max-width: 200px; margin: 0; }
}

/* ---------------------------------------------------------------- opening */
.opening { padding: clamp(64px, 9vw, 112px) 0 clamp(48px, 7vw, 80px); }
.opening blockquote { margin: 0 0 1.4em; }
.opening blockquote p { color: var(--ink); font-size: clamp(1.45rem, 2.7vw, 2rem); line-height: 1.35; font-weight: 500; letter-spacing: -.02em; text-wrap: pretty; }
.opening p { max-width: 62ch; }

/* ---------------------------------------------------------------- the meter: areas to scale */
.meter { background: var(--paper); padding: clamp(56px, 8vw, 104px) 0; }
.meter-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(32px, 6vw, 80px); align-items: center; }
.meter dl { margin: 1.4em 0 1.6em; border-top: 1px solid var(--ink); }
.meter dl div { display: grid; grid-template-columns: 7.5rem 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rule-warm); }
.meter dt { font: 500 1.15rem/1.45 var(--mono); color: var(--green); letter-spacing: -.02em; }
.meter dd { margin: 0; }
.meter-note { color: var(--muted); font-size: .95rem; max-width: 46ch; }
.meter-square { position: relative; width: 100%; max-width: 560px; aspect-ratio: 1; margin-left: auto; background: var(--navy); }
/* A 488 W square next to a 1.2 GW one would be 1/1568 of the side: well under a pixel. One pixel it is. */
.meter-dot { position: absolute; left: 12%; top: 12%; width: 1px; height: 1px; background: #fff; }
.meter-lead { position: absolute; left: calc(12% + 4px); top: 12%; width: 18%; border-top: 1px solid rgba(185, 220, 210, .55); }
.meter-dot-label { position: absolute; left: calc(30% + 10px); top: calc(12% - .75em); font: 500 .95rem/1.5 var(--mono); color: var(--mint); }
.meter-big-label { position: absolute; right: 6%; bottom: 5%; font: 500 clamp(1.6rem, 4vw, 2.6rem)/1 var(--mono); color: #fff; letter-spacing: -.03em; }
@media (max-width: 820px) {
  .meter-grid { grid-template-columns: 1fr; }
  .meter-square { margin: 0; }
}

/* ---------------------------------------------------------------- contents */
.toc { padding: clamp(64px, 9vw, 112px) 0 clamp(40px, 6vw, 72px); }
.lead { max-width: 60ch; font-size: 1.15rem; line-height: 1.55; color: var(--ink); margin-bottom: 2.4em; }
.part { margin-top: 2.6em; }
.part-intro { margin-top: 0; }
.part h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding-bottom: 12px; border-bottom: 1px solid var(--ink); font-size: 1.35rem; }
.part-no { color: var(--green); }
.part-brief { flex-basis: 100%; font-size: .95rem; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.chapters { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(24px, 4vw, 48px); }
.part-intro .chapters { border-top: 1px solid var(--ink); }
.chapter { display: grid; grid-template-columns: 136px 2.4rem 1fr; gap: 16px; align-items: start; padding: 18px 0; border-bottom: 1px solid var(--rule-warm); }
.chapter img { width: 136px; aspect-ratio: 16 / 9; object-fit: cover; filter: saturate(.85); }
.ch-no { font: 500 .85rem/1.9 var(--mono); color: var(--green); }
.chapter h4 { font-size: 1.1rem; letter-spacing: -.015em; line-height: 1.3; margin-bottom: 4px; }
.chapter p { margin: 0; font-size: .95rem; line-height: 1.5; }
.tag { display: inline-block; margin-top: 8px; padding: 1px 8px; background: var(--mint); color: var(--navy); font-size: .8rem; font-weight: 600; border-radius: 2px; }
@media (max-width: 900px) { .chapters { grid-template-columns: 1fr; } }
@media (max-width: 520px) {
  .chapter { grid-template-columns: 88px 1fr; gap: 12px; }
  .chapter img { width: 88px; grid-row: span 2; }
  .ch-no { line-height: 1.2; }
}

/* ---------------------------------------------------------------- how it is written */
.rules { background: var(--paper); padding: clamp(56px, 8vw, 96px) 0; }
.rule-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(24px, 5vw, 64px); margin: 1em 0 0; border-top: 1px solid var(--ink); }
.rule-list div { padding: 18px 0; border-bottom: 1px solid var(--rule-warm); }
.rule-list dt { color: var(--ink); font-weight: 700; display: inline; }
.rule-list dd { display: inline; margin: 0 0 0 .25em; }
@media (max-width: 720px) { .rule-list { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- sample */
.sample { padding: clamp(64px, 9vw, 112px) 0; }
.sample-head { max-width: 640px; margin-bottom: clamp(32px, 5vw, 56px); }
.sample-head .btn { margin-top: .6em; }
.pages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 3vw, 40px); }
.pages figure { margin: 0; }
.pages img { box-shadow: 0 1px 2px rgba(37, 55, 70, .12), 0 12px 32px -12px rgba(37, 55, 70, .35); }
.pages figcaption { margin-top: 12px; font-size: .9rem; color: var(--muted); }
@media (max-width: 720px) {
  .pages { grid-template-columns: repeat(3, 72%); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; margin-right: calc(-1 * var(--gutter)); padding-right: var(--gutter); }
  .pages figure { scroll-snap-align: start; }
}

/* ---------------------------------------------------------------- buy */
.buy { background: var(--navy); color: var(--on-navy); padding: clamp(64px, 9vw, 112px) 0; }
.buy h2 { color: #fff; }
.buy-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(32px, 6vw, 80px); }
.price { font-size: clamp(4rem, 10vw, 7rem); font-weight: 600; letter-spacing: -.05em; line-height: 1; color: var(--mint); margin: .1em 0 .3em; }
.buy-why { max-width: 36ch; }
.buy-list { list-style: none; margin: 0 0 28px; padding: 0; border-top: 1px solid rgba(185, 220, 210, .5); }
.buy-list li { padding: 12px 0; border-bottom: 1px solid rgba(185, 220, 210, .2); color: #fff; }
.buy-pay { margin-top: 18px; font-size: .95rem; max-width: 52ch; }
.buy-pending { color: var(--mint); font-size: .95rem; }
.buy-alt { font-size: .95rem; }
.buy-alt a { color: var(--mint); }
.buy-alt a:hover { color: #fff; }
@media (max-width: 820px) { .buy-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- author, questions */
.author { padding: clamp(64px, 9vw, 104px) 0 0; }
.faq { padding: clamp(48px, 7vw, 80px) 0 clamp(64px, 9vw, 112px); }
.faq details { border-bottom: 1px solid var(--rule-warm); }
.faq details:first-of-type { border-top: 1px solid var(--ink); }
.faq summary { cursor: pointer; list-style: none; padding: 16px 32px 16px 0; position: relative; color: var(--ink); font-weight: 600; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 13px; font-size: 1.3rem; font-weight: 400; color: var(--green); }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding-bottom: 8px; max-width: 64ch; }

/* ---------------------------------------------------------------- footer */
.footer { background: var(--paper); padding: 40px 0 48px; font-size: .9rem; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; }
.credits { margin-bottom: 24px; }
.credits summary { cursor: pointer; color: var(--ink); font-weight: 600; }
.credits ul { padding-left: 1.1em; margin: .6em 0 0; }
.credits li { margin: 2px 0; }
.credits p { margin: .6em 0 0; }

/* ---------------------------------------------------------------- inner pages */
.page-main { padding-top: clamp(48px, 8vw, 96px); padding-bottom: clamp(64px, 9vw, 112px); min-height: 60vh; }
.page-main h1 { font-size: clamp(2rem, 4.4vw, 3rem); margin-bottom: .7em; }
.status { font-size: 1.1rem; color: var(--ink); }
.status.is-problem { padding: 16px 18px; background: var(--paper); border-left: 3px solid var(--green); }
.edition { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--ink); }
.edition h2 { font-size: 1.3rem; margin-bottom: .2em; }
.file { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rule-warm); }
.file span { color: var(--text); }
.file b { color: var(--ink); margin-right: 8px; }
.file .btn { min-height: 44px; padding: 8px 18px; background: var(--navy); color: #fff; flex-shrink: 0; }
.file .btn:hover { background: var(--green); }
.prose h2 { font-size: 1.35rem; margin: 2em 0 .6em; letter-spacing: -.02em; }
.prose ol, .prose ul { padding-left: 1.3em; }
.prose li { margin: .35em 0; }
.prose .note { padding: 14px 18px; background: var(--paper); font-size: .95rem; }
