/* ===========================================================
   LightSpeedRead — shared styles
   =========================================================== */
:root{
  --bg:#070a0d; --bg2:#0c1116; --panel:#0f151b; --panel-2:#131b22;
  --ink:#eef4f7; --ink-dim:#9fb0bb; --ink-faint:#5e7079; --line:#1e2a33;
  --accent:#22d3ee; --accent-deep:#0e7490; --orp:#ff5c5c; --good:#34d399;
  --r:16px; --maxw:1080px;
  --display:"Fraunces",Georgia,serif;
  --sans:"Hanken Grotesk",-apple-system,BlinkMacSystemFont,sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--bg); color:var(--ink); font-family:var(--sans); line-height:1.55;
  -webkit-font-smoothing:antialiased; min-height:100vh;
  background-image:
    radial-gradient(900px 520px at 50% -10%, rgba(34,211,238,.10), transparent 60%),
    radial-gradient(720px 620px at 110% 18%, rgba(14,116,144,.10), transparent 60%);
  background-attachment:fixed;
  transition:background-color .35s ease, color .35s ease;
}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}
.wrap{max-width:var(--maxw);margin:0 auto;padding:0 22px}

/* ---------- light theme ---------- */
[data-theme="light"]{
  --bg:#f3efe6; --bg2:#fbf9f3; --panel:#ffffff; --panel-2:#f1ede2;
  --ink:#17222b; --ink-dim:#4d5d68; --ink-faint:#85939c; --line:#e4ded1;
  --accent:#0b8aaa; --accent-deep:#0a6c86; --orp:#e23b3b; --good:#0f9d6b;
}
[data-theme="light"] body{
  background-image:
    radial-gradient(900px 520px at 50% -10%, rgba(11,138,170,.10), transparent 60%),
    radial-gradient(720px 620px at 110% 18%, rgba(245,205,120,.22), transparent 60%);
}
[data-theme="light"] .stage,[data-theme="light"] .bubble{box-shadow:0 26px 64px -42px rgba(40,60,75,.4), inset 0 1px 0 rgba(255,255,255,.6)}

/* ---------- header / nav ---------- */
header{padding:14px 0 2px;position:relative;z-index:20}
.bar{display:flex;align-items:center;justify-content:space-between;gap:12px}
.bar-right{display:flex;align-items:center;gap:14px}
.brand{display:flex;align-items:center;gap:12px;font-family:var(--display);
  font-size:1.45rem;letter-spacing:-.035em;color:var(--ink);line-height:1;text-decoration:none}
.brand:hover{text-decoration:none}
.bolt{width:32px;height:32px;display:grid;place-items:center;background:linear-gradient(160deg,var(--accent),var(--accent-deep));border-radius:10px;box-shadow:0 6px 20px -6px rgba(34,211,238,.55);flex:none}
.bolt svg{width:18px;height:18px;display:block}

