:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #1b1d22;
  --muted: #5d626d;
  --line: #e2e0d8;
  --accent: #a8670a;
  --accent-soft: #f3e6cf;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318;
    --surface: #191c23;
    --text: #e9e7e1;
    --muted: #9aa0ab;
    --line: #2a2e38;
    --accent: #e8b04a;
    --accent-soft: #2b2416;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
main { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }

.top {
  max-width: 760px; margin: 0 auto; padding: 20px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { font-weight: 800; letter-spacing: .02em; color: var(--text); text-decoration: none; font-size: 1.1rem; }
.top nav { display: flex; gap: 18px; }
.top nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem; }
.top nav a:hover { color: var(--text); }

h1, h2, h3 { line-height: 1.2; }
h2 { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 48px 0 16px; }
.hero { padding: 40px 0 8px; }
.hero h1 { font-size: clamp(2.4rem, 8vw, 3.6rem); margin: 0 0 4px; letter-spacing: -.02em; }
.tagline { font-size: 1.2rem; color: var(--accent); font-weight: 600; margin: 0 0 20px; }
.lede { color: var(--muted); }

.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.card a {
  display: flex; flex-direction: column; height: 100%; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s;
}
.card a:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h3 { margin: 0 0 6px; font-size: 1.15rem; }
.card p { margin: 0 0 14px; color: var(--muted); font-size: .97rem; flex: 1; }
.card .go { color: var(--accent); font-weight: 600; font-size: .92rem; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.list time { flex: 0 0 4.6em; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.list a { color: var(--text); text-decoration: none; }
.list a:hover { color: var(--accent); }
.year { margin-top: 36px; }

.links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.links a {
  display: inline-block; padding: 8px 16px; border-radius: 999px;
  background: var(--accent-soft); color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem;
}
.links a:hover { outline: 2px solid var(--accent); }

.archive-index h1, .post h1 { font-size: clamp(1.8rem, 6vw, 2.4rem); margin: 8px 0; }
.crumb { margin: 24px 0 0; font-size: .95rem; }
.crumb a { text-decoration: none; }
.meta { color: var(--muted); font-size: .95rem; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.tags li { background: var(--accent-soft); border-radius: 6px; padding: 1px 8px; font-size: .82rem; }
.post-body { overflow-wrap: anywhere; }
.post-body img, .post-body video { max-width: 100%; height: auto; border-radius: 8px; }
.post-body iframe { max-width: 100%; }
.post-body table { max-width: 100%; display: block; overflow-x: auto; border-collapse: collapse; }
.post-body td, .post-body th { padding: 4px 8px; }
.post-body .separator a { margin: 0 !important; }
.origin { margin-top: 40px; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); padding-top: 16px; }

.foot { max-width: 760px; margin: 0 auto; padding: 24px 16px 40px; color: var(--muted); font-size: .9rem; }

.card > div { display: flex; flex-direction: column; height: 100%; padding: 18px 20px; background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; }
.card .soon { color: var(--muted); }
.about { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 8px 28px; }
.about h3 { margin: 0 0 8px; font-size: 1.05rem; }
.about ul { margin: 0 0 16px; padding-left: 1.1em; }
.about li { margin-bottom: 8px; }
.about li::marker { color: var(--accent); }

/* mouse effects (static/fx.js adds .fx on mouse/trackpad devices without reduced motion) */
.fx body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(520px circle at var(--mx, -999px) var(--my, -999px), var(--accent-soft), transparent 70%);
}
.fx .hero { position: relative; isolation: isolate; }
.embers { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.fx .card > a, .fx .card > div { position: relative; transition: transform .18s ease-out, border-color .15s; transform-style: preserve-3d; will-change: transform; }
.fx .card > a::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .2s;
  background: radial-gradient(260px circle at var(--gx, 50%) var(--gy, 50%), rgba(255,255,255,.14), transparent 60%);
}
.fx .card > a:hover::after { opacity: 1; }
.fx .links a { transition: outline-color .15s; will-change: transform; }
.fx .hero h1 { cursor: default; }

/* hero terminal (static/term.js); always dark, like a real one */
.term {
  --t-bg: #0c0e13; --t-line: #262b36; --t-fg: #d7dae0; --t-dim: #7d8594; --t-ok: #7ee2a8; --t-acc: #e8b04a;
  margin: 28px 0 8px; background: var(--t-bg); color: var(--t-fg); border: 1px solid var(--t-line); border-radius: 12px;
  font: 14px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; overflow: hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
}
.t-bar { display: flex; align-items: center; gap: 7px; padding: 9px 14px; border-bottom: 1px solid var(--t-line); color: var(--t-dim); font-size: 12px; }
.t-bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.t-bar i:nth-child(2) { background: #febc2e; } .t-bar i:nth-child(3) { background: #28c840; }
.t-bar span { margin-left: 8px; }
.t-log { list-style: none; margin: 0; padding: 12px 16px; max-height: 260px; overflow-y: auto; overflow-wrap: anywhere; }
.term.live .t-log { height: 260px; }
.t-log p { margin: 0 0 2px; }
.t-in { color: var(--t-fg); }
.t-out { color: var(--t-dim); margin-bottom: 10px !important; }
.t-out:first-letter { color: var(--t-ok); }
.t-ps { color: var(--t-acc); font-weight: 700; }
.term a { color: var(--t-ok); }
.term code { color: var(--t-acc); background: rgba(232,176,74,.1); border-radius: 4px; padding: 0 4px; }
.t-caret { display: inline-block; width: .55em; height: 1.05em; vertical-align: -2px; background: var(--t-acc); margin-left: 1px; animation: t-blink 1s steps(1) infinite; }
@keyframes t-blink { 50% { opacity: 0; } }
.t-form { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--t-line); }
.t-form input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--t-fg); font: inherit; caret-color: var(--t-acc); }
.t-form input::placeholder { color: #4d5462; }
.term:focus-within { border-color: #3a4150; }

/* tech stack chips on project cards */
.stack { list-style: none; padding: 0; margin: -4px 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.stack li { font: 12px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 7px; }
@media (prefers-reduced-motion: reduce) { .t-caret { animation: none; } }

/* project write-up pages (content/projects/<slug>/body.html) */
.project h1 { font-size: clamp(2rem, 7vw, 2.8rem); margin: 8px 0 6px; }
.project h2 { margin-top: 44px; }
.project h3 { margin: 26px 0 6px; }
.project .lede { font-size: 1.08rem; }
.project ul { padding-left: 1.2em; }
.project li { margin-bottom: 8px; }
.table-wrap { overflow-x: auto; margin: 14px 0; }
.project table { border-collapse: collapse; width: 100%; font-size: .95rem; min-width: 540px; }
.project th, .project td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.project th { color: var(--muted); font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.project .note { color: var(--muted); font-size: .9rem; }
.model { margin: 20px 0 10px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; height: 640px; }
.model iframe { width: 100%; height: 100%; border: 0; display: block; }
.model-cta { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.model-cta span { color: var(--muted); font-size: .92rem; flex: 1 1 260px; }
.button { display: inline-block; background: var(--accent); color: var(--bg); text-decoration: none; font-weight: 700; padding: 9px 16px; border-radius: 999px; }
.button:hover { filter: brightness(1.08); }
@media (max-width: 720px) { .model { display: none; } }
.schematic { margin: 18px 0; }
.schematic .sheet { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.schematic svg { display: block; width: 100%; min-width: 680px; height: auto; }
.s-box { fill: var(--bg); stroke: var(--text); stroke-width: 1.3; }
.s-box.hot { stroke: var(--accent); stroke-width: 2; }
.s-box.ctrl { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.s-t { fill: var(--text); font: 600 13px system-ui, sans-serif; text-anchor: middle; }
.s-s { fill: var(--muted); font: 400 11.5px system-ui, sans-serif; text-anchor: middle; }
.s-l { fill: var(--muted); font: 600 11px ui-monospace, Menlo, monospace; }
.s-l.dc { fill: #d9822b; }
.s-cap { fill: var(--muted); font: 600 11px ui-monospace, Menlo, monospace; letter-spacing: .08em; text-transform: uppercase; }
.s-fill { fill: var(--muted); }
.w-ac { stroke: #d64545; stroke-width: 3; fill: none; }
.w-dc { stroke: #d9822b; stroke-width: 2.5; fill: none; }
.w-gnd { stroke: var(--muted); stroke-width: 2; fill: none; }
.w-sig { stroke: var(--muted); stroke-width: 1.5; fill: none; stroke-dasharray: 5 4; }
.w-i2c { stroke: #3d8fd1; stroke-width: 2; fill: none; }
.legend { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }
.legend i { display: inline-block; width: 22px; height: 0; margin-right: 8px; vertical-align: middle; border-top: 3px solid; }
.legend .k-ac { border-top-color: #d64545; } .legend .k-dc { border-top-color: #d9822b; } .legend .k-sig { border-top-style: dashed; border-top-color: var(--muted); } .legend .k-i2c { border-top-color: #3d8fd1; }

/* Discord-style embed mock (project pages) */
.embed { background: #2b2d31; color: #dbdee1; border-left: 4px solid #e8b04a; border-radius: 6px; padding: 12px 16px; margin: 18px 0 6px; max-width: 520px; font-size: .93rem; line-height: 1.45; }
.embed p { margin: 0 0 6px; color: #dbdee1; }
.embed .embed-title { font-weight: 700; color: #fff; font-size: 1rem; }
.embed .embed-sub { color: #b5bac1; margin-bottom: 10px; }
.embed .embed-field { font-weight: 700; color: #fff; margin-top: 8px; margin-bottom: 2px; }

/* "Try PokéAide" chat (content/projects/pokeassistant/pokeaide.js) */
.aide { background: #313338; color: #dbdee1; border-radius: 10px; overflow: hidden; margin: 16px 0; font-size: .95rem; border: 1px solid #1e1f22; }
.aide-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 9px 14px; border-bottom: 1px solid #1e1f22; font-weight: 600; color: #f2f3f5; }
.aide-hash { color: #80848e; font-size: 1.2rem; margin-right: -4px; }
.aide-quick { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.aide-quick button, .aide-chip { background: #404249; color: #dbdee1; border: 0; border-radius: 4px; padding: 3px 8px; font: 500 .85rem/1.4 ui-monospace, Menlo, monospace; cursor: pointer; }
.aide-quick button:hover, .aide-chip:hover { background: #5865f2; color: #fff; }
.aide-log { list-style: none; margin: 0; padding: 10px 14px; height: 440px; overflow-y: auto; }
.aide-msg { margin: 0 0 14px; }
.aide-msg p { margin: 0 0 4px; }
.aide-who { font-weight: 600; color: #f2f3f5; display: flex; align-items: center; gap: 6px; }
.aide-msg.you .aide-who { color: #e8b04a; }
.aide-tag { background: #5865f2; color: #fff; font-size: .62rem; font-weight: 700; border-radius: 3px; padding: 1px 4px; }
.aide-text, .aide-msg .aide-text { color: #dbdee1; }
.aide-note { color: #949ba4; font-size: .85rem; }
.aide-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px !important; }
.aide-card { margin: 4px 0 0; max-width: 560px; }
.aide-type { display: inline-block; border-radius: 4px; padding: 0 7px; margin-right: 5px; font-size: .8rem; font-weight: 600; color: #fff; background: #6d6d6d; }
.t-fire { background: #e2622f; } .t-water { background: #3f8ee0; } .t-grass { background: #3fa045; } .t-electric { background: #e1b52a; color: #222; }
.t-ice { background: #4fc0d6; color: #10343c; } .t-fighting { background: #c03028; } .t-poison { background: #9141cb; } .t-ground { background: #9a6b34; }
.t-flying { background: #7d9be6; } .t-psychic { background: #e8467a; } .t-bug { background: #91a119; } .t-rock { background: #a99e66; }
.t-ghost { background: #6f4a8c; } .t-dragon { background: #5160e1; } .t-dark { background: #4f3f3d; } .t-steel { background: #6f8fa0; } .t-fairy { background: #e07fdd; } .t-normal { background: #8f8e7c; }
.aide-moves { list-style: none; padding: 0; margin: 2px 0 6px; display: grid; gap: 3px; }
.aide-moves li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.aide-moves b { color: #f2f3f5; font-weight: 600; }
.aide-role { font-size: .7rem; font-weight: 700; border-radius: 3px; padding: 0 5px; }
.aide-role.stab { background: #e8b04a; color: #2b2112; } .aide-role.cov { background: #4e5058; color: #dbdee1; }
.aide-mv { color: #b5bac1; font-size: .85rem; }
.aide-foot { color: #949ba4 !important; font-size: .78rem; margin-top: 8px !important; }
.aide-form { padding: 0 14px 14px; }
.aide-form input { width: 100%; background: #383a40; border: 0; border-radius: 8px; padding: 11px 14px; color: #dbdee1; font: inherit; outline: 0; }
.aide-form input::placeholder { color: #80848e; }
@media (max-width: 560px) { .aide-log { height: 380px; } .aide-quick { margin-left: 0; } }
