/* ---------- Theme tokens ----------
 * Mainly black, with dark grey and small touches of dark green, dark blue and brown. White text.
 */
:root {
  --black: #000000;
  --grey-950: #0a0a0b;
  --grey-900: #111213;
  --grey-800: #18191b;
  --grey-700: #222427;
  --grey-600: #303338;
  --green: #2f6b47;        /* dark green */
  --green-bright: #5fa77b;
  --blue: #2f4f86;         /* dark blue */
  --blue-bright: #6f93cf;
  --brown: #6b4a2f;        /* brown */
  --brown-bright: #b8875c;

  --bg: var(--black);
  --surface: var(--grey-900);
  --surface-2: var(--grey-800);
  --text: #ffffff;
  --muted: #c3c6cb;
  --border: var(--grey-600);
  --accent: var(--brown-bright);
  --accent-2: var(--green-bright);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.6), 0 8px 24px rgb(0 0 0 / 0.6);
  --shadow-hover: 0 2px 4px rgb(0 0 0 / 0.4), 0 16px 40px rgb(0 0 0 / 0.45);
  --radius: 16px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --display: "Space Grotesk", var(--font);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; }

.container { width: min(1120px, 100% - 32px); margin-inline: auto; }
.accent {
  background: linear-gradient(90deg, var(--brown-bright), var(--green-bright));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600; font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--brown); color: var(--text); border-color: var(--brown-bright); }
.btn--primary:hover { box-shadow: var(--shadow-hover); }
.btn--ghost { border-color: var(--border); background: var(--surface); color: var(--text); }
.btn--ghost:hover { border-color: var(--muted); }
.btn--lg { padding: 16px 30px; font-size: 1.05rem; }

