:root{
  --bg:#f8fafc;--surface:#ffffff;--surface-2:#e2e8f0;--text:#0f172a;--muted:#334155;
  --border:#64748b;--primary:#0f4c81;--primary-hover:#0a355c;--on-primary:#ffffff;
  --accent:#0f766e;--link:#0f4c81;--code-bg:#0f172a;--code-text:#f8fafc;
  --shadow:0 2px 6px rgba(15,23,42,.10),0 10px 24px rgba(15,23,42,.08);
  --focus:#b45309;--hero-a:#dbeafe;--hero-b:#ccfbf1;
  --radius:14px;--maxw:1260px;--nav-h:clamp(66px,4.5vw,78px);
  color-scheme:light;
}
[data-theme="dark"]{
  --bg:#090f1c;--surface:#111c33;--surface-2:#1a2847;--text:#f1f5f9;--muted:#cbd5e1;
  --border:#334155;--primary:#38bdf8;--primary-hover:#7dd3fc;--on-primary:#090f1c;
  --accent:#2dd4bf;--link:#38bdf8;--code-bg:#050914;--code-text:#e2e8f0;
  --shadow:0 2px 6px rgba(0,0,0,.45),0 10px 26px rgba(0,0,0,.38);
  --focus:#fbbf24;--hero-a:#0c2340;--hero-b:#0c2d2c;
  color-scheme:dark;
}
*{box-sizing:border-box;min-width:0}
html{scroll-behavior:smooth;scroll-padding-top:calc(var(--nav-h) + 18px);-webkit-text-size-adjust:100%;overflow-x:clip;max-width:100%}
h1,h2,h3,h4,p,li,td,th,a,figcaption,label,blockquote,span,code,.sub,.lead,.eyebrow,.card,.stat,.tag{overflow-wrap:anywhere}
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}*{animation:none!important;transition:none!important}}
body{margin:0;font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;font-size:clamp(16px,.95rem + .25vw,19px);line-height:1.7;background:var(--bg);color:var(--text);-webkit-font-smoothing:antialiased;overflow-x:clip;transition:background .25s,color .25s}
main{padding-top:calc(var(--nav-h) + 2px)}
a{color:var(--link);text-underline-offset:3px}
a:hover{text-decoration-thickness:2px}
:focus-visible{outline:3px solid var(--focus);outline-offset:3px;border-radius:6px}
img,svg{max-width:100%;height:auto}
code,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
.container{max-width:min(var(--maxw),100%);margin:0 auto;padding:0 clamp(14px,4vw,32px)}
.skip{position:absolute;left:-999px;top:8px;background:var(--primary);color:var(--on-primary);padding:8px 14px;border-radius:8px;z-index:100}
.skip:focus{left:12px}

/* Navigation (Fixed on scroll) */
.nav{position:fixed;top:0;left:0;right:0;width:100%;z-index:100;background:color-mix(in srgb,var(--bg) 95%,transparent);backdrop-filter:saturate(160%) blur(10px);border-bottom:2px solid var(--border);transition:box-shadow .2s}
.nav.scrolled{box-shadow:var(--shadow)}
.nav-inner{display:flex;align-items:center;gap:10px;height:var(--nav-h)}
.brand{font-weight:800;font-size:clamp(1.02rem,.95rem + .2vw,1.18rem);color:var(--text);text-decoration:none;display:flex;align-items:center;gap:8px;white-space:nowrap;flex:none}
.brand-logo{width:36px;height:36px;border-radius:10px;background:var(--primary);color:var(--on-primary);display:grid;place-items:center;font-size:.84rem;font-weight:800}
.nav-links{display:flex;align-items:center;gap:2px;margin:0 0 0 auto;list-style:none;padding:0;flex-wrap:nowrap}
.nav-links a{display:block;padding:7px 9px;border-radius:8px;color:var(--text);text-decoration:none;font-size:clamp(1rem,.92rem + .14vw,1.075rem);font-weight:700;letter-spacing:.01em;line-height:1.2;white-space:nowrap;overflow-wrap:normal;transition:background .15s,color .15s}
.nav-links a:hover{background:var(--surface-2)}
.nav-links a.active{color:var(--on-primary);background:var(--primary);box-shadow:0 2px 10px color-mix(in srgb,var(--primary) 35%,transparent)}
.icon-btn{width:44px;height:44px;border-radius:11px;border:2px solid var(--border);background:var(--surface);color:var(--text);display:grid;place-items:center;cursor:pointer;flex:none;transition:transform .15s,background .2s}
.icon-btn:hover{background:var(--surface-2);border-color:var(--primary)}
.icon-btn:active{transform:scale(.94)}
.icon-btn svg{width:22px;height:22px}
.menu-btn{display:none}
.menu-btn .close-ico{display:none}
.menu-btn[aria-expanded="true"] .menu-ico{display:none}
.menu-btn[aria-expanded="true"] .close-ico{display:block}
.theme-btn .sun{display:none}[data-theme="dark"] .theme-btn .sun{display:block}[data-theme="dark"] .theme-btn .moon{display:none}
@media (max-width:1240px){
  .menu-btn{display:grid;margin-left:auto}
  .nav-links{position:absolute;top:100%;left:0;right:0;flex-direction:column;align-items:stretch;background:var(--surface);border-bottom:2px solid var(--border);padding:10px 16px 16px;display:none;margin:0;box-shadow:var(--shadow);max-height:calc(100dvh - var(--nav-h));overflow-y:auto;gap:2px}
  .nav-links.open{display:flex}
  .nav-links a{font-size:1.175rem;padding:12px 14px;border-radius:9px}
}

