/* Freebookia Reader – chapter and contents pages. Uses the theme's fonts (Fraunces, Atkinson Hyperlegible Next). */

/* A lighter Fraunces (400, soft) for long reading; OFL, see fonts/OFL-Fraunces.txt */
@font-face{font-family:"Fraunces Text";src:url(fonts/fraunces-text.woff) format("woff");font-weight:300 450;font-style:normal;font-display:swap}
@font-face{font-family:"Fraunces Text";src:url(fonts/fraunces-text-italic.woff) format("woff");font-weight:300 450;font-style:italic;font-display:swap}

html[data-page]{
  --fbr-bg:#f4f3ee;--fbr-text:#1c2a25;--fbr-muted:#56625c;--fbr-rule:#dcdad0;--fbr-panel:#fbfaf6;
  --fbr-accent:#8b2635;--fbr-next:#14302a;--fbr-next-text:#f4f3ee;--fbr-link:#14302a;--fbr-hi:#eae8df;
  --fbr-serif:"Fraunces",Georgia,"Times New Roman",serif;
  --fbr-sans:"Atkinson Hyperlegible Next","Atkinson Hyperlegible",system-ui,-apple-system,"Segoe UI",sans-serif;
  --fbr-text-serif:"Fraunces Text","Fraunces",Georgia,"Times New Roman",serif;
  --fbr-body:var(--fbr-text-serif);
  background:var(--fbr-bg);
  color-scheme:light;
}
html[data-page="sepia"]{
  --fbr-bg:#f1e7d0;--fbr-text:#3b2f1e;--fbr-muted:#6b5b41;--fbr-rule:#ddd0b2;--fbr-panel:#f8f0dc;
  --fbr-accent:#8b2635;--fbr-next:#3b2f1e;--fbr-next-text:#f1e7d0;--fbr-link:#3b2f1e;--fbr-hi:#e6d6b0;
}
html[data-page="night"]{
  --fbr-bg:#121d19;--fbr-text:#e6e1d3;--fbr-muted:#a8b2aa;--fbr-rule:#2c3a34;--fbr-panel:#1a2823;
  --fbr-accent:#d4a73a;--fbr-next:#d4a73a;--fbr-next-text:#1d1504;--fbr-link:#ecca72;--fbr-hi:#1f302a;
  color-scheme:dark;
}
html[data-letters="clean"]{--fbr-body:var(--fbr-sans)}

body.fbr-page{margin:0;background:var(--fbr-bg);color:var(--fbr-text);font-family:var(--fbr-sans);font-size:17px;line-height:1.5;transition:background-color .25s,color .25s;-webkit-text-size-adjust:100%}
.fbr-page *,.fbr-page *::before,.fbr-page *::after{box-sizing:border-box}
.fbr-page a{color:var(--fbr-link)}
.fbr-page :focus-visible{outline:3px solid var(--fbr-accent);outline-offset:2px}
.fbr-page .skip-link:focus{position:fixed!important;width:auto;height:auto;clip:auto;margin:0;left:12px;top:12px;z-index:100;padding:12px 16px;background:var(--fbr-next);color:var(--fbr-next-text);border-radius:8px}

