/* ==========================================================================
 * terminal.css — light CLI/terminal layer on top of nubo-design-style.
 * --------------------------------------------------------------------------
 * Loaded LAST (tokens.css → nubo-design.css → terminal.css). Only ADDS new
 * classes + a few scoped tweaks; never edits the vendored files. Everything is
 * built on existing design tokens so light/dark themes keep working.
 * ========================================================================== */

:root {
  --term-mono: var(--p-font-mono);
  /* Body / prose now use the system UI font; only the terminal accents below
   * (brand, nav, section labels, tags, venues, dates …) keep Ubuntu Mono via
   * --term-mono / --p-font-mono. */
  --p-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
                 Arial, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC",
                 "Noto Sans CJK TC", sans-serif;
}

/* Slightly larger base type for comfortable reading. */
body { font-size: 16.5px; }

/* Always reserve the scrollbar gutter so the centered header + content never
 * shift horizontally between pages — keeps the traffic-light dots from jumping
 * when navigating tabs of differing height. */
html { scrollbar-gutter: stable; }

/* --------------------------------------------------------------------------
 * Site header — terminal prompt brand + command-style nav (uses base
 * `header` element styling for sticky/padding, constrains inner width).
 * ------------------------------------------------------------------------ */
.site-header { padding: 0; }
.sh-inner {
  display: flex; align-items: center; gap: 18px;
  width: 100%; max-width: 1180px; margin: 0 auto;
  padding: 12px 32px;
}
.term-brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--term-mono); text-decoration: none;
  font-size: 15px; font-weight: 700; color: var(--p-dark);
  flex-shrink: 0;
}
.term-brand .tb-dots { display: inline-flex; gap: 6px; margin-right: 4px; }
.win-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.win-dot.r { background: #ff5f56; }
.win-dot.y { background: #ffbd2e; }
.win-dot.g { background: #27c93f; }
.term-brand .tb-user { color: var(--p-accent); }
.term-brand .tb-sep,
.term-brand .tb-cwd { color: var(--p-muted); font-weight: 600; }
.term-brand .tb-prompt { color: var(--p-dark); }

.term-nav {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: auto; flex-wrap: wrap;
  font-family: var(--term-mono);
}
.term-nav a {
  display: inline-flex; align-items: center;
  padding: 5px 12px; border-radius: var(--p-radius-sm);
  color: var(--p-muted); text-decoration: none;
  font-size: 13px; font-weight: 600;
  border: 1px solid transparent;
  transition: color var(--p-dur-fast), background var(--p-dur-fast), border-color var(--p-dur-fast);
}
.term-nav a:hover { color: var(--p-accent); background: var(--p-card-alt); }
.term-nav a.active {
  color: var(--p-accent);
  border-color: var(--p-accent-border);
  background: var(--p-accent-soft);
}

/* --------------------------------------------------------------------------
 * Window chrome — traffic-light title bar for cards / hero panels.
 * ------------------------------------------------------------------------ */
.win {
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg);
  background: var(--p-card-bg);
  overflow: hidden;
}
.win-chrome {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--p-border);
  background: color-mix(in srgb, var(--p-card-alt) 70%, transparent);
  font-family: var(--term-mono); font-size: 12px; color: var(--p-muted);
}
.win-dots { display: inline-flex; gap: 6px; flex-shrink: 0; }
.win-title { margin-left: 4px; letter-spacing: 0.3px; }
.win-body { padding: 20px 22px; }

/* --------------------------------------------------------------------------
 * Terminal section head — `$ ls publications` style prompt + box rule.
 * ------------------------------------------------------------------------ */
.term-head {
  display: flex; align-items: baseline; gap: 9px;
  margin: 0 0 18px; padding-bottom: 9px;
  font-family: var(--term-mono);
  border-bottom: 1px dashed var(--p-border);
}
.term-head .th-prompt { color: var(--p-accent); font-weight: 700; flex-shrink: 0; }
.term-head .th-cmd {
  color: var(--p-dark); font-weight: 700;
  font-size: 18.5px; letter-spacing: 0.3px;
}
.term-head .th-meta { margin-left: auto; font-size: 12px; color: var(--p-muted); }

/* --------------------------------------------------------------------------
 * Blinking cursor + inline prompt helpers.
 * ------------------------------------------------------------------------ */
.term-cursor {
  display: inline-block; width: 0.55em; height: 1.05em;
  vertical-align: text-bottom; margin-left: 3px;
  background: var(--p-accent);
  animation: term-blink 1.1s steps(1) infinite;
}
@keyframes term-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.prompt { font-family: var(--term-mono); color: var(--p-accent); font-weight: 700; }
.term-line { font-family: var(--term-mono); }

/* Box-drawing divider */
.cli-rule {
  border: 0; height: 0; margin: 22px 0;
  border-top: 1px dashed var(--p-border);
}

/* --------------------------------------------------------------------------
 * App-shell sidebar — larger, mono terminal labels (overrides vendored size).
 * ------------------------------------------------------------------------ */
.sidebar { flex: 0 0 210px; width: 210px; }
.sidebar a {
  font-family: var(--term-mono);
  font-size: 15px; padding: 8px 12px;
}

/* --------------------------------------------------------------------------
 * Profile / hero block — terminal "card" with prompt lines.
 * ------------------------------------------------------------------------ */
/* Avatar sits on the RIGHT and stretches to match the id block height
 * (top edge of the name → bottom edge of the social buttons). */
.profile-head { display: flex; gap: 24px; align-items: stretch; flex-wrap: wrap; }
.profile-avatar {
  align-self: stretch;
  width: 150px; height: auto; border-radius: var(--p-radius-lg);
  object-fit: cover; border: 1px solid var(--p-border); flex: 0 0 auto;
  order: 2;
}
.profile-id { flex: 1 1 260px; min-width: 240px; order: 1; }
.profile-id h1 {
  font-family: var(--p-font-brand);
  font-size: 33px; margin: 0 0 4px; letter-spacing: 0.01em;
}
.profile-id .p-title { color: var(--p-accent); font-family: var(--term-mono); font-weight: 600; font-size: 15px; }
.profile-id .p-affil { color: var(--p-muted); font-size: 14.5px; margin-top: 6px; }
.profile-bio { margin-top: 16px; color: var(--p-text); }

/* Social links row */
.social-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.social-row a.social-link {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: var(--p-radius-sm);
  border: 1px solid var(--p-border); background: var(--p-card-alt);
  color: var(--p-dark); text-decoration: none;
  font-family: var(--term-mono); font-size: 13.5px; font-weight: 600;
  transition: border-color var(--p-dur-fast), color var(--p-dur-fast);
}
.social-row a.social-link:hover { border-color: var(--p-accent); color: var(--p-accent); }
.social-row a.social-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* VAISR mark is a filled logo, not a stroke icon — render it monochrome via fill. */
.social-row a.social-link svg.vaisr-ico { fill: currentColor; stroke: none; }

/* Research interests as command-output tags */
.interest-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* Inline SVG sizing inside normal buttons / links (icon buttons override). */
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* --------------------------------------------------------------------------
 * Publication / award / generic list cards
 * ------------------------------------------------------------------------ */
.pub-list { display: flex; flex-direction: column; gap: 12px; }
.pub-item {
  border: 1px solid var(--p-border); border-radius: var(--p-radius);
  background: var(--p-card-bg); padding: 14px 16px;
  transition: border-color var(--p-dur-fast), box-shadow var(--p-dur-mid);
}
.pub-item:hover { border-color: var(--p-accent-border); box-shadow: 0 6px 16px var(--p-shadow); }
.pub-item .pub-title { font-size: 16.5px; font-weight: 700; color: var(--p-accent); margin: 0 0 6px; }
.pub-item .pub-authors { font-size: 14.5px; color: var(--p-text); margin-bottom: 6px; }
.pub-item .pub-authors .me { text-decoration: underline; font-weight: 700; }
.pub-item .pub-venue { font-family: var(--term-mono); font-size: 13.5px; color: var(--p-muted); }
.pub-item .pub-abs { font-size: 14px; color: var(--p-muted); margin-top: 8px; }
.pub-meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* Award / certificate gallery grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}
.gallery-item { display: flex; flex-direction: column; gap: 8px; }
.gallery-item .img-thumb { aspect-ratio: 4 / 3; width: 100%; }
.gallery-item .img-thumb img { height: 100%; }
.gallery-item .gi-title { font-size: 14.5px; font-weight: 600; color: var(--p-dark); line-height: 1.35; }
.gallery-item .gi-sub { font-size: 13px; color: var(--p-muted); font-family: var(--term-mono); }

