/* duowang.dev — one stylesheet, two looks.
   Default: terminal. html.plain: minimal light. @media print: one-page CV. */

@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: 700; font-display: swap; src: url(fonts/jetbrains-mono-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 600; font-display: swap; src: url(fonts/space-grotesk-latin-600-normal.woff2) format("woff2"); }

:root {
  --bg: #0E1116; --panel: #12161C; --panel-2: #0A0D11; --line: #262D36; --line-2: #3A4450;
  --text: #D6DEE6; --soft: #C3CCD5; --muted: #8B98A5; --bright: #F3F6F9;
  --accent: #4ADE80; --on-accent: #0E1116; --link: #7DD3FC; --link-hover: #BAE6FD;
  --amber: #FBBF24; --red: #FB7185;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --body: var(--mono); --display: var(--mono);
  --radius: 0; --radius-lg: 0;
  --wrap: 1180px;
  color-scheme: dark;
}
html.plain {
  --bg: #FAFAF9; --panel: #FFFFFF; --panel-2: #F5F5F4; --line: #E7E5E4; --line-2: #D6D3D1;
  --text: #1C1917; --soft: #44403C; --muted: #57534E; --bright: #1C1917;
  --accent: #1D4ED8; --on-accent: #FFFFFF; --link: #1D4ED8; --link-hover: #1E3A8A;
  --amber: #A16207; --red: #B91C1C;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --radius: 10px; --radius-lg: 16px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 15px; line-height: 1.7; }
html.plain body { font-size: 16px; line-height: 1.6; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
h1, h2, h3 { color: var(--bright); line-height: 1.2; margin: 0; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
pre { margin: 0; font-family: var(--mono); }
code { font-family: var(--mono); }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 10; padding: 8px 14px; background: var(--accent); color: var(--on-accent); font-weight: 700; text-decoration: none; }
.skip:focus { top: 8px; }

/* What shows in which look */
html.plain .t-only { display: none !important; }
html:not(.plain) .p-only { display: none !important; }
html:not(.js) .js-only { display: none !important; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 32px; }
@media (max-width: 640px) { .wrap { padding: 0 20px; } }

/* Header */
.site-header { position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding-top: 10px; padding-bottom: 10px; }
.brand { padding: 2px 10px; background: var(--accent); color: var(--on-accent); font-family: var(--mono); font-weight: 700; text-decoration: none; }
.brand:hover { color: var(--on-accent); }
html.plain .brand { background: none; color: var(--text); padding: 0; font-family: var(--display); font-size: 20px; }
html.plain .brand::after { content: "."; color: var(--accent); }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 20px; }
.nav a { display: inline-flex; align-items: center; min-height: 40px; color: var(--text); text-decoration: none; }
.nav a:hover { color: var(--accent); }
.nav .n { color: var(--muted); }
html.plain .nav .n { display: none; }
html.plain .nav a { color: var(--soft); font-weight: 600; font-size: 15px; }
.nav .cv { color: var(--accent); }
.view-toggle { min-height: 36px; padding: 0 10px; background: transparent; border: 1px solid var(--line-2); border-radius: var(--radius); color: var(--soft); font: inherit; font-family: var(--mono); font-size: 13px; cursor: pointer; }
.view-toggle:hover { color: var(--bright); border-color: var(--muted); }
.site-header .wrap { flex-wrap: nowrap; }
.nav { margin-left: auto; }
@media (max-width: 760px) {
  .site-header .wrap { flex-wrap: wrap; }
  .view-toggle { margin-left: auto; }
  .nav { order: 3; width: 100%; margin-left: 0; flex-wrap: nowrap; overflow-x: auto; gap: 16px; }
  .nav a { white-space: nowrap; }
}

/* Prompts and section heads */
.cmd { color: var(--muted); font-size: 14px; }
.cmd .u { color: var(--accent); }
.cmd .d { color: var(--link); }
.h2 { font-size: 32px; font-weight: 700; }
.h2 .hash { color: var(--accent); }
html.plain .h2 { font-family: var(--display); font-weight: 600; font-size: 40px; letter-spacing: -0.02em; }
html.plain .h2 .hash { display: none; }
html.plain .h2 .lc { text-transform: capitalize; }
.section { padding: 64px 0; border-top: 1px dashed var(--line-2); display: flex; flex-direction: column; gap: 24px; }
html.plain .section { border-top-style: solid; border-color: var(--line); padding: 72px 0; }
.note { font-size: 13px; color: var(--amber); }
.muted { color: var(--muted); }

/* Buttons */
.btns { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { display: inline-flex; align-items: center; min-height: 48px; padding: 0 20px; border: 1px solid var(--line-2); border-radius: var(--radius); color: var(--bright); font-weight: 500; text-decoration: none; }
.btn:hover { border-color: var(--muted); color: var(--bright); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn.primary:hover { color: var(--on-accent); filter: brightness(1.08); }
.btn.ghost { border-color: transparent; color: var(--link); padding: 0 8px; }
html.plain .btn { font-weight: 600; background: var(--panel); }
html.plain .btn.primary { background: var(--accent); }
html.plain .btn.ghost { background: none; }
html.plain .btn .br { display: none; }

/* Hero */
.hero { padding: 72px 0 80px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); gap: 48px; align-items: start; }
.hero-text { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.boot-lines { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.ok { color: var(--accent); }
.ascii { font-size: 22px; line-height: 1.15; font-weight: 700; color: var(--accent); overflow-x: auto; margin-top: 6px; }
.hero h1 { font-size: 19px; font-weight: 400; color: var(--bright); }
.lede { font-size: 19px; color: var(--bright); max-width: 40em; }
.status { font-size: 17px; color: var(--amber); }
html.plain .hero { padding: 104px 0 96px; grid-template-columns: 1fr; }
html.plain .hero h1 { font-family: var(--display); font-weight: 600; font-size: clamp(44px, 7vw, 76px); line-height: 1.03; letter-spacing: -0.03em; max-width: 16ch; }
html.plain .lede { font-size: 20px; color: var(--muted); }
html.plain .status { order: -1; align-self: flex-start; display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); color: var(--soft); font-size: 14px; }
html.plain .status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #16A34A; }
html.plain .status .gt { display: none; }

@keyframes bootin { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
html.js:not(.plain) .boot { opacity: 0; animation: bootin .35s ease-out forwards; animation-delay: var(--d, 0s); }
.cursor { display: inline-block; width: .6em; height: 1.1em; vertical-align: -.15em; background: var(--accent); animation: blink 1.1s steps(1) infinite; }
@media (prefers-reduced-motion: reduce) {
  html.js:not(.plain) .boot { opacity: 1; animation: none; }
  .cursor { animation: none; }
  html { scroll-behavior: auto; }
}

/* Interactive terminal */
.term { display: flex; flex-direction: column; border: 1px solid var(--line-2); background: var(--panel-2); min-width: 0; }
.term-bar { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.term-out { height: 300px; overflow-y: auto; padding: 14px 16px; font-size: 14px; line-height: 1.6; }
.term-out .l { white-space: pre-wrap; word-break: break-word; }
.term-out .c-cmd { color: var(--bright); }
.term-out .c-out { color: var(--soft); }
.term-out .c-hi { color: var(--amber); }
.term-out .c-err { color: var(--red); }
.term-out .c-ok { color: var(--accent); }
.term-out .c-muted { color: var(--muted); }
.term-out .c-next { color: var(--link); }
.term-out .ps { color: var(--accent); }
.term-out a { color: var(--link); }
.term-form { display: flex; align-items: center; gap: 8px; margin: 0 16px 14px; padding: 0 12px; border: 1px solid var(--line-2); background: var(--panel); }
.term-form:focus-within { box-shadow: 0 0 0 2px var(--link); }
.term-form label { color: var(--accent); }
.term-input { flex: 1; min-width: 0; min-height: 44px; background: transparent; border: 0; color: var(--bright); font: inherit; font-size: 16px; }
.term-input:focus { outline: none; }
.term-send { min-height: 36px; padding: 0 12px; background: transparent; border: 1px solid var(--line-2); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 16px; }
.chip { min-height: 36px; padding: 0 12px; background: transparent; border: 1px dashed var(--line-2); color: var(--soft); font: inherit; font-size: 13px; cursor: pointer; }
.chip:hover { background: var(--panel); color: var(--bright); }
.fog { display: block; margin: 6px 0; font-size: 14px; line-height: 1.05; color: var(--muted); cursor: crosshair; user-select: none; touch-action: none; white-space: pre; overflow: hidden; }
.fog .clear { color: var(--accent); }
@media (max-width: 640px) {
  .term-out { height: 200px; font-size: 12.5px; }
  .ascii { font-size: 15px; }
  .hero { padding: 36px 0 48px; gap: 28px; }
  .lede { font-size: 16px; }
}

/* Live stats */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 20px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius-lg); min-width: 0; }
.tile-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; font-size: 13px; color: var(--muted); }
.tile-head .live { color: var(--accent); }
.tile-head .done { color: var(--amber); }
.tile-num { font-size: 34px; font-weight: 700; color: var(--bright); line-height: 1.2; }
.tile-num small { font-size: 17px; font-weight: 400; color: var(--soft); }
.tile-sub { font-size: 13px; color: var(--soft); }
.tile-src { font-size: 11px; color: var(--muted); }
html.plain .tile-head { font-family: var(--body); font-size: 14px; }
html.plain .tile-num { font-family: var(--display); font-weight: 600; }
@media (max-width: 640px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 14px; }
  .tile-num { font-size: 24px; }
  .tile-num small { font-size: 13px; }
  .tile-src { display: none; }
}

/* Project cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 10px; padding: 22px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius-lg); min-width: 0; }
.card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 4px; }
.card-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
.card h3 { font-size: 19px; font-weight: 700; color: var(--accent); }
.card p { color: var(--soft); }
.card .tags { margin-top: auto; font-size: 13px; color: var(--amber); }
.card .go { text-decoration: none; }
html.plain .card-meta .perm { display: none; }
html.plain .card-meta { font-family: var(--body); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: var(--accent); }
html.plain .card h3 { font-family: var(--display); font-weight: 600; font-size: 23px; color: var(--bright); }
html.plain .card h3 .slash { display: none; }
html.plain .card .tags { color: var(--muted); }
html.plain .card .go { font-weight: 600; }
html.plain .card .go .gt { display: none; }

/* About */
.about { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 48px; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.prose p { color: var(--soft); }
html.plain .prose p { font-size: 18px; }
.edu { padding: 16px 20px; border-left: 2px solid var(--amber); background: var(--panel); }
.edu .c { color: var(--amber); }
.edu strong { color: var(--bright); display: block; }
html.plain .edu { border: 1px solid var(--line); border-radius: var(--radius-lg); }
html.plain .edu .c { display: none; }
.json { padding: 22px; border: 1px solid var(--line); background: var(--panel); font-size: 15px; line-height: 1.8; white-space: pre-wrap; color: var(--text); }
.json .k { color: var(--link); }
.json .v { color: var(--accent); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills li { padding: 7px 14px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); font-size: 14px; }

/* Contact */
.contact-list { display: flex; flex-direction: column; gap: 4px; font-size: 17px; }
.contact-list .k { display: inline-block; width: 9ch; color: var(--muted); }
html.plain .contact-list { flex-direction: row; flex-wrap: wrap; gap: 12px; }
html.plain .contact-list li { display: flex; }
html.plain .contact-list .k { display: none; }
html.plain .contact-list a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 22px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel); font-weight: 600; text-decoration: none; }

