:root {
  --ink: #20231f; --bone: #efe8da; --page: #f8f3e6; --muted: #6c7267; --rule: #d3cfbf;
  --hl: #ecd492; --bar: 52px;
  --sage: #c9d4c6; --moss: #3e5a4b; --oxblood: #8a2f2b; --ochre: #c4923a;
  --main: "Schibsted Grotesk", system-ui, sans-serif;
  --sans: var(--main);
  --hand: "Shantell Sans", "Comic Sans MS", cursive;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html.reading { overflow: hidden; }
body { margin: 0; background: var(--bone) radial-gradient(rgba(32, 35, 31, .07) .6px, transparent .9px) 0 0 / 4px 4px; color: var(--ink); font: 17px/1.6 var(--main); overflow-x: hidden; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--oxblood); }

/* ---------- hover: a line that draws in from the left ---------- */
.bar-links a, .facts a, .out a, .git, .gh-foot a, .foot a, .pop-card a {
  text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  padding-bottom: 1px; transition: background-size .28s cubic-bezier(.4,0,.2,1), color .2s;
}
.bar-links a:hover, .facts a:hover, .out a:hover, .git:hover, .gh-foot a:hover, .foot a:hover, .pop-card a:hover,
.bar-links a[aria-current] { background-size: 100% 1px; }
.contact p a { text-decoration: none; padding-bottom: 1px; transition: background-size .28s cubic-bezier(.4,0,.2,1); background-image: linear-gradient(var(--rule), var(--rule)), linear-gradient(currentColor, currentColor); background-size: 100% 1px, 0 1px; background-repeat: no-repeat; background-position: 0 100%; }
.contact p a:hover { background-size: 100% 1px, 100% 1px; }
/* rows and essay titles get a highlighter swipe instead */
.row .nm, .entries b { background: linear-gradient(var(--hl), var(--hl)) 0 88% / 0 42% no-repeat; transition: background-size .32s cubic-bezier(.4,0,.2,1); }
.row:hover .nm, .row:focus-visible .nm, .entries a:hover b, .entries a:focus-visible b { background-size: 100% 42%; }

