/* ============ shared ============ */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; }
body { background: #0d1117; font-family: "SF Mono", "Menlo", "Fira Code", monospace; }

.mode-btn {
  background: transparent;
  border: 1px solid #444c56;
  color: #8b949e;
  font: inherit;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-left: auto;
}
.mode-btn:hover { color: #e6edf3; border-color: #8b949e; }

/* ============ terminal mode ============ */
#terminal-mode {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.term-window {
  width: min(900px, 100%);
  height: min(620px, 100%);
  background: #161b22;
  border-radius: 10px;
  border: 1px solid #30363d;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.term-titlebar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  background: #21262d;
  border-bottom: 1px solid #30363d;
}
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }
.term-title { color: #8b949e; font-size: 12px; margin-left: 8px; }
.term-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.5;
  cursor: text;
}
.term-line { color: #c9d1d9; white-space: pre-wrap; word-break: break-word; }
.term-line.err { color: #f85149; }
.term-line.dim { color: #6e7681; font-style: italic; }
.term-line.banner { color: #58a6ff; }
.term-line.bigname {
  color: #58a6ff;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-top: 4px;
}
.prompt { color: #3fb950; font-weight: 600; }
.term-input-line { display: flex; gap: 8px; align-items: baseline; }
#term-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #c9d1d9;
  font: inherit;
  caret-color: #3fb950;
}
#term-input::placeholder {
  color: #6e7681;
  font-style: italic;
  opacity: 1;
  animation: hintpulse 2.4s ease-in-out infinite;
}
@keyframes hintpulse { 50% { opacity: .35; } }

/* ============ GUI mode ============ */
:root {
  --ink: #16181d;
  --muted: #5c6470;
  --accent: #0f766e;
  --accent-soft: #e6f4f2;
  --line: #e6e8ec;
  --bg: #fafaf8;
  --card: #ffffff;
  --mono: "SF Mono", "Menlo", "Fira Code", monospace;
}
#gui-mode {
  min-height: 100vh;
  background: var(--bg);
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
}

/* nav */
.gui-nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 14px 28px;
  background: rgba(250,250,248,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.gui-brand { font-family: var(--mono); font-weight: 700; font-size: 18px; color: var(--accent); }
.brand-cursor { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.gui-nav-links { display: flex; gap: 20px; margin: 0 auto; }
.gui-nav-links a {
  color: var(--muted); text-decoration: none; font-size: 14.5px; font-weight: 500;
}
.gui-nav-links a:hover { color: var(--accent); }
.gui-switch { background: var(--card); border-color: var(--line); color: var(--muted); font-family: var(--mono); }
.gui-switch:hover { color: var(--accent); border-color: var(--accent); }

/* hero */
.gui-hero { border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fff 0%, var(--bg) 100%); }
.gui-hero-inner {
  max-width: 940px; margin: 0 auto; padding: 64px 28px 56px;
  display: flex; align-items: center; gap: 48px;
}
.hero-photo { flex: 0 0 auto; }
.hero-photo img, .hero-photo-placeholder {
  width: 216px; height: 288px; object-fit: cover;
  border-radius: 0;
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(15, 118, 110, .12);
}
.hero-photo-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--mono); font-size: 64px; font-weight: 700;
}
.hero-text { flex: 1; min-width: 0; }
.hero-kicker { font-family: var(--mono); color: var(--accent); font-size: 14px; margin: 0 0 10px; }
.gui-hero h1 { margin: 0; font-size: 42px; letter-spacing: -1px; line-height: 1.1; }
.hero-tagline { color: var(--muted); font-size: 18px; margin: 8px 0 14px; }
.hero-intro p { margin: 0 0 8px; color: #333a44; }
.hero-intro { margin-bottom: 18px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.chip {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--accent-soft); color: var(--accent);
  padding: 4px 12px; border-radius: 999px;
}
.hero-links { display: flex; flex-wrap: wrap; gap: 14px; }
.hero-link {
  font-size: 14.5px; color: var(--ink); text-decoration: none;
  border: 1px solid var(--line); background: var(--card);
  padding: 7px 14px; border-radius: 8px;
  transition: border-color .15s, color .15s;
}
.hero-link:hover { border-color: var(--accent); color: var(--accent); }

/* main sections */
.gui-main { max-width: 780px; margin: 0 auto; padding: 24px 28px 48px; }
.gui-main section { padding: 36px 0; border-bottom: 1px solid var(--line); }
.gui-main section:last-of-type { border-bottom: none; }
.gui-main h2 { font-size: 24px; margin: 0 0 18px; letter-spacing: -0.3px; }
.sec-hash { color: var(--accent); font-family: var(--mono); margin-right: 2px; }
.gui-main p { margin: 0 0 12px; color: #333a44; }
.muted { color: var(--muted); }

/* cv */
.cv-grid { display: grid; gap: 22px; }
.cv-block h3 {
  margin: 0 0 10px; font-size: 13px; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
}
.cv-row { display: flex; gap: 18px; padding: 7px 0; border-top: 1px dashed var(--line); }
.cv-years { font-family: var(--mono); font-size: 13.5px; color: var(--accent); min-width: 76px; padding-top: 2px; }
.cv-what { font-weight: 500; }
.cv-detail { font-weight: 400; color: var(--muted); }

/* publications & posts */
.pub-card {
  display: flex; gap: 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; margin-bottom: 12px;
}
.pub-year { font-family: var(--mono); font-size: 13.5px; color: var(--accent); min-width: 76px; padding-top: 2px; }
.pub-title { font-weight: 600; }
.pub-title a { color: var(--ink); text-decoration: none; }
.pub-title a:hover { color: var(--accent); }
.pub-meta { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.talk-row { padding: 7px 0; border-top: 1px dashed var(--line); font-weight: 500; }
.talk-year { color: var(--accent); font-family: var(--mono); font-size: 14px; font-weight: 400; }
.talk-detail { color: var(--muted); font-weight: 400; font-size: 14.5px; margin-top: 2px; }
#gui-teaching .sub-h:first-child { margin-top: 0; }
.sub-h {
  margin: 28px 0 8px; font-size: 13px; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
}

#gui-contact a { color: var(--accent); }

.gui-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 28px; }
.gui-updated { margin-top: 6px; font-family: var(--mono); font-size: 12px; color: #9aa1ab; }
.pub-kind { color: var(--accent); font-family: var(--mono); font-size: 13px; }
.gui-footer a { color: var(--muted); font-family: var(--mono); text-decoration: none; }
.gui-footer a:hover { color: var(--accent); }

@media (max-width: 760px) {
  .gui-hero-inner { flex-direction: column; align-items: flex-start; gap: 28px; }
  .hero-photo img, .hero-photo-placeholder { width: 150px; height: 200px; }
}
@media (max-width: 640px) {
  .gui-nav-links { display: none; }
  .gui-hero h1 { font-size: 34px; }
  .cv-row, .pub-card { flex-direction: column; gap: 2px; }
}

@media (max-width: 600px) {
  #terminal-mode { padding: 0; }
  .term-window { border-radius: 0; height: 100vh; width: 100%; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
