/* swbpipe.com — the hardcover.
   Design language: the 1956 Wiley edition of Design of Piping Systems. Teal book cloth with gilt
   stamping for the cover; a Modern-face book page for everything inside; figures in the
   Kellogg isometric manner. Colours are tokens; dark mode is the cloth itself.
   Fonts are self-hosted: the host's Content-Security-Policy allows only 'self'.
   Computer Modern (CMU) is subset to Latin; see tools/ for the subsetting note. */

@font-face{font-family:"CMU Serif";font-style:normal;font-weight:500;font-display:swap;src:url(fonts/cmu-serif-500-roman.woff2) format("woff2")}
@font-face{font-family:"CMU Serif";font-style:italic;font-weight:500;font-display:swap;src:url(fonts/cmu-serif-500-italic.woff2) format("woff2")}
@font-face{font-family:"CMU Serif";font-style:normal;font-weight:700;font-display:swap;src:url(fonts/cmu-serif-700-roman.woff2) format("woff2")}
@font-face{font-family:"CMU Serif Extra";font-style:normal;font-weight:700;font-display:swap;src:url(fonts/cmu-serif-extra-700-roman.woff2) format("woff2")}
@font-face{font-family:"Varela Round";font-style:normal;font-weight:400;font-display:swap;src:url(fonts/varela-round-latin-400-normal.woff2) format("woff2")}

:root{
  --paper:#f6f3ec; --paper-2:#ece7da; --card:#fbf9f4;
  --ink:#1c1d1f; --ink-2:#45474a; --ink-3:#6f6d67;
  --rule:#d8d0bf; --rule-strong:#b9ae97;
  --cloth:#1a3d50; --cloth-deep:#132f3e; --cloth-ink:#e9e1cc;
  --gilt:#cfae62; --gilt-deep:#8c6f2e;
  --mark:#b0452a;                     /* the checker's red pencil: proposals and marks */
  --serif:"CMU Serif", "Computer Modern Serif", "Century Schoolbook", Georgia, serif;
  --display:"CMU Serif Extra", "CMU Serif", Georgia, serif;
  --letter:"Varela Round", "Avenir Next", system-ui, sans-serif;
  --measure:36rem; --wrap:72rem; --gutter:clamp(1rem,4vw,2.5rem);
  --section:clamp(4rem,9vw,7rem);
  color-scheme:light dark;
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --paper:#10222c; --paper-2:#152a36; --card:#172e3b;
    --ink:#ebe4d2; --ink-2:#c4bca9; --ink-3:#978f7e;
    --rule:#29414e; --rule-strong:#3c5664;
    --cloth:#0b1a22; --cloth-deep:#08141a;
    --gilt:#d6b56b; --gilt-deep:#d6b56b;
    --mark:#e58a6c;
  }
}
:root[data-theme="dark"]{
  --paper:#10222c; --paper-2:#152a36; --card:#172e3b;
  --ink:#ebe4d2; --ink-2:#c4bca9; --ink-3:#978f7e;
  --rule:#29414e; --rule-strong:#3c5664;
  --cloth:#0b1a22; --cloth-deep:#08141a;
  --gilt:#d6b56b; --gilt-deep:#d6b56b;
  --mark:#e58a6c;
}

*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--paper);color:var(--ink);font:500 1.125rem/1.6 var(--serif);
  font-kerning:normal;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased}
img,svg{max-width:100%;height:auto;display:block}
a{color:inherit;text-decoration-thickness:1px;text-underline-offset:.18em}
a:hover{color:var(--gilt-deep)}
.wrap{max-width:var(--wrap);margin:0 auto;padding:0 var(--gutter)}
.skip{position:absolute;left:-999px}.skip:focus{left:1rem;top:1rem;background:var(--paper);padding:.5rem 1rem;z-index:9}

/* ---------- small capitals, the book's workhorse ---------- */
.caps{font-variant:small-caps;letter-spacing:.08em;text-transform:lowercase}
.spaced{text-transform:uppercase;letter-spacing:.18em;font-size:.72em}

/* ---------- header ---------- */
.site-head{position:absolute;inset:0 0 auto 0;z-index:3;color:var(--cloth-ink)}
.site-head .wrap{display:flex;align-items:center;justify-content:space-between;height:4.25rem}
.brand{display:flex;align-items:center;gap:.65rem;text-decoration:none;font:700 1.05rem/1 var(--serif);letter-spacing:.14em}
.brand i{width:1.55rem;height:1.72rem;background:var(--gilt);
  -webkit-mask:url(swb-mark-160.png) center/contain no-repeat;mask:url(swb-mark-160.png) center/contain no-repeat}
.nav{display:flex;gap:1.6rem;align-items:center;font-size:.95rem}
.nav a{text-decoration:none;opacity:.86}.nav a:hover{opacity:1;color:var(--gilt)}
.nav .dl{border:1px solid color-mix(in srgb,var(--gilt) 70%,transparent);color:var(--gilt);padding:.42rem .9rem;border-radius:2px;opacity:1}