/* Hero */
.hero{padding:70px 0 56px;background:radial-gradient(1100px 480px at 10% -10%,var(--hero-a),transparent 60%),radial-gradient(900px 480px at 100% 0%,var(--hero-b),transparent 60%);border-bottom:2px solid var(--border)}
.eyebrow{display:inline-block;font-size:.88rem;font-weight:800;letter-spacing:.05em;text-transform:uppercase;color:var(--accent);background:var(--surface);border:2px solid var(--border);padding:5px 14px;border-radius:99px}
.hero h1{font-size:clamp(2rem,1.2rem + 3.8vw,3.9rem);line-height:1.12;margin:18px 0 14px;letter-spacing:-.02em;font-weight:800}
.hero p.lead{font-size:clamp(1.08rem,1rem + .4vw,1.32rem);color:var(--muted);max-width:880px;margin:0 0 22px}
.badges{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:26px}
.badges img{height:30px;width:auto;border-radius:5px}
.cta{display:flex;flex-wrap:wrap;gap:12px}
.btn{position:relative;overflow:hidden;display:inline-flex;align-items:center;gap:9px;padding:13px 22px;border-radius:12px;font-weight:800;font-size:1rem;text-decoration:none;border:2px solid transparent;cursor:pointer;min-height:44px;white-space:nowrap;transition:transform .15s,background .2s,box-shadow .2s}
.btn-primary{background:var(--primary);color:var(--on-primary);border-color:var(--primary)}
.btn-primary:hover{background:var(--primary-hover);box-shadow:var(--shadow);transform:translateY(-2px)}
.btn-ghost{background:var(--surface);color:var(--text);border-color:var(--border)}
.btn-ghost:hover{border-color:var(--primary);color:var(--primary);transform:translateY(-2px)}
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:14px;margin-top:38px}
.stat{background:var(--surface);border:2px solid var(--border);border-radius:var(--radius);padding:16px 18px;box-shadow:var(--shadow)}
.stat b{display:block;font-size:clamp(1.7rem,1.3rem + 1.3vw,2.4rem);line-height:1.1;color:var(--primary);font-weight:800}
.stat span{color:var(--muted);font-size:.93rem;font-weight:700}

