*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #f5f7f2;
  --bg-card: #fff;
  --surface: #d8e9d2;
  --accent: #40916c;
  --primary: #1b4332;
  --text-1: #1b4332;
  --text-2: rgba(27, 67, 50, 0.75);
  --text-3: rgba(27, 67, 50, 0.5);
  --line: #d8e9d2;
  --line-2: #b7d7a8;
  --tag-bg: rgba(216, 233, 210, 0.5);
  --hover: rgba(216, 233, 210, 0.4);
  --sans: "Space Grotesk", -apple-system, system-ui, sans-serif;
  --mono: "JetBrains Mono", monospace;
  --r: 10px;
  --shadow: 0 2px 8px rgba(27, 67, 50, 0.04);
}

[data-theme="dark"] {
  --bg: #0f1a14;
  --bg-card: #162220;
  --surface: #1e3a2c;
  --accent: #52b788;
  --primary: #d8f3dc;
  --text-1: #d8f3dc;
  --text-2: rgba(216, 243, 220, 0.72);
  --text-3: rgba(216, 243, 220, 0.42);
  --line: #1e3a2c;
  --line-2: #2d5a3f;
  --tag-bg: rgba(30, 58, 44, 0.6);
  --hover: rgba(30, 58, 44, 0.5);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
[data-theme="dark"] ::selection {
  background: var(--accent);
  color: var(--bg);
}
[data-theme="dark"] .featured-img {
  background: #1a2e24 !important;
}

[data-theme="dark"] .featured-tech .tag {
  background: rgba(82, 183, 136, 0.1);
}
[data-theme="dark"] .cli-green {
  background: rgba(82, 183, 136, 0.1);
}
[data-theme="dark"] .cli-dark {
  background: rgba(216, 243, 220, 0.06);
}
[data-theme="dark"] .cert-done {
  background: rgba(82, 183, 136, 0.1);
}
[data-theme="dark"] .cert-wip {
  background: rgba(216, 243, 220, 0.06);
}
[data-theme="dark"] .back-to-top {
  background: var(--accent);
  color: var(--bg);
  border-color: rgba(82, 183, 136, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .back-to-top:hover {
  background: var(--primary);
  color: var(--bg);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}

body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--sans);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  opacity: 0;
  transition: opacity 0.35s ease;
}
body.loaded {
  opacity: 1;
}

::selection {
  background: var(--primary);
  color: #f5f7f2;
}
a {
  color: inherit;
}
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ── FOCUS ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
:focus:not(:focus-visible) {
  outline: none;
}

/* ── SKIP LINK ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--primary);
  color: var(--bg);
  padding: 0.5rem 1rem;
  border-radius: 0 0 8px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  z-index: 10000;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0;
}

/* ── LAYOUT ── */
.page {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── TAP TARGET ── */
@media (pointer: coarse) {
  a,
  button {
    min-height: 44px;
  }
}

/* ── PROGRESS BAR ── */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--accent);
  z-index: 1000;
  transition: width 0.05s linear;
  will-change: width;
}

/* ── HEADER ── */
.header {
  padding: 4.5rem 0 0;
  margin-bottom: 2.5rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 1.5rem;
}
.header-meta {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1rem;
}
.header h1 {
  font-size: clamp(2.5rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 0.6rem;
}
.header-role {
  font-size: 1.05rem;
  color: var(--text-2);
  font-weight: 400;
  margin-bottom: 1.25rem;
}
.header-bio {
  font-size: 0.92rem;
  color: var(--text-2);
  line-height: 1.65;
  max-width: 580px;
  margin-bottom: 1.5rem;
}
.header-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.stat-pill {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--primary);
  background: var(--tag-bg);
  border: 1px solid var(--line);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
}
.stat-pill .stat-label {
  font-weight: 400;
  color: var(--text-3);
  margin-right: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.65rem;
}

/* ── SECTION TITLES ── */
.section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.section-num {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--text-3);
}
.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ── FEATURED PROJECTS ── */
.featured {
  margin-bottom: 3rem;
}
.featured-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.featured-card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-card);
  text-decoration: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    transform 0.2s;
}
.featured-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(27, 67, 50, 0.08);
  transform: translateY(-2px);
}
.featured-img {
  width: 100%;
  aspect-ratio: 16/10;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
}
.featured-card:hover .featured-img {
  transform: scale(1.02);
}

.featured-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.featured-img-placeholder {
  width: 100%;
  height: 100%;
  background: var(--surface);
}

.featured-body {
  padding: 1rem;
}
.featured-name {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.15rem;
}
.featured-year {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-3);
  margin-bottom: 0.3rem;
}
.featured-desc {
  font-size: 0.8rem;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 0.6rem;
}
.featured-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.featured-tech .tag {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--accent);
  background: rgba(64, 145, 108, 0.08);
  padding: 0.15rem 0.45rem;
  border-radius: 100px;
}

