/* ── TOKENS ──────────────────────────────────────────────── */
:root {
  --bg: #ffffff;
  --bg-secondary: #f6f5f2;
  --text: #141414;
  --text-secondary: #6b6b6b;
  --text-tertiary: #a8a8a8;
  --border: rgba(0, 0, 0, 0.09);
  --border-md: rgba(0, 0, 0, 0.16);
  --radius-md: 8px;
  --radius-lg: 12px;
  --bull: #1D9E75;
  --bear: #D85A30;
  --amber: #EF9F27;
  --amber-bg: #FAEEDA;
  --amber-text: #854F0B;
  --amber-border: #FAC775;
  --green-bg: #EAF3DE;
  --green-text: #3B6D11;
  --green-border: #97C459;
  --blue-bg: #DEEAF6;
  --blue-text: #1A5276;
  --blue-border: #5DADE2;
  --info: #185FA5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --bg-secondary: #1c1c1c;
    --text: #efefef;
    --text-secondary: #9a9a9a;
    --text-tertiary: #5a5a5a;
    --border: rgba(255, 255, 255, 0.09);
    --border-md: rgba(255, 255, 255, 0.16);
    --amber-bg: #2c1a04;
    --amber-text: #FAC775;
    --amber-border: #854F0B;
    --green-bg: #0d2004;
    --green-text: #C0DD97;
    --green-border: #3B6D11;
    --blue-bg: #0a1929;
    --blue-text: #90CAF9;
    --blue-border: #1A5276;
    --info: #85B7EB;
  }
}

/* ── RESET ───────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

hr {
  border: none;
}

/* ── LAYOUT ──────────────────────────────────────────────── */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
}

.section {
  margin: 3.5rem 0;
}

.divider {
  border-top: 0.5px solid var(--border);
}

/* ── NAV ─────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 3.5rem;
  flex-wrap: wrap;
}

.nav-brand {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 500;
}

.nav-link {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-tertiary);
  transition: color 0.15s;
}

.nav-link:hover {
  color: var(--text);
}

.open-badge {
  margin-left: auto;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--green-text);
  background: var(--green-bg);
  border: 0.5px solid var(--green-border);
  padding: 3px 10px;
  border-radius: var(--radius-md);
}

/* ── HERO ────────────────────────────────────────────────── */
.hero-role {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 0.4rem;
}

.hero-name {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: clamp(36px, 6vw, 48px);
  font-weight: 400;
  line-height: 1.08;
  margin-bottom: 0.8rem;
}

.hero-tagline {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 0.6rem;
}

.hero-meta {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-break {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  background: transparent;
  transition: background 0.15s, color 0.15s;
}

.btn-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn:hover {
  background: var(--bg-secondary);
}

.btn--private {
  opacity: 0.5;
  cursor: default;
}

.btn--private:hover {
  background: transparent;
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.btn-primary:hover {
  opacity: 0.88;
  background: var(--text);
}

/* ── SECTION LABEL ───────────────────────────────────────── */
.section-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

/* ── RESEARCH ────────────────────────────────────────────── */
.research-title-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 0.75rem;
}

.research-title-row .research-title {
  margin-bottom: 0;
}

.research-title-row .exp-period {
  margin-top: 6px;
}

.research-title {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: clamp(20px, 3vw, 24px);
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.research-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.badge {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 3px 8px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}

.badge-amber {
  background: var(--amber-bg);
  color: var(--amber-text);
  border-color: var(--amber-border);
}

.badge-green {
  background: var(--green-bg);
  color: var(--green-text);
  border-color: var(--green-border);
}

.badge-blue {
  background: var(--blue-bg);
  color: var(--blue-text);
  border-color: var(--blue-border);
}

.research-abstract {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 1.5rem;
}

/* ── CHART ───────────────────────────────────────────────── */
.chart-wrap {
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
  background: var(--bg-secondary);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

.chart-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-tertiary);
}

.legend-row {
  display: flex;
  gap: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-swatch {
  width: 10px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
}

#ohlcChart {
  width: 100%;
  height: 220px;
  display: block;
}

.chart-annotation {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 6px 16px 10px;
  text-align: right;
}

/* ── METRICS ─────────────────────────────────────────────── */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 1.75rem;
}

