/* ---------------------------------------------------------------- *
 * terminal.css — base / reset / theme foundation for the site      *
 * Originally vendored from panr/terminal-css and trimmed to only   *
 * selectors actually exercised by index.html / 404.html.           *
 *                                                                  *
 * Removed from the original: settings UI, dialog, fieldset,        *
 * code/kbd/pre, table, input[type=checkbox|color|radio], select,   *
 * mark, [hidden], hanchor, etc.                                    *
 *                                                                  *
 * Page-specific overrides live in index.css / 404.css; this file   *
 * is the shared base that those pages inherit / fall back on.      *
 * ---------------------------------------------------------------- */

/* === variables (site-wide design tokens; single source of truth) === */
:root {
 --background:  #153489;
 --foreground:  #eceae5;
 --accent:      #5ea5ee;
 --radius:      0;
 --font-size:   1rem;
 --line-height: 1.54em;
}

/* === heading scale === */
h1 {
 margin: 0 0 16px 0;
 font-size: 1.5em;
 font-weight: 600;
 color: var(--accent);
 letter-spacing: 0.04em;
 text-decoration: none;
 text-transform: uppercase;
}
h2 {
 text-transform: uppercase;
}
h1, h2, h3, h4, h5, h6 {
 display: block;
 letter-spacing: 0.04em;
}
h2 { font-size: calc(var(--font-size) * 1.25); }
h3 { font-size: calc(var(--font-size) * 1.05); }
h4, h5, h6 { font-size: calc(var(--font-size) * 1); }

/* === header / titlebar (shared by index.html / 404.html) ===
 *  Logo path strip pinned at the top of every page. The bar itself
 *  has no chrome — just a flex row that centers the title-block.
 *  title-block is wrapped in an <a> on both pages (home + 404), so
 *  text-decoration is explicitly cleared here.
 */
.titlebar {
 display: flex;
 align-items: stretch;
 justify-content: center;
 height: 44px;
 margin: 0 0 24px 0;
 font-size: 0;
 line-height: 1;
 gap: 10px; /* reserved for future extension */
 text-decoration: none;
}
.title-block {
 color: var(--foreground);
 font-size: 16px;
 font-weight: 600;
 letter-spacing: 0;
 display: flex;
 align-items: center;
 justify-content: center;
 gap: 4px;
 padding: 0 15px;
 line-height: 32px;
 cursor: pointer;
 user-select: none;
 text-decoration: none;
}
.title-block:focus-visible {
 outline: 2px solid var(--foreground);
 outline-offset: 2px;
}
.title-path-prefix {
 font-weight: 500;
 font-size: 0.95em;
 letter-spacing: 0.01em;
 opacity: 0.65;
 white-space: nowrap;
}
.title-path {
 font-weight: 600;
 font-size: 0.95em;
 letter-spacing: 0.01em;
 color: var(--foreground);
 white-space: nowrap;
}
/* mobile: drop body side padding so content gets more horizontal room */
@media (max-width: 720px) {
 body { padding: 20px 18px 60px 18px; }
}

@media (max-width: 720px) {
 .titlebar { height: 44px; margin-bottom: 18px; }
 .title-block { font-size: 16px; padding: 0 12px; gap: 4px; }
 .title-path { font-size: 0.82em; }
}

/* === framed block (shared by index.html / 404.html) ===
 *  Solid-bordered "card" variant of <section>. Overrides the default
 *  dashed-top-border + 25px padding from the section base rule with
 *  a full 1px accent border + 30px padding. position/color are kept
 *  from the 404 page's usage so absolute-positioned children
 *  (e.g. a future corner badge) and explicit text-color inheritance
 *  behave identically on both pages.
 */
.framed-block {
 border: 1px solid var(--accent);
 padding: 30px 32px;
 margin: 30px 0;
 position: relative;
 color: var(--foreground);
}
/* direct div children: muted small print under the intro (home) */
.framed-block > div {
 color: color-mix(in srgb, var(--foreground) 70%, transparent);
 font-size: 0.95em;
 margin: 40px 0 2px 0;
}
/* decorative face chip on the intro h1's aside */
.framed-block sup.face {
 font-size: 0.7em;
 color: var(--accent);
 margin-left: 4px;
 letter-spacing: 0.15em;
 vertical-align: super;
 line-height: 0;
}
/* paragraph rhythm inside the framed block (404's rendered copy) */
.framed-block p {
 margin: 0 0 12px 0;
}
.framed-block p:last-of-type {
 margin-bottom: 0;
}
/* inline code chips inside the framed block (heavily used by 404).
 *  On index.html the global `border-radius: 0 !important` reset in
 *  index.css overrides the 2px below; on 404.html (which does not
 *  load index.css) the chip keeps its 2px corner. Intentional. */
.framed-block code {
 color: var(--accent);
 background: rgba(94, 165, 238, 0.08);
 padding: 1px 6px;
 border-radius: 2px;
 font-family: inherit;
 word-break: break-all;
}
@media (max-width: 720px) {
 .framed-block { padding: 24px 22px; }
}

