/* Theme ---------------------------------------------------------------- */
.t-light{--bg:#F3F2ED;--ink:#121A18;--card:#FFFFFF;--muted:#5F6663;--body:#2B3331;--rule:rgba(18,26,24,0.25);--accent:#E8541E;--shadow:rgba(18,26,24,0.5)}
.t-dark{--bg:#0F1412;--ink:#E9E6DC;--card:#182019;--muted:#A8AFA6;--body:#C9CBC2;--rule:rgba(233,230,220,0.25);--accent:#F2733D;--shadow:rgba(0,0,0,0.6)}
.t-light .i-sun{display:none}
.t-dark .i-moon{display:none}
.i-auto{display:none}
/* Once app.js sets the mode, the icon shows the current setting. */
[data-theme-mode] [data-theme-toggle] svg{display:none}
[data-theme-mode=auto] [data-theme-toggle] .i-auto,[data-theme-mode=light] [data-theme-toggle] .i-sun,[data-theme-mode=dark] [data-theme-toggle] .i-moon{display:block}

/* Base ------------------------------------------------------------------ */
*{box-sizing:border-box}
html{background:var(--bg);color:var(--ink);transition:background .4s ease,color .4s ease}
body{margin:0;font-family:'Space Grotesk',system-ui,sans-serif;-webkit-font-smoothing:antialiased;line-height:1.4;min-height:100vh;display:flex;flex-direction:column}
a{color:var(--ink);text-decoration:none}
a:hover{color:var(--accent)}
h1,h2,h3{margin:0;font-weight:700;letter-spacing:-0.03em;line-height:1}
h2{font-size:56px}
img{max-width:100%}
.mono{font-family:'IBM Plex Mono',ui-monospace,monospace;font-size:12px;letter-spacing:0.06em;text-transform:uppercase;color:var(--muted)}
.container{max-width:1360px;margin:0 auto;width:100%}
.container-narrow{max-width:720px;margin:0 auto;width:100%}
.section{padding:112px 40px;border-top:1.5px solid var(--ink)}
.stack-20{display:flex;flex-direction:column;gap:20px}
.stack-24{display:flex;flex-direction:column;gap:24px}
.stack-40{display:flex;flex-direction:column;gap:40px}
.row-10{display:flex;gap:10px;flex-wrap:wrap}
.row-18{display:flex;gap:18px;flex-wrap:wrap}
.lede{margin:0;font-size:18px;line-height:1.5;color:var(--muted)}
.page-title{font-size:72px;line-height:0.95;letter-spacing:-0.035em}

/* Buttons --------------------------------------------------------------- */
.btn{display:inline-flex;align-items:center;gap:10px;height:52px;padding:0 24px;border-radius:999px;font-weight:600;font-size:16px;border:0;font-family:inherit;cursor:pointer;transition:transform .2s ease,background .2s ease,color .2s ease}
.btn:hover{transform:translateY(-2px)}
.btn-ink{background:var(--ink);color:var(--bg)}
.btn-ink:hover{background:var(--accent);color:var(--bg)}
.btn-line{border:1.5px solid var(--ink);background:transparent;color:var(--ink)}
.btn-quiet{border-color:var(--rule)}
.btn-sm{height:44px;padding:0 18px;font-size:15px}
.tbtn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:36px;padding:0 12px;min-width:92px;border:1px solid var(--rule);border-radius:999px;background:transparent;color:var(--ink);cursor:pointer;font-family:'IBM Plex Mono',ui-monospace,monospace;font-size:11px;letter-spacing:0.06em;text-transform:uppercase}
.tbtn:hover{border-color:var(--ink)}
.tbtn-icon{width:36px;padding:0;justify-content:center}
.quiet-link{display:inline-flex;align-items:center;gap:8px;font-weight:600;font-size:16px;border-bottom:1.5px solid var(--rule);padding-bottom:2px}
.live{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--accent);animation:blink 2s infinite}
.status{display:inline-flex;align-items:center;gap:8px}
@keyframes blink{0%,100%{opacity:1}50%{opacity:.2}}

