/* ─── TOKENS ─────────────────────────────────────────── */
:root {
  --bg:            #0e0f11;
  --bg-secondary:  #13141a;
  --bg-card:       #161820;
  --bg-toc:        #13141a;
  --border:        #2a2c38;
  --border-light:  #1e2029;
  --text:          #e8e9ef;
  --text-muted:    #8b8fa8;
  --text-light:    #5a5e74;
  --link:          #c8a97e;
  --link-visited:  #a07c5a;
  --accent:        #c8a97e;
  --accent-glow:   rgba(200, 169, 126, 0.12);
  --header-bg:     rgba(14, 15, 17, 0.92);
  --header-border: #1e2029;
  --rule:          #2a2c38;
  --th-bg:         #181a22;
  --num-color:     #3a3d52;

  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition: 0.25s var(--ease-out);
}

body.light-mode {
  --bg:            #f5f2ec;
  --bg-secondary:  #efebe3;
  --bg-card:       #faf8f4;
  --bg-toc:        #efebe3;
  --border:        #c8bfad;
  --border-light:  #ddd8ce;
  --text:          #1a1916;
  --text-muted:    #6b6456;
  --text-light:    #9c9182;
  --link:          #8b5e2a;
  --link-visited:  #6a4520;
  --accent:        #8b5e2a;
  --accent-glow:   rgba(139, 94, 42, 0.10);
  --header-bg:     rgba(245, 242, 236, 0.94);
  --header-border: #c8bfad;
  --rule:          #c8bfad;
  --th-bg:         #e8e2d8;
  --num-color:     #c8bfad;
}

/* ─── RESET ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

/* ─── BACKGROUND ─────────────────────────────────────── */
.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(var(--border-light) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-light) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.4;
}

.bg-glow {
  position: fixed; top: -30vh; left: 50%; transform: translateX(-50%);
  width: 80vw; height: 60vh;
  background: radial-gradient(ellipse at center, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}

/* ─── BASE ───────────────────────────────────────────── */
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.75;
  position: relative;
}

a { color: var(--link); text-decoration: none; transition: opacity var(--transition), color var(--transition); }
a:visited { color: var(--link-visited); }
a:hover { opacity: 0.75; text-decoration: underline; }

.container { max-width: 900px; margin: 0 auto; padding: 0 2rem; position: relative; z-index: 1; }

/* ─── HEADER ─────────────────────────────────────────── */
#site-header {
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  padding: 0.7rem 0;
  position: sticky; top: 0; z-index: 200;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header-inner { display: flex; align-items: center; gap: 1rem; flex-wrap: nowrap; }

.site-title a {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

nav { flex: 1; overflow: hidden; }

.nav-links { list-style: none; display: flex; gap: 0; flex-wrap: nowrap; align-items: center; }

.nav-links li a {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: color var(--transition);
}

.nav-links li a:hover,
.nav-links li a.active,
.nav-links li a[aria-current="page"] { color: var(--accent); }

.nav-links li a.active,
.nav-links li a[aria-current="page"] { position: relative; }

.nav-links li a.active::after,
.nav-links li a[aria-current="page"]::after {
  content: ''; position: absolute; bottom: 0;
  left: 0.7rem; right: 0.7rem;
  height: 1px; background: var(--accent);
}

/* ─── THEME TOGGLE ───────────────────────────────────── */
#theme-toggle {
  font-family: var(--font-mono); font-size: 0.72rem;
  padding: 0.3rem 0.75rem;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; white-space: nowrap;
  display: flex; align-items: center; gap: 0.4rem;
  letter-spacing: 0.04em; border-radius: 2px;
  transition: border-color var(--transition), color var(--transition);
}
#theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.toggle-icon { font-size: 0.85rem; line-height: 1; }

/* ─── MOBILE MENU ────────────────────────────────────── */
.mobile-menu-btn {
  display: none; background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; font-size: 1rem;
  padding: 0.25rem 0.5rem; border-radius: 2px;
}

.mobile-nav {
  display: none; background: var(--bg-secondary);
  border-top: 1px solid var(--border); padding: 0.5rem 0;
}
.mobile-nav ul { list-style: none; }
.mobile-nav ul li a {
  display: block; padding: 0.6rem 1.5rem;
  font-family: var(--font-mono); font-size: 0.82rem;
  color: var(--text-muted); letter-spacing: 0.04em;
}
.mobile-nav ul li a:hover { color: var(--accent); }
.mobile-nav.open { display: block; }

/* ─── MAIN ───────────────────────────────────────────── */
#main-content { padding-top: 4rem; padding-bottom: 6rem; }
section { margin-bottom: 5rem; }

/* ─── REVEAL ─────────────────────────────────────────── */
.reveal {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.65s var(--ease-out), transform 0.65s var(--ease-out);
}
.reveal.visible { opacity: 1; transform: none; }

/* ─── SECTION HEADER ─────────────────────────────────── */
.section-header { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 0.4rem; }

