/* nss.css — nih.ar · no classes · no js · no tracking · mobile-first */

/* tokens */
:root{
  --bg:#070b0f;--bg2:#0f161b;--bg3:#152027;--line:#1f2c33;--grid:rgba(58,128,122,.09);
  --fg:#e6ecec;--mute:#8b979a;--acc:#3a807a;--ink:#66bdb3;--acc2:#a9b8ff;--hot:#ff6b6b;
  --glow:rgba(58,128,122,.22);
  --mono:ui-monospace,"JetBrains Mono","Cascadia Code","SF Mono",Menlo,Consolas,monospace;
  --sans:system-ui,-apple-system,"Segoe UI",Roboto,"Noto Sans",sans-serif;
  --r:12px;--gut:1rem;--w:46rem;color-scheme:dark;
}
@media (prefers-color-scheme:light){:root{
  --bg:#f6f8f8;--bg2:#fff;--bg3:#eaf1f0;--line:#d7e2e0;--grid:rgba(58,128,122,.10);
  --fg:#14201f;--mute:#5c6b6a;--ink:#2c6a64;--acc2:#4b5bb5;--hot:#d63c3c;--glow:rgba(58,128,122,.12);color-scheme:light;
}}

/* base */
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%;scroll-behavior:smooth;scroll-padding-top:4.5rem}
body{
  display:flex;flex-direction:column;margin:0;min-height:100vh;color:var(--fg);
  font:16px/1.7 var(--sans);overflow-wrap:break-word;
  background:radial-gradient(45rem 28rem at 105% -10%,var(--glow),transparent 70%),
    linear-gradient(var(--grid) 1px,transparent 1px),linear-gradient(90deg,var(--grid) 1px,transparent 1px) var(--bg);
  background-size:auto,32px 32px,32px 32px;background-attachment:fixed;
}
body>*{width:100%;max-width:var(--w);margin-inline:auto;padding-inline:var(--gut)}
::selection{background:var(--acc);color:#fff}
a{color:inherit;text-decoration:underline 2px var(--acc);text-underline-offset:.22em;transition:color .2s}
a:hover{color:var(--ink)}
a:focus-visible{outline:2px solid var(--acc);outline-offset:3px;border-radius:4px}
h1,h2,h3,h4{line-height:1.25;letter-spacing:-.02em;margin:2.2em 0 .6em;text-wrap:balance}
h2{font-size:1.35rem}h3{font-size:1.12rem}h4{font-size:1rem;color:var(--mute)}
p,ul,ol,pre,table,blockquote{margin:0 0 1.2em}
ul,ol{padding-left:1.25rem}
li{margin:.3em 0}
li::marker{color:var(--acc)}
img{display:block;max-width:100%;height:auto;margin-inline:auto;border-radius:var(--r)}
p>img{margin-block:.5rem;border:1px solid var(--line)}
hr{border:0;height:1px;margin:2.5rem 0;background:linear-gradient(90deg,transparent,var(--line) 15%,var(--acc) 50%,var(--line) 85%,transparent)}
small{font:.78rem var(--mono);color:var(--mute)}
time{font-family:var(--mono);font-variant-numeric:tabular-nums}
center>:first-child{margin-top:2rem}

/* header: one sticky bar on every page.
   home/homelab: <h1><a>logo</a></h1><nav>  ·  notes: <h1>Title</h1><nav> → header dissolves,
   nav becomes the bar, its first link is drawn as the logo, the title drops below */
:is(header:has(>h1>a),header:not(:has(>h1>a))>nav){
  position:sticky;top:0;z-index:10;order:-1;display:flex;align-items:center;gap:.1rem;
  max-width:none;min-height:3.4rem;margin:0;padding:.55rem max(var(--gut),calc((100% - var(--w))/2 + var(--gut)));
  background:color-mix(in srgb,var(--bg) 80%,transparent);backdrop-filter:blur(12px) saturate(1.4);
  -webkit-backdrop-filter:blur(12px) saturate(1.4);border-bottom:1px solid var(--line);
}
header:not(:has(>h1>a)){display:contents}
header>h1:has(>a){flex:none;margin:0 .4rem 0 0;font-size:1.1rem;line-height:1}
header>nav{display:flex;flex:1;min-width:0;justify-content:safe flex-end;overflow-x:auto;scrollbar-width:none}
header>nav::-webkit-scrollbar{display:none}
header:not(:has(>h1>a))>nav{flex:none;justify-content:flex-start}
header a{flex:none;white-space:nowrap;text-decoration:none;font:500 .85rem/1 var(--mono);color:var(--mute);padding:.55rem .5rem;border-radius:999px}
header a:hover{color:var(--fg);background:var(--bg2)}
:is(header>h1>a,header:not(:has(>h1>a))>nav>a:first-child){
  display:inline-flex;align-items:baseline;margin-right:auto;padding:0;background:none!important;
  font:700 1.1rem/1 var(--mono);letter-spacing:-.02em;color:var(--fg)!important;
}
header>h1>a::before{content:"~/";color:var(--ink)}
:is(header>h1>a,header:not(:has(>h1>a))>nav>a:first-child)::after{content:"_";color:var(--ink);animation:blink 1.1s steps(1) infinite}
header:not(:has(>h1>a))>nav>a:first-child{font-size:0}
header:not(:has(>h1>a))>nav>a:first-child::before{content:"~/nih.ar";background:linear-gradient(90deg,var(--ink) 0 2ch,var(--fg) 2ch);-webkit-background-clip:text;background-clip:text;color:transparent}
header:not(:has(>h1>a))>nav>a:first-child::before,header:not(:has(>h1>a))>nav>a:first-child::after{font-size:1.1rem}
header:has(>h1>a)>nav>a:first-child[href="/"]{display:none}
header>h1:not(:has(a)){
  width:100%;max-width:var(--w);margin:2rem auto .25rem;padding-inline:var(--gut);
  font:800 clamp(1.75rem,7vw,2.8rem)/1.15 var(--sans);letter-spacing:-.035em;
  background:linear-gradient(100deg,var(--fg) 45%,var(--ink));-webkit-background-clip:text;background-clip:text;color:transparent;
}

/* home: hero */
body>section:first-of-type>p:first-of-type{margin:2.75rem 0 1rem;font-size:clamp(1.5rem,5.2vw + .6rem,2.75rem);font-weight:750;line-height:1.18;letter-spacing:-.035em;text-wrap:balance}
body>section:first-of-type>p:first-of-type::before{content:"$ whoami";display:block;margin-bottom:.9rem;font:500 .8rem/1 var(--mono);color:var(--acc2)}
body>section:first-of-type>p:first-of-type a{text-decoration:none;background:linear-gradient(100deg,var(--ink),#b8ece6 50%,var(--acc2));-webkit-background-clip:text;background-clip:text;color:transparent}
body>section:first-of-type>p~p{color:var(--mute);font-size:1.02rem}
body>section:first-of-type>p~p a{color:var(--fg);font-weight:600}
body>section:first-of-type>h2{margin:3rem 0 1rem;padding-bottom:.6rem;border-bottom:1px solid var(--line);font:700 .78rem/1 var(--mono);text-transform:uppercase;letter-spacing:.18em;color:var(--mute)}
body>section:first-of-type>h2::first-letter{color:var(--ink);font-size:1.25em}

/* home: projects → cards */
body>section:first-of-type>ul:not(:last-of-type){display:grid;gap:.75rem;padding:0;list-style:none}
body>section:first-of-type>ul:not(:last-of-type)>li{color:var(--mute);font-size:.93rem;line-height:1.5}
body>section:first-of-type>ul:not(:last-of-type)>li>a:first-child{font:700 1.02rem var(--mono);color:var(--fg);text-decoration:none}
body>section:first-of-type>ul:not(:last-of-type)>li>a:first-child::before{content:"→ ";color:var(--ink)}

/* home: notes → timeline */
body>section:first-of-type>ul:last-of-type{list-style:none;padding:0 0 0 1rem;border-left:1px solid var(--line)}
body>section:first-of-type>ul:last-of-type>li{position:relative;display:flex;flex-wrap:wrap;align-items:baseline;gap:0 .45rem;margin:0;padding:.6rem 0 .6rem .9rem;font:.78rem/1.6 var(--mono);color:var(--mute)}
body>section:first-of-type>ul:last-of-type>li::before{content:"";position:absolute;left:-1.33rem;top:.95rem;width:9px;height:9px;border-radius:50%;background:var(--bg);border:2px solid var(--mute);transition:.2s}
body>section:first-of-type>ul:last-of-type>li:hover::before{background:var(--acc);border-color:var(--acc)}
body>section:first-of-type>ul:last-of-type>li:first-child::before{background:var(--ink);border-color:var(--ink);box-shadow:0 0 0 4px var(--glow)}
body>section:first-of-type>ul:last-of-type>li>a{flex:1 1 100%;font:500 1rem/1.45 var(--sans);color:var(--fg);text-decoration:none}
body>section:first-of-type>ul:last-of-type>li:first-child>a::after{content:"new";display:inline-block;margin-left:.5rem;padding:.12rem .45rem;border-radius:999px;vertical-align:.12em;font:700 .62rem/1.2 var(--mono);text-transform:uppercase;letter-spacing:.08em;color:var(--bg);background:var(--ink)}

/* later one-paragraph section ("# Member of …") → badge strip */
body>section:not(:first-of-type):has(>p:only-child){margin-top:3.5rem;padding-top:1.5rem;font:500 .82rem/2.4 var(--mono);color:var(--mute);background:linear-gradient(var(--line),var(--line)) center top/calc(100% - 2*var(--gut)) 1px no-repeat}
body>section:not(:first-of-type):has(>p:only-child)>p{margin:0}
body>section:not(:first-of-type):has(>p:only-child)>p::first-letter{color:var(--ink)}
body>section:not(:first-of-type):has(>p:only-child) a{padding:.05rem .65rem;line-height:1.9;border:1px dashed var(--line);border-radius:999px;text-decoration:none;color:var(--fg);transition:.2s}
body>section:not(:first-of-type):has(>p:only-child) a:hover{border:1px solid var(--acc);color:var(--ink)}

/* articles */
article{padding-block:1rem 0}
article h2::before{content:"## ";font:600 .8em var(--mono);color:var(--ink)}
article h3::before{content:"### ";font:600 .8em var(--mono);color:var(--acc2)}
article>p:last-child:has(time){margin-top:3rem;padding-top:1rem;border-top:1px dashed var(--line);font:500 .8rem/1.5 var(--mono);color:var(--mute)}

/* lists of only links (link page, homelab services) → tiles */
:is(article,body>section:not(:first-of-type)) ul:has(>li>a:first-child):not(:has(>li>:first-child:not(a))){display:grid;grid-template-columns:repeat(auto-fill,minmax(10.5rem,1fr));gap:.5rem;padding:0;list-style:none}
:is(article,body>section:not(:first-of-type)) ul:has(>li>a:first-child):not(:has(>li>:first-child:not(a)))>li{margin:0;padding:.7rem .85rem;font-size:.92rem;line-height:1.4;color:var(--mute)}
:is(article,body>section:not(:first-of-type)) ul:has(>li>a:first-child):not(:has(>li>:first-child:not(a)))>li>a{color:var(--fg);font-weight:600;text-decoration:none}

/* shared card look + whole-card click for project cards and tiles */
:is(body>section:first-of-type>ul:not(:last-of-type),:is(article,body>section:not(:first-of-type)) ul:has(>li>a:first-child):not(:has(>li>:first-child:not(a))))>li{
  position:relative;margin:0;background:var(--bg2);border:1px solid var(--line);border-radius:var(--r);transition:border-color .2s,transform .2s,background .2s;
}
body>section:first-of-type>ul:not(:last-of-type)>li{padding:1rem 1.1rem}
:is(body>section:first-of-type>ul:not(:last-of-type),:is(article,body>section:not(:first-of-type)) ul:has(>li>a:first-child):not(:has(>li>:first-child:not(a))))>li>a:first-child::after{content:"";position:absolute;inset:0;border-radius:var(--r)}
:is(body>section:first-of-type>ul:not(:last-of-type),:is(article,body>section:not(:first-of-type)) ul:has(>li>a:first-child):not(:has(>li>:first-child:not(a))))>li:hover{border-color:var(--acc);background:var(--bg3);transform:translateY(-2px)}

/* "label : value" lists (uses page, homelab stats) */
ul:has(>li>strong:first-child){list-style:none;padding:0}
ul:has(>li>strong:first-child)>li{margin:0;padding:.5rem 0;border-bottom:1px dashed var(--line)}
ul:has(>li>strong:first-child)>li:last-child{border-bottom:0}
li>strong:first-child{font:600 .92em var(--mono);color:var(--ink)}
li>small{margin-left:.35rem}
li>progress{width:6rem;margin:0 .4rem}

/* code */
code{font:.87em/1.5 var(--mono)}
:not(pre)>code{padding:.12em .4em;border-radius:6px;background:var(--bg3);border:1px solid var(--line);color:var(--ink);white-space:break-spaces}
pre{
  overflow-x:auto;margin-inline:calc(var(--gut) * -1);padding:2.3rem var(--gut) 1rem;font-size:.85rem;line-height:1.6;tab-size:2;
  border-block:1px solid var(--line);background:var(--bg2) no-repeat;background-size:12px 12px;
  background-image:radial-gradient(circle,var(--hot) 4px,transparent 4.5px),radial-gradient(circle,var(--acc) 4px,transparent 4.5px),radial-gradient(circle,var(--acc2) 4px,transparent 4.5px);
  background-position:var(--gut) .8rem,calc(var(--gut) + 18px) .8rem,calc(var(--gut) + 36px) .8rem;
}
pre code{font-size:inherit;color:var(--fg)}

/* misc elements */
blockquote{margin-inline:0;padding:.8rem 1rem;border-left:3px solid var(--acc);background:var(--bg2);border-radius:0 var(--r) var(--r) 0;color:var(--mute)}
table{display:block;width:max-content;max-width:100%;overflow-x:auto;border-collapse:collapse;font-size:.9rem;border:1px solid var(--line);border-radius:var(--r)}
th,td{padding:.6rem .85rem;text-align:left;border-bottom:1px solid var(--line)}
th{font:600 .72rem var(--mono);text-transform:uppercase;letter-spacing:.1em;color:var(--mute);background:var(--bg2)}
progress{height:.55rem;border:0;border-radius:999px;background:var(--bg3);overflow:hidden;appearance:none;vertical-align:middle}
progress::-webkit-progress-bar{background:var(--bg3)}
progress::-webkit-progress-value{background:linear-gradient(90deg,var(--acc),var(--ink))}
progress::-moz-progress-bar{background:linear-gradient(90deg,var(--acc),var(--ink))}
form{display:flex;flex-wrap:wrap;gap:.5rem;margin:0 0 1.5rem}
input,button{font:inherit;line-height:1.4;color:inherit;background:var(--bg2);border:1px solid var(--line);border-radius:8px;padding:.55rem .75rem;max-width:100%}
form>input:not([type=submit]){flex:1 1 12rem;min-width:0}
:is(button,input[type=submit]){background:var(--acc);border-color:var(--acc);color:#fff;font-weight:600;cursor:pointer}

/* footer */
footer{margin-top:3rem;padding-block:1.5rem 2.5rem;background:linear-gradient(var(--line),var(--line)) center top/calc(100% - 2*var(--gut)) 1px no-repeat}
footer>nav{display:flex;flex-wrap:wrap;gap:.35rem 1.25rem}
footer a{padding:.3rem 0;font:.86rem var(--mono);color:var(--mute);text-decoration:none}
footer a:hover,footer a[href^="mailto"]{color:var(--ink)}
footer a[href^="mailto"]::before{content:"✉ "}

/* tablet ≥ 640px */
@media (min-width:40rem){
  :root{--gut:1.5rem}
  body{font-size:17px;background-size:auto,48px 48px,48px 48px}
  header a{padding:.55rem .75rem}
  body>section:first-of-type>ul:not(:last-of-type){grid-template-columns:repeat(2,minmax(0,1fr))}
  body>section:first-of-type>ul:last-of-type>li{flex-wrap:nowrap;gap:.6rem}
  body>section:first-of-type>ul:last-of-type>li>a{flex:1 1 auto;min-width:0;margin-left:.4rem}
  body>section:first-of-type>ul:last-of-type>li>time{flex:none}
  ul:has(>li>strong:first-child)>li{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:.45rem}
  ul:has(>li>strong:first-child)>li>strong:first-child{flex:0 0 11rem}
  li:has(>small:last-child){display:flex;justify-content:space-between;gap:1rem}
  pre{margin-inline:0;border:1px solid var(--line);border-radius:var(--r)}
  table{display:table;width:100%}
}
/* desktop ≥ 896px */
@media (min-width:56rem){
  body>section:first-of-type>p:first-of-type{margin-top:5rem}
  body>section:first-of-type>ul:not(:last-of-type){grid-template-columns:repeat(auto-fill,minmax(14rem,1fr))}
}
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
@media print{
  body{background:none;color:#000}
  header>nav,footer{display:none}
  pre{white-space:pre-wrap;background-image:none;padding-top:1rem}
}
@keyframes blink{50%{opacity:0}}