.metric {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
}

.metric-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.metric-value {
  font-size: 22px;
  font-weight: 500;
}

.metric-sub {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ── METHODOLOGY ─────────────────────────────────────────── */
.method-flow {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.mstep {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 5px 10px;
  background: var(--bg-secondary);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}

.marrow {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ── LOA ─────────────────────────────────────────────────── */
.loa-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bull);
  flex-shrink: 0;
  margin-top: 6px;
}

.loa-content {
  line-height: 1.5;
}

.loa-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.loa-link {
  font-size: 13px;
  color: var(--info);
}

.loa-link:hover {
  text-decoration: underline;
}

/* ── SKILLS ──────────────────────────────────────────────── */
.skills-grid {
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.skill-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  border-bottom: 0.5px solid var(--border);
}

.skill-row:last-child {
  border-bottom: none;
}

.skill-cat {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 13px 16px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
}

.skill-items {
  padding: 13px 16px;
  font-size: 14px;
  color: var(--text);
}

/* ── PROJECTS ────────────────────────────────────────────── */
.projects-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.projects-header .section-label {
  margin-bottom: 0;
}

.projects-nav {
  display: flex;
  gap: 6px;
}

.projects-arrow {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border-md);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, opacity 0.2s;
}

.projects-arrow:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.projects-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Firefox */
  padding-bottom: 4px;
}

.projects-grid::-webkit-scrollbar {
  display: none;
  /* Chrome / Safari */
}

.project-card {
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  min-width: calc((100% - 20px) / 3);
  /* show 3 cards */
  max-width: calc((100% - 20px) / 3);
  flex-shrink: 0;
  scroll-snap-align: start;
}

.project-name {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
}

.project-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1rem;
  flex: 1;
}

.tech-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 1rem;
}

.tech-tag {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 2px 7px;
  background: var(--bg-secondary);
  border-radius: 4px;
  color: var(--text-secondary);
}

.card-links {
  display: flex;
  gap: 6px;
}

.card-link {
  font-size: 12px;
  color: var(--text-secondary);
  border: 0.5px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-md);
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.icon-gh,
.icon-lock,
.icon-ext {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.card-link--private {
  opacity: 0.5;
  cursor: default;
  font-size: 11px;
}

.card-link:hover {
  background: var(--bg-secondary);
}

/* ── EXPERIENCE ──────────────────────────────────────────── */
.exp-list {
  display: flex;
  flex-direction: column;
}

.exp-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 1rem 0;
  border-bottom: 0.5px solid var(--border);
  align-items: start;
}

.exp-item:first-child {
  padding-top: 0;
}

.exp-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.exp-role {
  font-size: 15px;
  font-weight: 500;
}

.exp-org {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.exp-detail {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 5px;
  line-height: 1.55;
}

.exp-period {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  text-align: right;
  margin-top: 2px;
}

.research-meta .exp-period {
  margin-left: auto;
  margin-top: 0;
}

/* ── CREDENTIALS ─────────────────────────────────────────── */
.cred-group {
  margin-bottom: 1.25rem;
}

.cred-group:last-child {
  margin-bottom: 0;
}

.cred-group-title {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.cred-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cred-item {
  display: inline-block;
  font-size: 13px;
  padding: 5px 12px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: background 0.15s;
}

a.cred-item:hover {
  background: var(--bg-secondary);
}

.cred-list {
  display: flex;
  flex-direction: column;
}

.cred-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 0.5px solid var(--border);
}

.cred-row:last-child {
  border-bottom: none;
}

.cred-row .cred-item {
  border: none;
  padding: 0;
}

/* ── FOOTER ──────────────────────────────────────────────── */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 1.75rem 0 2.5rem;
}

.footer-email {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-tertiary);
}

.footer-logo {
  display: block;
  width: 18px;
  height: 18px;
  opacity: 0.75;
  transition: opacity .2s ease;
}

.footer-email:hover {
  color: var(--text-secondary);
}

.footer-email:hover .footer-logo {
  opacity: 1;
}

.footer-location {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-tertiary);
}