/* === section container: top dashed border + 25px breathing room === */
section {
 border-top: 1px dashed color-mix(in srgb, var(--foreground) 20%, transparent);
 padding-top: 25px;
 padding-bottom: 25px;
 padding-left: 0;
 padding-right: 0;
}
section > :first-child { margin-top: 0; }
section > :last-child  { margin-bottom: 0; }

/* === reset + base typography === */
html { box-sizing: border-box; }
*, *::before, *::after {
 box-sizing: inherit;
 margin: 0;
 padding: 0;
}
/* === body layout primitive (shared by index.html / 404.html) ===
 *  Single source of truth for the centered-card layout both pages
 *  use: 720px max-width, 32/24/60 padding, flex-column with
 *  min-height:100vh so <main> can fill remaining space and push
 *  <footer> to the bottom of the viewport (sticky-footer trick).
 *  Fira Code ligatures (calt + liga) enabled here too — previously
 *  this was duplicated on index.html's body override.
 */
body {
 font-family: "Fira Code", "JetBrains Mono", Monaco, Consolas, "Sarasa Mono SC", monospace;
 font-size: var(--font-size);
 font-weight: 400;
 line-height: var(--line-height);
 background-color: var(--background);
 color: var(--foreground);
 font-feature-settings: "calt" 1, "liga" 1;
 text-rendering: optimizeLegibility;
 font-variant-ligatures: contextual;
 -webkit-overflow-scrolling: touch;
 -webkit-text-size-adjust: 100%;
 max-width: 720px;
 margin: 0 auto;
 padding: 32px 24px 60px;
 min-height: 100vh;
 display: flex;
 flex-direction: column;
}

/* main fills remaining vertical space in the flex-column body, so footer sticks to viewport bottom */
main { flex: 1 0 auto; }

/* === block elements get a default 25px vertical margin === */
h1, h2, h3, h4, h5, h6,
p, ul, ol,
img, figure, video,
table { margin: 25px 0; }

a { color: var(--accent); text-decoration: none; }

/* === buttons (generic terminal accent border; inline overrides per site) === */
button {
 position: relative;
 font: inherit;
 font-weight: bold;
 text-decoration: none;
 text-align: center;
 background: transparent;
 color: var(--accent);
 padding: 5px 18px;
 border: 4px solid var(--accent);
 border-radius: var(--radius);
 transition: background 0.15s linear;
 appearance: none;
 cursor: pointer;
 outline: none;
}
button:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }
button:focus-visible,
a:focus-visible {
 outline: 1px solid var(--accent);
 outline-offset: 2px;
}

/* === forms — only <input> is exercised (cmd-input); === */
/* === textarea/select/fieldset/checkboxes/radios removed, see header === */
label { display: inline-block; }
label input { margin-top: 0; }

input {
 background: transparent;
 color: var(--foreground);
 border: 1px solid var(--foreground);
 border-radius: var(--radius);
 padding: 10px;
 font: inherit;
 appearance: none;
}
input:focus-visible,
input:active {
 border-color: var(--accent);
 outline: 1px solid var(--accent);
 outline-offset: 2px;
}
input:active { box-shadow: none; }

/* === figures and standalone images (about section uses one of each) === */
img {
 display: block;
 max-width: 100%;
 border: 8px solid var(--accent);
 border-radius: var(--radius);
 padding: 8px;
 overflow: hidden;
}
/* 带 width/height 属性的 img：CSS 只负责 height:auto，浏览器会从
 * 属性推导 aspect-ratio，懒加载时也不会 CLS（替代旧的 style="height:auto"）。 */
img[width][height] { height: auto; }
figure img, figure video { margin-bottom: 0; }
figure figcaption {
 background: var(--accent);
 color: var(--background);
 text-align: center;
 font-size: 1em;
 font-weight: normal;
 margin-top: -8px;
 border-radius: 0 0 var(--radius) var(--radius);
}

/* === lists ===
 *  ul/ol base indent + reset,
 *  nested-list margin override (4 sections in habits use <li><h4><ul>),
 *  marker coloring for the dot accent,
 *  relative positioning so future ::before / ::after anchors work.
 */
ul, ol { margin-left: 4ch; padding: 0; }
ul ul, ul ol, ol ul, ol ol { margin-top: 0; }
li::marker { color: var(--accent); }
ul li, ol li { position: relative; }

/* === inline notations: <sup class="face"> (1) + <sub> (2) ===
 * <abbr> 全部下划线移除：indent only via .subjects abbr (PLANS section)
 */
sup { line-height: 0; }
sub { bottom: -0.25em; }
sup { top: -0.25em; }

/* === blockquote ===
 *  4 blockquotes across sections (plans, habits, friends, about).
 */
blockquote {
 position: relative;
 border-top: 1px solid var(--accent);
 border-bottom: 1px solid var(--accent);
 margin: 0;
 padding: 25px;
}
blockquote:before {
 content: ">";
 display: block;
 position: absolute;
 left: 0;
 color: var(--accent);
}
blockquote p:first-child { margin-top: 0; }
blockquote p:last-child  { margin-bottom: 0; }

/* === hr (one use in about after the figure) === */
hr {
 width: 100%;
 border: none;
 background: var(--accent);
 height: 2px;
}