/* ---------- the cover ---------- */
.cover{position:relative;background:var(--cloth);color:var(--cloth-ink);overflow:hidden;
  padding:clamp(8rem,16vw,11rem) 0 clamp(4.5rem,9vw,7rem);text-align:center}
.cover::before{content:"";position:absolute;inset:0;pointer-events:none;opacity:.5;
  background:
    repeating-linear-gradient(0deg,rgba(255,255,255,.028) 0 1px,transparent 1px 3px),
    repeating-linear-gradient(90deg,rgba(0,0,0,.08) 0 1px,transparent 1px 3px)}
.cover::after{content:"";position:absolute;inset:0;pointer-events:none;
  background:radial-gradient(ellipse at 50% 30%,transparent 40%,rgba(0,0,0,.28) 100%)}
.cover .wrap{position:relative;z-index:1}
.cover p{margin-left:auto;margin-right:auto;max-width:none}
.cover h1{font:700 clamp(2.3rem,5.4vw,4.1rem)/1.08 var(--display);color:var(--gilt);margin:0 auto;max-width:17ch;
  letter-spacing:-.005em;text-wrap:balance;
  text-shadow:0 1px 0 rgba(0,0,0,.35), 0 -1px 0 rgba(255,255,255,.08)}
.cover .mt-page{margin-top:2.2rem}
.btn.soon{background:transparent;color:var(--gilt);border-style:dashed;cursor:default}
.cover .imprint{margin:1.5rem 0 0;color:var(--gilt);font:700 .82rem/1 var(--serif);letter-spacing:.2em;text-transform:uppercase;opacity:.92}
.stamp{width:clamp(5.5rem,10vw,7.2rem);aspect-ratio:932/1032;margin:2.1rem auto 0;background:var(--gilt);
  -webkit-mask:url(swb-mark-640.png) center/contain no-repeat;mask:url(swb-mark-640.png) center/contain no-repeat;
  filter:drop-shadow(0 1px 0 rgba(0,0,0,.4))}
.cover .lede{max-width:40rem !important;margin:2.4rem auto 0;font-size:clamp(1.08rem,1.4vw,1.22rem);line-height:1.6;color:var(--cloth-ink)}
.cover .actions{display:flex;flex-wrap:wrap;justify-content:center;gap:.8rem;margin-top:2rem}
.cover .fine{margin:1.3rem 0 0;font-size:.82rem;letter-spacing:.14em;text-transform:uppercase;color:color-mix(in srgb,var(--cloth-ink) 68%,transparent)}

.btn{display:inline-flex;align-items:center;gap:.5rem;padding:.78rem 1.3rem;border-radius:2px;font:700 1rem/1 var(--serif);
  text-decoration:none;border:1px solid var(--gilt);background:var(--gilt);color:var(--cloth-deep)}
.btn:hover{color:var(--cloth-deep);filter:brightness(1.06)}
.btn.ghost{background:transparent;color:var(--gilt)}
.btn.ghost:hover{color:var(--gilt);background:color-mix(in srgb,var(--gilt) 12%,transparent)}
.btn.ink{background:var(--ink);border-color:var(--ink);color:var(--paper)}
.btn.ink:hover{color:var(--paper)}

/* ---------- chapters ---------- */
section{padding:var(--section) 0}
section + section{border-top:1px solid var(--rule)}
.chapter{display:grid;grid-template-columns:minmax(0,14rem) minmax(0,1fr);gap:clamp(1.5rem,4vw,4rem);align-items:start}
.chapter-no{margin:0;font:700 .78rem/1.2 var(--serif);letter-spacing:.2em;text-transform:uppercase;color:var(--ink-3);
  padding-top:.7rem;border-top:2px solid var(--ink)}
.chapter-no b{display:block;font:700 2.6rem/1 var(--display);letter-spacing:0;color:var(--ink);margin-top:.5rem}
h2{font:700 clamp(1.9rem,3.6vw,2.75rem)/1.12 var(--display);margin:0 0 1.2rem;letter-spacing:-.005em;text-wrap:balance}
h3{font:700 1.2rem/1.3 var(--serif);margin:0 0 .45rem}
h3 .n{font-weight:700;margin-right:.55rem}
p{margin:0 0 1rem;max-width:var(--measure);hyphens:auto}
.lead{font-size:1.24rem;line-height:1.55;color:var(--ink-2)}
.drop::first-letter{float:left;font:700 3.35em/.84 var(--display);margin:.06em .1em 0 0;padding-right:.02em}
.aside{font-style:italic;color:var(--ink-2);border-left:2px solid var(--mark);padding-left:1rem;margin-top:1.6rem}