.site-footer { border-top: 1px solid var(--line); padding: 28px 0 44px; margin-top: 40px; font-size: 13px; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.site-footer a { color: var(--muted); }

/* Project pages */
.article { max-width: 880px; margin: 0 auto; padding: 56px 32px 72px; display: flex; flex-direction: column; gap: 44px; }
@media (max-width: 640px) { .article { padding: 36px 20px 56px; gap: 36px; } }
.article h1 { font-size: clamp(30px, 5vw, 44px); font-weight: 700; }
html.plain .article h1 { font-family: var(--display); font-weight: 600; letter-spacing: -0.02em; }
html.plain .article h1 .hash { display: none; }
.article .intro { font-size: 19px; color: var(--soft); }
.article section { display: flex; flex-direction: column; gap: 12px; }
.article h2 { font-size: 24px; }
.article h2 .hash { color: var(--muted); }
html.plain .article h2 { font-family: var(--display); font-weight: 600; }
html.plain .article h2 .hash { display: none; }
.article h3 { font-size: 17px; margin-top: 8px; }
.article p, .article li { color: var(--soft); }
.article li strong { color: var(--bright); }
.list { display: flex; flex-direction: column; gap: 10px; }
.list li { position: relative; padding-left: 1.6em; }
.list li::before { content: "→"; position: absolute; left: 0; color: var(--accent); }
.list.good li::before { content: "+"; }
.list.bad li::before { content: "−"; color: var(--red); }
.list.num { counter-reset: n; }
.list.num li::before { counter-increment: n; content: counter(n) "."; color: var(--amber); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.facts div { padding: 16px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
@media (max-width: 640px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 0; color: var(--bright); }
.facts .big { font-size: 22px; font-weight: 700; }
.facts .big small { font-size: 15px; font-weight: 400; color: var(--soft); }
.facts .acc { color: var(--accent); }
figure { margin: 0; display: flex; flex-direction: column; gap: 10px; }
figure img { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); }
figcaption { font-size: 13px; color: var(--muted); }
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.code { padding: 20px 24px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); font-size: 15px; line-height: 1.7; white-space: pre; overflow-x: auto; color: var(--text); }
.code .c { color: var(--muted); }
.code .a { color: var(--accent); }
.code .h { color: var(--amber); }
.crumb { color: var(--muted); font-size: 14px; }

/* Print: the page becomes a one-page CV */
.print-only { display: none; }
@media print {
  :root, html.plain {
    --bg: #fff; --panel: #fff; --text: #111; --soft: #222; --muted: #555; --bright: #000;
    --accent: #000; --link: #000; --amber: #333; --line: #ccc; --line-2: #ccc;
  }
  @page { size: A4; margin: 14mm 16mm; }
  body { font-family: "Inter", Arial, sans-serif; font-size: 10pt; line-height: 1.4; background: #fff; }
  .t-only, .p-only, .site-header, .site-footer, .term, .btns, .cmd, #live, #contact, .card img, .card .go, .card-meta .perm, .skip, .no-print, figure, .json { display: none !important; }
  .print-only { display: block !important; }
  .wrap { max-width: none; padding: 0; }
  .section, html.plain .section { padding: 8pt 0; border: 0; gap: 6pt; break-inside: avoid; }
  .h2, html.plain .h2 { font-family: "Inter", Arial, sans-serif; font-size: 12pt; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid #999; padding-bottom: 2pt; }
  .h2 .hash { display: none; }
  .h2 .lc { text-transform: uppercase; }
  .hero { display: block; padding: 0 0 6pt; }
  .hero h1 { display: none; }
  .lede .p-only { display: inline !important; }
  .lede, .status { font-size: 10pt; color: #222; }
  .status .gt { display: none; }
  .status { border: 0 !important; padding: 0 !important; }
  .status::before { display: none !important; }
  .cards { display: block; }
  .card { display: block; padding: 0 0 6pt; border: 0; break-inside: avoid; }
  .card-meta { display: inline; font-size: 9pt; color: #555; text-transform: none !important; letter-spacing: 0 !important; }
  .card h3, html.plain .card h3 { display: inline; font-family: "Inter", Arial, sans-serif; font-size: 10.5pt; color: #000; }
  .card h3 .slash { display: none; }
  .card p { font-size: 10pt; }
  .card .tags { font-size: 9pt; color: #555; }
  .about { display: block; }
  .prose p { font-size: 10pt !important; }
  .edu { border: 0; padding: 0; }
  .edu .c { display: none; }
  .contact-list { display: none; }
  a { text-decoration: none; }
}
