/* Adam Saoudani: home page. Warm paper, bordered cards, a little old-web. */
:root { --bg:#f4ecd8; --ink:#2b2418; --muted:#716349; --accent:#b4441f; --line:#2b2418; --card:#fbf6e8; --nav-h:66px; }
:root[data-theme="dark"] { --bg:#1d1a14; --ink:#eadfc4; --muted:#a09370; --accent:#e8845a; --line:#eadfc4; --card:#27231b; color-scheme:dark; }
@media (prefers-color-scheme:dark) { :root:not([data-theme="light"]) { --bg:#1d1a14; --ink:#eadfc4; --muted:#a09370; --accent:#e8845a; --line:#eadfc4; --card:#27231b; color-scheme:dark; } }
@media (max-width:800px) { :root { --nav-h:44px; } }

* { box-sizing:border-box; }
/* --nav-h is measured by site.js; the values above are the no-JS guess */
html { scroll-behavior:smooth; scroll-padding-top:calc(var(--nav-h) + 16px); scrollbar-gutter:stable; }
body { margin:0; background:var(--bg); color:var(--ink); font:18px/1.6 Georgia,"Times New Roman",serif; }
a { color:var(--accent); }
:focus-visible { outline:3px solid var(--accent); outline-offset:3px; }
.mono { font:14px/1.4 ui-monospace,Consolas,"Courier New",monospace; }
.wrap { max-width:820px; margin:0 auto; padding:0 20px 80px; }
.skip { position:absolute; left:-999px; } .skip:focus { left:8px; top:8px; background:var(--card); padding:6px 10px; z-index:100; }

/* nav: ~/adam, this page's sections, then the other pages. One scrolling row on small screens. */
nav { position:sticky; top:0; z-index:30; background:var(--bg); border-bottom:2px solid var(--line); box-shadow:-12px 0 0 var(--bg), 12px 0 0 var(--bg); display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:baseline; gap:0 26px; padding:10px 0; font:14px/1.6 ui-monospace,Consolas,monospace; }
nav a { text-decoration:none; } nav a:hover { text-decoration:underline; text-underline-offset:3px; }
nav .home { color:var(--ink); font-weight:bold; }
nav .here, nav .away { display:flex; flex-wrap:wrap; gap:0 18px; }
nav .t { align-self:center; }
button.t { font:inherit; background:var(--card); color:var(--ink); border:2px outset var(--muted); padding:2px 10px; cursor:pointer; }
button.t:active { border-style:inset; }
@media (max-width:800px) {
  nav { align-items:center; gap:0 10px; padding:0; }
  nav .home { padding:10px 0; }
  nav .links { display:flex; overflow-x:auto; scrollbar-width:none; white-space:nowrap; scroll-padding-inline:24px 48px;
    -webkit-mask-image:linear-gradient(90deg,var(--fade-l,#000),#000 20px,#000 calc(100% - 44px),var(--fade-r,transparent));
            mask-image:linear-gradient(90deg,var(--fade-l,#000),#000 20px,#000 calc(100% - 44px),var(--fade-r,transparent)); }
  nav .links::-webkit-scrollbar { display:none; }
  nav .links.scrolled { --fade-l:transparent; } nav .links.end { --fade-r:#000; }
  nav .here, nav .away { flex-wrap:nowrap; gap:0; }
  nav .away { margin-left:6px; padding-left:6px; border-left:1px solid var(--muted); }
  nav .links a { padding:10px 7px; }
  nav .links a:focus-visible { outline-offset:-4px; }
}

h1 { font-size:clamp(2.4rem,7vw,3.8rem); line-height:1.05; margin:40px 0 10px; font-weight:normal; }
h1 em { color:var(--accent); }
h2 { font:bold 15px ui-monospace,Consolas,monospace; text-transform:uppercase; letter-spacing:.12em; border-bottom:1px dashed var(--muted); padding-bottom:4px; margin:64px 0 18px; }
h3 { margin:0; font-size:1.1em; line-height:1.25; }
.lede { font-size:1.15em; }
.hero { display:grid; grid-template-columns:1fr 230px; gap:28px; align-items:start; }
.portrait { margin:40px 0 0; border:2px solid var(--line); box-shadow:5px 5px 0 var(--line); background:var(--card); }
.portrait img { display:block; width:100%; height:auto; }
@media (max-width:640px) { .hero { grid-template-columns:1fr; gap:16px; } .portrait { margin:4px 0 0; max-width:260px; } }

.card { background:var(--card); border:2px solid var(--line); box-shadow:4px 4px 0 var(--line); padding:14px 16px; margin:0 0 18px; }
.card .meta { font:13px ui-monospace,Consolas,monospace; color:var(--muted); }
.card p { margin:6px 0 0; font-size:.95em; }
.tags span { display:inline-block; font:12px ui-monospace,monospace; border:1px solid var(--muted); padding:0 6px; margin:6px 4px 0 0; }
.cards { display:grid; grid-template-columns:repeat(2,1fr); gap:16px; }
.cards .card { margin:0; }
@media (max-width:560px) { .cards { grid-template-columns:1fr; } }
ul.list { list-style:square; padding-left:20px; margin:0; }
ul.list li { margin:6px 0; }

/* work: one ledger card, current roles first, dates in a right-hand column */
.ledger { list-style:none; padding:2px 16px; }
.ledger li { padding:12px 0; }
.ledger li + li { border-top:1px dashed var(--muted); }
.ledger .when { font:13px ui-monospace,Consolas,monospace; color:var(--muted); white-space:nowrap; }
.ledger .meta { margin-top:2px; }
@media (min-width:561px) { .ledger .top { display:flex; justify-content:space-between; align-items:baseline; flex-wrap:wrap; gap:4px 16px; } }
@media (max-width:560px) { .ledger .when { display:block; margin-top:2px; } }

/* per-project cards: each borrows its project's own design */
.proj { margin:0 0 26px; }
.proj a { text-decoration:none; }
.proj h3 a:hover, .proj h3 a:focus-visible { text-decoration:underline; text-underline-offset:4px; }
.proj .ext { display:inline-block; margin-left:.15em; font:400 .55em/1 system-ui,sans-serif; vertical-align:.7em; }
.p-nook { background:#fbf5e6; color:#2c281e; border:2px solid #2c281e; border-radius:255px 18px 225px 18px/18px 225px 18px 255px; padding:20px 26px; box-shadow:5px 6px 0 var(--line); font-family:"Geist",system-ui,sans-serif; transform:rotate(-.4deg); }
.p-nook :focus-visible { outline-color:#2c281e; }
.p-nook h3 { font-family:"Gochi Hand",cursive; font-size:2rem; font-weight:normal; }
.p-nook h3 a { color:#2c281e; text-decoration-color:#16f5a3; text-decoration-thickness:2px; }
.p-nook .pill { font:12px "Geist Mono",ui-monospace,monospace; background:#16f5a3; color:#2c281e; padding:1px 10px; border-radius:99px; border:1.5px solid #2c281e; vertical-align:middle; }
.p-nook p { color:#2c281ebf; margin:6px 0; font-size:.95rem; }
.p-nook .meta { font:12px "Geist Mono",ui-monospace,monospace; color:#2c281eb3; }
.p-nook ul { margin:8px 0 0; padding-left:18px; font-size:.9rem; color:#2c281ebf; }
.p-nook .tags span { border-color:#2c281e73; color:#2c281eb3; border-radius:99px; }
.p-offtime { background:linear-gradient(160deg,#fefefd,#eceee9); color:#171714; border:1px solid rgba(23,23,20,.12); border-radius:22px; padding:22px 26px; box-shadow:0 10px 30px rgba(23,23,20,.10); font-family:"Satoshi","Helvetica Neue",Arial,sans-serif; }
.p-offtime :focus-visible { outline-color:#171714; }
.p-offtime h3 { font-size:1.5rem; letter-spacing:-.02em; font-weight:600; }
.p-offtime h3 a { color:#171714; text-decoration-thickness:1px; }
.p-offtime .dot { display:inline-flex; align-items:center; gap:6px; font-size:12px; color:#5f5f5c; margin-left:10px; font-weight:400; letter-spacing:0; vertical-align:middle; }
.p-offtime .dot::before { content:""; width:8px; height:8px; border-radius:50%; background:#239447; box-shadow:0 0 0 3px rgba(35,148,71,.2); }
.p-offtime p { color:rgba(23,23,20,.66); margin:6px 0; font-size:.95rem; }
.p-offtime .meta { font-size:12px; color:#6b6b68; }
/* Claven: claven.md open in Claven itself. One block per line, numbered by a counter, so wrapped lines hang under the text. */
.p-claven { background:#0F1115; color:#E8E6E1; border:1px solid #3D424C; border-radius:8px; overflow:hidden; box-shadow:0 8px 0 #000000a0; font-family:"IBM Plex Sans",system-ui,sans-serif; }
.p-claven :focus-visible { outline-color:#FF5A2B; }
.p-claven .tabs { display:flex; background:#0a0c10; border-bottom:1px solid #3D424C; font:12px "JetBrains Mono",ui-monospace,monospace; }
.p-claven .tabs span { padding:6px 14px; color:#9AA0AA; } .p-claven .tabs span.on { color:#E8E6E1; background:#0F1115; border-top:2px solid #FF5A2B; margin-top:-1px; }
.p-claven .txt { counter-reset:ln; padding:12px 16px 14px 0; font:13px/1.7 "JetBrains Mono",ui-monospace,monospace; }
.p-claven .l { display:block; margin:0; padding-left:48px; text-indent:-48px; counter-increment:ln; }
.p-claven .l::before { content:counter(ln); display:inline-block; width:34px; margin-right:14px; text-align:right; text-indent:0; color:#8C96A5; font:400 13px/1.7 "JetBrains Mono",ui-monospace,monospace; letter-spacing:0; }
.p-claven h3.l { font:600 1.4rem/1.35 "Space Grotesk",sans-serif; }
.p-claven .k { color:#FF5A2B; } .p-claven .s { color:#5FBF7A; } .p-claven .f { color:#5AD1E6; } .p-claven .c { color:#8C96A5; }
.p-claven a { color:#E8E6E1; } .p-claven a:hover { color:#FF5A2B; }
.p-claven .status { display:flex; flex-wrap:wrap; justify-content:space-between; gap:0 16px; padding:3px 14px; background:#0a0c10; border-top:1px solid #3D424C; color:#9AA0AA; font:12px/1.7 "JetBrains Mono",ui-monospace,monospace; }

/* math log teaser: the heading is the link, stretched over the whole box */
.mathbox { position:relative; color:var(--ink); background:var(--card); border:2px solid var(--line); box-shadow:4px 4px 0 var(--line); padding:18px 20px; }
.mathbox:active { transform:translate(3px,3px); box-shadow:1px 1px 0 var(--line); }
.mathbox h3 { font:500 1.6rem/1.2 "CMU Serif",Georgia,serif; }
.mathbox h3 a { color:inherit; text-decoration:none; }
.mathbox h3 a::after { content:""; position:absolute; inset:-2px; }
.mathbox:hover h3 a, .mathbox h3 a:focus-visible { color:var(--accent); }
.mathbox h3 a:focus-visible { outline:none; } .mathbox h3 a:focus-visible::after { outline:3px solid var(--accent); outline-offset:3px; }
.mathbox p { font-family:"CMU Serif",Georgia,serif; font-size:1.1rem; margin:6px 0 14px; }
.strip { display:flex; gap:12px; align-items:flex-start; }
.strip img { flex:var(--r) 1 2px; min-width:0; width:auto; height:auto; display:block; background:#fff; border:1px solid var(--muted); }
@media (max-width:560px) { .strip img:nth-child(4) { display:none; } }
.more { display:inline-block; margin-top:14px; color:var(--accent); }

/* gallery: site.js places each photo under the shortest column (in photo order, so Tab follows the numbers
   and the first dozen stay put when the rest appear). Rows are 2px; each photo spans its height plus the gap. */
.masonry { display:grid; grid-template-columns:repeat(var(--cols,3),minmax(0,1fr)); grid-auto-rows:2px; column-gap:12px; }
.masonry button { display:block; align-self:start; width:100%; padding:0; margin:0; border:2px solid var(--line); background:var(--card); cursor:zoom-in; box-shadow:3px 3px 0 var(--line); }
.masonry button:hover, .masonry button:focus-visible { outline:3px solid var(--accent); outline-offset:1px; }
.masonry:not(.all) .later { display:none; }
.masonry img { display:block; width:100%; height:auto; }
.masonry noscript { grid-column:1 / -1; grid-row:span 16; }
button.all-photos { margin-top:4px; padding:6px 14px; font:14px ui-monospace,Consolas,monospace; }
@media (max-width:640px) { .masonry { column-gap:10px; } .masonry button { box-shadow:2px 2px 0 var(--line); } }
.lb { position:fixed; inset:0; background:#0b0a08; display:none; z-index:60; flex-direction:column; color:#eee; }
.lb.on { display:flex; }
.lb .bar { display:flex; gap:8px; align-items:center; justify-content:center; padding:8px 14px; font:14px ui-monospace,Consolas,monospace; }
.lb .bar button { min-width:44px; min-height:44px; background:none; color:#eee; border:1px solid #666; padding:3px 14px; cursor:pointer; font:inherit; }
.lb .bar button:hover { border-color:var(--accent); color:var(--accent); }
.lb #cap { min-width:7ch; text-align:center; }
.lb .view { flex:1; min-height:0; display:flex; align-items:center; justify-content:center; padding:0 16px 16px; touch-action:pan-y pinch-zoom; }
.lb .view img { max-width:100%; max-height:100%; width:auto; height:auto; object-fit:contain; min-height:0; user-select:none; -webkit-user-drag:none; }

footer { margin-top:70px; border-top:2px solid var(--line); padding-top:16px; color:var(--muted); font:13px/1.6 ui-monospace,Consolas,monospace; display:flex; flex-wrap:wrap; gap:8px 24px; }

/* dark theme: things that keep their own colours */
:root[data-theme="dark"] .p-offtime { box-shadow:0 10px 30px rgba(0,0,0,.45); }
:root[data-theme="dark"] .strip img { filter:brightness(.88); }
:root[data-theme="dark"] .mathbox:hover .strip img { filter:none; }
@media (prefers-color-scheme:dark) {
  :root:not([data-theme="light"]) .p-offtime { box-shadow:0 10px 30px rgba(0,0,0,.45); }
  :root:not([data-theme="light"]) .strip img { filter:brightness(.88); }
  :root:not([data-theme="light"]) .mathbox:hover .strip img { filter:none; }
}

@media (prefers-reduced-motion:no-preference) { .mathbox { transition:transform 80ms, box-shadow 80ms; } }
@media (prefers-reduced-motion:reduce) { html { scroll-behavior:auto; } .p-nook { transform:none; } }