/* ---------- figures and plates ---------- */
figure{margin:0}
.figure{margin-top:clamp(2rem,5vw,3.5rem);color:var(--ink)}
.figure svg{width:100%}
.fig .pipe{fill:none;stroke:currentColor;stroke-width:3.4;stroke-linecap:round;stroke-linejoin:round}
.fig .anchor{stroke:currentColor;stroke-width:3.4;stroke-linecap:round}
.fig .thin{stroke:currentColor;stroke-width:1;fill:none}
.fig .thin2{stroke:currentColor;stroke-width:1.6;fill:none}
.fig .valve{fill:var(--paper);stroke:currentColor;stroke-width:1.6}
.fig .accent{stroke:var(--mark);stroke-width:2;fill:none}
.fig .accentt{fill:var(--mark)}
.fig .removed{stroke:currentColor;stroke-width:1.4;stroke-dasharray:3 3;opacity:.55}
.fig text{font-family:var(--letter);fill:currentColor}
.fig text.lbl{font-size:11px;letter-spacing:.05em}
.fig text.sm{font-size:9.5px}
.fig text.head{font-size:12.5px;font-weight:700;letter-spacing:.08em}
.fig text.node{font:italic 500 13px var(--serif);letter-spacing:0}
.fig text.accentt{fill:var(--mark)}
figcaption{margin-top:1rem;font-size:.9rem;line-height:1.5;color:var(--ink-3);text-align:center}
figcaption .caps{color:var(--ink-2)}

.plate{margin-top:clamp(2.5rem,6vw,4.5rem)}
.plate .frame{background:var(--card);border:1px solid var(--rule-strong);padding:clamp(.5rem,1.4vw,1rem);
  box-shadow:0 1px 0 var(--rule),0 18px 40px -24px rgba(20,30,40,.35)}
.plate img{width:100%;border:1px solid var(--rule)}

/* ---------- three numbered paragraphs, set like 1956 section heads ---------- */
.sections{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:clamp(1.5rem,3.5vw,3rem);margin-top:2.2rem}
.sections > div{border-top:1px solid var(--rule-strong);padding-top:1.1rem}
.sections p{font-size:1.02rem;line-height:1.58}

/* ---------- the note, boxed as a book sets a caution ---------- */
.note{border:1.5px solid var(--ink);padding:clamp(1.4rem,3.5vw,2.4rem) clamp(1.3rem,4vw,2.8rem);background:var(--card);max-width:50rem}
.note .spaced{display:block;font-weight:700;margin-bottom:.9rem;color:var(--ink)}
.note p{max-width:none}
.note p:last-child{margin-bottom:0}
.pair{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1px;background:var(--rule-strong);border:1px solid var(--rule-strong);margin-top:2.2rem;max-width:50rem}
.pair > div{background:var(--paper);padding:1.2rem 1.3rem}
.pair .spaced{display:block;color:var(--ink-3);margin-bottom:.4rem}
.pair p{margin:0;font-size:1rem}

/* ---------- lineage ---------- */
.lineage{background:var(--paper-2)}
blockquote{margin:1.6rem 0;padding:0;font-size:1.35rem;line-height:1.45;font-style:italic;max-width:32rem}
blockquote cite{display:block;margin-top:.6rem;font:500 .85rem/1.4 var(--serif);font-style:normal;letter-spacing:.06em;color:var(--ink-3)}

/* ---------- colophon ---------- */
.colophon{background:var(--cloth);color:var(--cloth-ink);padding:clamp(3.5rem,7vw,5rem) 0 2.5rem;border:0}
.colophon .grid{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr) minmax(0,1fr);gap:2.5rem}
.colophon h4{margin:0 0 .8rem;font:700 .75rem/1 var(--serif);letter-spacing:.2em;text-transform:uppercase;color:var(--gilt)}
.colophon p,.colophon li{font-size:.98rem;color:color-mix(in srgb,var(--cloth-ink) 86%,transparent)}
.colophon ul{list-style:none;margin:0;padding:0;display:grid;gap:.45rem}
.colophon a{text-decoration-color:color-mix(in srgb,var(--gilt) 60%,transparent)}
.colophon a:hover{color:var(--gilt)}
.colophon .legal{max-width:none;margin-top:3rem;padding-top:1.4rem;border-top:1px solid rgba(255,255,255,.12);font-size:.82rem;letter-spacing:.06em;color:color-mix(in srgb,var(--cloth-ink) 60%,transparent)}

@media (max-width:860px){
  .chapter{grid-template-columns:1fr;gap:1.2rem}
  .chapter-no{display:flex;align-items:baseline;gap:.8rem;border-top-width:1px}
  .chapter-no b{display:inline;font-size:1.3rem;margin:0}
  .sections{grid-template-columns:1fr}
  .colophon .grid{grid-template-columns:1fr}
  .nav a:not(.dl){display:none}
}
@media (max-width:560px){
  .pair{grid-template-columns:1fr}
  .figure{margin-left:calc(var(--gutter) * -.5);margin-right:calc(var(--gutter) * -.5)}
}
