/* ===== Tokens: monochrome (black & white) ===== */
:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f5;
  --surface: #ffffff;
  --text: #0a0a0a;
  --muted: #5c5c5c;
  --border: #e6e6e6;
  --accent: #0a0a0a;      /* primary = black in light mode */
  --accent-2: #4a4a4a;
  --on-accent: #ffffff;
  --divider: #d4d4d4;
  --shadow: 0 10px 30px rgba(0, 0, 0, .06);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .12);
  --radius: 18px;
  --header-h: 72px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-alt: #121212;
  --surface: #161616;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --border: #262626;
  --accent: #ffffff;      /* primary = white in dark mode */
  --accent-2: #9a9a9a;
  --on-accent: #0a0a0a;
  --divider: #333333;
  --shadow: 0 10px 30px rgba(0, 0, 0, .4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a; --bg-alt: #121212; --surface: #161616; --text: #f5f5f5;
    --muted: #a3a3a3; --border: #262626; --accent: #ffffff; --accent-2: #9a9a9a;
    --on-accent: #0a0a0a; --divider: #333333; --shadow: 0 10px 30px rgba(0,0,0,.4); --shadow-lg: 0 24px 60px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); -webkit-text-size-adjust: 100%; }
body {
  font-family: "Poppins", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  transition: background .35s ease, color .35s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.fill { fill: currentColor; stroke: none; }
::selection { background: var(--text); color: var(--bg); }

.container { width: min(1160px, 100% - 2.5rem); margin-inline: auto; }
.grad { position: relative; white-space: nowrap; }
.grad::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: .08em; height: .14em;
  background: var(--text); border-radius: 4px; opacity: .9;
}

/* ===== Header ===== */
.header {
  position: fixed; inset: 0 0 auto; z-index: 50; height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .35s;
}
.header.scrolled { border-bottom-color: var(--border); }
.nav { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.nav__logo { font-weight: 700; font-size: 1.3rem; letter-spacing: -.02em; }
.nav__logo span { color: var(--muted); }
.nav__menu { display: flex; gap: 2rem; }
.nav__link { font-size: .92rem; font-weight: 500; color: var(--muted); position: relative; transition: color .2s; }
.nav__link::after {
  content: ""; position: absolute; left: 0; bottom: -6px; width: 0; height: 2px;
  background: var(--text); border-radius: 2px; transition: width .25s;
}
.nav__link:hover, .nav__link.active { color: var(--text); }
.nav__link.active::after { width: 100%; }
.nav__actions { display: flex; gap: .4rem; align-items: center; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--border); transition: background .2s, transform .2s;
}
.icon-btn:hover { background: var(--bg-alt); transform: rotate(-12deg); }
.nav__toggle { display: none; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: block; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: .6rem; padding: .95rem 1.6rem;
  border-radius: 14px; font-weight: 500; font-size: .95rem;
  transition: transform .2s, box-shadow .2s, background .2s;
}
.btn svg { width: 18px; height: 18px; }
.btn--primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow); }
.btn--primary:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.btn--ghost { border: 1.5px solid var(--text); }
.btn--ghost:hover { background: var(--text); color: var(--bg); }

/* ===== Home ===== */
.home { min-height: 100vh; min-height: 100svh; padding-top: calc(var(--header-h) + 2rem); padding-bottom: 5rem; position: relative; display: flex; align-items: center; }
.home::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse at 70% 40%, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 70% 40%, #000 20%, transparent 70%);
}
.home__container { display: grid; grid-template-columns: auto 1.1fr 1fr; align-items: center; gap: 3rem; }
.home__social { display: flex; flex-direction: column; align-items: center; gap: 1.3rem; }
.home__social a { color: var(--muted); transition: color .2s, transform .2s; }
.home__social a:hover { color: var(--text); transform: translateY(-3px); }
.home__social-line { width: 1px; height: 60px; background: var(--border); }
.home__badge {
  display: inline-flex; align-items: center; gap: .55rem; font-size: .8rem; font-weight: 500;
  padding: .4rem .9rem; border: 1px solid var(--border); border-radius: 99px; background: var(--surface);
  margin-bottom: 1.4rem;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.5); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.home__title { font-size: clamp(2.2rem, 2rem + 2.6vw, 4rem); line-height: 1.12; font-weight: 700; letter-spacing: -.03em; }
