/* shared by index.html and projects.html */
/* JetBrains Mono (OFL), self-hosted in fonts/ so it loads with the page */
@font-face {
  font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap;
  src: url(fonts/jetbrains-mono-latin-400-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono'; font-weight: 500; font-display: swap;
  src: url(fonts/jetbrains-mono-latin-500-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono'; font-weight: 700; font-display: swap;
  src: url(fonts/jetbrains-mono-latin-700-normal.woff2) format('woff2');
}
/* dark by default; light once it's picked with the theme button (site.js) */
:root {
  --bg: #0d0d0d;
  --ink: #eee;
  --dim: #888;
  --line: #222;
  /* a few bright colours for highlights. they're used as text, so dark mode's are light enough to stay bright on black,
     and light mode gets deeper versions that read on white */
  --blue: #6b9bff; --pink: #ff5ca8; --green: #2ee59d; --gold: #ffc233;
  --accent: var(--pink);
}
:root[data-theme="light"] {
  --bg: #fff; --ink: #111; --dim: #777; --line: #e5e5e5;
  --blue: #2463ff; --pink: #e6006f; --green: #00995a; --gold: #c27400;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* the theme switch crossfades the old page into the new one (see site.js) */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .4s; animation-timing-function: ease-in-out; }
html { -webkit-text-size-adjust: 100%; scrollbar-width: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }
/* dotted mountains sit along the bottom of the screen, behind everything (site.js) */
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 'JetBrains Mono', ui-monospace, Menlo, monospace;
  padding: 16px 16px 96px;
}
main { width: min(560px, 100%); margin: 0 auto; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }

/* translucent and blurred, so scrolled text doesn't show through sharply */
header {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 20px;
  position: sticky; top: 0; z-index: 50; padding: 16px 0; margin-top: -16px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
nav { display: flex; align-items: center; gap: 16px; }
/* the padding is cancelled by the negative margin, so the highlight adds no width and the links don't wrap */
nav a { color: var(--dim); text-decoration: none; padding: 0 2px; margin: 0 -2px; }
nav a:hover, nav a:focus-visible { background: var(--accent); color: #fff; }

h1 { font-size: 15px; font-weight: 500; }

/* highlighted words: a block tinted with the highlight's colour (the accent unless a colour class picks another),
   wrapped in brackets of that colour like the [play] [skip] controls, with an optional logo at the end */
.hl { --c: var(--accent); background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--ink); padding: 0 .2em; }
.hl::before { content: '['; color: var(--c); }
.hl::after { content: ']'; color: var(--c); }
.hl.plain { --c: var(--ink); } .hl.blue { --c: var(--blue); } .hl.pink { --c: var(--pink); } .hl.green { --c: var(--green); } .hl.gold { --c: var(--gold); }
.hl .ico { display: inline-block; width: 1em; height: 1em; vertical-align: -.14em; margin-left: .3em; object-fit: contain; }
/* microsoft: the tint runs through the logo's red, green, blue and yellow, and the brackets take the first and last */
.hl.ms {
  background: linear-gradient(90deg, color-mix(in srgb, #f25022 18%, transparent), color-mix(in srgb, #7fba00 18%, transparent),
    color-mix(in srgb, #00a4ef 18%, transparent), color-mix(in srgb, #ffb900 18%, transparent));
}
.hl.ms::before { color: #f25022; }
.hl.ms::after { color: #ffb900; }
.dim { color: var(--dim); }

button {
  display: grid; place-items: center; width: 24px; height: 24px;
  color: var(--dim); background: none; border: 0; cursor: pointer;
}
button:hover { color: var(--ink); }
/* theme toggle: the word for the mode it switches to, in brackets */
#theme, #music-toggle {
  height: 28px; padding: 0 2px; font: 14px/1 'PingFang SC', 'Noto Sans SC', sans-serif;
  color: var(--ink); border-radius: 0;
}
#theme:hover, #theme:focus-visible, #music-toggle:hover, #music-toggle:focus-visible, #music-toggle[aria-expanded="true"] { background: var(--accent); color: #fff; }

section { margin-top: 18px; }
h2 { font-size: 15px; font-weight: 400; color: var(--dim); margin-bottom: 6px; }

/* dash bullets: the dash hangs in the gutter so wrapped lines line up under the text */
.list { list-style: none; }
.list li { padding: 5px 0 5px 1.5em; text-indent: -1.5em; }
.list li::before { content: '- '; color: var(--dim); }

/* 陳文飛 — the name is the place. Each character fills in turn as you scroll.
   ported from portfolio-html; font is a 3-glyph subset of Noto Serif SC (OFL) */
@font-face {
  font-family: 'Noto Serif SC'; font-weight: 700; font-display: swap;
  src: url(data:font/woff2;base64,d09GMgABAAAAAAXsABAAAAAACbQAAAWQAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGx4cQAZgP1NUQVQqAEwRCAqIaIcPCwwAATYCJAMQBCAFhBgHIBckGAwbvAfIxOBpWz9vF1B3CRML72NhVSLeNUbWZRlcRhMX+aOK/7kcX1NPoIWJhnpj/baNNejuqDZ5wGMOSyywXuTWMHZ5kTwQAAwkbABJTM4shCE4IHa93iEr2GgMPPiqe2l3Sx1klS3ltZBVKRuqIatVNighq1O2NUDWvKzrYA79gToPLkAtooqRMcPTITPgTwLDFEVBZ6QwMdv9XaSxwImTc1JyclIghVT1im7SLwACziCZNItHDIpDFEW9qF/KAwGB4QLB3BFIQHVWVrWRCKhMCsScOt8/Ng7QjUx0YxcHoVsbbQgKFKTl88dbVa8WTUci/Ye1vdUrKt0wpZcSEL0eogC4WZbh2I+EjBIgrxsAxwFu0JcFy6FpmuazrAjoc4xYhuMiEAg+1s5OYMLy+QKB3MCEV1MpLC836BJVVPAqezWaK0P7r7tv1F51V6rV6veFYt0nrxSK4T0XLjiPMsY2olkajUYjNz/+2FOr1WqLagWK4T1nLliMMkK5AHwIwFewUKsLxTrdTPnoqBNvaPdxhukhcoY3tBu8tZcFo2AK5KOM6vLly64PNBoMqQuHt4rHd4rJ4sXsYstdZFgbv06n09XXGbbdnBrafpxhKgjpnYgdWarRaNLMt1+WXNRqi3pFEBaLIGyte73TBo3mSdDYhOXEIVuLwj0bzFXHb8q0Wm1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plss6lIAc5SEHEwimvxilSriiF23JKfeGHEHgFDn8EwtI4lKERJcu1uB4twaDT8HlDWQ3e20/Uwwdu2Eg/kLb6E/CH/ntiDPLr/3yAPa0X/RfPNjwslNBfCugm2EOGYAAAAA==) format('woff2');
  unicode-range: U+6587, U+9673, U+98DB;
}
.namefill-dock {
  position: fixed; right: 40px; top: 50%; transform: translateY(-50%); z-index: 90;
}
.namefill {
  display: flex; flex-direction: column; gap: 16px;
  font: 700 44px/1 'Noto Serif SC', serif;
  touch-action: none; user-select: none; cursor: grab; position: relative;
}
.namefill.grabbing, .namefill.grabbing * { cursor: grabbing; }
.namefill[hidden] { display: none; }
.namefill-glyph { transition: transform .2s; }
.namefill-glyph:hover { transform: translateX(-3px); }
.namefill.grabbing .namefill-glyph:hover { transform: none; }
.namefill-glyph {
  position: relative; display: block; font-style: normal;
  color: color-mix(in srgb, var(--ink) 15%, transparent);
}
.namefill-glyph b {
  position: absolute; inset: 0; color: var(--ink); font-weight: inherit;
  clip-path: inset(0 0 100% 0);
}
.namefill:focus { outline: none; }
.namefill:focus-visible { outline: 1px solid var(--line); outline-offset: 6px; }
@media (max-width: 767px) { .namefill-dock { display: none; } }

/* github contribution graph: ink tints per level, so it flips with the theme */
.gh-months, .gh-cells {
  display: grid; grid-template-columns: repeat(var(--weeks, 26), 1fr); gap: 2px;
}
.gh-months { height: 16px; margin-bottom: 4px; }
.gh-months span { font-size: 11px; line-height: 16px; color: var(--dim); white-space: nowrap; }
.gh-cell { aspect-ratio: 1; background: var(--line); }
.gh-cell.empty { visibility: hidden; }
/* while it loads (site.js msg): placeholder tiles fade in where they'll sit, in the wave's order, then keep breathing
   until the real squares replace them */
.gh-cell.ph { background: var(--line); animation: gh-ph 1.4s ease-in-out infinite alternate backwards; animation-delay: calc(var(--i) * 14ms); }
@keyframes gh-ph { from { opacity: .2; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .gh-cell.ph { animation: none; } }
/* the opening wave (site.js): squares wait unseen, then fade in in order of --i, oldest week first */
.gh-cells.wait .gh-cell { opacity: 0; }
.gh-cells.in .gh-cell { animation: gh-in .4s ease-out backwards; animation-delay: calc(var(--i) * 16ms); }
@keyframes gh-in { from { opacity: 0; } }
/* solid tints: each level is mixed with the page colour, so the tiles are opaque and don't show the mountains through */
.gh-cell[data-level="1"] { background: color-mix(in srgb, var(--ink) 25%, var(--bg)); }
.gh-cell[data-level="2"] { background: color-mix(in srgb, var(--ink) 45%, var(--bg)); }
.gh-cell[data-level="3"] { background: color-mix(in srgb, var(--ink) 70%, var(--bg)); }
.gh-cell[data-level="4"] { background: var(--ink); }
.gh-graph { position: relative; }
.gh-tip {
  position: absolute; z-index: 1; pointer-events: none; white-space: nowrap;
  transform: translate(-50%, calc(-100% - 8px));
  background: var(--ink); color: var(--bg); font-size: 12px; line-height: 1; padding: 6px 8px;
}
.gh-tip[hidden] { display: none; }
.gh-total { margin: 0 0 16px; color: var(--dim); }

/* music: a menu that drops down from the header when [♪] is pressed. the album cover sits on the left, and the
   track info, playback bar and text controls (in the page's bracket style) on the right */
#music {
  position: absolute; top: 100%; right: 0; z-index: 60; width: min(360px, calc(100vw - 32px));
  padding: 12px; background: var(--bg); border: 1px solid var(--line);
}
#music[hidden] { display: none; }
.player { display: flex; gap: 14px; align-items: flex-start; }
/* the track's album cover as ascii art (ascii.js); square until its art loads and sets the real height */
.cover { display: block; flex: none; width: 112px; aspect-ratio: 1; touch-action: pan-y; }
/* the info column takes the rest of the menu's width, and long titles wrap inside it, so the bar never grows with the text */
.info { flex: 1; min-width: 0; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.info p { margin: 0; }
.ctl {
  display: inline; width: auto; height: auto; padding: 0; margin-right: 8px;
  font: inherit; color: var(--dim); background: none; border: 0; cursor: pointer;
}
.ctl:hover, .ctl:focus-visible { color: var(--ink); }
.controls { white-space: nowrap; margin-top: 6px; }
/* playback bar: a 4px track that fills with ink as the track plays. the box is 18px tall so it's easy to hit; click, drag or arrow keys seek */
.bar { position: relative; width: 100%; height: 18px; margin-top: 4px; cursor: pointer; touch-action: none; }
.bar::before { content: ''; position: absolute; left: 0; right: 0; top: calc(50% - 2px); height: 4px; background: color-mix(in srgb, var(--ink) 25%, transparent); }
.bar .fill { position: absolute; left: 0; top: calc(50% - 2px); height: 4px; width: 0; background: var(--ink); }
.time { display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.bar:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

/* footer sits on the bottom edge of the page, below the content */
body:has(> footer) { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: 24px; }
footer {
  width: 100%; max-width: 560px; margin: auto auto 0; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px;
  color: var(--dim); font-size: 13px;
}
footer a { color: var(--dim); }
footer a:hover { color: var(--ink); }
/* the verse takes its own line under the footer row */
.verse { flex-basis: 100%; font-style: italic; }
.verse span { font-style: normal; margin-left: .4em; }

/* keyboard focus: a plain outline, shown only for keyboard users */
:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

/* touch screens: the nav and footer links get a taller tap area without moving the layout (negative margin cancels the padding) */
@media (pointer: coarse) {
  nav a, footer a, .proj-link, .ctl, #theme, #music-toggle { display: inline-block; padding: 10px 0; margin: -10px 0; }
  footer a { padding: 10px 0; }
}

/* the poro strip sits inside the content column, between the last section and the footer */
.poro { position: relative; top: 8px; z-index: 2; width: 100%; height: 65px; margin: 58px 0 0; cursor: default; user-select: none; overflow: hidden; }

/* dotted mountains, drawn by site.js (which sets the height): fixed to the bottom of the screen, behind everything,
   and never in the way */
.mountains { position: fixed; left: 0; bottom: 0; width: 100%; height: 0; z-index: -1; pointer-events: none; }