.icon-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s;
}
.icon-btn:hover { border-color: var(--muted); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.nav.is-scrolled { border-bottom-color: var(--border); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.nav__logo { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); transition: color 0.2s, border-color 0.2s; }
.nav__logo:hover { color: var(--brown-bright); border-color: var(--brown-bright); }
.nav__links { display: flex; gap: 32px; }
.nav__links a { text-decoration: none; color: var(--muted); font-weight: 500; transition: color 0.2s; }
.nav__links a:hover { color: var(--text); }
.nav__actions { display: flex; gap: 8px; }
.nav__menu { display: none; }

@media (max-width: 680px) {
  .nav__menu { display: grid; }
  .nav__links {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px;
    display: none;
  }
  .nav__links.is-open { display: flex; }
  .nav__links a { padding: 12px 0; font-size: 1.1rem; }
}

/* ---------- Hero ---------- */
.hero { position: relative; padding: clamp(64px, 12vw, 140px) 0 clamp(48px, 8vw, 96px); }
.eyebrow { color: var(--muted); font-weight: 500; margin: 0 0 16px; }
.hero__title { font-size: clamp(2.4rem, 7vw, 5rem); letter-spacing: -0.03em; max-width: 14ch; }
.hero__lead { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--muted); max-width: 56ch; margin: 24px 0 36px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Sections ---------- */
.section { padding: clamp(48px, 8vw, 96px) 0; }
.section__head {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between;
  gap: 20px; margin-bottom: 36px;
}
.section__title { font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -0.02em; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit; font-size: 0.9rem; font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.filter:hover { color: var(--text); border-color: var(--muted); }
.filter.is-active { background: var(--surface-2); color: var(--text); border-color: var(--green-bright); box-shadow: inset 0 -2px 0 var(--green-bright); }

/* ---------- Project grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 24px;
}
@media (min-width: 900px) {
  .card--featured { grid-column: span 2; }
  .card--featured .card__media { aspect-ratio: 21 / 9; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.card:hover, .card:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  outline: none;
}
.card:focus-visible { border-color: var(--blue-bright); }
.card__media { aspect-ratio: 16 / 10; overflow: hidden; }
.card__media img, .card__media .cover { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.card:hover .card__media img, .card:hover .card__media .cover { transform: scale(1.04); }
.card__body { padding: 20px 22px 24px; }
.card__meta {
  display: flex; justify-content: space-between;
  font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin-bottom: 8px;
}
.card__title { font-size: 1.3rem; margin-bottom: 6px; }
.card__summary { color: var(--muted); margin: 0 0 16px; }

.cover {
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 20% 20%, rgb(255 255 255 / 0.07), transparent 55%),
    linear-gradient(135deg, var(--a), var(--b));
}
.cover span {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(2.5rem, 6vw, 4rem);
  color: rgb(255 255 255 / 0.9);
  letter-spacing: -0.04em;
}

.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* ---------- Chips ---------- */
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.9rem; font-weight: 500;
}
.chips--sm li { padding: 3px 10px; font-size: 0.78rem; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(32px, 6vw, 80px); align-items: start; }
.about__text p { color: var(--muted); font-size: 1.08rem; }
.about__text .section__title { margin-bottom: 20px; }
.about__skills {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.about__skills h3 { font-size: 1.1rem; margin-bottom: 16px; }
@media (max-width: 780px) { .about { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact__title { font-size: clamp(2.2rem, 6vw, 4rem); letter-spacing: -0.03em; }
.contact__lead { color: var(--muted); font-size: 1.15rem; margin: 16px auto 32px; max-width: 44ch; }
.socials { list-style: none; padding: 0; margin: 8px 0 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 28px; }
.socials a { color: var(--muted); text-decoration: none; font-weight: 500; transition: color 0.2s; }
.socials a:hover { color: var(--green-bright); }

/* ---------- Footer ---------- */
.footer {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  padding: 32px 0 48px;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: 0.9rem;
}
.footer p { margin: 0; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--text); }

/* ---------- Modal ---------- */
.modal {
  width: min(720px, 100% - 32px);
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-hover);
  overflow: auto;
}
.modal::backdrop { background: rgb(0 0 0 / 0.5); backdrop-filter: blur(4px); }
.modal[open] { animation: pop 0.25s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.modal__close { position: absolute; top: 14px; right: 14px; z-index: 1; }
.modal__media { aspect-ratio: 16 / 8; }
.modal__media img, .modal__media .cover { width: 100%; height: 100%; object-fit: cover; }
.modal__body { padding: 28px 32px 32px; }
.modal__meta { margin: 0 0 6px; color: var(--muted); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.modal__title { font-size: 1.8rem; margin-bottom: 12px; }
.modal__desc { color: var(--muted); margin: 0 0 20px; }
.modal__links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.modal__links:empty { display: none; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Small colour touches ---------- */
.card__meta span:first-child { color: var(--brown-bright); }
.modal__meta { color: var(--brown-bright); }
.card { border-top: 2px solid var(--grey-600); }
.card:hover { border-top-color: var(--green-bright); }
.about__skills { border-left: 3px solid var(--blue); }
.eyebrow { color: var(--green-bright); }

/* ---------- Section subtitle ---------- */
.section__sub { color: var(--muted); margin: 10px 0 0; }

/* ---------- Experience ---------- */
.xp { display: grid; gap: 48px; }
.xp__heading {
  font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--brown-bright); margin-bottom: 18px;
}
.xp__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.xp__item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--grey-600);
  border-radius: 12px;
  padding: 22px 24px;
  transition: border-color 0.2s;
}
.xp__item:hover { border-left-color: var(--green-bright); }
.xp__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; align-items: baseline; }
.xp__role { font-family: var(--display); font-size: 1.15rem; margin: 0; }
.xp__org { margin: 2px 0 0; color: var(--muted); }
.xp__dates { color: var(--muted); font-size: 0.88rem; white-space: nowrap; }
.xp__points, .modal__points { margin: 14px 0 0; padding-left: 18px; color: var(--muted); }
.xp__points li, .modal__points li { margin-bottom: 6px; }
.modal__points { margin: 0 0 20px; }
.modal__points:empty { display: none; }

/* ---------- Certifications ---------- */
.about__subhead { margin-top: 28px; }
.certs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.certs li { color: var(--muted); padding-left: 16px; position: relative; font-size: 0.95rem; }
.certs li::before {
  content: ""; position: absolute; left: 0; top: 0.6em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--blue-bright);
}