/* ── OTHER PROJECTS ── */
.projects {
  margin-bottom: 3rem;
}
.project-list {
  display: flex;
  flex-direction: column;
}
.project {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: start;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
}
.project:hover {
  opacity: 0.75;
  transform: translateX(3px);
}
.project-info {
  min-width: 0;
}
.project-name {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.15rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.project-name .ext-icon {
  opacity: 0.3;
  flex-shrink: 0;
}
.project:hover .ext-icon {
  opacity: 0.7;
}
.project-desc {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.5;
}
.project-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  padding-top: 2px;
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: flex-end;
}
.tag {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-2);
  background: var(--tag-bg);
  padding: 0.2rem 0.5rem;
  border-radius: 100px;
  white-space: nowrap;
}
.project-year {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-3);
}

/* ── EXPERIENCE ── */
.experience {
  margin-bottom: 3rem;
}
.exp-list {
  display: flex;
  flex-direction: column;
}
.exp-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.exp-item:last-child {
  border-bottom: none;
}
.exp-role {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.1rem;
}
.exp-company {
  font-size: 0.82rem;
  color: var(--text-2);
}
.exp-desc {
  font-size: 0.78rem;
  color: var(--text-3);
  line-height: 1.55;
  margin-top: 0.35rem;
  max-width: 480px;
}
.exp-date {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-3);
  white-space: nowrap;
  padding-top: 3px;
}

/* ── CERTIFICATIONS ── */
.certs {
  margin-bottom: 3rem;
}
.cert-list {
  display: flex;
  flex-direction: column;
}
.cert-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}
.cert-name {
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.cert-org {
  font-size: 0.78rem;
  color: var(--text-3);
}
.cert-status {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  white-space: nowrap;
  align-self: center;
}
.cert-done {
  background: rgba(64, 145, 108, 0.08);
  color: var(--accent);
}
.cert-wip {
  background: rgba(27, 67, 50, 0.05);
  color: var(--text-3);
}

/* ── EDUCATION ── */
.education {
  margin-bottom: 3rem;
}

/* ── STACK ── */
.stack {
  margin-bottom: 3rem;
}
.stack-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.stack-tag {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-1);
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  transition:
    border-color 0.2s,
    background 0.2s,
    transform 0.2s;
}
.stack-tag:hover {
  border-color: var(--accent);
  background: var(--hover);
  transform: translateY(-1px);
}

/* ── CONTACT ── */
.contact {
  padding: 2.5rem 0 1rem;
  border-top: 2px solid var(--accent);
  margin-top: 1rem;
}
.contact-intro {
  font-size: 0.95rem;
  color: var(--text-2);
  margin-bottom: 1.25rem;
  line-height: 1.65;
  max-width: 480px;
}
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.contact-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-card);
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    transform 0.2s;
}
.contact-link:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(27, 67, 50, 0.06);
  transform: translateY(-1px);
}
.contact-link-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cli-green {
  background: rgba(64, 145, 108, 0.08);
  color: var(--accent);
}
.cli-dark {
  background: rgba(27, 67, 50, 0.06);
  color: var(--primary);
}
.contact-link-text {
  min-width: 0;
}
.cl-label {
  font-size: 0.65rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.cl-value {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-1);
}

/* ── EMAIL COPY TOOLTIP ── */
.email-copy {
  position: relative;
  cursor: pointer;
}
.email-copy .copy-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--primary);
  color: var(--bg);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
}
.email-copy .copy-tip.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.footer-line {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-3);
  padding: 1.5rem 0;
}

/* ── THEME TOGGLE ── */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition:
    border-color 0.2s,
    background 0.2s,
    transform 0.2s;
  box-shadow: var(--shadow);
  color: var(--text-1);
}
.theme-toggle:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  transition:
    opacity 0.2s,
    transform 0.2s;
  position: absolute;
}
.theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0);
}
.theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(-90deg);
}
[data-theme="dark"] .theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(90deg);
}
[data-theme="dark"] .theme-toggle .icon-moon {
  opacity: 1;
  transform: rotate(0);
}