/* wordmark */
.wm{display:inline-flex;align-items:baseline}
.wm-light{font-weight:900;color:var(--ink)}
.wm-speed{font-weight:900;background:linear-gradient(115deg,var(--accent),#8df3ff);-webkit-background-clip:text;background-clip:text;color:transparent}
.wm-read{font-weight:900;color:var(--ink)}
/* the red e, with focal guide ticks above & below (echoes the reader) */
.wm-e{color:var(--orp);position:relative;display:inline-block}
.wm-e::before,.wm-e::after{content:"";position:absolute;left:50%;transform:translateX(-50%);
  width:2px;height:.30em;background:var(--accent);border-radius:1px;opacity:.8}
.wm-e::before{bottom:1.02em;border-radius:0 0 2px 2px}
.wm-e::after{top:1.02em;border-radius:2px 2px 0 0}

.nav{display:flex;align-items:center;gap:18px}
.nav a{color:var(--ink-dim);font-weight:600;font-size:.92rem;text-decoration:none;transition:color .15s}
.nav a:hover{color:var(--accent);text-decoration:none}
.nav a.active{color:var(--ink)}

/* theme toggle (header, centered) */
.theme-toggle{width:42px;height:42px;border-radius:50%;display:grid;place-items:center;
  cursor:pointer;border:1px solid var(--line);background:var(--panel-2);color:var(--ink);
  box-shadow:0 8px 22px -12px rgba(0,0,0,.5);
  transition:transform .12s ease,border-color .15s,color .15s,background .25s}
.theme-toggle:hover{border-color:var(--accent);color:var(--accent)}
.theme-toggle:active{transform:scale(.92)}
.theme-toggle svg{width:20px;height:20px;display:block;transition:transform .4s cubic-bezier(.2,.7,.2,1)}
.theme-toggle:hover svg{transform:rotate(35deg)}

/* ---------- hero ---------- */
.hero{padding:18px 0 6px;text-align:center;animation:rise .7s cubic-bezier(.2,.7,.2,1) both}
.hero h1{font-family:var(--display);font-weight:900;letter-spacing:-.03em;line-height:1.02;
  font-size:clamp(1.8rem,5vw,2.9rem);margin:0 0 .25em}
.hero h1 em{font-style:italic;font-weight:500;color:var(--accent)}
.hero p{max-width:560px;margin:0 auto;color:var(--ink-dim);font-size:.98rem}

/* ---------- reader stage ---------- */
.stage{margin:16px 0 0;border:1px solid var(--line);border-radius:18px;
  background:linear-gradient(180deg,var(--panel),var(--bg2));
  box-shadow:0 26px 70px -42px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,.03);
  overflow:hidden;animation:rise .8s .08s cubic-bezier(.2,.7,.2,1) both}
.screen{position:relative;padding:34px 22px 26px;min-height:158px;display:flex;flex-direction:column;justify-content:center}
.screen::before,.screen::after{content:"";position:absolute;left:50%;width:2px;height:16px;background:var(--accent);opacity:.55;transform:translateX(-50%)}
.screen::before{top:18px;border-radius:0 0 2px 2px}
.screen::after{bottom:50px;border-radius:2px 2px 0 0}
.word{position:relative;display:grid;grid-template-columns:1fr auto 1fr;align-items:baseline;
  font-family:var(--sans);font-weight:600;letter-spacing:-.01em;font-size:clamp(2rem,7.5vw,3.4rem);min-height:1.3em}
/* focal ticks that hug the word (used in fullscreen, where the screen-edge
   guides would be far from the word) */
.word::before,.word::after{content:"";position:absolute;left:50%;transform:translateX(-50%);
  width:3px;height:.32em;background:var(--accent);opacity:.6;border-radius:2px;display:none}
.word::before{bottom:100%;margin-bottom:.16em}
.word::after{top:100%;margin-top:.16em}
.word .pre{text-align:right;color:var(--ink)}
.word .piv{color:var(--orp);padding:0 .02em}
.word .post{text-align:left;color:var(--ink)}
.word.idle,.word.idle .pre,.word.idle .post{color:var(--ink-faint);font-weight:500}
.word.done .pre,.word.done .post,.word.done .piv{color:var(--accent)}
.meta{display:flex;align-items:center;justify-content:center;gap:16px;color:var(--ink-faint);font-size:.8rem;font-variant-numeric:tabular-nums;margin-top:14px}
.meta .dot{width:4px;height:4px;border-radius:50%;background:var(--line)}
.progress{height:6px;background:var(--line);position:relative;cursor:pointer}
.progress .fill{position:absolute;inset:0 auto 0 0;width:0;background:linear-gradient(90deg,var(--accent-deep),var(--accent));transition:width .08s linear}

/* controls */
.controls{display:flex;flex-wrap:wrap;align-items:center;gap:12px;padding:14px 16px;border-top:1px solid var(--line);background:rgba(255,255,255,.012)}
.btns{display:flex;align-items:center;gap:8px}
button.ctrl{appearance:none;border:1px solid var(--line);background:var(--panel-2);color:var(--ink);
  width:44px;height:44px;border-radius:12px;display:grid;place-items:center;cursor:pointer;
  transition:transform .08s ease,border-color .15s,background .15s}
button.ctrl svg{width:19px;height:19px}
button.ctrl:hover{border-color:var(--accent);color:var(--accent)}
button.ctrl:active{transform:translateY(1px)}
button.play{width:54px;height:54px;border-radius:15px;background:linear-gradient(160deg,var(--accent),var(--accent-deep));border:none;color:#04141a;box-shadow:0 10px 26px -10px rgba(34,211,238,.7)}
button.play:hover{color:#04141a;filter:brightness(1.06)}
button.play svg{width:22px;height:22px}
.sliders{display:flex;flex:1 1 320px;gap:22px;align-items:center;min-width:240px;justify-content:flex-end;flex-wrap:wrap}
.field{display:flex;flex-direction:column;gap:5px;min-width:150px;flex:1 1 150px;max-width:260px}
.field .lab{display:flex;justify-content:space-between;font-size:.74rem;color:var(--ink-faint);letter-spacing:.04em;text-transform:uppercase}
.field .lab b{color:var(--accent);font-weight:700;font-variant-numeric:tabular-nums}
input[type=range]{-webkit-appearance:none;appearance:none;height:6px;border-radius:6px;background:var(--line);outline:none;width:100%}
input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:18px;height:18px;border-radius:50%;background:var(--accent);cursor:pointer;box-shadow:0 0 0 4px rgba(34,211,238,.18)}
input[type=range]::-moz-range-thumb{width:18px;height:18px;border:none;border-radius:50%;background:var(--accent);cursor:pointer}
.ctrl-right{margin-left:auto;display:flex;align-items:center;gap:8px}

/* ---------- input cards ---------- */
.feed{margin:16px 0 6px;display:grid;grid-template-columns:1fr 1fr;gap:14px;align-items:stretch;animation:rise .8s .16s cubic-bezier(.2,.7,.2,1) both}
.card{border:1px solid var(--line);border-radius:var(--r);background:var(--panel);padding:16px;display:flex;flex-direction:column}
.card h2{font-family:var(--display);font-weight:600;font-size:1.05rem;margin:0 0 3px}
.card .sub{color:var(--ink-faint);font-size:.83rem;margin:0 0 11px}
.feed textarea{flex:1}
.url-input{width:100%;background:var(--bg2);border:1px solid var(--line);color:var(--ink);border-radius:11px;padding:13px 14px;font-size:.96rem;font-family:var(--sans)}
.url-input:focus{outline:none;border-color:var(--accent)}
.url-row{display:flex;gap:10px;flex-wrap:wrap}
.url-row input[type=url]{flex:1 1 280px;min-width:0;background:var(--bg2);border:1px solid var(--line);color:var(--ink);border-radius:11px;padding:13px 14px;font-size:.96rem;font-family:var(--sans)}
.url-row input[type=url]:focus{outline:none;border-color:var(--accent)}
.linknote{margin-top:auto;padding-top:14px;font-size:.8rem;color:var(--ink-faint);line-height:1.5}
.linknote b{color:var(--ink-dim)}
textarea{width:100%;min-height:104px;resize:vertical;background:var(--bg2);border:1px solid var(--line);color:var(--ink);border-radius:11px;padding:13px;font-size:.98rem;font-family:var(--sans);line-height:1.55}
textarea:focus{outline:none;border-color:var(--accent)}
.row{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-top:14px}
button.solid{appearance:none;border:none;cursor:pointer;font-family:var(--sans);font-weight:700;font-size:.95rem;padding:12px 20px;border-radius:11px;background:linear-gradient(160deg,var(--accent),var(--accent-deep));color:#04141a;transition:filter .15s,transform .08s}
button.solid:hover{filter:brightness(1.07)}
button.solid:active{transform:translateY(1px)}
button.ghost{appearance:none;cursor:pointer;font-family:var(--sans);font-weight:600;font-size:.92rem;padding:12px 18px;border-radius:11px;background:transparent;border:1px solid var(--line);color:var(--ink-dim);transition:.15s}
button.ghost:hover{border-color:var(--accent);color:var(--accent)}
.status{font-size:.85rem;color:var(--ink-faint);min-height:1.2em}
.status.err{color:var(--orp)}
.status.ok{color:var(--good)}
.count{margin-left:auto;font-size:.82rem;color:var(--ink-faint);font-variant-numeric:tabular-nums}
.kbd-hint{margin-top:8px;font-size:.8rem;color:var(--ink-faint)}
kbd{font-family:var(--sans);font-size:.74rem;background:var(--panel-2);border:1px solid var(--line);border-bottom-width:2px;border-radius:6px;padding:1px 7px;color:var(--ink-dim)}

/* ---------- bubble sections (homepage) ---------- */
.bubbles{margin:26px 0 6px}
.section-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin:0 0 14px}
.section-head h2{font-family:var(--display);font-weight:600;font-size:1.35rem;letter-spacing:-.01em;margin:0}
.section-head .all{font-size:.86rem;font-weight:600}
.bubble-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
.bubble{position:relative;border:1px solid var(--line);border-radius:20px;background:linear-gradient(180deg,var(--panel),var(--bg2));
  padding:18px;display:flex;flex-direction:column;gap:9px;text-decoration:none;color:inherit;
  transition:transform .18s ease,border-color .18s,box-shadow .18s}
.bubble:hover{transform:translateY(-4px);border-color:var(--accent);box-shadow:0 20px 44px -26px rgba(34,211,238,.55);text-decoration:none}
.bubble .ic{width:42px;height:42px;border-radius:13px;display:grid;place-items:center;background:rgba(34,211,238,.12);color:var(--accent)}
.bubble .ic svg{width:22px;height:22px}
.bubble h3{font-family:var(--display);font-weight:600;font-size:1.04rem;margin:0;color:var(--ink)}
.bubble p{margin:0;font-size:.86rem;color:var(--ink-dim);line-height:1.5;flex:1}
.bubble .more{font-size:.82rem;font-weight:700;color:var(--accent)}

/* stat strip */
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin:14px 0 0}
.stat{border:1px solid var(--line);border-radius:16px;background:var(--panel);padding:16px 18px;text-align:center}
.stat b{display:block;font-family:var(--display);font-weight:900;font-size:1.5rem;color:var(--ink);letter-spacing:-.02em}
.stat span{font-size:.82rem;color:var(--ink-faint)}

/* ---------- page content (about / faq) ---------- */
.page{max-width:780px;margin:0 auto}
.page-hero{text-align:center;padding:20px 0 6px;animation:rise .6s cubic-bezier(.2,.7,.2,1) both}
.page-hero .eyebrow{font-size:.78rem;letter-spacing:.16em;text-transform:uppercase;color:var(--accent);font-weight:700}
.page-hero h1{font-family:var(--display);font-weight:900;font-size:clamp(2rem,5.5vw,3rem);letter-spacing:-.03em;margin:.18em 0 .3em;line-height:1.05}
.page-hero p{color:var(--ink-dim);max-width:620px;margin:0 auto;font-size:1.02rem}
.prose{animation:rise .7s .08s cubic-bezier(.2,.7,.2,1) both}
.prose h2{font-family:var(--display);color:var(--ink);font-weight:600;font-size:1.32rem;margin:30px 0 8px;letter-spacing:-.01em}
.prose h3{font-weight:700;font-size:1.04rem;margin:20px 0 6px;color:var(--ink)}
.prose p{color:var(--ink-dim);margin:0 0 13px;line-height:1.72}
.prose ul{color:var(--ink-dim);line-height:1.7;padding-left:20px;margin:0 0 13px}
.prose li{margin:5px 0}
.prose strong{color:var(--ink)}
.callout{border:1px solid var(--line);border-left:3px solid var(--accent);background:var(--panel);border-radius:0 14px 14px 0;padding:14px 18px;margin:18px 0;color:var(--ink-dim);font-size:.94rem}
.callout b{color:var(--ink)}

/* references */
.refs{list-style:none;padding:0;margin:12px 0 0;display:grid;gap:10px;counter-reset:ref}
.refs li{border:1px solid var(--line);border-radius:13px;padding:13px 15px 13px 44px;background:var(--panel);font-size:.9rem;color:var(--ink-dim);position:relative;line-height:1.5}
.refs li::before{counter-increment:ref;content:counter(ref);position:absolute;left:13px;top:13px;width:22px;height:22px;border-radius:50%;background:rgba(34,211,238,.14);color:var(--accent);font-size:.74rem;font-weight:700;display:grid;place-items:center}
.refs .src{color:var(--ink);font-weight:600}
.refs .where{color:var(--ink-faint);font-style:italic}

/* faq accordion */
.faq{display:grid;gap:10px;margin-top:10px}
.faq details{border:1px solid var(--line);border-radius:14px;background:var(--panel);overflow:hidden}
.faq details[open]{border-color:var(--accent)}
.faq summary{cursor:pointer;padding:15px 18px;font-family:var(--display);font-weight:600;font-size:1.04rem;color:var(--ink);list-style:none;display:flex;justify-content:space-between;align-items:center;gap:12px}
.faq summary::-webkit-details-marker{display:none}
.faq summary::after{content:"+";color:var(--accent);font-size:1.4rem;font-weight:300;line-height:1;transition:transform .2s}
.faq details[open] summary::after{transform:rotate(45deg)}
.faq .a{padding:0 18px 16px;color:var(--ink-dim);line-height:1.66;font-size:.93rem}
.faq .a p{margin:0 0 10px}
.faq .a p:last-child{margin:0}

/* ---------- footer ---------- */
footer{border-top:1px solid var(--line);margin-top:30px;padding:22px 0 34px;color:var(--ink-faint);font-size:.82rem;text-align:center}
footer .flinks{display:flex;gap:16px;justify-content:center;margin-bottom:8px;flex-wrap:wrap}
footer .flinks a{color:var(--ink-dim);font-weight:600}
footer .copy{color:var(--ink-dim);margin:4px 0}
footer p{margin:2px 0}

/* ---------- fullscreen ---------- */
.stage:fullscreen{display:flex;flex-direction:column;justify-content:center;background:var(--bg);border-radius:0}
.stage:fullscreen .screen{flex:1;min-height:0}
.stage:fullscreen .word{font-size:clamp(3rem,10vw,7rem)}
.stage:-webkit-full-screen .word{font-size:clamp(3rem,10vw,7rem)}
/* CSS fallback used where the Fullscreen API is unavailable (e.g. iOS Safari) */
.stage.faux-fs{position:fixed;inset:0;z-index:1000;border-radius:0;display:flex;flex-direction:column;justify-content:center;background:var(--bg)}
.stage.faux-fs .screen{flex:1;min-height:0}
.stage.faux-fs .word{font-size:clamp(2.6rem,11vw,6rem)}
/* in fullscreen, the box fills the screen, so anchor the guides to the word
   and drop the stats to the bottom near the controls */
.stage:fullscreen .screen::before,.stage:fullscreen .screen::after,
.stage:-webkit-full-screen .screen::before,.stage:-webkit-full-screen .screen::after,
.stage.faux-fs .screen::before,.stage.faux-fs .screen::after{display:none}
.stage:fullscreen .word::before,.stage:fullscreen .word::after,
.stage:-webkit-full-screen .word::before,.stage:-webkit-full-screen .word::after,
.stage.faux-fs .word::before,.stage.faux-fs .word::after{display:block}
.stage:fullscreen .meta,.stage:-webkit-full-screen .meta,
.stage.faux-fs .meta{position:absolute;left:0;right:0;bottom:26px;margin-top:0}
body.faux-fs{overflow:hidden}
body.fs-active .hero,body.fs-active .feed,body.fs-active .bubbles,body.fs-active header,body.fs-active footer{display:none}

@keyframes rise{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:none}}