/* Reading bar ------------------------------------------------------------ */
.fbr-bar{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:16px;min-height:72px;padding:10px clamp(12px,3vw,40px);border-bottom:1px solid var(--fbr-rule);background:var(--fbr-bg);transition:transform .25s ease,background-color .25s}
.fbr-bar.is-hidden{transform:translateY(-100%)}
.admin-bar .fbr-bar{top:32px}
@media (max-width:782px){.admin-bar .fbr-bar{top:46px}}
@media (max-width:600px){.admin-bar .fbr-bar{top:0}}
.fbr-logo{color:var(--fbr-text)!important;text-decoration:none;font-weight:800;font-size:26px;letter-spacing:-.04em;line-height:1;white-space:nowrap;flex:none}
.fbr-logo svg{color:inherit}
.fbr-where{flex:1;min-width:0;text-align:center}
.fbr-where p{margin:0}
.fbr-book{font-family:var(--fbr-serif);font-size:18px;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.fbr-book-short{display:none}
.fbr-sub{font-size:13px;color:var(--fbr-muted)}
.fbr-tools{display:flex;align-items:center;gap:8px;flex:none}
.fbr-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;min-width:44px;padding:0 14px;border-radius:999px;border:1px solid var(--fbr-rule);background:transparent;color:var(--fbr-text)!important;font:inherit;font-size:15px;font-weight:700;line-height:1;cursor:pointer;text-decoration:none;transition:background-color .15s,border-color .15s}
.fbr-btn:hover{background:var(--fbr-hi)}
.fbr-icon{width:44px;padding:0}
.fbr-aa{font-family:var(--fbr-serif);font-size:18px;font-weight:500}
.fbr-aa[aria-expanded="true"]{background:var(--fbr-hi)}
.fbr-back{display:none}
.fbr-save path{fill:transparent;transition:fill .15s}
.fbr-save[aria-pressed="true"]{background:#d4a73a;border-color:#d4a73a;color:#1d1504!important}
.fbr-save[aria-pressed="true"] path{fill:currentColor}
.fbr-progress{position:absolute;left:0;right:0;bottom:-1px;height:3px;pointer-events:none}
.fbr-progress span{display:block;height:100%;width:0;background:#d4a73a;transition:width .2s linear}
body.fbr-contents .fbr-progress{display:none}

/* Settings popover */
.fbr-settings{position:absolute;right:clamp(12px,3vw,40px);top:calc(100% + 8px);z-index:30;width:min(330px,calc(100vw - 24px));padding:20px;border-radius:16px;background:var(--fbr-panel);color:var(--fbr-text);border:1px solid var(--fbr-rule);box-shadow:0 24px 48px -20px rgba(0,0,0,.45);display:flex;flex-direction:column;gap:18px}
.fbr-settings[hidden]{display:none}
.fbr-set-label{margin:0 0 8px;font-size:13px;font-weight:700;color:var(--fbr-muted)}
.fbr-size{display:flex;align-items:center;gap:10px}
.fbr-smaller{font-size:14px;font-family:var(--fbr-serif)}
.fbr-bigger{font-size:22px;font-family:var(--fbr-serif)}
.fbr-size-track{flex:1;height:6px;border-radius:3px;background:var(--fbr-rule);position:relative;overflow:hidden}
.fbr-size-track span{position:absolute;inset:0 auto 0 0;width:50%;border-radius:3px;background:#d4a73a}
.fbr-swatches{display:flex;gap:14px}
.fbr-swatch{display:flex;flex-direction:column;align-items:center;gap:6px;border:0;background:none;font:inherit;font-size:13px;font-weight:600;color:inherit;cursor:pointer;padding:4px;border-radius:10px}
.fbr-dot{width:40px;height:40px;border-radius:50%;display:block;box-shadow:inset 0 0 0 1px var(--fbr-rule)}
[data-fbr-page="paper"] .fbr-dot{background:#f4f3ee}
[data-fbr-page="sepia"] .fbr-dot{background:#f1e7d0}
[data-fbr-page="night"] .fbr-dot{background:#121d19}
.fbr-swatch[aria-pressed="true"] .fbr-dot{box-shadow:0 0 0 2px var(--fbr-panel),0 0 0 4px #d4a73a}
.fbr-seg{display:flex;padding:4px;border-radius:999px;background:var(--fbr-rule)}
.fbr-seg button{flex:1;min-height:44px;padding:0 16px;border:0;background:transparent;color:inherit;font:inherit;font-weight:700;font-size:15px;cursor:pointer;border-radius:999px}
.fbr-seg .fbr-seg-book{font-family:var(--fbr-serif);font-weight:600}
.fbr-seg button[aria-pressed="true"]{background:var(--fbr-panel);box-shadow:0 1px 2px rgba(0,0,0,.12)}

/* Chapter ---------------------------------------------------------------- */
.fbr-main{outline:none}
.fbr-article{max-width:760px;margin:0 auto;padding:clamp(40px,7vw,72px) clamp(20px,4vw,32px) 48px}
.fbr-head{margin-bottom:clamp(28px,4vw,40px)}
.fbr-eyebrow{margin:0 0 6px;font-family:var(--fbr-serif);font-style:italic;font-size:19px;color:var(--fbr-accent)}
.fbr-title{margin:0;font-family:var(--fbr-serif);font-weight:500;font-size:clamp(2.4rem,1.7rem + 3vw,3.5rem);line-height:1.05;letter-spacing:-.01em;color:var(--fbr-text);text-wrap:balance}

.fbr-text{font-family:var(--fbr-body);font-size:var(--fbr-size-user,clamp(19px,18px + .3vw,20px));line-height:1.75;max-width:36em;hyphens:auto;-webkit-hyphens:auto;overflow-wrap:break-word}
html[data-letters="clean"] .fbr-text{line-height:1.7}
.fbr-text p{margin:0 0 1.1em}
.fbr-text h2,.fbr-text h3,.fbr-text h4,.fbr-text h5,.fbr-text h6{font-family:var(--fbr-serif);font-weight:500;line-height:1.2;margin:1.8em 0 .7em;color:var(--fbr-text)}
.fbr-text h2{font-size:1.45em}
.fbr-text h3{font-size:1.25em}
.fbr-text h4,.fbr-text h5,.fbr-text h6{font-size:1.08em}
.fbr-text blockquote{margin:1.4em 0;padding:0 0 0 1.2em;border-left:2px solid var(--fbr-rule);color:var(--fbr-text)}
.fbr-text blockquote p:last-child{margin-bottom:0}
.fbr-text hr{border:0;margin:2em 0;text-align:center;height:auto}
.fbr-text hr::after{content:"·  ·  ·";letter-spacing:.4em;color:var(--fbr-muted)}
.fbr-text ul,.fbr-text ol{margin:0 0 1.1em;padding-left:1.4em}
.fbr-text table{border-collapse:collapse;margin:1.4em 0;font-size:.9em;max-width:100%;display:block;overflow-x:auto}
.fbr-text td,.fbr-text th{padding:.3em .6em;vertical-align:top;text-align:left}
.fbr-text sup{font-size:.7em;line-height:0}
.fbr-text sup a,.fbr-text a[href^="#"]{text-decoration:none;color:var(--fbr-accent);font-family:var(--fbr-sans);font-weight:700}
.fbr-text a{text-decoration-color:color-mix(in srgb,currentColor 40%,transparent);text-underline-offset:3px}
.fbr-text :target{background:var(--fbr-hi);border-radius:4px}
.fbr-text .center,.fbr-text .c{text-align:center}
.fbr-text .right,.fbr-text .signature,.fbr-text .sig{text-align:right}
.fbr-text .smcap,.fbr-text .sc{font-variant:small-caps;letter-spacing:.02em}
.fbr-text .stanza,.fbr-text .poem{margin:0 0 1.2em;padding-left:1.5em}
.fbr-text .stanza{text-indent:0}
.fbr-text [class*="i2"]{padding-left:1em}
.fbr-text [class*="i4"]{padding-left:2em}
.fbr-text .footnote,.fbr-text .footnotes,.fbr-text .fn{font-size:.85em;color:var(--fbr-muted)}
.fbr-text .epigraph{font-style:italic;margin-left:auto;max-width:28em}

/* Drop cap on the first paragraph */
.fbr-dropcap > p:first-child::first-letter{float:left;font-family:var(--fbr-serif);font-weight:500;font-size:4.1em;line-height:.82;padding:.06em .1em 0 0;color:var(--fbr-accent)}
html[data-letters="clean"] .fbr-dropcap > p:first-child::first-letter{font-family:var(--fbr-serif)}

/* Previous / next */
.fbr-nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-top:64px;padding-top:32px;border-top:1px solid var(--fbr-rule)}
.fbr-card{display:flex;flex-direction:column;gap:4px;padding:18px 20px;border-radius:14px;border:1px solid var(--fbr-rule);color:var(--fbr-text)!important;text-decoration:none;transition:transform .15s,background-color .15s}
.fbr-card:hover{background:var(--fbr-hi)}
.fbr-card-k{font-size:13px;font-weight:700;color:var(--fbr-muted)}
.fbr-card-t{font-family:var(--fbr-serif);font-size:20px;line-height:1.25}
.fbr-next{background:var(--fbr-next);border-color:var(--fbr-next);color:var(--fbr-next-text)!important;text-align:right;grid-column:2}
.fbr-next:hover{background:var(--fbr-next);transform:translateY(-1px)}
.fbr-next .fbr-card-k{color:inherit;opacity:.8}
.fbr-note{margin:28px 0 0;text-align:center;font-size:15px;color:var(--fbr-muted)}
.fbr-note a{font-weight:700;color:var(--fbr-text)}

/* Contents --------------------------------------------------------------- */
.fbr-toc-page{max-width:760px;margin:0 auto;padding:clamp(36px,6vw,64px) clamp(16px,4vw,32px) 64px}
.fbr-toc-head{margin:0 0 28px}
.fbr-toc-by{margin:10px 0 0;color:var(--fbr-muted)}
.fbr-toc-progress{margin-top:18px;max-width:420px}
.fbr-toc-progress[hidden]{display:none}
.fbr-bar-track{height:6px;border-radius:3px;background:var(--fbr-rule);overflow:hidden}
.fbr-bar-track span{display:block;height:100%;width:0;background:#d4a73a}
.fbr-toc-progress p{margin:6px 0 0;font-size:13px;color:var(--fbr-muted)}
.fbr-toc-actions{display:flex;flex-wrap:wrap;align-items:center;gap:12px 20px;margin:22px 0 0}
.fbr-start{display:inline-flex;align-items:center;min-height:50px;padding:0 24px;border-radius:999px;background:var(--fbr-next);color:var(--fbr-next-text)!important;font-weight:700;text-decoration:none}
.fbr-start:hover{filter:brightness(1.08)}
.fbr-toc-book{font-weight:700}
.fbr-toc{list-style:none;margin:0;padding:0;border-top:1px solid var(--fbr-rule)}
.fbr-toc li{border-bottom:1px solid var(--fbr-rule)}
.fbr-toc a{display:flex;align-items:center;gap:14px;min-height:56px;padding:8px 10px;color:var(--fbr-text);text-decoration:none;border-radius:10px;scroll-margin-top:96px}
.fbr-toc a:hover{background:var(--fbr-hi)}
.fbr-toc-n{flex:none;width:34px;text-align:right;font-size:14px;color:var(--fbr-muted);font-variant-numeric:tabular-nums}
.fbr-toc-t{flex:1;min-width:0;font-family:var(--fbr-serif);font-size:18px;line-height:1.3}
.fbr-toc-t small{display:block;font-family:var(--fbr-sans);font-size:12px;font-weight:700;color:var(--fbr-muted);letter-spacing:.02em}
.fbr-toc-s{flex:none;font-size:13px;font-weight:700;color:var(--fbr-muted);white-space:nowrap}
.fbr-toc li.is-read .fbr-toc-s{color:var(--fbr-muted)}
.fbr-toc li.is-here a{background:var(--fbr-hi)}
.fbr-toc li.is-here .fbr-toc-t{font-weight:600}
.fbr-toc li.is-here .fbr-toc-s{color:var(--fbr-accent)}
.fbr-credit{margin:32px 0 0;font-size:14px;color:var(--fbr-muted)}

/* Phones: back arrow instead of the logo, icon-only buttons (mockup: phone chapter) */
@media (max-width:720px){
  .fbr-bar{gap:8px;min-height:64px;padding:0 12px}
  .fbr-logo,.fbr-close,.fbr-save{display:none}
  .fbr-back{display:inline-flex}
  .fbr-book{font-size:16px}
  .fbr-book-long{display:none}
  .fbr-book-short{display:inline}
  .fbr-sub{font-size:12px}
  .fbr-tocbtn{width:44px;padding:0}
  .fbr-tocbtn .fbr-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
  .fbr-settings{right:12px}
  .fbr-title{font-size:2.5rem}
  .fbr-nav{grid-template-columns:1fr;margin-top:40px;gap:12px}
  .fbr-next{grid-column:auto;order:-1;text-align:left;padding:18px 20px}
  .fbr-next .fbr-card-t{font-size:21px}
  .fbr-prev{border:0;padding:12px 4px}
  .fbr-prev .fbr-card-k{display:inline}
  .fbr-prev .fbr-card-t{font-family:var(--fbr-sans);font-size:15px;font-weight:700}
}

@media (prefers-reduced-motion:reduce){
  body.fbr-page,.fbr-bar,.fbr-progress span,.fbr-card{transition:none}
}
@media print{
  .fbr-bar,.fbr-nav,.fbr-note{display:none}
  html[data-page]{--fbr-bg:#fff;--fbr-text:#000}
}