.home__subtitle { font-size: clamp(1rem, .95rem + .4vw, 1.2rem); font-weight: 500; color: var(--muted); margin: 1rem 0 1.1rem; }
.home__description { color: var(--muted); max-width: 480px; margin-bottom: 2rem; }
.home__buttons { display: flex; flex-wrap: wrap; gap: 1rem; }
.stats {
  display: grid; grid-template-columns: repeat(4, auto); justify-content: start;
  margin-top: 2.6rem; padding: 1.3rem 0; max-width: 560px;
}
.stat { padding: 0 1.6rem; border-left: 1px solid var(--divider); }
.stat:first-child { padding-left: 0; border-left: 0; }
.stat dt { font-size: clamp(1.7rem, 1.4rem + 1vw, 2.3rem); font-weight: 700; line-height: 1.1; letter-spacing: -.03em; display: flex; align-items: center; gap: .1rem; }
.stat .star { font-size: .85em; }
.stat dd { margin-top: .45rem; font-size: .85rem; line-height: 1.5; color: var(--muted); white-space: nowrap; }
.home__img { justify-self: center; width: 100%; max-width: 420px; }
.avatar { position: relative; aspect-ratio: 1; }
.avatar__ring {
  position: absolute; inset: -14px; border-radius: 50%;
  border: 1.5px dashed var(--divider); animation: spin 40s linear infinite;
}
.avatar__photo {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  border: 8px solid var(--surface); box-shadow: var(--shadow-lg);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Sections ===== */
.section { padding: clamp(4.5rem, 3rem + 5vw, 7.5rem) 0; }
.section--tint { background: var(--bg-alt); }
.section__head { text-align: center; margin-bottom: clamp(2.5rem, 2rem + 2vw, 4rem); }
.section__title { font-size: clamp(1.8rem, 1.5rem + 1.4vw, 2.6rem); font-weight: 700; letter-spacing: -.02em; }
.section__subtitle { color: var(--muted); font-size: .95rem; }

/* Education & Awards */
.edu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; max-width: 980px; margin-inline: auto; }
.side__title { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-bottom: 1rem; }
.list + .side__title { margin-top: 2rem; }
.edu-grid__full { grid-column: 1 / -1; }
.list--row { grid-template-columns: repeat(4, 1fr); gap: 1.4rem; }
@media (max-width: 900px) { .list--row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .list--row { grid-template-columns: 1fr; } }
.list { display: grid; gap: 1.1rem; }
.list li { display: grid; gap: .1rem; padding-left: 1rem; border-left: 2px solid var(--border); }
.list strong { font-weight: 600; font-size: .95rem; }
.list span { color: var(--muted); font-size: .86rem; }
.list__head { font-size: .95rem; }
.list__title { justify-self: start; }
.list__title:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.list__title:hover .ext { color: var(--text); transform: translate(2px, -2px); }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
@media (max-width: 1024px) { .skills { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .skills { grid-template-columns: 1fr; } }
.skill-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.8rem; transition: transform .25s, box-shadow .25s, border-color .25s;
}
.skill-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--text); }
.skill-card__icon {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  font-size: 1.5rem; background: var(--bg-alt); margin-bottom: 1.1rem; filter: grayscale(1);
}
.skill-card__icon svg { width: 26px; height: 26px; color: var(--text); }
.skill-card h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; }
.tags { display: flex; flex-wrap: wrap; gap: .5rem; }
.tags span {
  font-size: .78rem; padding: .3rem .75rem; border-radius: 99px;
  background: var(--bg-alt); border: 1px solid var(--border); color: var(--text);
}
.tags--sm span { font-size: .72rem; padding: .22rem .65rem; }

/* Timeline */
.timeline { position: relative; max-width: 820px; margin-inline: auto; padding-left: 2rem; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl { position: relative; padding-bottom: 2.6rem; }
.tl:last-child { padding-bottom: 0; }
.tl::before {
  content: ""; position: absolute; left: calc(-2rem + 0px); top: 6px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--bg); border: 3px solid var(--text);
}
.tl__date { display: inline-block; font-size: .75rem; font-weight: 500; padding: .2rem .7rem; border-radius: 99px; background: var(--text); color: var(--bg); }
.tl h3 { font-size: 1.15rem; font-weight: 600; margin-top: .6rem; }
.tl__org { color: var(--muted); font-size: .9rem; margin-bottom: .6rem; }
.tl ul { display: grid; gap: .45rem; }
.tl ul li { position: relative; padding-left: 1.1rem; color: var(--muted); font-size: .92rem; }
.tl ul li::before { content: ""; position: absolute; left: 0; top: .7em; width: 6px; height: 2px; background: var(--text); }