/* ── BACK TO TOP ── */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: var(--bg);
  border: 1px solid rgba(216, 233, 210, 0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all 0.25s ease;
  z-index: 900;
  box-shadow: 0 4px 16px rgba(27, 67, 50, 0.12);
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.back-to-top:hover {
  background: var(--accent);
  transform: translateY(-2px);
}

/* ── REVEAL ── */
.rv {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.45s ease,
    transform 0.45s ease;
}
.rv.vis {
  opacity: 1;
  transform: none;
}
.rv-d1 {
  transition-delay: 0.05s;
}
.rv-d2 {
  transition-delay: 0.1s;
}
.rv-d3 {
  transition-delay: 0.15s;
}

/* ── RESPONSIVE: TABLET ── */
@media (max-width: 768px) {
  .featured-grid {
    grid-template-columns: 1fr;
  }
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

/* ── RESPONSIVE: PHONE ── */
@media (max-width: 600px) {
  .page {
    padding: 0 1.25rem;
  }
  .header {
    padding: 2.5rem 0 0;
    margin-bottom: 2.25rem;
    padding-bottom: 1.25rem;
  }
  .header-meta {
    font-size: 0.62rem;
    margin-bottom: 0.75rem;
  }
  .header h1 {
    font-size: clamp(2rem, 8vw, 2.4rem);
  }
  .header-role {
    font-size: 0.92rem;
    margin-bottom: 0.85rem;
  }
  .header-bio {
    font-size: 0.88rem;
    margin-bottom: 1.15rem;
    line-height: 1.7;
  }
  .header-stats {
    gap: 0.35rem;
  }
  .stat-pill {
    font-size: 0.68rem;
    padding: 0.35rem 0.65rem;
  }

  .section-label {
    font-size: 0.6rem;
    margin-bottom: 1rem;
    margin-top: 0.5rem;
  }

  .featured {
    margin-bottom: 2.5rem;
  }
  .featured-card {
    border-radius: 8px;
  }
  .featured-img {
    aspect-ratio: 16/9;
  }
  .featured-body {
    padding: 1rem;
  }
  .featured-name {
    font-size: 0.88rem;
  }
  .featured-desc {
    font-size: 0.8rem;
    line-height: 1.55;
  }
  .featured-tech {
    gap: 0.3rem;
  }
  .featured-tech .tag {
    font-size: 0.64rem;
    padding: 0.2rem 0.5rem;
  }

  .projects {
    margin-bottom: 2.5rem;
  }
  .project {
    padding: 1rem 0;
  }
  .project-right {
    display: none;
  }
  .project-name {
    font-size: 0.88rem;
  }
  .project-desc {
    font-size: 0.82rem;
    line-height: 1.55;
  }

  .experience {
    margin-bottom: 2.5rem;
  }
  .exp-item {
    grid-template-columns: 1fr;
    gap: 0.1rem;
    padding: 1rem 0;
  }
  .exp-date {
    padding-top: 0;
    font-size: 0.66rem;
    order: -1;
    margin-bottom: 0.15rem;
  }
  .exp-role {
    font-size: 0.88rem;
  }
  .exp-company {
    font-size: 0.8rem;
  }
  .exp-desc {
    font-size: 0.78rem;
    line-height: 1.6;
    margin-top: 0.4rem;
  }

  .education {
    margin-bottom: 2.5rem;
  }

  .certs {
    margin-bottom: 2.5rem;
  }
  .cert-item {
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    padding: 0.85rem 0;
  }
  .cert-name {
    font-size: 0.84rem;
  }
  .cert-org {
    font-size: 0.74rem;
  }
  .cert-status {
    font-size: 0.62rem;
    padding: 0.2rem 0.5rem;
  }

  .stack {
    margin-bottom: 2.5rem;
  }
  .stack-grid {
    gap: 0.35rem;
  }
  .stack-tag {
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
  }

  .contact {
    padding: 2rem 0 1rem;
  }
  .contact-intro {
    font-size: 0.9rem;
    line-height: 1.7;
  }
  .contact-grid {
    gap: 0.4rem;
  }
  .contact-link {
    padding: 0.7rem 0.85rem;
    gap: 0.7rem;
  }
  .contact-link-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }
  .cl-label {
    font-size: 0.62rem;
  }
  .cl-value {
    font-size: 0.82rem;
  }

  .theme-toggle {
    top: 14px;
    right: 16px;
    width: 38px;
    height: 38px;
  }

  .back-to-top {
    bottom: 20px;
    right: 16px;
    width: 42px;
    height: 42px;
    border-radius: 10px;
  }

  .footer-line {
    font-size: 0.65rem;
    padding: 1.5rem 0;
  }
}

/* ── RESPONSIVE: SMALL PHONE ── */
@media (max-width: 380px) {
  .page {
    padding: 0 1rem;
  }
  .header h1 {
    font-size: 1.85rem;
  }
  .header-bio {
    font-size: 0.84rem;
  }
  .header-stats {
    flex-direction: column;
    gap: 0.3rem;
  }
  .stat-pill {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
  .featured-body {
    padding: 0.85rem;
  }
  .contact-link {
    padding: 0.6rem 0.7rem;
  }
  .stack-tag {
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
  }
}
/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .rv {
    opacity: 1;
    transform: none;
  }
  body {
    opacity: 1;
  }
  .featured-card:hover .featured-img {
    transform: none;
  }
}

/* ── PRINT ── */
@media print {
  .progress-bar,
  .back-to-top,
  .theme-toggle,
  .skip-link {
    display: none !important;
  }
  body {
    opacity: 1;
    background: #fff;
    color: #000;
    font-size: 11pt;
  }
  .page {
    max-width: 100%;
    padding: 0;
  }
  .rv {
    opacity: 1;
    transform: none;
  }
  .header {
    padding-top: 0;
  }
  a {
    text-decoration: underline;
  }
  .featured-grid {
    grid-template-columns: 1fr 1fr;
  }
  .contact-grid {
    grid-template-columns: 1fr 1fr;
  }
  .featured-img {
    break-inside: avoid;
  }
  section {
    break-inside: avoid;
  }
}
