:root {
  --bg: #fdfdfd;
  --fg: #1b1b1b;
  --muted: #4a4a4a;
  --pill: #f1f1f2;
  --pill-hover: #f6f6f7;
  --border: #e6e6e8;
  --nav-bg: rgba(255, 255, 255, 0.82);
  --focus: #2b59ff;
  --accent: #bfacfd;
  --card: #f4f4f4;
  --btn: #e4e4e4;
  --btn-hover: #dadada;
  --tags: #097681;
  --backdrop: rgba(0, 0, 0, 0.4);
}
:root[data-theme="dark"] {
  --bg: #0e0e10;
  --fg: #f3f3f4;
  --muted: #b4b4b8;
  --pill: #232326;
  --pill-hover: #1a1a1d;
  --border: #2a2a2e;
  --nav-bg: rgba(14, 14, 16, 0.82);
  --focus: #7b9bff;
  --card: #1a1a1d;
  --btn: #2c2c31;
  --btn-hover: #36363c;
  --tags: #4fc3cf;
  --backdrop: rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Geist, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s, color .2s;
}

/* ---------- Top navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav__inner {
  max-width: 1074px;
  margin: 0 auto;
  padding: 0 16px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.nav__logo {
  flex: none;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.09em;
  line-height: 1;
  color: var(--accent);
  text-decoration: none;
  padding: 6px 4px;
  margin-left: -4px;
  border-radius: 8px;
  transition: opacity .15s;
}
.nav__logo:hover { opacity: .8; }
.nav__logo:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.nav__menu { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-end; }
.nav__links { display: flex; align-items: center; gap: 4px; }
.nav__burger { display: none; }

.nav__link {
  flex: none;
  padding: 9px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s;
}
.nav__link:hover { background: var(--pill-hover); }
.nav__link[aria-current="page"] { background: var(--pill); }

.theme-toggle {
  flex: none;
  width: 32px;
  height: 32px;
  margin-left: 8px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  transition: background-color .15s;
}
.theme-toggle:hover { background: var(--pill-hover); }

.nav__link:focus-visible,
.theme-toggle:focus-visible,
.nav__burger:focus-visible,
.btn:focus-visible,
.modal__close:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.trail { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 45; }

/* ---------- Layout ---------- */
main { max-width: 1074px; margin: 0 auto; padding: 0 16px; }
.page-empty { min-height: 60vh; padding: 56px 0; }
.page-empty h1 { margin: 0; font-size: 32px; font-weight: 500; }

/* ---------- Hero ---------- */
.hero {
  padding: 56px 0 96px;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 38px;
  align-items: center;
}
.hero__text { display: flex; flex-direction: column; gap: 40px; max-width: 647px; }
.hero__text > * { margin: 0; line-height: normal; }
.hero__title { font-size: 32px; font-weight: 500; }
.hero__accent { color: var(--accent); }
.hero__lines { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
.hero__line { margin: 0; line-height: normal; display: flex; align-items: flex-start; gap: 12px; font-size: 20px; font-weight: 400; }
.hero__icon { flex: none; width: 24px; height: 24px; margin-top: -1px; color: var(--accent); }
.hero__cta { margin-top: 12px; }
.hero__photo {
  width: 320px;
  aspect-ratio: 1;
  border-radius: 32px;
  object-fit: cover;
  display: block;
}

/* ---------- Case card ---------- */
.cases { padding: 0 0 96px; display: flex; flex-direction: column; gap: 96px; }
.case {
  position: relative;
  display: flex;
  align-items: center;
  gap: 60px;
  padding: 32px;
  border-radius: 32px;
  background: #ffffff;
  box-shadow: 0 12px 44px rgba(70, 70, 85, 0.12), 0 1px 4px rgba(70, 70, 85, 0.06);
}
.case__body { flex: none; width: 558px; max-width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.case__body > * { margin: 0; line-height: normal; }
.case__title { font-size: 28px; font-weight: 500; }
.case__tags { font-size: 16px; font-weight: 500; color: var(--tags); }
.case__desc { font-size: 16px; font-weight: 400; }
/* Laptop is a pre-composited, high-res image (screen warped into the photo);
   it overlaps the card's top edge like in the Figma layout. */
.case__media { position: absolute; top: -40px; right: 60px; width: 370px; aspect-ratio: 1; pointer-events: none; }
.case__media img { display: block; width: 100%; height: auto; }
/* Ework card (Figma): gray, laptop on the left, text on the right, orange tags */
.case--flip { justify-content: flex-end; }
.case--flip .case__media { right: auto; left: 44px; width: 362px; top: -40px; }
.case--flip .case__tags { color: #e0962f; }


.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 8px;
  background: var(--btn);
  color: var(--fg);
  font-size: 16px;
  font-weight: 500;
  line-height: normal;
  text-decoration: none;
  transition: background-color .15s;
}
.btn:hover { background: var(--btn-hover); }
.btn svg { flex: none; transition: transform .15s; }
.btn:hover svg { transform: translateX(2px); }

/* ---------- Contact pop-up ---------- */
.modal {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--bg);
  color: var(--fg);
}
.modal::backdrop { background: var(--backdrop); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.modal__title { margin: 0; font-size: 28px; font-weight: 500; }
.modal__close {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--pill);
  color: var(--fg);
  cursor: pointer;
}
.modal__close:hover { background: var(--btn-hover); }
.modal__body { padding-top: 20px; }
.modal__lead { margin: 0 0 20px; font-size: 20px; }
.modal__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 18px; }
.modal__list li { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--border); align-items: baseline; }
.modal__list span { color: var(--muted); font-size: 14px; }
.modal__list a { color: var(--fg); text-decoration-color: var(--accent); text-underline-offset: 4px; overflow-wrap: anywhere; }
.modal__list a:hover { text-decoration-color: var(--fg); }