/* --------------------------------------------------------------------------
 * Blog list + post
 * ------------------------------------------------------------------------ */
.post-list { display: flex; flex-direction: column; gap: 14px; }
.post-card {
  display: block; text-decoration: none;
  border: 1px solid var(--p-border); border-radius: var(--p-radius-lg);
  background: var(--p-card-bg); padding: 18px 20px; color: var(--p-text);
  transition: transform var(--p-dur-mid) var(--p-ease-out), border-color var(--p-dur-fast), box-shadow var(--p-dur-mid);
}
.post-card:hover { transform: translateY(-3px); border-color: var(--p-accent); box-shadow: 0 12px 30px var(--p-shadow); }
.post-card .pc-date { font-family: var(--term-mono); font-size: 12px; color: var(--p-muted); }
.post-card .pc-title { font-size: 18px; font-weight: 700; color: var(--p-dark); margin: 4px 0 6px; }
.post-card .pc-desc { font-size: 13.5px; color: var(--p-muted); margin-bottom: 10px; }
.post-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-family: var(--term-mono); font-size: 12px; color: var(--p-muted); }

.lang-switch { display: inline-flex; gap: 2px; padding: 3px; margin: 0 0 18px; background: var(--p-toggle-bg); border: 1px solid var(--p-border); border-radius: var(--p-radius-sm); }
.lang-switch button { padding: 5px 14px; border: 0; background: transparent; color: var(--p-muted); cursor: pointer; border-radius: 4px; font: inherit; font-family: var(--term-mono); font-size: 12.5px; font-weight: 600; transition: background var(--p-dur-fast), color var(--p-dur-fast); }
.lang-switch button[aria-selected="true"] { background: var(--p-accent); color: var(--p-accent-ink); }
.post-body { display: none; }
.post-body.active { display: block; animation: nubo-fade-up 0.28s ease both; }
.post-body img { max-width: 100%; border-radius: var(--p-radius); }