/* ---------- responsive ---------- */
@media (max-width:900px){
  .bubble-grid{grid-template-columns:repeat(2,1fr)}
}
@media (max-width:820px){
  .feed{grid-template-columns:1fr}
}
@media (max-width:600px){
  .wrap{padding:0 16px}
  .brand{font-size:1.2rem;gap:9px;white-space:nowrap;min-width:0}
  .wm{white-space:nowrap}
  .bolt{width:28px;height:28px}
  .bar-right{gap:11px}
  .nav{gap:13px}
  .nav a{font-size:.86rem}
  .theme-toggle{width:38px;height:38px}
  .hero{padding:14px 0 4px}
  .hero p{font-size:.92rem}
  .screen{padding:30px 16px 24px;min-height:140px}
  .controls{gap:10px;padding:12px}
  .sliders{flex:1 1 100%;justify-content:space-between;gap:14px;min-width:0}
  .field{flex:1 1 0;min-width:0}
  .btns{flex:1 1 100%;justify-content:center}
  .ctrl-right{margin-left:0;flex:1 1 100%;justify-content:center}
  .count{margin-left:0;flex-basis:100%}
  .bubble-grid{grid-template-columns:1fr}
  .stats{grid-template-columns:1fr}
  .hide-sm{display:none}
  .row{gap:8px}
  .row button.solid,.row button.ghost{padding:10px 13px;font-size:.88rem}
}
@media (max-width:400px){
  .bar{gap:8px}
  .brand{font-size:1.05rem;gap:7px}
  .bolt{width:25px;height:25px}
  .nav{gap:10px}
  .nav a{font-size:.8rem}
  .theme-toggle{width:36px;height:36px}
}
@media (max-width:380px){
  button.ctrl{width:42px;height:42px}
  .meta{gap:10px;font-size:.74rem}
}
