/* Layout and type follow SBG's assets/css/main.css. Colours come from tokens.css (generated from tokens.json). */
@font-face{font-family:"IBM Plex Sans";font-style:normal;font-weight:400;font-display:swap;src:url(fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2")}
@font-face{font-family:"IBM Plex Sans";font-style:italic;font-weight:400;font-display:swap;src:url(fonts/ibm-plex-sans-latin-400-italic.woff2) format("woff2")}
@font-face{font-family:"IBM Plex Sans";font-style:normal;font-weight:600;font-display:swap;src:url(fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2")}
@font-face{font-family:"IBM Plex Sans";font-style:normal;font-weight:700;font-display:swap;src:url(fonts/ibm-plex-sans-latin-700-normal.woff2) format("woff2")}

:root{
  --font:"IBM Plex Sans",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  --measure:700px;
  font-size:18px;
}
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--text);font-family:var(--font);font-size:1rem;line-height:1.65;overflow-wrap:break-word}
a{color:var(--link);text-decoration:underline;text-decoration-thickness:.08em;text-underline-offset:.18em}
a:hover{color:var(--link-hover);text-decoration-thickness:.14em}
:focus-visible{outline:3px solid var(--link);outline-offset:3px;border-radius:2px}
::selection{background:var(--link);color:var(--bg)}
main{max-width:calc(var(--measure) + 2rem);margin:0 auto;padding:0 1rem}

/* Header */
.top{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem 1.25rem;max-width:calc(var(--measure) + 2rem);margin:0 auto;padding:1.5rem 1rem 1.25rem}
.wordmark{font-weight:700;font-size:1.3rem;line-height:1.2;letter-spacing:-.01em;color:var(--text);text-decoration:none}
.wordmark:hover{color:var(--link)}
.search{flex:1 1 260px;max-width:420px}
input[type=search],select{width:100%;font:inherit;font-size:14px;padding:.4rem .6rem;border:1px solid var(--border);border-radius:6px;background:var(--bg);color:var(--text)}
input[type=search]:focus,select:focus{outline:2px solid var(--link);outline-offset:1px}

/* Titles and meta */
h1{font-size:clamp(1.6rem,1.25rem + 1.4vw,2.1rem);line-height:1.2;margin:1rem 0 .5rem;letter-spacing:-.01em}
.meta,.crumbs,.pdfpage{margin:0 0 .35rem;color:var(--muted);font-size:.875rem;line-height:1.4}
.crumbs a,.meta a{color:inherit}

/* Lists as an SBG-style timeline: hairline rules between entries */
.years,.rules{list-style:none;margin:0;padding:0}
.years li,.rules li{padding:1.1rem 0;border-top:1px solid var(--border)}
.years li:first-child,.rules li:first-child{border-top-color:transparent}
.years a,.rules a{font-size:1.2rem;font-weight:700;text-decoration:none;color:var(--text)}
.years a:hover,.rules a:hover{color:var(--link);text-decoration:underline}

/* Article body */
h2,h3,h4{line-height:1.25}
h2{font-size:1.45rem;margin:1.8em 0 .5em}
h3{font-size:1.05rem;margin:1.6em 0 .4em;font-weight:700;scroll-margin-top:1.5rem}
p{margin:1em 0}
.pdfpage{margin:0 0 .15rem}
em{font-style:italic}
strong{font-weight:700}

/* Search results */
.filters{display:flex;flex-wrap:wrap;gap:.75rem 1.25rem;margin:.5rem 0 1rem;font-size:14px}
.filters label{display:flex;flex-direction:column;gap:.25rem;min-width:11rem}
.hit{padding:1.1rem 0;border-top:1px solid var(--border)}
.hit:first-child{border-top-color:transparent}
.hit a{font-weight:700}
.hit mark{background:transparent;color:var(--link);font-weight:700}
.empty{color:var(--muted);padding:2rem 0}

@media print{.top .search{display:none}}

/* Change notes under each article: the book's own changes, with links to earlier wording */
.changes{margin:.9rem 0 1.2rem;padding:.6rem .9rem;border-left:3px solid var(--link);background:var(--code-bg);border-radius:0 6px 6px 0;font-size:.9rem;line-height:1.45}
.changes-title{font-weight:700;margin-bottom:.25rem}
.changes ul{margin:0;padding-left:1.1rem}
.changes li{margin:.25rem 0}

/* Word-level diff: what was removed and what was added */
.change-head{font-weight:700;margin-bottom:.15rem}
.change-desc{color:var(--muted);margin-bottom:.35rem}
.changes p.diff{margin:.3rem 0 0;line-height:1.55}
.changes del{color:var(--link);text-decoration:line-through;text-decoration-thickness:.08em}
.changes ins{color:var(--syn-string);text-decoration:underline;text-decoration-thickness:.08em;text-underline-offset:.15em}

/* Collapsible change notes: native <details> with a rotating disclosure triangle */
details.changes{margin:.9rem 0 1.2rem;border-left:3px solid var(--link);background:var(--code-bg);border-radius:0 6px 6px 0;font-size:.9rem;line-height:1.45}
details.changes>summary{cursor:pointer;list-style:none;padding:.55rem .9rem;font-weight:700;display:flex;align-items:center;gap:.5rem;user-select:none}
details.changes>summary::-webkit-details-marker{display:none}
details.changes>summary::before,details.change>summary::before{content:"";width:.45em;height:.45em;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(-45deg);transition:transform .15s ease;flex:0 0 auto;margin-left:.1rem}
details.changes[open]>summary::before,details.change[open]>summary::before{transform:rotate(45deg) translate(-.1em,-.1em)}
details.changes>summary:hover,details.change>summary:hover{color:var(--link)}
details.changes>summary .count{margin-left:auto;font-weight:400;color:var(--muted);font-size:.85rem}
details.changes>ul{margin:0;padding:0 .9rem .6rem 1.1rem}
details.changes>ul>li{margin:.35rem 0}
details.change>summary{cursor:pointer;list-style:none;display:flex;align-items:center;gap:.5rem;padding:.15rem 0}
details.change>summary::-webkit-details-marker{display:none}
details.change>.change-desc,details.change>.diff{margin-left:1.1rem}

/* Pictures from the book (for example the official signals), shown as the book prints them */
figure.book-figure{margin:1.2rem 0;text-align:center}
figure.book-figure img{max-width:100%;height:auto;border:1px solid var(--border);border-radius:6px;background:#fff}

/* Text version of the penalty index, under the book's pictures */
details.index-text{margin:1rem 0 1.5rem}
details.index-text>summary{cursor:pointer;font-weight:700}
h4.index-heading{margin:1.1rem 0 .3rem;font-size:1rem}
table.index-table{width:100%;table-layout:fixed;font-size:.92rem;border-collapse:collapse}
table.index-table col.col-foul{width:76%}
table.index-table col.col-rule{width:24%}
table.index-table th,table.index-table td{text-align:left;vertical-align:top;padding:.3rem .5rem;border-bottom:1px solid var(--border)}
table.index-table td:last-child{white-space:normal}

/* Each book picture is collapsible, under the text version */
details.book-picture{margin:.6rem 0;border:1px solid var(--border);border-radius:6px;padding:.4rem .7rem}
details.book-picture>summary{cursor:pointer;font-weight:700}

/* Appearance switch: Auto, Day and Night in one compact control */
fieldset.appearance-switch{display:inline-flex;gap:2px;margin:0;padding:2px;border:1px solid var(--border);border-radius:999px;background:var(--bg)}
fieldset.appearance-switch label{position:relative;display:inline-flex;align-items:center;justify-content:center;width:34px;height:30px;border-radius:999px;cursor:pointer;color:var(--muted)}
fieldset.appearance-switch input{position:absolute;opacity:0;pointer-events:none}
fieldset.appearance-switch label:hover{color:var(--text)}
fieldset.appearance-switch label:has(input:checked){background:var(--link);color:var(--bg)}
fieldset.appearance-switch input:focus-visible+.ico{outline:3px solid var(--link);outline-offset:2px;border-radius:999px}
fieldset.appearance-switch .ico svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

/* Hidden from sight, still read by screen readers (labels for the appearance switch) */
.visually-hidden{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* Phones: the name and the appearance switch share the first row; search takes the full width below */
@media (max-width:600px){
  .top{display:grid;grid-template-columns:1fr auto;align-items:center;gap:.6rem 1rem;padding:.9rem 1rem}
  .top .wordmark{grid-column:1;grid-row:1}
  fieldset.appearance-switch{grid-column:2;grid-row:1;justify-self:end}
  .top .search{grid-column:1 / -1;grid-row:2;max-width:none;flex:none}
}

/* Header at every width: name and theme switch on the first row, full-width search below, then the breadcrumb trail */
.top{display:grid;grid-template-columns:1fr auto;align-items:center;gap:.8rem 1rem;max-width:calc(var(--measure) + 2rem);margin:0 auto;padding:1.1rem 1rem}
.top .wordmark{grid-column:1;grid-row:1}
fieldset.appearance-switch{grid-column:2;grid-row:1;justify-self:end}
.top .search{grid-column:1 / -1;grid-row:2;max-width:none;flex:none;width:100%}
.top .search input{padding:.85rem 1.1rem;font-size:1.05rem;line-height:1.3}