article.post h1 { font-family: var(--p-font-brand); font-size: 30px; margin: 0 0 6px; }

/* --------------------------------------------------------------------------
 * CV landing page
 * ------------------------------------------------------------------------ */
.cv-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 6px; }
.cv-block { margin-top: 26px; }
.edu-list { display: flex; flex-direction: column; }
.edu-item { padding: 4px 0 14px; }
.edu-item .ei-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.edu-item .ei-degree { font-weight: 700; color: var(--p-dark); font-size: 16px; }
.edu-item .ei-period { font-family: var(--term-mono); font-size: 13.5px; color: var(--p-muted); white-space: nowrap; }
.edu-item .ei-school { color: var(--p-text); font-size: 15px; }
.edu-item .ei-dept { color: var(--p-muted); font-size: 14px; }
.skill-group { margin-bottom: 14px; }
.skill-group .sg-label { font-family: var(--term-mono); color: var(--p-accent); font-weight: 700; font-size: 13px; margin-bottom: 7px; }

/* Homepage experience / services entry lists (also styled like CV entries). */
.cv-entries { display: flex; flex-direction: column; gap: 16px; }
.cv-entry .ce-head { font-weight: 700; color: var(--p-dark); font-size: 15px; }
.cv-entry .ce-sub { color: var(--p-text); font-size: 14.5px; margin-top: 2px; }
.cv-entry .ce-list { margin: 5px 0 0; padding-left: 20px; }
.cv-entry .ce-list li { margin: 4px 0; color: var(--p-text); font-size: 14.5px; }
.cv-entry .ce-period { font-family: var(--term-mono); font-size: 12.5px; color: var(--p-muted); white-space: nowrap; }

/* CV page — download / open buttons, grouped by language. */
.cv-download-grid { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 20px; }
.cv-dl-group { display: flex; flex-direction: column; gap: 10px; min-width: 220px; }
.cv-dl-label { font-family: var(--term-mono); font-weight: 700; font-size: 13px; color: var(--p-accent); letter-spacing: 0.3px; }

/* --------------------------------------------------------------------------
 * Space page + breadcrumb
 * ------------------------------------------------------------------------ */
.space-children { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 20px; }
.space-child {
  display: block; text-decoration: none; color: var(--p-text);
  border: 1px solid var(--p-border); border-radius: var(--p-radius);
  background: var(--p-card-bg); padding: 14px 16px;
  font-family: var(--term-mono);
  transition: border-color var(--p-dur-fast), transform var(--p-dur-mid) var(--p-ease-out);
}
.space-child:hover { border-color: var(--p-accent); transform: translateY(-2px); }
.space-child .sc-name { font-weight: 700; color: var(--p-dark); }
.space-child .sc-name::before { content: "› "; color: var(--p-accent); }
.space-child .sc-sub { font-size: 12px; color: var(--p-muted); margin-top: 4px; }
.prose { max-width: 760px; }
.prose h2 { margin-top: 28px; }
.prose h3 { margin-top: 20px; }
.prose img { max-width: 100%; border-radius: var(--p-radius); }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 4px 0; }

/* --------------------------------------------------------------------------
 * Footer
 * ------------------------------------------------------------------------ */
.site-foot .foot-prompt { font-family: var(--term-mono); }
.site-foot .foot-prompt .prompt { margin-right: 6px; }

/* --------------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------------ */
@media (max-width: 760px) {
  .sh-inner { flex-wrap: wrap; padding: 12px 18px; gap: 10px; }
  .term-nav { margin-left: 0; width: 100%; }
  .profile-head { gap: 16px; align-items: flex-start; }
  .profile-avatar { width: 120px; height: 120px; align-self: flex-start; order: 0; }
  .profile-id { order: 1; }
}