/* Header / footer ------------------------------------------------------- */
/* Header height; app.js replaces it with the measured value. */
:root{--header-h:88px}
.site-header{position:relative;z-index:3;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:16px;padding:22px 40px}
.wordmark{font-weight:700;font-size:18px;letter-spacing:-0.01em}
.header-meta{display:flex;flex-wrap:wrap;align-items:center;gap:22px}
.header-meta>a{display:inline-flex;align-items:center;gap:6px;height:36px;padding:0 14px;border:1px solid var(--ink);border-radius:999px;color:var(--ink);transition:background .2s ease,color .2s ease}
/* Mute the contours behind the header pills. */
.header-meta>a,.header-meta .tbtn{background:color-mix(in srgb,var(--bg) 72%,transparent);-webkit-backdrop-filter:blur(1.5px);backdrop-filter:blur(1.5px)}
.header-meta>a::after{content:"→";font-size:13px;transition:transform .2s ease}
.header-meta>a:hover{background:var(--ink);color:var(--bg)}
.header-meta>a:hover::after{transform:translateX(2px)}
.header-meta>a.is-current{background:var(--ink);color:var(--bg)}
.moon{display:inline-flex;align-items:center;gap:8px}
.theme-controls{display:inline-flex;align-items:center;gap:6px}
.site-footer{margin-top:auto;padding:40px;display:flex;flex-wrap:wrap;justify-content:space-between;gap:16px;align-items:center}
.footer-links{display:flex;gap:24px}

/* Hero ------------------------------------------------------------------ */
.hero{position:relative;min-height:760px;min-height:max(760px,calc(100vh - 92px));display:flex;align-items:center;overflow:hidden;cursor:crosshair}
/* The hero slides up under the header so the contours fill the top bar too. */
.site-header+.hero{margin-top:calc(-1 * var(--header-h));padding-top:var(--header-h);min-height:max(calc(760px + var(--header-h)),100vh)}
.contours{position:absolute;inset:0;width:100%;height:100%;display:block}
.hero-wash{position:absolute;inset:0;background:radial-gradient(ellipse 52% 70% at 28% 55%,var(--bg) 0%,transparent 100%);pointer-events:none}
.hero-inner{position:relative;z-index:2;width:100%;max-width:1360px;margin:0 auto;padding:40px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:48px;pointer-events:none}
.hero-copy{display:flex;flex-direction:column;gap:24px;max-width:720px;pointer-events:auto}
.hero-title{display:flex;flex-direction:column;gap:14px;font-size:92px;line-height:0.98;letter-spacing:-0.04em;max-width:900px}
.hero-name,.hero-tail{font-size:40px;font-weight:500;letter-spacing:-0.015em;line-height:1}
.hero-tail{color:var(--muted)}
.hero-line em{font-style:normal;color:var(--accent)}
.hero-lede{margin:8px 0 0;font-size:20px;line-height:1.55;max-width:520px;color:var(--body)}
.hero-actions{display:flex;flex-wrap:wrap;align-items:center;gap:28px;margin-top:8px}
.hero-corner{position:absolute;bottom:24px;margin:0;z-index:2;pointer-events:none;display:inline-flex;align-items:center;gap:8px}
.hero-corner-left{left:40px}
.hero-corner-right{right:40px}

