/* ==========================================================================
   Editorial Dossier — Nguyễn Đình Lộc (locnguyen.info)
   Restrained typography, hairline rules, asymmetric grid, zero SaaS/AI tropes
   ========================================================================== */

:root {
  --bg: #fbfbf9;
  --surface: #f3f2ee;
  --ink: #141413;
  --text: #2e2e2c;
  --muted: #6b6a65;
  --rule: #e2e0d8;
  --rule-strong: #141413;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --nav-h: 60px;
}

html[data-theme="dark"] {
  --bg: #121211;
  --surface: #1b1b19;
  --ink: #f2f0ea;
  --text: #d4d2cb;
  --muted: #8e8c84;
  --rule: #2a2a27;
  --rule-strong: #f2f0ea;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  color: var(--ink);
  scroll-padding-top: calc(var(--nav-h) + 24px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.96875rem;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

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

a, button {
  font-variant-emoji: text;
}

::selection {
  background: var(--ink);
  color: var(--bg);
}

:focus-visible {
  outline: 1.5px solid var(--ink);
  outline-offset: 3px;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure {
  margin: 0;
  padding: 0;
}

ul, ol {
  list-style: none;
}

html[data-lang="en"] .vi,
html[data-lang="vi"] .en {
  display: none !important;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding-left: max(clamp(20px, 4.5vw, 48px), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(20px, 4.5vw, 48px), env(safe-area-inset-right, 0px));
}

.skip {
  position: fixed;
  left: 20px;
  top: -80px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.8125rem;
  font-weight: 500;
}
.skip:focus {
  top: 10px;
}

/* ==========================================================================
   Navigation Bar — Quiet, flat, typographic
   ========================================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.nav-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 100%;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.logo-seal {
  display: block;
  width: 26px;
  height: 26px;
  flex: none;
  transition: transform 200ms ease;
}

.logo:hover .logo-seal {
  transform: translateY(-1px);
}

.links {
  display: flex;
  align-items: center;
  gap: 22px;
}

.links a {
  font-size: 0.84375rem;
  color: var(--muted);
  padding: 4px 0;
  transition: color 150ms ease;
}

.links a:hover,
.links a.on {
  color: var(--ink);
}

.links a.on {
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
}

.nav-end {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.8125rem;
}

.lang {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.lang button {
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.lang button[aria-pressed="true"] {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.lang button:hover {
  color: var(--ink);
}

.theme-btn {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.theme-btn:hover {
  color: var(--ink);
}

html[data-theme="light"] .theme-label-dark { display: none; }
html[data-theme="dark"] .theme-label-light { display: none; }

.nav-cv {
  font-weight: 500;
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding-bottom: 1px;
  white-space: nowrap;
}

.nav-cv:hover {
  opacity: 0.65;
}

.menu {
  display: none;
  width: 36px;
  height: 36px;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  padding: 0;
}

.menu span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: currentColor;
  transition: transform 180ms ease;
}

.nav.open .menu span:first-child {
  transform: translateY(3.25px) rotate(45deg);
}

.nav.open .menu span:last-child {
  transform: translateY(-3.25px) rotate(-45deg);
}

.sheet {
  display: none;
  position: absolute;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  padding: 8px 20px 16px;
  flex-direction: column;
}

.nav.open .sheet {
  display: flex;
}

.sheet a {
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.9375rem;
  color: var(--text);
}

.sheet a:last-child {
  border-bottom: 0;
}

/* ==========================================================================
   Hero / Opening
   ========================================================================== */
.hero {
  padding: clamp(48px, 8vh, 88px) 0 clamp(44px, 6vh, 72px);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
}

.role {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.75rem, 5.5vw, 4.25rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.lead {
  margin-top: 22px;
  max-width: 58ch;
  font-size: clamp(1.0625rem, 1.35vw, 1.2rem);
  line-height: 1.62;
  color: var(--ink);
  font-weight: 400;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 22px;
  font-size: 0.875rem;
  color: var(--muted);
}

.hero-meta a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule-strong);
}

.hero-meta a:hover {
  opacity: 0.65;
}

.sep {
  color: var(--rule);
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 20px;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  transition: opacity 150ms ease, background-color 150ms ease, color 150ms ease;
}

.btn:hover {
  opacity: 0.82;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-strong);
}

.btn.ghost:hover {
  background: var(--surface);
  opacity: 1;
}

.portrait {
  width: 220px;
}

.portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 4.8;
  object-fit: cover;
  object-position: 50% 16%;
  filter: contrast(1.02);
}