.section-num {
  font-family: var(--font-mono); font-size: 0.7rem;
  color: var(--num-color); letter-spacing: 0.08em; flex-shrink: 0;
}

h2 {
  font-family: var(--font-display); font-size: 1.65rem;
  font-weight: 400; color: var(--text);
  letter-spacing: -0.01em; line-height: 1.2;
}

.section-rule { border: none; border-top: 1px solid var(--rule); margin-bottom: 1.4rem; }

.section-desc { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 1.5rem; max-width: 560px; }

p { margin-bottom: 1rem; font-size: 0.95rem; color: var(--text); }

/* ─── HERO ───────────────────────────────────────────── */
.hero-section { padding-top: 2rem; padding-bottom: 1rem; }

.hero-tag {
  font-family: var(--font-mono); font-size: 0.68rem;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 1.2rem;
  display: flex; align-items: center; gap: 0.6rem;
}
.hero-tag::after { content: ''; display: block; width: 40px; height: 1px; background: var(--accent); opacity: 0.5; }

h1 {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 400; line-height: 1.0;
  color: var(--text); letter-spacing: -0.02em;
  margin-bottom: 0.8rem;
}
h1 em { font-style: italic; color: var(--accent); }

.subtitle {
  font-family: var(--font-mono); font-size: 0.8rem;
  color: var(--text-muted); letter-spacing: 0.12em;
  text-transform: uppercase; margin-bottom: 1.4rem;
}

.lead {
  font-size: 1rem; color: var(--text-muted);
  max-width: 520px; line-height: 1.8;
  margin-bottom: 2rem; font-weight: 300;
}

.hero-divider { width: 40px; height: 2px; background: var(--accent); margin: 2rem 0; opacity: 0.6; }

.home-lower { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 2rem; align-items: flex-start; }

.intro-para { font-size: 0.95rem; color: var(--text-muted); max-width: 680px; line-height: 1.9; margin-top: 1.5rem; }

/* ─── INFOBOX ────────────────────────────────────────── */
.infobox {
  background: var(--bg-card);
  border: 1px solid var(--border);
  min-width: 200px;
  position: relative;
}
.infobox::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 2px; height: 100%; background: var(--accent); opacity: 0.6;
}
.infobox-title {
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted); padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  margin: 0;
}
.infobox table { width: 100%; border-collapse: collapse; }
.infobox th, .infobox td {
  padding: 0.4rem 1rem; font-size: 0.82rem;
  border-bottom: 1px solid var(--border-light);
  text-align: left; vertical-align: top;
}
.infobox tr:last-child th,
.infobox tr:last-child td { border-bottom: none; }
.infobox th {
  font-family: var(--font-mono); font-size: 0.7rem;
  color: var(--text-muted); font-weight: 500;
  letter-spacing: 0.04em; white-space: nowrap;
  width: 90px;
}
.infobox td { color: var(--text); }

/* ─── TOC ────────────────────────────────────────────── */
.toc-box {
  display: inline-block;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.9rem 1.3rem;
  min-width: 200px;
  position: relative;
}
.toc-box::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 2px; height: 100%; background: var(--accent); opacity: 0.6;
}
.toc-title {
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 0.7rem;
}
.toc-list { padding-left: 1.1rem; font-size: 0.875rem; line-height: 2; }
.toc-list a { color: var(--text-muted); text-decoration: none; transition: color var(--transition); }
.toc-list a:hover { color: var(--accent); }

/* ─── ABOUT ──────────────────────────────────────────── */
.about-body p { font-size: 0.96rem; line-height: 1.9; color: var(--text); max-width: 680px; }

.about-cores { margin: 1.2rem 0; }
.about-cores h3 {
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 0.6rem;
}
.core-list {
  list-style: none; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.core-list li {
  font-family: var(--font-mono); font-size: 0.78rem;
  color: var(--text-muted); letter-spacing: 0.04em;
  border: 1px solid var(--border); padding: 0.25rem 0.75rem;
  background: var(--bg-card);
}

/* ─── SKILLS GRID ────────────────────────────────────── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-top: 0.5rem;
}

.skill-group {
  padding: 1.4rem 1.3rem;
  background-color: var(--bg-card);
  transition: background-color var(--transition);
}
.skill-group:hover { background-color: var(--bg-secondary); }

.skill-group h3 {
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--accent); margin-top: 0; margin-bottom: 1rem;
  padding-bottom: 0.6rem; border-bottom: 1px solid var(--border);
}

.skill-list { list-style: none; padding: 0; }
.skill-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border-light); }
.skill-list li:last-child { border-bottom: none; padding-bottom: 0; }
.skill-name { display: block; font-size: 0.875rem; font-weight: 500; color: var(--text); margin-bottom: 0.1rem; }
.skill-note { display: block; font-size: 0.78rem; color: var(--text-muted); font-family: var(--font-mono); line-height: 1.5; }

/* ─── PROJECTS ───────────────────────────────────────── */
.project-entry {
  border: 1px solid var(--border);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1px;
  background-color: var(--bg-card);
  position: relative; overflow: hidden;
  opacity: 0; transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease,
              background-color 0.25s ease, border-color 0.25s ease;
}
.project-entry.visible { opacity: 1; transform: none; }

.project-entry::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 0; height: 2px; background: var(--accent);
  transition: width 0.4s var(--ease-out);
}
.project-entry:hover::before { width: 100%; }
.project-entry:hover { background-color: var(--bg-secondary); }