/* === bold-weight scoping ===
 *  th is kept in the selector list because dropping it would mean
 *  splitting an otherwise tidy shared selector group. The selector
 *  is a no-op here (no <table>), but the inheritance behavior of
 *  the rest is unchanged.
 */
h1, h2, h3, h4, h5, h6,
b, strong,
th,
button { font-weight: 600; }

/* === vendor overrides + utilities ===
 *  Defensive rules that override browser/vendor defaults and apply
 *  identically to all pages. Page-specific overrides go in index.css
 *  (or stay inline in the page).
 */

/* override vendor: <code>/<kbd>/<pre>/<samp> ship with a UI-monospace
 *  stack in some browsers; force our mono font instead. */
code, kbd, pre, samp {
 font-family: 'Fira Code', 'Sarasa Mono SC', monospace !important;
}

/* a11y helper: visually hidden but still announced by screen readers.
 *  Standard "sr-only" / "visually-hidden" pattern. */
.visually-hidden {
 position: absolute;
 width: 1px; height: 1px;
 padding: 0; margin: -1px;
 overflow: hidden; clip: rect(0,0,0,0);
 white-space: nowrap; border: 0;
}

/* === scrollbar (BSOD themed, webkit + firefox) ===
 *  Applied globally; pages with overflow rely on this for the
 *  accent-colored thumb against the background-colored track.
 */
* { scrollbar-width: thin; scrollbar-color: var(--accent) var(--background); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--background); }
::-webkit-scrollbar-thumb { background: var(--accent); }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--accent) 80%, var(--foreground)); }
::-webkit-scrollbar-corner { background: var(--background); }

/* === typewriter caret ===
 *  Used by assets/js/typewriter.js for both the static fallback
 *  (.caret, e.g. inline next to the typed-text link) and the
 *  dynamic caret the JS appends after each character (.caret-typed).
 *  Slower blink on .caret-typed because it persists after typing.
 */
@keyframes blink { 50% { opacity: 0; } }
.caret {
 display: inline-block;
 width: 0.2em;
 height: 1em;
 background: var(--accent);
 margin-left: 3px;
 vertical-align: -0.2em;
 animation: blink 1s ease-in-out infinite;
}
.caret-typed {
 animation: blink 2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
 .caret, .caret-typed { animation: none; }
}

/* === aside: end-of-section subtle note (shared by index.html / 404.html) ===
 * Italic accent text. Default right-align fits the home section tail;
 * override `text-align` per-context if needed.
 */
.aside {
 font-size: 0.85em;
 color: color-mix(in srgb, var(--accent) 75%, transparent);
 font-style: italic;
 margin: 36px 0 0 0;
 text-align: right;
}

/* === cta-link: prominent typed-text link with caret (shared) ===
 * Centered filled accent button. Used for any primary in-page call-to-action
 * that should mirror the typewriter effect. Examples: index.html's
 * Github Pages link, 404.html's Home button.
 */
.cta-link { margin: 20px 0; text-align: center; }
.cta-link a {
 display: inline-block;
 padding: 10px 18px;
 background: var(--accent);
 color: var(--background);
 font-size: 1em;
 font-weight: 600;
 letter-spacing: 0.04em;
 text-decoration: none;
}
.cta-link a:hover {
 outline: 1px solid var(--accent);
 outline-offset: 2px;
 background: color-mix(in srgb, var(--accent) 85%, var(--foreground));
}

/* === footer chrome (shared by index.html / 404.html) ===
 *  Footer is pinned to the bottom of the page with a dashed accent
 *  divider above it. The `margin-top` is page-specific (home stacks
 *  footer immediately after main; 404 wants extra breathing room),
 *  so this base rule only owns the dashed divider + zero padding.
 *  Each page overrides `margin-top` locally.
 */
footer {
 padding-top: 0;
 border-top: 1px dashed var(--accent);
}

/* === ICP / meta / beian footer (shared) ===
 *  Three-up meta row (.meta), beian compliance links (.beian), and
 *  the inline gongan badge icon (.gongan-icon). Color values follow
 *  the foreground-dimmed-by-N% pattern via color-mix.
 */
.meta {
 display: grid;
 grid-template-columns: 1fr auto 1fr;
 align-items: center;
 gap: 1em;
 font-size: 0.78em;
 color: color-mix(in srgb, var(--foreground) 80%, transparent);
 margin: 5px 0;
}
.meta-side { color: inherit; }
.meta-side.left { text-align: right; }
.meta-side.right { text-align: left; }
.meta-dot { color: var(--accent); }

.beian {
 display: flex;
 flex-wrap: wrap;
 gap: 14px 16px;
 justify-content: center;
 align-items: center;
 font-size: 0.72em;
 margin: 6px 0 24px;
 color: color-mix(in srgb, var(--foreground) 45%, transparent);
}
.beian a {
 color: inherit;
 text-decoration: none;
 display: inline-flex;
 align-items: center;
 gap: 4px;
}
.beian a:hover { color: var(--accent); }
.gongan-icon {
 width: 14px;
 height: 14px;
 display: inline-block;
 vertical-align: -2px;
}