/* Photo deck */
.deck-wrap{display:flex;flex-direction:column;gap:14px;align-items:flex-end;pointer-events:auto;--slot-0:rotate(4deg);--slot-1:rotate(-6deg) translate(-26px,14px);--slot-2:rotate(9deg) translate(22px,-10px)}
.deck{position:relative;width:300px;height:272px}
.card{position:absolute;inset:0;display:flex;flex-direction:column;gap:12px;padding:14px 14px 18px;background:var(--card);border:0;border-radius:2px;cursor:pointer;font-family:inherit;color:inherit;text-align:left;box-shadow:0 24px 50px -24px var(--shadow);transform:var(--t);transition:transform .55s cubic-bezier(.2,.8,.2,1)}
.card:hover{transform:var(--t) translateY(-6px)}
.card img{width:100%;aspect-ratio:4/3;object-fit:cover;display:block;background:#DDD;pointer-events:none;height:auto}
.card-caption{display:flex;justify-content:space-between;width:100%}
.deck[data-pos="0"] .card:nth-child(1),.deck[data-pos="1"] .card:nth-child(2),.deck[data-pos="2"] .card:nth-child(3){--t:var(--slot-0);z-index:3}
.deck[data-pos="0"] .card:nth-child(2),.deck[data-pos="1"] .card:nth-child(3),.deck[data-pos="2"] .card:nth-child(1){--t:var(--slot-1);z-index:2}
.deck[data-pos="0"] .card:nth-child(3),.deck[data-pos="1"] .card:nth-child(1),.deck[data-pos="2"] .card:nth-child(2){--t:var(--slot-2);z-index:1;opacity:.9}

.card-title{cursor:zoom-in;text-decoration:underline;text-decoration-color:var(--rule);text-underline-offset:3px}
.card-title:hover{color:var(--accent);text-decoration-color:currentColor}
.deck-foot{display:flex;align-items:center;gap:12px;flex-wrap:wrap;justify-content:flex-end}
.deck-expand{min-width:0;color:var(--muted)}
.deck-expand:hover{color:var(--ink)}

/* Full-screen photo viewer */
.lightbox{position:fixed;inset:0;width:100vw;height:100vh;max-width:none;max-height:none;margin:0;padding:0;border:0;background:rgba(9,13,11,0.97);color:#E9E6DC}
.lightbox::backdrop{background:rgba(9,13,11,0.6)}
.lightbox[open]{display:flex;align-items:center;justify-content:center;animation:lb-in .2s ease}
@keyframes lb-in{from{opacity:0}to{opacity:1}}
.lightbox-figure{margin:0;width:100%;height:100%;padding:64px 88px 24px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px}
.lightbox-figure img{max-width:100%;max-height:calc(100% - 40px);object-fit:contain;display:block;box-shadow:0 30px 80px -30px #000}
.lightbox figcaption{display:flex;gap:24px;color:#A8AFA6}
.lightbox-btn{position:absolute;display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;border-radius:50%;border:1px solid rgba(233,230,220,0.3);background:rgba(15,20,18,0.6);color:#E9E6DC;cursor:pointer;transition:border-color .2s ease,background .2s ease}
.lightbox-btn:hover{border-color:#E9E6DC;background:rgba(15,20,18,0.9)}
.lightbox-btn:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.lightbox-close{top:16px;right:16px}
.lightbox-prev{left:20px;top:50%;transform:translateY(-50%)}
.lightbox-next{right:20px;top:50%;transform:translateY(-50%)}

/* Sections -------------------------------------------------------------- */
.section-head{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:flex-end;gap:16px}
.repo-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}
.repo{position:relative;display:flex;flex-direction:column;gap:18px;padding:28px;background:var(--card);border:1px solid var(--rule);border-radius:14px;min-height:220px;transition:transform .25s ease,box-shadow .25s ease,border-color .25s ease}
.repo:hover{transform:translateY(-4px);box-shadow:0 18px 40px -20px var(--shadow);border-color:var(--ink);color:var(--ink)}
.repo h3{font-size:24px;line-height:1.2;letter-spacing:-0.02em;padding-right:40px;flex-grow:1}
.repo-index{position:absolute;top:24px;right:24px}
.repo-name{color:var(--accent)}
.repo-meta{display:flex;gap:18px;align-items:center}
.lang{display:inline-flex;align-items:center;gap:6px}
.dot{width:9px;height:9px;border-radius:50%;display:inline-block}
.repo .go{position:absolute;right:22px;bottom:22px;opacity:.35;transition:opacity .2s ease,transform .2s ease}
.repo:hover .go{opacity:1;transform:translate(2px,-2px)}

.notes-band{background:var(--card)}
.notes-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:40px}
.notes-grid>:first-child{grid-column:span 4}
.notes-grid>:last-child{grid-column:span 8}
.note-list{display:flex;flex-direction:column;border-top:1px solid var(--rule)}
.note{display:grid;grid-template-columns:140px 1fr 40px;gap:24px;align-items:center;padding:26px 0;border-bottom:1px solid var(--rule)}
.note-title{font-size:24px;font-weight:500;letter-spacing:-0.01em}
.note-empty .note-title{color:var(--muted)}
.arrow{font-size:24px;transition:transform .2s ease}
.note:hover .arrow{transform:translateX(6px)}
.notes-index{flex-grow:1;border-top:0;padding-top:64px}
.note-article{border-top:0;padding-top:64px}
.note-foot{display:flex;justify-content:space-between;gap:16px;padding-top:24px;border-top:1px solid var(--rule)}
.prose{font-size:19px;line-height:1.65;color:var(--body)}
.prose p{margin:0 0 1.2em}
.prose h2{font-size:28px;letter-spacing:-0.02em;margin:1.6em 0 .6em;color:var(--ink)}
.prose h3{font-size:22px;margin:1.4em 0 .5em;color:var(--ink)}
.prose a{color:var(--accent);text-decoration:underline;text-underline-offset:3px}
.prose img{border-radius:6px;display:block;margin:8px 0 24px}
.prose pre{background:var(--card);border:1px solid var(--rule);border-radius:8px;padding:16px;overflow-x:auto;font-size:15px}
.prose code{font-family:'IBM Plex Mono',ui-monospace,monospace;font-size:0.92em}
.prose blockquote{margin:0 0 1.2em;padding-left:16px;border-left:3px solid var(--accent);color:var(--muted)}

/* Contact dialog -------------------------------------------------------- */
.contact{border:0;padding:0;background:transparent;max-width:min(520px,calc(100vw - 32px));width:100%}
.contact::backdrop{background:rgba(9,13,11,0.6)}
.contact-form{background:var(--bg);color:var(--ink);border:1.5px solid var(--ink);border-radius:16px;padding:32px;display:flex;flex-direction:column;gap:16px;box-shadow:0 30px 60px -30px rgba(0,0,0,0.6)}
.contact-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}
.contact-head h2{font-size:32px;margin-bottom:6px}
.contact-head p{margin:0}
.contact-fields{display:flex;flex-direction:column;gap:16px}
.field{display:flex;flex-direction:column;gap:6px}
.field input,.field textarea{width:100%;height:48px;padding:0 14px;border:1.5px solid var(--rule);border-radius:8px;background:var(--card);color:var(--ink);font:inherit;font-size:16px}
.field textarea{min-height:140px;padding:12px 14px;resize:vertical}
.field input:focus,.field textarea:focus{outline:2px solid var(--accent);outline-offset:1px;border-color:transparent}
.hp{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}
.contact-actions{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}
.contact-sent{display:flex;flex-direction:column;gap:10px;padding:24px 0 8px}
.contact-sent p{margin:0;color:var(--muted);line-height:1.5}
.contact-sent-title{font-size:22px;font-weight:600;color:var(--ink)!important}
[hidden]{display:none!important}

/* Responsive ------------------------------------------------------------ */
/* Small laptop / tablet landscape: keep copy and deck side by side. */
@media (max-width:1024px){
  :root{--header-h:84px}
  .site-header{padding:20px 32px}
  .moon [data-moon-name]{display:none}
  .hero-inner{padding:40px 32px;flex-wrap:nowrap;gap:32px}
  .hero-copy{flex:1 1 auto;min-width:0}
  .hero-title{font-size:72px}
  .hero-name,.hero-tail{font-size:32px}
  .hero-lede{font-size:18px}
  .deck-wrap{flex:none;padding-right:16px}
  .deck{width:260px;height:236px}
  .hero-corner-left{left:32px}
  .hero-corner-right{right:32px}
  .section{padding:96px 32px}
  h2{font-size:44px}
}
/* Tablet portrait: one column, header stays on one row. */
@media (max-width:860px){
  .section{padding:72px 24px}
  .site-header{padding:16px 24px;flex-wrap:nowrap;gap:12px}
  .header-meta{margin-left:auto;flex-wrap:nowrap;gap:16px}
  .header-meta .status,.header-meta .moon{display:none}
  .site-footer{padding:24px}
  :root{--header-h:76px}
  .hero,.site-header+.hero{min-height:0;cursor:default}
  .hero-inner{flex-direction:column;align-items:stretch;padding:32px 24px 72px;gap:48px}
  .hero-wash{background:linear-gradient(180deg,transparent 20%,var(--bg) 85%)}
  .hero-title{font-size:64px;gap:12px}
  .hero-name,.hero-tail{font-size:28px}
  .hero-lede{font-size:18px}
  .hero-actions{gap:24px}
  .hero-corner-right{display:none}
  .hero-corner-left{left:24px}
  .deck-wrap{align-items:center;width:100%;gap:40px;padding-right:0}
  .deck-foot{justify-content:center}
  .deck{width:300px;height:272px}
  .repo{padding:24px;min-height:0}
  .repo h3{font-size:21px}
  .notes-grid{display:flex;flex-direction:column;gap:24px}
  .page-title{font-size:56px}
  .site-footer{flex-direction:column;align-items:flex-start;gap:10px}
}
/* Phone. */
@media (max-width:600px){
  .section{padding:64px 16px}
  :root{--header-h:68px}
  .site-header{padding:14px 16px;gap:8px}
  .header-meta{gap:10px}
  .header-meta .tbtn,.header-meta>a{height:40px}
  .header-meta>a{padding:0 12px}
  .header-meta [data-theme-label]{display:none}
  .header-meta .tbtn[data-theme-toggle]{width:40px;min-width:0;padding:0}
  .site-header .btn-sm{height:40px;padding:0 12px;gap:8px;font-size:14px;white-space:nowrap;flex:none}
  .header-meta,.wordmark{white-space:nowrap}
  .site-footer{padding:24px 16px}
  .hero-inner{padding:24px 16px 72px;gap:40px}
  .hero-title{font-size:min(48px,13vw);gap:10px}
  .hero-name,.hero-tail{font-size:min(24px,6.8vw)}
  .hero-lede{font-size:17px}
  .hero-actions{gap:16px;flex-direction:column;align-items:flex-start}
  .hero-actions .btn{width:100%;justify-content:center}
  .hero-corner-left{left:16px;right:16px;display:block}
  .deck{width:min(280px,calc(100vw - 96px));height:auto;aspect-ratio:300/272}
  .card-caption{gap:8px}
  .card-caption>span{white-space:nowrap}
  .card-caption>span:first-child{overflow:hidden;text-overflow:ellipsis}
  .note{grid-template-columns:1fr;gap:6px}
  .note .arrow{display:none}
  .note-title{font-size:19px}
  .page-title{font-size:44px}
  h2{font-size:min(40px,11vw)}
  .repo-grid{grid-template-columns:1fr}
  .repo{gap:14px}
  .repo h3{font-size:20px;padding-right:24px}
  .contact-form{padding:24px 20px}
  .contact-head h2{font-size:28px}
}
/* Narrow phone: drop the mail icon, then the label, before anything wraps. */
@media (max-width:420px){
  .site-header .btn-sm svg{display:none}
  .header-meta>a::after{display:none}
  .header-meta{gap:8px}
  .card{padding:10px 10px 12px;gap:8px}
  .card-caption{font-size:10px}
}
@media (max-width:374px){
  .site-header .btn-sm{width:40px;padding:0;gap:0;justify-content:center;font-size:0}
  .site-header .btn-sm svg{display:block}
  .header-meta{gap:6px}
}
@media (max-width:600px){
  .lightbox-figure{padding:72px 12px 96px}
  .lightbox-prev,.lightbox-next{top:auto;bottom:24px;transform:none}
  .lightbox-prev{left:calc(50% - 60px)}
  .lightbox-next{right:calc(50% - 60px)}
}
@media (prefers-reduced-motion:reduce){
  .lightbox[open]{animation:none}
  .card,.repo,.btn,.arrow{transition:none}
  .live{animation:none}
}