/* Sections & Cards */
section{padding:60px 0;border-top:1px solid var(--border)}
section h2{font-size:clamp(1.5rem,1rem + 2vw,2.3rem);margin:0 0 8px;letter-spacing:-.01em;font-weight:800}
.sub{color:var(--muted);margin:0 0 26px;max-width:860px}
.grid{display:grid;gap:16px;grid-template-columns:repeat(auto-fill,minmax(min(265px,100%),1fr))}
.card{background:var(--surface);border:2px solid var(--border);border-radius:var(--radius);padding:20px;box-shadow:var(--shadow);transition:transform .18s,border-color .2s}
.card:hover,.card:focus-within{transform:translateY(-3px);border-color:var(--primary)}
.card h3{margin:0 0 6px;font-size:1.12rem;font-weight:800}
.card p{margin:0 0 8px;color:var(--muted);font-size:.97rem}
.tag{display:inline-block;font-size:.78rem;font-weight:800;color:var(--accent);background:var(--bg);border:2px solid var(--border);padding:2px 9px;border-radius:99px;margin-bottom:10px}
details.acc{background:var(--surface);border:2px solid var(--border);border-radius:var(--radius);margin-bottom:12px;box-shadow:var(--shadow);transition:border-color .2s;overflow:hidden}
details.acc[open],details.acc:hover{border-color:var(--primary)}
details.acc summary{cursor:pointer;list-style:none;padding:16px 18px;display:flex;gap:12px;align-items:center;font-weight:800;min-height:44px;flex-wrap:wrap}
details.acc summary::-webkit-details-marker{display:none}
details.acc summary .num{flex:none;min-width:80px;text-align:center;font-size:.84rem;background:var(--primary);color:var(--on-primary);border-radius:8px;padding:4px 10px}
details.acc summary>span:not(.num){flex:1 1 200px;min-width:0;overflow-wrap:anywhere}
details.acc summary .chev{margin-left:auto;flex:none;transition:transform .2s;color:var(--muted)}
details.acc[open] summary .chev{transform:rotate(180deg)}
details.acc summary .meta{display:block;font-weight:500;color:var(--muted);font-size:.92rem;overflow-wrap:anywhere}
.acc-body{padding:0 18px 18px;max-width:100%}
.files{list-style:none;margin:0;padding:0;display:grid;gap:8px;grid-template-columns:repeat(auto-fill,minmax(min(360px,100%),1fr))}
.files li{min-width:0;max-width:100%}
.files a{display:block;padding:10px 12px;border-radius:8px;text-decoration:none;font-size:.92rem;font-weight:600;min-height:44px;background:var(--bg);border:1px solid var(--border);max-width:100%;overflow-wrap:break-word;word-break:normal;line-height:1.45}
.files a:hover{border-color:var(--primary);background:var(--surface-2)}