/* Projects */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.3rem; max-width: 1060px; margin-inline: auto; }
.project.project--featured { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 540px) 1fr; }
.project--featured .project__img { aspect-ratio: auto; height: 100%; display: grid; place-items: center; background: linear-gradient(#ea771d, #e06a10); }
.project--featured .project__img img { height: auto; aspect-ratio: 512 / 250; object-fit: contain; }
.project--featured .project__body { padding: 2rem 2.2rem; justify-content: center; gap: .7rem; }
.project--featured h3 { font-size: 1.6rem; letter-spacing: -.02em; }
.project--featured p { font-size: .95rem; }
@media (max-width: 900px) {
  .projects { grid-template-columns: 1fr; max-width: 560px; }
  .project.project--featured { grid-template-columns: 1fr; }
  .project--featured .project__img { aspect-ratio: 2 / 1; height: auto; min-height: 0; }
  .project--featured .project__body { padding: 1.4rem; }
  .project--featured h3 { font-size: 1.35rem; }
}
.project {
  background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .3s, box-shadow .3s;
}
.project:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.project__img { aspect-ratio: 2 / 1; overflow: hidden; background: var(--bg-alt); }
.project__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.project:hover .project__img img { transform: scale(1.05); }
.project--text { border-style: dashed; grid-column: 1 / -1; }
.project__body { padding: 1.2rem 1.3rem 1.3rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.project__meta { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.project__img { display: block; }
.project h3 { font-size: 1.1rem; font-weight: 600; line-height: 1.35; }
.project h3 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.ext { display: inline-block; font-size: .8em; color: var(--muted); transition: transform .2s, color .2s; }
.project h3 a:hover .ext { color: var(--text); transform: translate(2px, -2px); }
.project p { color: var(--muted); font-size: .88rem; line-height: 1.55; }

/* Contact */
.contact {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 3rem; align-items: center;
  padding: clamp(2rem, 1.5rem + 3vw, 4rem); border-radius: 28px;
  background: var(--accent); color: var(--on-accent);
}
.contact__title { font-size: clamp(1.8rem, 1.4rem + 2vw, 3rem); line-height: 1.15; font-weight: 700; letter-spacing: -.03em; margin-bottom: 1rem; }
.contact .grad::after { background: var(--on-accent); }
.contact p { opacity: .7; }
.contact__links { display: grid; gap: .9rem; }
.contact__item {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--on-accent) 18%, transparent);
  transition: background .2s, transform .2s; min-width: 0;
}
a.contact__item:hover { background: color-mix(in srgb, var(--on-accent) 10%, transparent); transform: translateX(4px); }
.contact__item span { display: grid; font-size: .92rem; min-width: 0; overflow-wrap: anywhere; }
.contact__item small { opacity: .6; font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; }
.contact__item svg { flex-shrink: 0; }

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 1.8rem 0; font-size: .85rem; color: var(--muted); }
.footer__inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer a:hover { color: var(--text); }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ===== Responsive ===== */
@media (min-width: 1600px) {
  html { font-size: 18px; }
  .container { width: min(1360px, 100% - 4rem); }
}
@media (max-width: 1024px) {
  .stats { grid-template-columns: repeat(4, auto); }
  .home__container { grid-template-columns: auto 1fr; gap: 2rem; }
  .home__img { grid-column: 2; grid-row: 1; max-width: 340px; }
  .home__data { grid-column: 2; }
  .home__social { grid-row: 1 / span 2; }
  .edu-grid, .contact { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .nav__toggle { display: grid; }
  .nav__menu {
    position: fixed; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; gap: 0; padding: .5rem 1.25rem 1.25rem;
    background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg);
    transform: translateY(-120%); opacity: 0; pointer-events: none;
    transition: transform .35s ease, opacity .25s;
  }
  .nav__menu.open { transform: none; opacity: 1; pointer-events: auto; }
  .nav__menu li { border-bottom: 1px solid var(--border); }
  .nav__menu li:last-child { border-bottom: 0; }
  .nav__link { display: block; padding: .95rem 0; font-size: 1rem; }
  .nav__link::after { display: none; }
}
@media (max-width: 640px) {
  :root { --header-h: 64px; }
  .home { padding-bottom: 4rem; }
  .home__container { grid-template-columns: 1fr; text-align: center; }
  .home__social { grid-row: auto; flex-direction: row; order: 3; justify-content: center; }
  .home__social-line { display: none; }
  .home__img, .home__data { grid-column: 1; }
  .home__img { max-width: 280px; }
  .home__description { margin-inline: auto; }
  .home__buttons { display: grid; grid-template-columns: 1fr 1fr; max-width: 440px; margin-inline: auto; }
  .home__buttons .btn { justify-content: center; padding-inline: 1rem; }
  .home__buttons .btn:first-child { grid-column: 1 / -1; }
  .stats { grid-template-columns: repeat(2, 1fr); row-gap: 1.4rem; margin-inline: auto; text-align: left; }
  .stat { padding: 0 1.2rem; }
  .stat:nth-child(odd) { padding-left: 0; border-left: 0; }
  .stat dd { white-space: normal; }
  .timeline { padding-left: 1.6rem; }
  .tl::before { left: -1.6rem; }
  .btn { padding: .85rem 1.3rem; }
}
@media (max-width: 380px) {
  .container { width: calc(100% - 2rem); }
}
@media (max-width: 340px) {
  .home__buttons { grid-template-columns: 1fr; }
}