/* Key Figures Row — Clean typographic columns, no boxes */
.figures {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px 32px;
  margin-top: clamp(44px, 7vh, 72px);
  padding-top: 24px;
  border-top: 1px solid var(--ink);
}

.figures dt {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 3.5vw, 2.85rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: lining-nums;
}

.figures dt small {
  font-size: 0.55em;
  color: var(--muted);
}

.figures dd {
  margin-top: 8px;
  font-size: 0.84375rem;
  line-height: 1.48;
  color: var(--muted);
  max-width: 24ch;
}

/* ==========================================================================
   Editorial Section Grid (Left Title Column + Right Content Column)
   ========================================================================== */
.section {
  padding: clamp(44px, 7vh, 80px) 0;
  border-top: 1px solid var(--rule);
}

.section-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px clamp(36px, 5vw, 72px);
  align-items: start;
}

.section-heading {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.5rem, 2.2vw, 1.85rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.section-sub {
  margin-top: 8px;
  font-size: 0.84375rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ==========================================================================
   About Section
   ========================================================================== */
.about-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 32px 48px;
  align-items: start;
}

.about-prose p + p {
  margin-top: 16px;
}

.availability-note {
  padding-left: 14px;
  border-left: 1.5px solid var(--ink);
  color: var(--ink);
  font-size: 0.90625rem;
}

.about-facts {
  border-top: 1px solid var(--rule);
}

.about-facts li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
}