/* ---------- quick-links bar ---------- */
.bar { position: fixed; z-index: 10; top: 0; left: 0; right: 0; height: var(--bar); display: flex; align-items: center; gap: 18px; padding: 0 clamp(18px, 2.2vw, 32px); color: #f3ecdf; font-size: 15px; transition: background-color .25s, color .25s, box-shadow .25s; }
.bar.solid, .bar.open { background: rgba(239, 232, 218, .92); color: var(--ink); box-shadow: 0 1px 0 var(--rule); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.bar-name { font-weight: 600; text-decoration: none; opacity: 0; pointer-events: none; transition: opacity .25s; }
.bar.past .bar-name, .bar.open .bar-name { opacity: 1; pointer-events: auto; }
.bar-links { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.bar-menu { display: none; margin-left: auto; font-size: 15px; }
.bar a:hover { color: inherit; }
main section, .foot { scroll-margin-top: calc(var(--bar) + 8px); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3, p, ul, ol, dl, dd, blockquote { margin: 0; padding: 0; }
ul, ol { list-style: none; }

/* ---------- front ---------- */
.stage { --nm: min(15.5vw, 34svh); --cream: #f3ecdf; position: relative; height: 100vh; height: 100svh; min-height: 560px; overflow: hidden; background: #0d1220; color: var(--cream); }
.frame { position: absolute; inset: 0; overflow: hidden; }
#photo { display: block; image-rendering: pixelated; touch-action: pan-y; }
.stage::after { content: ""; position: absolute; z-index: 1; inset: 0; pointer-events: none; background: linear-gradient(transparent 62%, rgba(8, 11, 20, .55)); }
.head { position: absolute; z-index: 2; left: clamp(18px, 2.2vw, 32px); top: calc(var(--bar) + clamp(0px, 1vh, 12px)); pointer-events: none; }
.stage h1 { margin: 0; font: 500 var(--nm)/.86 var(--main); letter-spacing: -.055em; white-space: nowrap; pointer-events: none; }
.mbr { display: none; }
.facts { position: absolute; z-index: 2; left: clamp(20px, 2.4vw, 34px); right: clamp(20px, 2.4vw, 34px); bottom: clamp(18px, 3.2vh, 30px); display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; font-size: 16px; line-height: 1.35; }
.seeking { margin: calc(var(--nm) * .1) 0 0 calc(var(--nm) * .045); font-size: clamp(16px, 1.55vw, 22px); line-height: 1.3; text-shadow: 0 1px 8px rgba(8, 11, 20, .55); }
.who { display: flex; align-items: baseline; gap: .9em; font-size: clamp(20px, 2.3vw, 32px); font-weight: 500; line-height: 1.1; letter-spacing: -.01em; }
.down { font-size: 15px; animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge { 50% { translate: 0 3px; } }
.crest { width: auto; height: 1.05em; vertical-align: -.17em; margin-right: .35em; }
.uw { white-space: nowrap; }
.stage a:hover { color: #fff; }
.stage :focus-visible { outline-color: var(--cream); }

/* ---------- popups ---------- */
.pop-card { background: var(--page); padding: 14px 18px 15px; border-radius: 2px; box-shadow: 0 10px 34px rgba(20, 28, 24, .28); position: relative; font-size: 16px; line-height: 1.35; animation: pop-in .22s cubic-bezier(.2,1.2,.4,1); }
@keyframes pop-in { from { scale: .92; opacity: 0; } }
.pop-card small { font: 13px var(--main); color: var(--muted); display: block; padding-right: 22px; }
.pop-title { display: block; font: 600 23px/1.12 var(--main); letter-spacing: -.025em; margin: 2px 22px 6px 0; text-transform: lowercase; }
.pop-card p { margin-top: 6px; }
.pop-card ul { margin-top: 2px; }
.pop-card li { padding: 2px 0; color: #3f453e; font-size: 15px; }
.pop-card li b { font-weight: 500; color: var(--ink); }
.pop-card a { font-size: 14px; }
.pop-x { position: absolute; top: 8px; right: 10px; width: 26px; height: 26px; font-size: 13px; color: var(--muted); }
.pop-x:hover { color: var(--ink); }
dialog.pop { padding: 0; border: 0; background: none; width: min(420px, calc(100% - 32px)); margin: auto; overflow: visible; color: var(--ink); }
dialog.pop::backdrop { background: rgba(32, 35, 31, .38); }
dialog.pop .pop-card { padding: 20px 24px 22px; font-size: 17px; line-height: 1.5; }

/* ---------- reading column ---------- */
main { max-width: 640px; margin: 0 auto; padding: 0 22px 40px; }
main section { padding: 54px 0 0; }
main section > p { margin-bottom: 14px; }
section > h2 { display: flex; align-items: center; gap: 9px; font: 500 16px/1.1 var(--main); color: var(--muted); margin-bottom: 14px; }
section > h2::before { content: ""; width: 7px; height: 7px; background: var(--oxblood); }

/* ---------- experience ---------- */
.toc h3 { font: 400 17px var(--main); color: var(--muted); margin: 18px 0 2px; }
.row { display: flex; align-items: baseline; gap: 8px; width: 100%; padding: 4px 0; text-align: left; }
.row .nm { font-weight: 500; }
.row:hover .nm { color: var(--oxblood); }
.row .wh { color: var(--muted); font-size: 16px; white-space: nowrap; }
.row .dots { flex: 1; min-width: 14px; border-bottom: 1px dotted #9a9c8f; translate: 0 -5px; }
.row .pg { font: 13px var(--sans); white-space: nowrap; }
.linked { display: flex; align-items: baseline; gap: 12px; }
.linked .row { flex: 1; min-width: 0; width: auto; }
.git { font: 13px var(--sans); white-space: nowrap; }

/* ---------- github ---------- */
.gh-head { margin-bottom: 10px !important; }
.gh-graph { --weeks: 53; }
.gh-months, .gh-cells { display: grid; grid-template-columns: repeat(var(--weeks), 1fr); gap: 3px; }
.gh-months { font: 12px var(--sans); color: var(--muted); height: 18px; }
.gh-months span { white-space: nowrap; }
.gh-cells { grid-template-rows: repeat(7, auto); grid-auto-flow: column; }
.gh-cells i { aspect-ratio: 1; border-radius: 2px; background: rgba(32, 35, 31, .08); }
.gh-cells i[data-l="1"] { background: #c9d4c6; }
.gh-cells i[data-l="2"] { background: #8fae98; }
.gh-cells i[data-l="3"] { background: #5d826b; }
.gh-cells i[data-l="4"] { background: #3e5a4b; }
.gh-cells i[data-t]:hover { outline: 1.5px solid var(--ink); outline-offset: 1px; }
.gh-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 18px; margin-top: 10px; font: 14px var(--sans); color: var(--muted); }
.gh-foot a { color: var(--ink); }

/* ---------- shelf ---------- */
.shelf { display: flex; flex-wrap: wrap; gap: 0 2px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 276' preserveAspectRatio='none'%3E%3Cpath d='M2 251C150 248 300 253 598 250L597 262C400 264 200 260 3 263Z' fill='%23b08a5a' stroke='%2320231f' stroke-width='2'/%3E%3Cpath d='M30 256c60-2 110 2 170 0M260 258c70-2 120 1 200-1M490 255c30 0 50 1 80 0' fill='none' stroke='%2320231f' stroke-width='1'/%3E%3C/svg%3E") 0 0 / 100% 276px repeat-y; padding: 0 8px; }
.slot { width: 62px; height: 276px; display: flex; align-items: flex-end; padding-bottom: 25px; }
.spine { display: block; transition: translate .22s cubic-bezier(.3,1.3,.5,1); }
.spine svg { display: block; overflow: visible; }
.spine-title { font: 500 15px var(--hand); }
.spine-by { font: 400 9.5px var(--hand); }
.spine:hover, .spine:focus-visible { translate: 0 -8px; }
.slot > svg { display: block; }
.shelf-more { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: -4px; font: 500 15px var(--hand); text-decoration: none; }
.shelf-more svg { transition: translate .2s; }
.shelf-more:hover svg { translate: 4px 0; }
.shelf-more.back { justify-content: flex-start; margin: 0 0 18px; }
.shelf-more.back:hover svg { translate: -4px 0; }
main.shelf-page { max-width: 1020px; padding-top: calc(var(--bar) + 10px); padding-bottom: 60px; }
.shelf-head { font: 600 32px/1.1 var(--main); letter-spacing: -.03em; margin-bottom: 8px; }

/* ---------- notebook ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 14px; font: 13px var(--sans); margin: 4px 0 8px; }
.chips button { color: var(--muted); }
.chips button[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.entries li { border-top: 1px solid var(--rule); }
.entries .empty { padding: 12px 0; color: var(--muted); }
.entries a { display: grid; grid-template-columns: 76px 1fr; gap: 0 12px; padding: 11px 0; text-decoration: none; }
.entries time { font: 13px var(--sans); color: var(--muted); padding-top: 4px; }
.entries b { font-weight: 500; font-size: 20px; line-height: 1.25; }
.entries a:hover b { color: var(--oxblood); }
.entries span { grid-column: 2; color: #3f453e; font-size: 17px; line-height: 1.35; }

/* ---------- contact ---------- */
.contact { padding-top: 76px !important; }
.out { display: flex; gap: 18px; font: 14px var(--sans); }
.copy { font-size: 13px; color: var(--muted); border: 1px solid var(--rule); border-radius: 3px; padding: 0 6px; vertical-align: 1px; transition: color .2s, border-color .2s; }
.copy:hover { color: var(--ink); border-color: var(--ink); }
.foot { display: flex; justify-content: space-between; margin-top: 70px; padding-top: 14px; border-top: 1px solid var(--rule); font: 14px var(--sans); color: var(--muted); }
.foot a { color: var(--ink); }

/* ---------- reader: a book ---------- */
.reader { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; perspective: 1800px; }
.scrim { position: absolute; inset: 0; background: rgba(62, 90, 75, .86); }
.book { position: relative; width: min(1000px, 100%); height: min(720px, 100%); background: var(--page); box-shadow: 0 24px 60px rgba(20, 28, 24, .35); padding: 44px 54px 54px; display: flex; flex-direction: column; animation: rise .35s cubic-bezier(.2,.9,.3,1); transform-style: preserve-3d; }
@keyframes rise { from { translate: 0 24px; opacity: 0; } }
.book::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 56px; margin-left: -28px; background: linear-gradient(90deg, transparent, rgba(32,35,31,.12) 49%, rgba(32,35,31,.04) 51%, transparent); pointer-events: none; }
.viewport { flex: 1; min-height: 0; overflow: hidden; position: relative; z-index: 1; }
.flow { height: 100%; columns: 2; column-gap: 92px; column-fill: auto; font: 16.5px/1.6 var(--main); }
.flow header { break-inside: avoid; margin-bottom: 18px; }
.flow header small, .threads small { font: 12.5px var(--sans); color: var(--muted); display: block; }
.flow h2 { font: 600 clamp(28px, 3.6vw, 38px)/1.08 var(--main); margin-top: 6px; letter-spacing: -.035em; }
.flow .by { margin-top: 4px; }
.flow p { margin: 0 0 13px; }
.flow .body > p:first-child { font-size: 19px; line-height: 1.4; font-weight: 500; }
.flow h3 { font: 500 22px/1.2 var(--main); margin: 18px 0 8px; break-after: avoid; }
.flow blockquote { margin: 16px 0; padding-left: 14px; border-left: 2px solid var(--oxblood); break-inside: avoid; }
.flow ul { margin: 0 0 13px 18px; list-style: "– "; }
.flow code { font: .82em ui-monospace, monospace; background: rgba(32,35,31,.07); padding: 0 4px; }
.threads { margin-top: 18px; break-inside: avoid; }
.threads a { display: block; font: 19px var(--main); margin-top: 4px; }
.close { position: absolute; z-index: 3; top: 8px; right: 12px; width: 34px; height: 34px; font-size: 16px; }
.foot-bar { position: absolute; z-index: 3; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; align-items: center; gap: 16px; font: 13px var(--sans); }
.foot-bar button { width: 34px; height: 28px; }
.foot-bar button:disabled { opacity: .25; cursor: default; }
.leaf { position: absolute; z-index: 2; top: 0; bottom: 0; left: 50%; right: 0; background: #fbf7ec; transform-origin: left center; visibility: hidden; border-left: 1px solid rgba(32,35,31,.15); }
.leaf.go { visibility: visible; }
.leaf.go.fwd { animation: flipF .43s ease-in-out both; }
.leaf.go.back { animation: flipB .43s ease-in-out both; }
.leaf.cover { visibility: visible; background: var(--cover); animation: coverOpen .7s cubic-bezier(.4,.1,.3,1) both; }
@keyframes flipF { from { transform: rotateY(0); } to { transform: rotateY(-180deg); } }
@keyframes flipB { from { transform: rotateY(-180deg); } to { transform: rotateY(0); } }
@keyframes coverOpen { from { transform: rotateY(0); } to { transform: rotateY(-180deg); opacity: .2; } }

/* ---------- small screens + touch ---------- */
@media (max-width: 700px) {
  .stage { --nm: 23vw; }
  .stage::after { background: linear-gradient(transparent 46%, rgba(8, 11, 20, .78) 78%); }
  .mbr { display: inline; }
  .head { left: 16px; top: calc(var(--bar) + 4px); right: 16px; }
  .seeking { font-size: min(17px, 3.85vw); white-space: nowrap; }
  .bar { padding: 0 16px; }
  .bar-menu { display: block; }
  .bar-links { display: none; position: absolute; top: var(--bar); left: 0; right: 0; flex-direction: column; align-items: flex-start; gap: 0; padding: 4px 16px 14px; background: var(--bone); box-shadow: 0 1px 0 var(--rule); }
  .bar.open .bar-links { display: flex; }
  .bar-links a { padding: 9px 0; font-size: 17px; }
    .down { display: none; }
  .facts { flex-direction: column; align-items: flex-start; gap: 12px; }
  .who { font-size: min(24px, 6.2vw); }
  body { font-size: 17.5px; }
  main section { padding-top: 46px; }
  .row { flex-wrap: wrap; gap: 0 10px; }
  .row .dots { display: none; }
  .row .pg { margin-left: auto; }
  .row .wh { order: 3; width: 100%; }
  .shelf { padding: 0 4px; }
  .pop-card li { font-size: 14px; }
  .reader { padding: 0; }
  .book { height: 100%; height: 100dvh; width: 100%; box-shadow: none; padding: 46px 22px 56px; }
  .book::after { display: none; }
  .flow { columns: 1; column-gap: 44px; }
  .leaf { left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
