/* Shared styles for the whole personal site. Light = papyrus, dark = red-figure (follows the visitor's system
   setting). Classical serif for the frame and for articles; IBM Plex Mono for terminal-style content. */

:root {
  --bg: #F4ECDC; --ink: #2B241B; --title: #2B241B; --muted: #7A6A55; --faint: #9C8C75;
  --rule: #D9CBB0; --accent: #A8641E; --track: #E3D6BD;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  color-scheme: light;
}
/* Dark: when the system asks for it, unless the visitor chose light; or whenever the visitor chose dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B1714; --ink: #E8DCC8; --title: #E69460; --muted: #8C7B68; --faint: #7A6B5C;
    --rule: #3A302A; --accent: #D0743C; --track: #3A302A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1B1714; --ink: #E8DCC8; --title: #E69460; --muted: #8C7B68; --faint: #7A6B5C;
  --rule: #3A302A; --accent: #D0743C; --track: #3A302A;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--serif); font-size: 19px; line-height: 1.55; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.page { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
.mono { font-family: var(--mono); font-size: 14px; line-height: 1.7; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* The Greek key border */
.meander { display: block; width: 100%; height: 12px; color: var(--accent); }

/* Shell-prompt top bar with the site nav */
.top { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; color: var(--muted); }
.top a { color: inherit; text-decoration: none; }
.prompt a:hover { text-decoration: underline; }
.top a:hover, .top a[aria-current="page"] { color: var(--accent); }
.top nav { display: flex; flex-wrap: wrap; align-items: baseline; }
.top nav > * + *::before { content: "·"; margin: 0 0.6ch; color: var(--faint); }
.theme-toggle { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.theme-toggle:hover { color: var(--accent); }
.theme-toggle svg { width: 1.1em; height: 1.1em; vertical-align: -0.2em; }

h1 { font-family: var(--serif); font-weight: 500; font-size: 40px; line-height: 1.15; margin: 12px 0 4px; color: var(--title); }
h2 { font-family: var(--serif); font-weight: 500; font-size: 28px; margin: 40px 0 8px; color: var(--title); }
.sub { font-style: italic; font-size: 20px; color: var(--muted); margin: 0 0 20px; }

/* Back link above the page title */
.back { margin: 8px 0 0; font-size: 13px; }
.back a { color: var(--muted); text-decoration: none; }
.back a:hover { color: var(--accent); }

/* Project cards on the home and projects pages */
.cards { list-style: none; padding: 0; margin: 8px 0 0; }
.cards li + li { margin-top: 12px; }
.cards a { display: block; padding: 16px 18px; border: 0.5px solid var(--rule); border-radius: 6px; color: var(--ink); text-decoration: none; }
.cards a:hover { border-color: var(--accent); }
.card-title { display: block; font-size: 24px; color: var(--title); }
.card-text { display: block; margin-top: 4px; }
.card-meta { display: block; margin-top: 8px; color: var(--faint); }

footer { margin-top: 56px; padding-top: 16px; border-top: 0.5px solid var(--rule); color: var(--faint); display: flex; flex-wrap: wrap; gap: 4px 16px; }
footer a { color: var(--muted); }

@media (max-width: 520px) {
  h1 { font-size: 32px; }
}

/* The home page: a book's title page, whose table of contents is the navigation. */
.title-page { text-align: center; max-width: 480px; margin: 48px auto 0; }
.name { font-size: clamp(44px, 12vw, 84px); font-weight: 500; line-height: 1; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 14px; }
.title-page .sub { margin-bottom: 40px; }
.contents { list-style: none; padding: 0; margin: 0; text-align: left; }
.contents a { display: flex; align-items: baseline; padding: 6px 0; color: var(--ink); text-decoration: none;
              font-size: 15px; letter-spacing: 0.12em; text-transform: uppercase; transition: transform 0.15s ease-out; }
.contents a:hover, .contents a:focus-visible { color: var(--accent); transform: translateX(-4px); }
.contents .leader { flex: 1; margin: 0 8px; border-bottom: 2px dotted var(--faint); transform: translateY(-4px); }
.contents .num { letter-spacing: 0.04em; }
.version { margin: 48px 0 4px; font-size: 15px; }
.version a { color: var(--ink); text-decoration: none; }
.version a:hover { color: var(--accent); }
.toggle-row { margin: 0; }
.toggle-row .theme-toggle { color: var(--ink); font-size: 20px; }
.toggle-row .theme-toggle:hover { color: var(--accent); }
.links { margin-top: 24px; color: var(--faint); }
.links a { color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
  .contents a { transition: none; }
}

/* Quoted prompts and the prompt-variant list on the method page */
pre.quote { white-space: pre-wrap; margin: 12px 0 16px; padding: 12px 16px; border-left: 2px solid var(--rule); color: var(--muted); font-size: 13px; }
.variants dt { color: var(--accent); }
.variants dd { margin: 0 0 12px 0; }

/* The thoughts index: date, title, one line, and a link out to the full post */
.posts { list-style: none; padding: 0; margin: 8px 0 0; }
.posts li { display: flex; flex-direction: column; gap: 2px; padding: 16px 0; border-bottom: 0.5px solid var(--rule); }
.posts li:first-child { border-top: 0.5px solid var(--rule); }
.post-title { font-size: 24px; line-height: 1.25; color: var(--title); text-decoration: none; }
.post-title:hover { color: var(--accent); text-decoration: underline; }
.post-sub { font-style: italic; color: var(--muted); }
.post-link { align-self: flex-start; margin-top: 4px; font-size: 14px; color: var(--accent); }
/* The opening of the post, cut off and faded into the page colour, so the link below reads as "continue reading". */
.excerpt { position: relative; max-height: 13em; overflow: hidden; margin-top: 8px; }
.excerpt p { margin: 0 0 0.8em; }
.excerpt::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 9em;
                  background: linear-gradient(to bottom, transparent, var(--bg)); pointer-events: none; }

/* The command line in the header prompt (terminal.js) */
.prompt { cursor: text; }
.term-input { font: inherit; color: var(--ink); background: none; border: 0; padding: 0; margin: 0; caret-color: var(--accent); }
.term-input:focus, .term-input:focus-visible { outline: none; }
.term-cursor { display: inline-block; width: 0.55em; height: 1.05em; margin-left: 0.4ch; vertical-align: -0.18em; background: var(--faint); animation: term-blink 1.1s steps(1) infinite; }
@keyframes term-blink { 50% { opacity: 0; } }
.term-out { font-family: var(--mono); font-size: 13px; line-height: 1.65; color: var(--ink); margin: 0 0 16px; padding: 10px 14px;
            border: 0.5px solid var(--rule); border-radius: 4px; max-height: 45vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.term-out a { color: var(--accent); }
.term-line:empty::before { content: "\200b"; } /* keep blank lines, e.g. in man pages */
.term-dim { color: var(--faint); }
.term-err { color: var(--muted); font-style: italic; }
.term-title { color: var(--title); }
@media (prefers-reduced-motion: reduce) { .term-cursor { animation: none; } }