.fact-k {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.fact-v {
  font-size: 0.90625rem;
  color: var(--ink);
  font-weight: 500;
}

/* ==========================================================================
   Experience Entries
   ========================================================================== */
.job {
  display: grid;
  grid-template-columns: 185px minmax(0, 1fr);
  gap: 20px 40px;
  padding: 36px 0;
  border-top: 1px solid var(--rule);
}

.job:first-child {
  padding-top: 0;
  border-top: 0;
}

.job-logo {
  margin-bottom: 12px;
}

.job-logo img {
  display: block;
  height: 22px;
  width: auto;
}

.job-logo.wide img {
  height: 32px;
}

html[data-theme="dark"] .job-logo img,
html[data-theme="dark"] .invert-dark {
  filter: brightness(0) invert(1);
}

html[data-theme="dark"] .job-logo.wide img {
  filter: none;
  background: #ffffff;
  padding: 4px 8px;
}

.job-date {
  font-size: 0.84375rem;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.job-loc {
  margin-top: 2px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.job-loc a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.job-metrics {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.job-metrics dt {
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink);
}

.job-metrics dd {
  font-size: 0.78125rem;
  color: var(--muted);
  margin-top: 2px;
}

.job-body h3 {
  font-family: var(--sans);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.where {
  margin-top: 2px;
  margin-bottom: 16px;
  font-size: 0.875rem;
  color: var(--muted);
}

.job-body ul {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.job-body li {
  position: relative;
  padding-left: 18px;
  color: var(--text);
}

.job-body li::before {
  content: "–";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--muted);
}

/* Understated Contact-Sheet Proof Strip */
.proofs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 20px;
}

.proof {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 6px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 150ms ease;
}

.proof:hover {
  border-color: var(--ink);
}

.proof img {
  display: block;
  width: 34px;
  height: 24px;
  object-fit: cover;
  border: 1px solid var(--rule);
}

/* ==========================================================================
   Research & Awards
   ========================================================================== */
.paper {
  padding: 32px 0;
  border-top: 1px solid var(--rule);
}

.paper:first-child {
  padding-top: 0;
  border-top: 0;
}

.paper-date {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.paper h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.35rem;
  line-height: 1.32;
  color: var(--ink);
  margin-bottom: 8px;
}

.paper p + p {
  margin-top: 10px;
}

.muted {
  color: var(--muted);
  font-size: 0.875rem;
}

.text-link {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.text-link:hover {
  opacity: 0.65;
}

.awards {
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}

.awards h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 14px;
}

.ledger li {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--rule);
  font-size: 0.90625rem;
  align-items: baseline;
}

.ledger i {
  font-style: normal;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.84375rem;
}

/* ==========================================================================
   Skills & Tools Ledger
   ========================================================================== */
.tools-ledger {
  border-top: 1px solid var(--rule);
}

.tools-ledger li {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px 28px;
  padding: 15px 0;
  border-bottom: 1px solid var(--rule);
  align-items: center;
}

.tool-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.tool-name img {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.tool-name strong {
  font-weight: 600;
  font-size: 0.9375rem;
}

.tool-desc {
  font-size: 0.90625rem;
  color: var(--text);
}

.note {
  margin-top: 18px;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ==========================================================================
   Coursework — Clean Academic Transcript Table (No Progress Bars)
   ========================================================================== */
.academic {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}

.acad-head h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.acad-head p {
  margin-top: 4px;
}

.acad-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 36px;
  margin-top: 22px;
}

.acad-group h4 {
  font-size: 0.78125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ink);
}

.acad-group dl > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.875rem;
}

.acad-group dt {
  color: var(--text);
}

.acad-group dd {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.acad-group dd span {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.78125rem;
}

/* ==========================================================================
   Contact & Footer
   ========================================================================== */
.contact-lead {
  max-width: 54ch;
  font-size: 1.0625rem;
  color: var(--ink);
  margin-bottom: 24px;
}

.contact-rows {
  border-top: 1px solid var(--rule);
}

.contact-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}

.contact-k {
  font-size: 0.8125rem;
  color: var(--muted);
}

.contact-v {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
}

.contact-v a {
  font-weight: 500;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.contact-v a:hover {
  opacity: 0.65;
}

.copy {
  padding: 2px 8px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.copy:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.copied {
  font-size: 0.78125rem;
  color: var(--muted);
}

.foot {
  padding: 28px 0 40px;
  border-top: 1px solid var(--rule);
  font-size: 0.8125rem;
  color: var(--muted);
}

.foot-in {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.to-top:hover {
  color: var(--ink);
}

/* ==========================================================================
   Lightbox Proof Dialog
   ========================================================================== */
.modal {
  overflow: hidden;
}

.viewer {
  width: min(94vw, 920px);
  max-width: none;
  max-height: 92dvh;
  padding: 16px;
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  overflow: auto;
}

.viewer::backdrop {
  background: rgba(18, 18, 17, 0.76);
}

.vfoot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  font-size: 0.875rem;
}

.viewer-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
}

.viewer .full {
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}

.viewer .close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.viewer .frame {
  --r: 1.5;
  width: min(100%, calc((92dvh - 130px) * var(--r)));
  aspect-ratio: var(--r);
  margin: 0 auto;
}

.viewer img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.viewer .state {
  margin-top: 10px;
  font-size: 0.84375rem;
  color: var(--muted);
  text-align: center;
}

.viewer .state:empty {
  display: none;
}

/* ==========================================================================
   Responsive Layout
   ========================================================================== */
@media (max-width: 900px) {
  .links, .nav-cv {
    display: none;
  }
  .menu {
    display: inline-flex;
  }
  .hero-grid {
    grid-template-columns: 1fr 160px;
    gap: 28px;
  }
  .portrait {
    width: 160px;
  }
  .figures {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .section-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .about-cols,
  .acad-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .portrait {
    order: -1;
    width: 112px;
  }
  .job {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .job-metrics {
    flex-direction: row;
    gap: 28px;
  }
  .tools-ledger li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .ledger li,
  .contact-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
