:root {
  color-scheme: light;
  font-family: Georgia, "Times New Roman", serif;
  color: #222;
  background: #fff;
  font-size: 18px;
  line-height: 1.65;
}

* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 760px; margin: 54px auto 40px; padding: 0 28px; }
h1, h2, h3 { color: #111; line-height: 1.2; }
h1 { margin: 0 0 8px; font-size: 2.4rem; font-weight: normal; letter-spacing: -0.035em; }
h2 { margin: 0 0 22px; font-size: 1.45rem; font-weight: normal; }
h3 { margin: 0 0 10px; font-size: 1.05rem; }
p { margin: 0 0 17px; }
a { color: #163eaa; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:visited { color: #60368a; }
a:hover { color: #0b2470; text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid #163eaa; outline-offset: 4px; border-radius: 1px; }
nav { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 0.95rem; }
.byline { margin-bottom: 15px; color: #555; }
hr { margin: 29px 0; border: 0; border-top: 1px solid #b8b8b8; }
section { margin-top: 40px; }
article + article { margin-top: 29px; }
.date { color: #555; font-size: 0.85rem; margin-top: -3px; margin-bottom: 12px; }
.books { margin: 12px 0 0; padding-left: 24px; }
.books li { padding-left: 3px; margin-bottom: 6px; }
footer { color: #555; font-size: 0.8rem; }
footer hr { margin-top: 38px; margin-bottom: 17px; }
.skip-link { position: absolute; top: -100px; left: 16px; background: #fff; padding: 8px; }
.skip-link:focus { top: 8px; }

@media (max-width: 520px) {
  :root { font-size: 17px; }
  main { margin-top: 32px; padding: 0 22px; }
  h1 { font-size: 2rem; }
  section { margin-top: 32px; }
}

@media print {
  :root { font-size: 11pt; }
  main { max-width: none; margin: 0; padding: 0; }
  a, a:visited { color: inherit; }
  h2, h3, h4 { break-after: avoid; }
  p { orphans: 3; widows: 3; }
  .skip-link { display: none; }
}

.site-nav { margin-bottom: 25px; }
.site-nav [aria-current="page"] { color: inherit; text-decoration: none; }
.resume ul { padding-left: 23px; }
.resume li { margin-bottom: 12px; }
.resume dt { font-weight: bold; }
.resume dd { margin: 0 0 12px; }
.print-hint { margin-top: 16px; color: #555; font-size: 0.8rem; }

@media print {
  .site-nav, .print-hint { display: none; }
  .resume { font-size: 10pt; line-height: 1.35; }
  .resume h1 { font-size: 24pt; }
  .resume h2 { margin-bottom: 12px; font-size: 15pt; }
  .resume h3 { font-size: 11pt; }
  .resume section { margin-top: 20px; }
  .resume article + article { margin-top: 18px; }
  .resume p, .resume li, .resume dd { margin-bottom: 8px; }
  .resume li, .resume section:last-of-type article { break-inside: avoid; }
  .resume .date { break-after: avoid; }
  .resume hr { margin: 15px 0; }
}

.bookshelf header h1 { margin-bottom: 18px; }
.bookshelf-list { list-style: none; padding: 0; margin: 0; }
.bookshelf-list li { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) 3ch; gap: 8px 24px; padding: 10px 0; border-bottom: 1px solid #eee; break-inside: avoid; }
.book-author { color: #555; font-size: 0.9rem; }
@media (max-width: 520px) {
  .bookshelf-list li { grid-template-columns: 1fr; gap: 2px; padding: 12px 0; }
}

.bookshelf-list cite { grid-column: 1; }
.bookshelf-list .book-author { grid-column: 2; }
.bookshelf-list .book-rating { grid-column: 3; grid-row: auto; }
.book-rating { color: #555; font-size: 0.85rem; white-space: nowrap; text-align: right; }
.shelf-note { color: #555; font-size: 0.85rem; }
.shelf-sections { font-size: 0.85rem; gap: 6px 20px; }
@media (max-width: 520px) {
  .bookshelf-list li { grid-template-columns: minmax(0, 1fr) 3ch; column-gap: 14px; }
  .bookshelf-list cite { grid-column: 1; grid-row: 1; }
  .bookshelf-list .book-author { grid-column: 1; grid-row: 2; }
  .bookshelf-list .book-rating { grid-column: 2; grid-row: 1; }
}

/* Temporary public design previews. Shared content is generated from the live pages. */
:root { --paper:#faf7ed; --ink:#20201e; --link:#1643a3; --muted:#56544c; --rule:#d4cec0; --visited:#60368a; --card:#fffdf6; --accent:#bd3527; background:var(--paper); color:var(--ink); }
/* Night: set by /theme.js from the visitor's local sunset (or a saved choice). Warm near-black, same structure. */
:root[data-theme="dark"] { color-scheme:dark; --paper:#191817; --ink:#e8e3d7; --link:#9fb7ff; --muted:#a39e93; --rule:#3b3935; --visited:#c9aee6; --card:#232220; --accent:#e0685a; }
:root[data-theme="dark"] a:focus-visible, :root[data-theme="dark"] .preview-mark summary:focus-visible { outline-color:var(--link); }
.skip-link { background:var(--paper); }
a:visited { color:var(--visited); }
body { background:var(--paper); }
a { color:var(--link); }
a:hover { color:var(--ink); }
h1,h2,h3 { color:var(--ink); }
.preview-bar { border-bottom:1px solid #b9b9b4; background:#fff; color:#222; padding:10px 20px; font:13px/1.4 Arial,sans-serif; }
.preview-bar-inner { max-width:980px; margin:auto; display:flex; align-items:center; gap:12px 24px; flex-wrap:wrap; }
.preview-bar a { color:#222; display:inline-block; padding:10px 12px; text-decoration:none; }
.preview-bar a[aria-current] { background:#222; color:white; }
.preview-bar nav { display:flex; gap:3px; font:inherit; }
.preview-bar .live-link { margin-left:auto; text-decoration:underline; }
.site-nav { font:15px/1.5 Arial,sans-serif; margin-bottom:32px; }
.site-nav a { padding:8px 0; }
main { max-width:940px; margin:45px auto; padding:0 30px; }
h1 { font-size:clamp(40px,5.5vw,64px); margin-bottom:20px; }
h2 { font-size:29px; }
p { max-width:68ch; }
hr { border-color:var(--rule); }
section { margin-top:48px; }
.date,.byline,.book-author,.book-rating,footer,.shelf-note { color:var(--muted); }
.bookshelf-list li { border-color:var(--rule); }
.shelf-sections a { padding:8px 0; }
.preview-mark { display:none; }
@media(max-width:520px) {
 main { margin:30px auto; padding:0 22px; }
 .preview-bar { padding:6px 12px; }
 .preview-bar-inner { gap:2px 8px; }
 .preview-bar .preview-label { width:100%; font-size:11px; }
 .preview-bar nav { gap:2px; }
 .preview-bar a { padding:10px 9px; }
 .preview-bar .live-link { font-size:12px; }
 h1 { font-size:39px; overflow-wrap:normal; }
 h2 { font-size:27px; }
 section { margin-top:36px; }
}
@media print { .preview-bar,.preview-mark { display:none!important; } :root,body { background:#fff; color:#000; } }

main { max-width:960px; }
.site-nav { border-top:5px solid var(--ink); padding-top:12px; }
header { position:relative; }
body[data-page="home"] header { padding-right:140px; }
body[data-page="home"] h1 { max-width:650px; }
body[data-page="home"] .preview-mark { display:block; position:absolute; right:0; top:0; width:120px; height:160px; }
h2 { font-family:Arial,sans-serif; font-size:28px; letter-spacing:-.035em; }
.bookshelf-list li { border-bottom-style:dotted; }
.bookshelf-list cite { font-style:italic; }
@media(max-width:520px) { body[data-page="home"] header { padding-right:0; } body[data-page="home"] h1 { max-width:85%; } body[data-page="home"] .preview-mark { width:56px; height:80px; right:-4px; top:4px; } body[data-page="home"] header nav { margin-top:20px; } }

/* Native disclosure works by touch and keyboard; title provides a hover hint. */
.preview-mark summary { list-style:none; cursor:pointer; }
.preview-mark summary::-webkit-details-marker { display:none; }
.preview-mark svg { display:block; width:100%; height:100%; }
.preview-mark summary:focus-visible { outline:3px solid var(--link); outline-offset:4px; }
.preview-mark .art-note { position:absolute; top:100%; right:0; z-index:2; width:250px; padding:16px; border:1px solid var(--ink); background:var(--paper); box-shadow:3px 3px 0 var(--ink); font:16px/1.5 Arial,Helvetica,sans-serif; }

/* Theme switch in the footer: text buttons, shown once /theme.js is running. */
.theme-switch { margin-top:6px; }
.theme-switch button { background:none; border:0; padding:0; margin:0; font:inherit; color:var(--link); text-decoration:underline; text-decoration-thickness:1px; text-underline-offset:3px; cursor:pointer; }
.theme-switch button:hover { color:var(--ink); text-decoration-thickness:2px; }
.theme-switch button[aria-pressed="true"] { color:var(--muted); text-decoration:none; cursor:default; }
.theme-switch button:focus-visible { outline:2px solid var(--link); outline-offset:3px; }
@media print { .theme-switch { display:none; } }

/* ---------- Living Miró ----------
   The homepage drawing (scripts/miro-mark.mjs) draws itself in, then idles slowly. Its sun is placed by /theme.js
   from the visitor's own sun; at night the sun sets and a crescent and constellation come out. Everything here is
   CSS: no new scripts, nothing the CSP has to allow. prefers-reduced-motion gets the finished drawing, still. */
:root { --m-red:#cf3f2b; --m-yellow:#e3b831; --m-blue:#1747a6; --ease-out:cubic-bezier(.2,.7,.2,1); --ease-spring:cubic-bezier(.34,1.56,.64,1); }
:root[data-theme="dark"] { --m-red:#e0685a; --m-yellow:#ecc54a; --m-blue:#4f7de6; }

body[data-page="home"] header { padding-right:190px; }
body[data-page="home"] .preview-mark.miro { width:157px; height:170px; top:-22px; }
.miro summary { display:block; width:100%; height:100%; }
.miro-art { overflow:visible; }
.miro-art .m-red { fill:var(--m-red); }
.miro-art .m-yellow { fill:var(--m-yellow); }
.miro-art .m-blue { fill:var(--m-blue); }
.miro-art .m-dot, .miro-art .m-dust { fill:var(--ink); }
.miro-art .m-line { fill:none; stroke:var(--ink); stroke-width:3.5; stroke-linecap:round; }
.miro-art .m-ink { fill:none; stroke:var(--ink); stroke-width:2.2; stroke-linecap:round; }
.miro-art .m-const { fill:none; stroke:var(--ink); stroke-width:1; stroke-dasharray:1; stroke-dashoffset:1; opacity:.55; }
.miro-art .m-spark { fill:none; stroke:var(--ink); stroke-width:1.6; stroke-linecap:round; }
.miro-art g, .miro-art circle { transform-box:fill-box; transform-origin:center; }

/* Sun: real position. Morning sits left and low, noon high, evening right and low. */
.miro-art .m-sun-pos { transform-box:view-box; transform-origin:0 0; transform:translate(calc(170px + var(--sun-x, .1) * 44px), calc(222px - var(--sun-y, .55) * 88px)); transition:transform 1.4s var(--ease-out), opacity .9s ease; }
.miro-art .m-moon-pos { transform-box:view-box; transform-origin:0 0; transform:translate(212px, 156px); }
.miro-art .m-moon { opacity:0; scale:.4; rotate:-40deg; transition:opacity .9s ease, scale 1.1s var(--ease-spring), rotate 1.1s var(--ease-out); }
.miro-art .m-night { opacity:0; transition:opacity 1.2s ease; }
:root[data-theme="dark"] .miro-art .m-sun-pos { opacity:0; }
:root[data-theme="dark"] .miro-art .m-moon { opacity:1; scale:1; rotate:0deg; }
:root[data-theme="dark"] .miro-art .m-night { opacity:1; }
:root[data-theme="dark"] .miro-art .m-const { stroke-dashoffset:0; transition:stroke-dashoffset 2.4s var(--ease-out) .4s; }

/* Hover or focus: the shapes lean in a little, like a mobile being touched. */
.miro .m-tri, .miro .m-ell, .miro .m-dot { transition:translate .7s var(--ease-spring); }
.miro summary:hover .m-tri, .miro summary:focus-visible .m-tri, .miro[open] .m-tri { translate:-5px 4px; }
.miro summary:hover .m-ell, .miro summary:focus-visible .m-ell, .miro[open] .m-ell { translate:4px -6px; }
.miro summary:hover .m-dot, .miro summary:focus-visible .m-dot, .miro[open] .m-dot { translate:6px 3px; }
.miro .art-note { max-width:calc(100vw - 44px); }
/* The header animates in, which gives it its own stacking context; lift it so the open caption paints above the paragraphs. */
body[data-page="home"] main > header { position:relative; z-index:5; }

@media (prefers-reduced-motion: no-preference) {
  /* Intro: line draws, shapes pop in on a spring, sun rises, star is inked last. */
  .miro-art .m-line { stroke-dasharray:1; animation:m-draw 1.1s var(--ease-out) .1s both; }
  .miro-art .m-tri { animation:m-pop .8s var(--ease-spring) .45s both; }
  .miro-art .m-ell { animation:m-pop .8s var(--ease-spring) .6s both, m-rock 11s ease-in-out 1.6s infinite; }
  .miro-art .m-dot { animation:m-pop .6s var(--ease-spring) .95s both; }
  .miro-art .m-sun { animation:m-rise 1.2s var(--ease-out) .75s both; }
  .miro-art .m-star path { stroke-dasharray:1; animation:m-draw .9s var(--ease-out) 1.05s both; }
  .miro-art .m-star { animation:m-turn 90s linear 2s infinite; }
  .miro-art .m-spark { animation:m-twinkle 4.2s ease-in-out infinite; }
  .miro-art .m-spark:nth-of-type(2) { animation-delay:-1.3s; }
  .miro-art .m-spark:nth-of-type(3) { animation-delay:-2.6s; animation-duration:5.1s; }
  .miro-art .m-spark:nth-of-type(4) { animation-delay:-.7s; animation-duration:3.6s; }

  /* The page settles in under the drawing. */
  body[data-page] main > header, body[data-page] main > hr, body[data-page] main > p { animation:m-settle .9s var(--ease-out) both; }
  body[data-page] main > header { animation-delay:.05s; }
  body[data-page] main > hr { animation-name:m-rule; transform-origin:left; animation-delay:.3s; }
  body[data-page] main > p:nth-of-type(1) { animation-delay:.35s; }
  body[data-page] main > p:nth-of-type(2) { animation-delay:.45s; }
  body[data-page] main > p:nth-of-type(3) { animation-delay:.55s; }

  /* The drawing's caption fades and drops in rather than snapping open. */
  .miro::details-content { opacity:0; transition:opacity 280ms ease, content-visibility 280ms allow-discrete; }
  .miro[open]::details-content { opacity:1; }
  .miro .art-note { translate:0 -6px; transition:translate 480ms cubic-bezier(.34,1.56,.64,1); }
  .miro[open] .art-note { translate:0 0; }

  /* Moving between pages: the title and navigation carry across (cross-document view transitions). */
  /* The navigation holds still; the rest of the page does one short crossfade. (The title is not morphed: it is
     different text on each page, and scaling one word into another read as a jolt on phones.) */
  @view-transition { navigation:auto; }
  .site-nav { view-transition-name:site-nav; }
  ::view-transition-group(site-nav) { animation:none; }
  ::view-transition-old(root) { animation:none; }
  ::view-transition-new(root) { animation:m-fade-in 200ms ease-out both; }
  /* Coming from another page here: no intro replay (theme.js sets .arrived). The drawing keeps its idle motion. */
  :root.arrived body[data-page] main > *, :root.arrived .miro-art .m-line, :root.arrived .miro-art .m-tri,
  :root.arrived .miro-art .m-dot, :root.arrived .miro-art .m-sun, :root.arrived .miro-art .m-star path { animation:none; }
  :root.arrived .miro-art .m-ell { animation:m-rock 11s ease-in-out infinite; }

  /* Choosing light or dark from the footer: the new theme spreads from the button (theme.js adds .theme-flip). */
  :root.theme-flip .site-nav { view-transition-name:none; }
  :root.theme-flip::view-transition-old(root) { animation:none; }
  :root.theme-flip::view-transition-new(root) { animation:m-flip .8s cubic-bezier(.6,0,.2,1) both; }
}

/* Section headings: a short bar in the drawing's colours grows in as each section scrolls into view. */
body:not([data-page="resume"]) main section > h2::after { content:""; display:block; width:44px; height:4px; margin-top:10px; background:var(--m-red); transform-origin:left; }
body:not([data-page="resume"]) main section:nth-of-type(3n+2) > h2::after { background:var(--m-blue); }
body:not([data-page="resume"]) main section:nth-of-type(3n) > h2::after { background:var(--m-yellow); }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    body:not([data-page="resume"]) main section > h2 { animation:m-settle linear both; animation-timeline:view(); animation-range:entry 0% entry 100%; }
    body:not([data-page="resume"]) main section > h2::after { animation:m-grow linear both; animation-timeline:view(); animation-range:entry 20% cover 25%; }
  }
}

a { transition:color .2s ease, text-decoration-color .2s ease, text-underline-offset .2s ease; }
a:hover { text-underline-offset:5px; }

@keyframes m-fade-in { from { opacity:0; } }
@keyframes m-draw { from { stroke-dashoffset:1; } to { stroke-dashoffset:0; } }
@keyframes m-pop { from { scale:0; opacity:0; } 60% { opacity:1; } to { scale:1; opacity:1; } }
@keyframes m-rise { from { translate:0 70px; opacity:0; } to { translate:0 0; opacity:1; } }
@keyframes m-rock { 0%, 100% { rotate:0deg; } 50% { rotate:-6deg; } }
@keyframes m-turn { to { rotate:360deg; } }
@keyframes m-twinkle { 0%, 100% { opacity:1; scale:1; } 50% { opacity:.25; scale:.6; } }
@keyframes m-settle { from { opacity:0; translate:0 14px; } to { opacity:1; translate:0 0; } }
@keyframes m-rule { from { scale:0 1; } to { scale:1 1; } }
@keyframes m-grow { from { scale:0 1; } to { scale:1 1; } }
@keyframes m-flip { from { clip-path:circle(0 at var(--flip-x, 50%) var(--flip-y, 100%)); } to { clip-path:circle(150vmax at var(--flip-x, 50%) var(--flip-y, 100%)); } }

@media (max-width:520px) {
  body[data-page="home"] header { padding-right:0; }
  body[data-page="home"] .preview-mark.miro { width:84px; height:91px; top:0; right:-6px; }
  body[data-page="home"] h1 { max-width:calc(100% - 88px); }
}
@media print { body:not([data-page="resume"]) main section > h2::after { display:none; } }