/* ---------- Inner pages (education, AI experiments) ---------- */
.page { padding: 56px 0 96px; display: grid; gap: 32px; }
.page__title { margin: 0; font-size: 32px; font-weight: 500; line-height: normal; }
.page__lead { margin: 0; font-size: 20px; line-height: 1.4; max-width: 647px; }
.panel { background: var(--card); border-radius: 32px; padding: 32px; }
.panel > * { min-width: 0; }
.panel p { margin: 0; font-size: 16px; line-height: 1.5; }
.panel__title { margin: 0; font-size: 24px; font-weight: 500; line-height: normal; }
.page__lead--full { max-width: none; }
.panel__meta { color: var(--accent); font-weight: 500; }
.edu { display: flex; flex-direction: row; gap: 40px; align-items: flex-start; justify-content: space-between; }
.edu__body { max-width: 680px; }
.edu p { margin: 0; font-size: 16px; line-height: 1.5; }
.learn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: stretch; }
.learn { display: flex; flex-direction: column; gap: 14px; }
.learn p { font-size: 17px; }
.learn__list { margin: 0; padding-left: 20px; display: grid; gap: 10px; font-size: 17px; line-height: 1.5; }
.edu__logo { flex: none; width: 128px; height: 128px; object-fit: contain; background: #fff; border-radius: 20px; padding: 8px; }
.edu__body, .cert__head, .xp__body { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.cert { display: flex; flex-direction: column; gap: 24px; align-items: flex-start; background: transparent; padding: 0; }
/* The PNG's own gray frame was cropped off; a CSS border follows the rounded corners instead */
.cert__img { width: 100%; height: auto; border-radius: 16px; background: #fff; border: 1px solid #969696; }
.page__title--wide { max-width: 760px; }
.qual-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.emoji { display: block; font-size: 32px; line-height: 1; }
.qual { display: flex; flex-direction: column; gap: 12px; }
.qual--wide { grid-column: 1 / -1; }
.qual p { font-size: 17px; }
.hl { font-weight: 500; background: linear-gradient(transparent 55%, color-mix(in srgb, var(--accent) 55%, transparent) 55%); }
.panel.skills { background: transparent; padding: 0; }
.skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 40px; }
.skills__group { display: flex; flex-direction: column; gap: 12px; }
.skills__label { margin: 0; font-size: 14px; font-weight: 500; color: var(--muted); }
.chips { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 8px 14px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); font-size: 15px; }
.links { display: flex; flex-direction: column; gap: 12px; }
.links__row { display: flex; flex-wrap: wrap; gap: 12px; }
.xp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.xp { display: flex; flex-direction: column; gap: 24px; padding: 16px 16px 32px; }
/* Set --xp-ratio to 1 once square images are ready */
.xp-grid { --xp-ratio: 4 / 3; }
.xp__img { width: 100%; height: auto; aspect-ratio: var(--xp-ratio); object-fit: cover; object-position: center; border-radius: 20px; display: block; }
.xp__body { flex: 1; padding: 0 16px; }
.xp__body > :last-child { margin-top: auto; }
.xp .panel__title { font-size: 20px; line-height: 1.25; }
.tag { display: inline-block; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: #8d8d93; font-size: 13px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; cursor: default; }

/* ---------- Mobile navigation: hamburger left, theme toggle right ---------- */
@media (max-width: 640px) {
  .nav__inner { justify-content: space-between; padding: 0 12px; }
  .nav__burger {
    display: grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--fg);
    cursor: pointer;
    transition: background-color .15s;
  }
  .nav__burger:hover { background: var(--pill-hover); }
  .nav__burger-close { display: none; }
  .nav.is-open .nav__burger-open { display: none; }
  .nav.is-open .nav__burger-close { display: block; }
  .theme-toggle { margin-left: 0; }
  .nav__menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    padding: 8px 12px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  }
  .nav.is-open .nav__menu { display: flex; }
  .nav__links { flex-direction: column; align-items: stretch; gap: 4px; }
  .nav__menu .nav__link { width: 100%; padding: 14px 12px; font-size: 16px; text-align: left; }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding-bottom: 64px; }
  .hero__photo { width: min(320px, 100%); }
  .case { flex-direction: column; align-items: stretch; gap: 8px; padding: 24px; }
  .case__body { width: auto; }
  .case__media, .case--flip .case__media { position: relative; top: auto; right: auto; left: auto; width: min(370px, 100%); margin: 0 auto -32px; }
}
@media (max-width: 860px) {
  .xp-grid { grid-template-columns: 1fr; }
  .qual-grid, .skills, .learn-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .modal__list li { grid-template-columns: 1fr; gap: 4px; padding: 12px 0; }
  .modal__list { font-size: 17px; }
  .edu { flex-direction: column; gap: 20px; }
  .edu__logo { align-self: flex-end; margin-left: auto; }
  .panel { padding: 24px; border-radius: 24px; }
  .hero__title { font-size: 26px; }
  .hero__line { font-size: 18px; }
  .case__title { font-size: 24px; }
  .modal { padding: 24px; }
}

/* ---------- Home page: fine gray grain on the background ---------- */
.bg-fx { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-fx::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n' x='0' y='0' width='100%' height='100%'><feTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.42  0 0 0 0 0.42  0 0 0 0 0.45  1.3 0 0 0 -0.35'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 180px 180px;
  opacity: 0.2;
}
:root[data-theme="dark"] .bg-fx::after { filter: invert(1); opacity: 0.12; }

:root[data-theme="dark"] .case { background: var(--card); box-shadow: 0 12px 44px rgba(0, 0, 0, 0.35), 0 1px 4px rgba(0, 0, 0, 0.2); }