.project-header {
  display: flex; align-items: baseline; gap: 0.9rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.7rem; margin-bottom: 0.8rem;
}
.project-num { font-family: var(--font-mono); font-size: 0.68rem; color: var(--num-color); letter-spacing: 0.08em; flex-shrink: 0; }

.project-entry h3 {
  font-family: var(--font-display); font-size: 1rem;
  font-weight: 400; color: var(--text); margin: 0; line-height: 1.3;
}

.project-stack {
  font-family: var(--font-mono); font-size: 0.76rem;
  color: var(--text-muted); margin-bottom: 0.4rem;
}
.project-desc { font-size: 0.85rem; color: var(--text-muted); font-style: italic; margin-bottom: 0.8rem; }

.project-links { display: flex; gap: 1.5rem; font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); }

/* ─── CONTACT ────────────────────────────────────────── */
.contact-table { border-collapse: collapse; font-size: 0.9rem; width: 100%; max-width: 520px; margin-top: 0.5rem; }
.contact-table th,
.contact-table td { padding: 0.65rem 0.85rem; border: 1px solid var(--border); text-align: left; vertical-align: middle; }
.contact-table th {
  background-color: var(--th-bg);
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  width: 120px; color: var(--text-muted);
}
.contact-table td a { font-family: var(--font-mono); font-size: 0.82rem; }

/* ─── CERTIFICATIONS PAGE ────────────────────────────── */
.page-hero { margin-bottom: 4rem; }

.back-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-mono); font-size: 0.76rem;
  color: var(--text-muted); letter-spacing: 0.04em;
  text-decoration: none; margin-bottom: 2rem;
  transition: color var(--transition);
}
.back-link:hover { color: var(--accent); text-decoration: none; opacity: 1; }

.cert-list { display: flex; flex-direction: column; gap: 1px; }

.cert-entry {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 1.4rem 1.5rem; position: relative; overflow: hidden;
  opacity: 0; transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease,
              background-color 0.25s ease;
}
.cert-entry.visible { opacity: 1; transform: none; }
.cert-entry::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 0; height: 2px; background: var(--accent);
  transition: width 0.4s var(--ease-out);
}
.cert-entry:hover::before { width: 100%; }
.cert-entry:hover { background-color: var(--bg-secondary); }

.cert-inner { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.cert-body { flex: 1; min-width: 0; }
.cert-index { font-family: var(--font-mono); font-size: 0.68rem; color: var(--num-color); letter-spacing: 0.08em; margin-bottom: 0.4rem; display: block; }
.cert-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 400; color: var(--text); margin-bottom: 0.3rem; line-height: 1.3; }
.cert-issuer { font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-muted); letter-spacing: 0.04em; }
.cert-issuer span { color: var(--accent); margin-left: 0.4rem; }

.cert-verify {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-mono); font-size: 0.74rem;
  color: var(--accent); letter-spacing: 0.04em;
  border: 1px solid var(--border); padding: 0.4rem 0.85rem;
  border-radius: 2px; white-space: nowrap; align-self: center; flex-shrink: 0;
  transition: border-color var(--transition), background-color var(--transition);
}
.cert-verify::after { content: ' →'; }
.cert-verify:hover { border-color: var(--accent); background: var(--accent-glow); opacity: 1; text-decoration: none; }

.notes-section { margin-top: 3.5rem; }
.notes-section p { font-size: 0.88rem; color: var(--text-muted); max-width: 520px; }

/* ─── FOOTER ─────────────────────────────────────────── */
#site-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 1.8rem 0; position: relative; z-index: 1;
}
.footer-inner {
  font-family: var(--font-mono); font-size: 0.72rem;
  color: var(--text-light); letter-spacing: 0.04em;
  display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 0.5rem;
}
.footer-inner a { color: var(--link); }

/* ─── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 720px) {
  h1 { font-size: clamp(2.4rem, 10vw, 3.6rem); }
  h2 { font-size: 1.35rem; }
  .container { padding: 0 1.2rem; }
  .nav-links { display: none; }
  .mobile-menu-btn { display: block; }
  .skills-grid { grid-template-columns: 1fr; }
  .home-lower { flex-direction: column; }
  .infobox { width: 100%; }
  .toc-box { width: 100%; }
  .cert-verify { width: 100%; justify-content: center; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 400px) {
  #theme-toggle .toggle-label { display: none; }
}