/* ---------- Gallery carousel ---------- */
.carousel {
  --w: min(500px, 62vw);   /* width of the centre photo */
  --gap: 20px;
  position: relative;
  overflow: hidden;
  padding: 12px 0;
  outline: none;
}
.carousel:focus-visible .slide.is-active { box-shadow: 0 0 0 2px var(--blue-bright); }
.carousel__track {
  --drag: 0px;
  position: relative;
  height: calc(var(--w) * 2 / 3);  /* 3:2 photos */
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
}
.carousel__track.is-dragging { cursor: grabbing; }
.carousel__track.is-dragging .slide { transition: opacity 0.55s; }
.slide {
  --rel: 0;
  position: absolute;
  top: 0; left: 50%;
  width: var(--w);
  aspect-ratio: 3 / 2;
  margin: 0 0 0 calc(var(--w) / -2);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(var(--rel) * (var(--w) + var(--gap)) + var(--drag))) scale(0.86);
  transition: opacity 0.55s, transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.slide.is-near { opacity: 0.35; pointer-events: auto; }
.slide.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(var(--drag));
  box-shadow: var(--shadow-hover);
}
.slide img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }

.carousel__btn {
  position: absolute; top: 50%; z-index: 2;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 0.15);
  background: rgb(0 0 0 / 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background 0.2s, border-color 0.2s;
}
.carousel__btn:hover { background: rgb(0 0 0 / 0.8); border-color: var(--brown-bright); }
.carousel__btn--prev { left: calc(50% - var(--w) / 2 + 14px); }
.carousel__btn--next { right: calc(50% - var(--w) / 2 + 14px); }

.carousel__footer {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  margin-top: 18px;
}
.carousel__caption { margin: 0; color: var(--muted); font-size: 0.95rem; min-height: 1.5em; }
.carousel__dots { display: flex; gap: 8px; }
.carousel__dot {
  width: 8px; height: 8px; padding: 0;
  border: none; border-radius: 999px;
  background: var(--grey-600);
  cursor: pointer;
  transition: width 0.3s, background 0.3s;
}
.carousel__dot.is-active { width: 24px; background: var(--brown-bright); }

@media (max-width: 680px) {
  .carousel { --w: 64vw; --gap: 6px; }
  .carousel__btn { width: 38px; height: 38px; }
}

/* ---------- Gallery at the top of the page ---------- */
.gallery--top { padding: 0 0 clamp(24px, 4vw, 48px); }
.contact__email { margin: 18px 0 0; }
.contact__email a { color: var(--muted); text-decoration: none; }
.contact__email a:hover { color: var(--brown-bright); }

/* ---------- Project screenshots ---------- */
.card__media img { object-position: top; }
.modal:has(.modal__media--gallery) { width: min(960px, 100% - 32px); }
.modal__media--gallery { aspect-ratio: auto; padding: 56px 20px 0; background: var(--surface-2); }
.shots__main { position: relative; border-radius: 10px; overflow: hidden; background: #fff; }
.shots__main img { width: 100%; height: auto; aspect-ratio: 1280 / 680; object-fit: contain; object-position: top; background: #f5f5f7; }
.shots__btn { width: 38px; height: 38px; }
.shots__btn--prev { left: 12px; }
.shots__btn--next { right: 12px; }
.shots__caption { margin: 12px 0 10px; text-align: center; color: var(--muted); font-size: 0.9rem; }
.shots__thumbs { display: flex; gap: 10px; justify-content: center; padding-bottom: 20px; overflow-x: auto; }
.shots__thumb {
  flex: 0 0 auto;
  width: 96px; aspect-ratio: 16 / 9;
  padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden;
  background: none; cursor: pointer; opacity: 0.5;
  transition: opacity 0.2s, border-color 0.2s;
}
.shots__thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.shots__thumb:hover { opacity: 0.85; }
.shots__thumb.is-active { opacity: 1; border-color: var(--brown-bright); }
@media (max-width: 680px) { .shots__thumb { width: 64px; } }
