/* Colors, type and the header, shared by every page. The tokens are the Playground's. */
/* Georgia, shrunk to Newsreader's width, while Newsreader loads: the text then wraps the same
   way before and after, so nothing jumps */
@font-face{font-family:'Newsreader Fallback';src:local('Georgia');size-adjust:93%}
:root{--ink:#111;--mute:#8f8f8f;--faint:#dcdcdc;--accent:#2fbf5b;--miss:#e5484d;--bg:#fff;--pill:#efefef;--tile:#f2f2f2;--gut:48px;color-scheme:light}
:root[data-theme="dark"]{--ink:#ececec;--mute:#7f7f7f;--faint:#2c2c2c;--accent:#3ccf68;--miss:#ff5c5c;--bg:#0c0c0c;--pill:#1e1e1e;--tile:#141414;color-scheme:dark}
html{transition:background .3s}
*{box-sizing:border-box;margin:0;padding:0}
html,body{background:var(--bg);color:var(--ink)}
body{font-family:'IBM Plex Mono',ui-monospace,monospace;font-size:11px;-webkit-font-smoothing:antialiased}
a{color:inherit;text-decoration:none}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
.pill{background:var(--pill);border-radius:999px;padding:7px 11px;font-size:11px}
.lost{max-width:640px;margin:0 auto;padding:180px var(--gut) 120px;font-family:Newsreader,'Newsreader Fallback',Georgia,serif;font-size:22px;line-height:1.5}
.lost p + p{margin-top:12px;color:var(--mute);font-size:19px}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}   /* for screen readers only */

/* the header and the menu, one piece (see _includes/menu.html). #nav is fixed at the top left;
   closed it holds only the header, open it covers the screen. The header is its first child, so
   the page's name sits at the same spot either way. */
#nav{position:fixed;top:0;left:0;right:0;z-index:5;pointer-events:none}
#nav > *{pointer-events:auto}
/* a solid strip, so the page scrolls under the title instead of through it */
.site-head{display:flex;align-items:flex-start;gap:.28em;padding:30px calc(var(--gut) + 64px) 18px var(--gut);   /* right: room for [M] */
  background:var(--bg);
  font-family:Newsreader,'Newsreader Fallback',Georgia,serif;font-size:26px;font-weight:500;letter-spacing:-.02em;line-height:1.18}
.tree{display:flex;flex-direction:column;min-width:0}
/* a section is always a flex row, open or closed, so the name's box never changes size */
.tree .sec{display:flex;flex-wrap:nowrap;align-items:baseline}
.menu-open .tree .sec{flex-wrap:wrap}
.tree .name{font-weight:500}
.tree .now{font-family:'IBM Plex Mono',monospace;font-weight:400;font-size:11px;letter-spacing:.04em;color:var(--accent);margin-left:12px;position:relative;top:-3px}
.tree .sec:not(.cur), .tree .kids, .tree .now, #nav .panel{display:none}
.tree .kids{margin:6px 0 4px 3px;border-left:1px solid var(--faint);padding-left:16px;flex-direction:column;   /* shown as flex only while the menu is open */
  font-family:'IBM Plex Mono',monospace;font-weight:400;font-size:12px;line-height:1.85;letter-spacing:.02em;color:var(--ink)}
.tree .kids i{font-style:normal;color:var(--mute)}
.tree .kids a:hover, .tree .kids a[aria-current]{color:var(--accent)}
/* on a project or article: "Seyfal's Research / MAGUS"; the name stays a link back to the section */
.tree .crumb{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tree .crumb::before{content:"/";margin:0 .32em 0 .3em;color:var(--mute)}
.menu-open .tree .crumb{display:none}
.tree .more{position:relative;align-self:flex-start;color:var(--mute);cursor:default;outline:none}   /* hugs its label, so hovering means pointing at the words */
/* "+ 5 more" slides open in place, pushing what is below it down; the projects fade in one
   after another and the arrow turns to point at them */
.tree .more .arr{display:inline-block;transition:transform .25s ease}
.tree .more .rest{display:grid;grid-template-rows:0fr;opacity:0;visibility:hidden;color:var(--ink);
  transition:grid-template-rows .32s ease,opacity .25s ease,visibility 0s .32s}
.tree .more .rest .in{overflow:hidden;display:flex;flex-direction:column}
.tree .more .rest a{opacity:0;transform:translateY(-4px);transition:opacity .25s ease,transform .25s ease}
.tree .more:hover .rest, .tree .more:focus-within .rest, .tree .more.open .rest{grid-template-rows:1fr;opacity:1;visibility:visible;transition-delay:0s}
.tree .more:hover .rest a, .tree .more:focus-within .rest a, .tree .more.open .rest a{opacity:1;transform:none;transition-delay:calc(60ms + var(--i) * 40ms)}
.tree .more:hover .arr, .tree .more:focus-within .arr, .tree .more.open .arr{transform:rotate(90deg)}
@media (prefers-reduced-motion:reduce){ .tree .more .rest, .tree .more .rest a, .tree .more .arr{transition:none!important} }

.menu-open, .menu-open body{overflow:hidden}
.menu-open #nav{right:0;bottom:0;background:var(--bg);overflow-y:auto;pointer-events:auto}
.menu-open .tree .sec, .menu-open .tree .kids{display:flex}
.menu-open .tree .kids{flex-basis:100%}
.menu-open .tree .sec{margin-bottom:12px}   /* below the name, so the name itself never moves */
.menu-open .tree .now{display:inline}
.menu-open #nav .panel{display:block}
#nav .latest{position:absolute;left:63%;top:96px;width:31%;font-size:12px;line-height:1.5}
#nav .latest .hd{color:var(--mute);letter-spacing:.1em;margin-bottom:14px;font-size:11px}
#nav .latest .row{display:flex;gap:16px;margin-bottom:10px}
#nav .latest .row span:first-child{white-space:nowrap;min-width:70px;color:var(--mute)}
#nav .latest .row:hover span:last-child, #nav .latest .all:hover{color:var(--accent)}
#nav .latest .all{color:var(--mute)}
#nav .foot{display:flex;flex-wrap:wrap;gap:8px 24px;font-size:13px;color:var(--ink)}
#nav .foot a:hover{color:var(--accent)}
/* desktop: the links sit at the bottom of the screen, or below the tree when the window is too
   short for both, so they never overlap */
@media (min-width:861px){
  .menu-open #nav{display:flex;flex-direction:column}
  .menu-open #nav .panel{display:flex;flex-direction:column;flex:1 0 auto;padding:24px var(--gut) 28px}
  #nav .foot{margin-top:auto}
}

.corner{position:fixed;top:30px;right:var(--gut);z-index:6;display:flex;gap:8px}
/* desktop: [M] sits just before the name and turns into ✕ there; while the menu is open [W]
   shows right under it, so the corner is empty. Phones and tablets keep [M] and [W] at the
   top right, for thumbs. */
.site-head .head-btns{display:none;flex-direction:column;gap:8px;margin-right:.32em;position:relative;top:-2px}   /* centred on the capitals of the name */
.site-head .head-btn{width:40px;padding-left:0;padding-right:0;text-align:center;
  font-family:'IBM Plex Mono',monospace;font-weight:400;letter-spacing:.02em;line-height:normal}
.site-head .theme-btn{display:none}
@media (min-width:861px){
  .site-head .head-btns{display:flex}
  .menu-open .site-head .theme-btn{display:block}
  .corner{display:none}
}
.corner .menu-corner{display:none;gap:8px}
.menu-open .corner #menuBtn{display:none}
.menu-open .corner .menu-corner{display:flex}

@media (max-width:860px){
  :root{--gut:20px}
  .site-head{font-size:22px;padding-top:20px}
  .corner{top:18px}
  /* phones: one column, the tree, then the news, then the links */
  #nav .latest, #nav .foot{position:static;width:auto}
  #nav .panel{padding:24px var(--gut) 32px}
  .menu-open #nav .panel{display:flex;flex-direction:column;gap:32px;align-items:flex-start}
  .menu-open .site-head{padding-right:var(--gut)}
  .tree{min-width:0;flex:1}
}

/* the reading page: the facts on the left, the title centred, one column of text */
.reading{position:relative;max-width:1440px;margin:0 auto;padding:140px var(--gut) 120px}
.reading .meta{position:absolute;left:var(--gut);top:150px;width:220px;font-size:12px;line-height:1.9;color:var(--mute);display:flex;flex-direction:column;gap:1.1em}
.reading .meta .grp{display:flex;flex-direction:column}
.reading .meta .lbl{color:var(--mute)}
.reading .meta .k{color:var(--ink)}
.reading .meta a:hover{text-decoration:underline}
.reading .title{max-width:820px;margin:0 auto;text-align:center;font-family:Newsreader,'Newsreader Fallback',Georgia,serif;font-weight:400;font-size:40px;line-height:1.15;letter-spacing:-.02em}
.reading .subtitle{margin:18px auto 0;text-align:center;font-size:12px;line-height:1.7;color:var(--mute)}
.reading .subtitle span{display:block}
/* the project's drawing, with one line on what it shows */
.reading .hero{max-width:640px;margin:44px auto 0}
.reading .hero .frame{position:relative;aspect-ratio:16/9;max-height:360px;background:var(--tile)}
.reading .hero canvas{position:absolute;inset:0;width:100%;height:100%;display:block}
.reading .hero figcaption{margin-top:12px;font-size:12px;line-height:1.6;color:var(--mute)}
.reading .body{max-width:640px;margin:56px auto 0;font-family:Newsreader,'Newsreader Fallback',Georgia,serif;font-size:19px;line-height:1.62;color:var(--ink)}
.reading .body > *{margin-bottom:20px}
.reading .body ul{padding-left:1.1em}
.reading .body a{text-decoration:underline;text-decoration-color:var(--mute);text-underline-offset:3px}
.reading .body img, .reading .body video{display:block;max-width:100%;height:auto;margin:36px auto;border-radius:2px}
.reading .body img.photo{width:180px;margin:0 auto 36px;border-radius:4px}
.reading .draft{font-family:'IBM Plex Mono',monospace;font-size:12px;color:var(--mute)}
.reading .next{display:block;max-width:640px;margin:64px auto 0;font-size:12px;text-align:right;color:var(--ink)}
.reading .next:hover{text-decoration:underline}

/* below desktop width the facts move above the title */
@media (max-width:1180px){
  /* centred above the title, one line per group */
  .reading .meta{position:static;width:auto;max-width:640px;margin:0 auto 40px;align-items:center;text-align:center;gap:.35em;line-height:1.7}
  .reading .meta .grp{flex-direction:row;flex-wrap:wrap;justify-content:center;column-gap:.9em}
}
@media (max-width:860px){
  .reading{padding-top:96px}
  .reading .title{font-size:30px}
  .reading .body{font-size:18px;margin-top:40px}
}

/* tile pages: at most three across, so no tile is small. The two newest projects take two
   columns each, in a zigzag; the next tiles fill the gaps beside them (dense). */
.section{padding:140px var(--gut) 120px;max-width:1440px;margin:0 auto}
.tiles{display:grid;grid-template-columns:repeat(3,1fr);grid-auto-flow:row dense;column-gap:40px;row-gap:56px;align-items:start}
.tile{display:block}
.tile.L{grid-column:span 2}
.tile.L + .tile.L{grid-column:2 / span 2}
.tile .cover{display:block;position:relative;background:var(--tile);overflow:hidden}
.tile canvas{position:absolute;inset:0;width:100%;height:100%;display:block}
.tile .type{position:absolute;inset:0;display:flex;align-items:flex-end;padding:20px;font-family:Newsreader,'Newsreader Fallback',Georgia,serif;font-size:30px;line-height:1.05;letter-spacing:-.02em}
.tile .cap{display:block;margin-top:14px;font-size:11.5px;color:var(--mute)}
.tile .cap b{display:block;margin-top:6px;font-family:Newsreader,'Newsreader Fallback',Georgia,serif;font-weight:400;font-size:18px;line-height:1.25;letter-spacing:-.01em;color:var(--ink)}
.tile:hover .cap b{text-decoration:underline;text-decoration-color:var(--mute);text-underline-offset:3px}
.section .empty{font-family:Newsreader,'Newsreader Fallback',Georgia,serif;font-size:19px;color:var(--mute)}

/* phones: two columns; a wide tile takes the whole width */
/* tablets: two across, the biggest tiles take the whole row */
@media (max-width:1100px){
  .tiles{grid-template-columns:1fr 1fr}
  .tile.L, .tile.L + .tile.L{grid-column:span 2}
}
@media (max-width:860px){
  .section{padding-top:96px}
  .tiles{grid-template-columns:1fr 1fr;column-gap:14px;row-gap:32px}
  .tile.L, .tile.L + .tile.L, .tile.M, .tile.S{grid-column:span 1}
  .tile.wide, .tile.L + .tile.L.wide{grid-column:span 2}   /* the second form outranks the zigzag rule */
  .tile .type{font-size:20px;padding:12px}
  .tile .cap b{font-size:16px}
}

/* News: one simple list, newest first */
.news-page{max-width:760px;margin:0 auto;padding:140px var(--gut) 120px}
.news{list-style:none}
.news li{display:grid;grid-template-columns:110px 1fr;gap:20px;padding:22px 0;border-top:1px solid var(--faint);scroll-margin-top:100px}
.news .when{font-size:12px;color:var(--mute);padding-top:4px}
.news .what{font-family:Newsreader,'Newsreader Fallback',Georgia,serif;font-size:19px;line-height:1.5}
.news .what a{text-decoration:underline;text-decoration-color:var(--mute);text-underline-offset:3px}
@media (max-width:860px){ .news-page{padding-top:96px} .news li{grid-template-columns:1fr;gap:6px} }

/* search, after Paradigm's: on a desktop "Find [F]" at the bottom opens a card in the middle;
   on tablets and phones a round button opens a sheet across the top */
.search-btn{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:9;
  background:var(--pill);border-radius:999px;padding:7px 11px;font-size:11px}
.search-btn svg{display:none}
.section-playground .search-btn{left:auto;right:var(--gut);transform:none}   /* the caption owns the centre */
#search{position:fixed;inset:0;z-index:8;background:rgba(51,51,51,.6);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}
:root:not([data-theme="dark"]) #search{background:rgba(255,255,255,.55)}
#search[hidden]{display:none}
#search .card{position:absolute;left:50%;top:36vh;transform:translateX(-50%);width:626px;max-width:calc(100% - 2 * var(--gut));
  background:var(--tile);border-radius:12px;padding-bottom:12px;font:12px/1.5 'IBM Plex Mono',monospace;color:var(--ink)}
#search .row{display:flex;align-items:center;padding:18px 16px 14px}
#search .prompt{flex:1;display:flex;align-items:baseline;min-width:0}
#search input{flex:1;min-width:0;border:0;outline:0;background:none;color:inherit;font:inherit;caret-color:var(--ink);-webkit-appearance:none;appearance:none}
#search input::-webkit-search-cancel-button{display:none}
#search .x{display:none;color:var(--mute);padding:4px;line-height:0}
#search .results{max-height:52vh;overflow-y:auto}
#search .results a{display:flex;align-items:center;justify-content:space-between;gap:20px;height:32px;padding:0 16px}
#search .results .t{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#search .results .p{flex-shrink:0;max-width:55%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--mute)}
#search .results a.on, #search .results a:hover{background:var(--pill)}
#search .none{padding:8px 16px;color:var(--mute)}
#search .hints{display:flex;justify-content:space-between;padding:14px 16px 2px;color:var(--mute)}

@media (max-width:1024px){
  .search-btn, .section-playground .search-btn{left:auto;right:24px;transform:none;width:34px;height:34px;padding:0;border-radius:14px;
    display:flex;align-items:center;justify-content:center;
    background:color-mix(in srgb,var(--pill) 75%,transparent);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}
  .search-btn .label{display:none}
  .search-btn svg{display:block}
  #search .card{left:0;right:0;top:0;transform:none;width:auto;max-width:none;border-radius:0}
  #search .row{padding:16px}
  #search .prompt{font-size:16px}
  #search .x{display:block}
  #search .hints{display:none}
}

/* narrow phones: "shown now" drops under the name, so only the name shares a line with the
   [W] ✕ pills */
@media (max-width:520px){
  .tree .now{flex-basis:100%;margin-left:0;top:0}
}