/* Tables & Code */
.table-wrap{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;border-radius:var(--radius);border:2px solid var(--border);margin-bottom:20px}
table{width:100%;min-width:0;border-collapse:collapse;background:var(--surface);font-size:.96rem}
th,td{text-align:left;padding:12px 14px;border-bottom:1px solid var(--border);vertical-align:top;overflow-wrap:break-word}
th{background:var(--surface-2);font-weight:800}
td a,th a{overflow-wrap:break-word;word-break:break-word}
.table-wrap:not(.wide) th:first-child,.table-wrap:not(.wide) td:first-child{width:36%;white-space:normal}
.table-wrap.wide{box-shadow:inset -16px 0 14px -12px color-mix(in srgb,var(--text) 28%,transparent)}
.table-wrap.wide table{width:max(100%,max-content);min-width:100%}
.table-wrap.wide th,.table-wrap.wide td{overflow-wrap:normal;word-break:normal;white-space:nowrap}
.code-wrap{margin:0 0 18px;border:2px solid var(--border);border-radius:12px;overflow:hidden;background:var(--code-bg);max-width:100%}
.code-bar{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;padding:7px 10px 7px 16px;background:#1e293b;border-bottom:1px solid #334155}
.code-label{font-size:.78rem;font-weight:800;letter-spacing:.04em;text-transform:uppercase;color:#f8fafc;white-space:normal;overflow-wrap:anywhere;min-width:0;flex:1 1 10rem;line-height:1.35}
.code-wrap .copy{font:inherit;font-size:.85rem;font-weight:700;background:#0f172a;color:#f8fafc;border:1px solid #64748b;border-radius:8px;padding:6px 14px;min-height:40px;cursor:pointer;white-space:nowrap;flex:none}
.code-wrap .copy:hover{background:#334155}
.code-wrap pre.code,.code-wrap pre.tree{margin:0;padding:16px 18px;overflow-x:auto;max-width:100%;white-space:pre;color:var(--code-text);font-size:.93rem;line-height:1.58}
.tree-wrap{background:var(--surface)}
.tree-wrap pre.tree{background:var(--surface);color:var(--text)}

/* Gallery: 3 cols desktop, 2 cols tablet, 1 col mobile */
.toolbar{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-bottom:22px}
.search{flex:1 1 260px;min-width:0;display:flex;align-items:center;gap:8px;background:var(--surface);border:2px solid var(--border);border-radius:12px;padding:0 12px}
.search:focus-within{border-color:var(--primary)}
.search input{flex:1;border:0;background:transparent;color:var(--text);font:inherit;padding:11px 4px;outline:none}
.chip{border:2px solid var(--border);background:var(--surface);color:var(--text);font:inherit;font-size:.92rem;font-weight:700;padding:8px 14px;border-radius:99px;cursor:pointer;min-height:44px;white-space:nowrap}
.chip:hover{border-color:var(--primary)}
.chip[aria-pressed="true"]{background:var(--primary);color:var(--on-primary);border-color:var(--primary)}
.gallery{display:grid;gap:18px;grid-template-columns:repeat(3,minmax(0,1fr))}
@media (max-width:1024px){.gallery{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:640px){.gallery{grid-template-columns:1fr}}
.shot{margin:0;background:var(--surface);border:2px solid var(--border);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow);transition:transform .18s,border-color .2s}
.shot:hover,.shot:focus-within{transform:translateY(-3px);border-color:var(--primary)}
.shot button{all:unset;cursor:zoom-in;display:block;width:100%}
.shot .thumb{aspect-ratio:16/10;overflow:hidden;background:#f8fafc;border-bottom:2px solid var(--border)}
.shot img{width:100%;height:100%;object-fit:cover;transform:scale(1.02);display:block;transition:transform .3s}
.shot:hover img{transform:scale(1.06)}
.shot figcaption{padding:13px 15px;font-weight:700;font-size:.96rem;overflow-wrap:anywhere}
.shot figcaption span{display:block;color:var(--muted);font-weight:500;font-size:.86rem;margin-top:4px;overflow-wrap:anywhere}
.empty{color:var(--muted);display:none;padding:20px 0;font-weight:600}

/* Lightbox with Zoom */
.lb{position:fixed;inset:0;background:rgba(9,15,28,.94);display:none;z-index:200;align-items:center;justify-content:center;flex-direction:column;padding:20px;touch-action:pan-y pinch-zoom}
.lb.open{display:flex}
.lb-stage{max-height:78vh;max-width:min(1400px,94vw);overflow:auto;display:flex;align-items:center;justify-content:center;border-radius:10px}
.lb img{max-height:76vh;max-width:min(1360px,90vw);width:auto;border-radius:10px;box-shadow:0 10px 40px rgba(0,0,0,.5);transition:transform .2s ease;cursor:zoom-in;background:#f8fafc}
.lb.zoomed img{max-height:none;max-width:none;width:1440px;cursor:zoom-out}
.lb p{color:#fff;background:rgba(15,23,42,.92);padding:8px 14px;border-radius:8px;margin:12px 0 0;font-weight:600;text-align:center;max-width:min(90vw,100%);overflow-wrap:anywhere}
.lb-controls{position:absolute;top:16px;right:16px;display:flex;gap:10px}
.lb .lb-btn{background:rgba(15,23,42,.92);color:#fff;border:2px solid #64748b;width:48px;height:48px;border-radius:50%;cursor:pointer;display:grid;place-items:center;font-size:1.3rem;font-weight:800}
.lb .lb-btn:hover{background:#1e293b;border-color:#fff}
.lb .prev,.lb .next{position:absolute;top:50%;transform:translateY(-50%)}
.lb .prev{left:16px}.lb .next{right:16px}
@media (max-width:640px){.lb .prev,.lb .next{top:auto;bottom:16px;transform:none}}

/* Filled Arrow-Only Back to Top Button (Sharp Chevron-Arrow) */
.to-top{position:fixed;right:22px;bottom:22px;z-index:60;width:52px;height:52px;border-radius:14px;border:2px solid var(--border);background:var(--primary);color:var(--on-primary);display:grid;place-items:center;cursor:pointer;box-shadow:var(--shadow);opacity:0;pointer-events:none;transform:translateY(12px);transition:opacity .25s,transform .25s}
.to-top.show{opacity:1;pointer-events:auto;transform:none}
.to-top:hover{background:var(--primary-hover)}
.to-top svg{width:26px;height:26px}

.reveal{opacity:0;transform:translateY(16px);transition:opacity .55s ease,transform .55s ease}
.reveal.in{opacity:1;transform:none}
.hide{display:none!important}
footer{border-top:2px solid var(--border);padding:34px 0;color:var(--muted);font-size:.95rem}
.kbd{display:inline-block;padding:2px 7px;border:1px solid var(--border);border-radius:6px;background:var(--surface-2);font-family:monospace;font-size:.86em;white-space:nowrap}


/* Author */
#author{min-height:calc(100dvh - var(--nav-h) - 2px)}
.author-card h3{margin:0 0 6px;font-size:1.25rem}
.author-card p{margin:0 0 6px}
.author-card p:last-child{margin-bottom:0}
