/* ==========================================================================
   Theme – change colours here
   ========================================================================== */
:root {
  --bg: #0a0b0d;            /* page background */
  --surface: #121418;       /* cards */
  --surface-2: #181b21;     /* hover / inputs */
  --border: #23272f;
  --border-strong: #3a414c; /* button outlines */
  --text: #e8eaed;          /* main text */
  --text-muted: #9aa3ae;    /* secondary text */
  --accent: #2dd4bf;        /* teal accent */
  --accent-strong: #5eead4;
  --accent-ink: #04211d;    /* text on accent */
  --radius: 12px;
  --max-width: 960px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem; top: -100px;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 1rem; color: var(--accent-ink); }

/* ==========================================================================
   Header / nav
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgb(10 11 13 / 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--border); }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.nav__brand {
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
  text-decoration: none;
}
.nav__links { display: flex; gap: 0.25rem; }
.nav__links a {
  display: block;
  padding: 0.4rem 0.7rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.925rem;
  border-radius: 8px;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.nav__links a:hover { color: var(--text); background: var(--surface-2); }
/* Five links have to fit next to the brand on small phones */
@media (max-width: 520px) {
  .nav__links { gap: 0; }
  .nav__links a { padding: 0.4rem 0.4rem; font-size: 0.85rem; }
}
/* Smallest phones: drop the "PB" brand so all five links fit */
@media (max-width: 380px) {
  .nav__brand { display: none; }
  .nav { justify-content: center; }
}
@media (max-width: 360px) {
  .nav__links a { padding: 0.4rem 0.3rem; font-size: 0.8rem; }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 46px;
  padding: 0.65rem 1.15rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.btn:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-1px);
}
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn--primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-ink);
}
.btn--lg {
  min-height: 50px;
  padding: 0.8rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
}
.btn[hidden] { display: none; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* Button rows: full width on phones, side by side from 480px */
.hero__actions,
.contact__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.hero__actions > .btn,
.contact__actions > .btn { flex: 1 1 100%; }
@media (min-width: 480px) {
  .hero__actions > .btn,
  .contact__actions > .btn { flex: 0 0 auto; }
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  padding-top: clamp(4rem, 14vh, 8rem);
  padding-bottom: clamp(3rem, 10vh, 6rem);
}
/* "Open to new roles" badge above the name */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  padding: 0.4rem 0.9rem 0.4rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  background: rgb(45 212 191 / 0.08);
  border: 1px solid rgb(45 212 191 / 0.35);
  border-radius: 999px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.status-badge:hover { color: var(--text); border-color: var(--accent); background: rgb(45 212 191 / 0.14); }
.status-badge__dot {
  position: relative;
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
}
.status-badge__dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  from { transform: scale(1); opacity: 0.7; }
  to   { transform: scale(2.6); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .status-badge__dot::after { display: none; }
}

.hero__eyebrow {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.hero__title {
  font-size: clamp(2.25rem, 8vw, 4rem);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.hero__role {
  margin-top: 0.9rem;
  font-size: clamp(1.05rem, 3vw, 1.3rem);
  font-weight: 500;
  color: var(--text);
}
.hero__role span { color: var(--text-muted); margin-inline: 0.2rem; }
.hero__tagline {
  margin-top: 1rem;
  max-width: 34rem;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.hero__actions { margin-top: 2.25rem; }

/* Photo: above the name on phones, to the right of the text from 720px */
.hero__grid { display: grid; gap: 1.75rem; }
.hero__text { min-width: 0; }
.hero__photo {
  display: block;
  width: 112px;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
}
@media (min-width: 720px) {
  .hero__grid { grid-template-columns: 1fr auto; align-items: center; gap: 3rem; }
  .hero__photo { order: 2; width: 180px; }
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 1.5rem;
}
.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease;
}
.social-link .icon { color: var(--text-muted); transition: color 0.15s ease; }
.social-link:hover,
.social-link:hover .icon { color: var(--accent-strong); }

/* ==========================================================================
   Sections
   ========================================================================== */
.section {
  padding-block: clamp(3rem, 8vw, 5rem);
  border-top: 1px solid var(--border);
  scroll-margin-top: 60px;
}
.section__title {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.75rem;
}

.about { display: grid; gap: 1rem; max-width: 42rem; }
.about p { font-size: 1.075rem; color: var(--text); }
.about p + p { color: var(--text-muted); }

/* Skills */
.skills-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .skills-grid { grid-template-columns: repeat(3, 1fr); }
}
.card {
  padding: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s ease;
}
.card:hover { border-color: #33404a; }
.card__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tags li {
  padding: 0.3rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text);
  background: rgb(45 212 191 / 0.08);
  border: 1px solid rgb(45 212 191 / 0.25);
  border-radius: 999px;
}

/* Experience timeline */
.timeline {
  max-width: 42rem;
  margin: 0 0 0 0.4rem;
  padding: 0;
  list-style: none;
  border-left: 2px solid var(--border);
}
.job { position: relative; padding: 0 0 2.25rem 1.6rem; }
.job:last-child { padding-bottom: 0.25rem; }
.job::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 0.35rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.job__meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.job__title { margin-top: 0.2rem; font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; }
.job__company {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.975rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0;
}
.job__desc { margin-top: 0.6rem; color: var(--text-muted); }
.job__list { margin-top: 0.6rem; padding-left: 1.1rem; list-style: disc; color: var(--text-muted); }
.job__list li + li { margin-top: 0.35rem; }
.job__list li::marker { color: var(--accent); }

.subsection__title {
  margin-top: clamp(2.5rem, 6vw, 3.5rem);
  margin-bottom: 1rem;
  font-size: 1.15rem;
  font-weight: 600;
}
.edu-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .edu-grid { grid-template-columns: repeat(2, 1fr); }
}
.edu__name { font-weight: 600; }
.edu__meta { margin-top: 0.3rem; font-size: 0.9rem; color: var(--text-muted); }

/* Project */
.project__header { margin-bottom: 1.5rem; max-width: 42rem; }
.project__name { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.6rem; }
.project__desc { color: var(--text-muted); font-size: 1.05rem; }

/* Claude skills */
.section__intro { max-width: 42rem; margin-bottom: 1.5rem; color: var(--text-muted); font-size: 1.05rem; }
.ai-skills { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .ai-skills { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .ai-skills { grid-template-columns: repeat(3, 1fr); }
}
.ai-skills .card__title { margin-bottom: 0.5rem; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.95rem; overflow-wrap: anywhere; }
.ai-skills .card__title a { color: var(--accent); text-decoration: none; }
.ai-skills .card__title a:hover { color: var(--accent-strong); text-decoration: underline; }
.ai-skills p { font-size: 0.925rem; color: var(--text-muted); }

/* Projects linked directly (#data-model etc.) clear the sticky header */
.project { scroll-margin-top: 76px; }

/* Challenge → Approach → Result */
.case {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .case { grid-template-columns: repeat(3, 1fr); }
}
.case__step {
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.case dt {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.case dd { margin: 0.4rem 0 0; font-size: 0.925rem; color: var(--text-muted); }

.game__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;       /* taller on mobile */
  max-height: 80vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
@media (min-width: 720px) {
  .game__frame { aspect-ratio: 16 / 10; max-height: none; }
}
.game__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.game.is-loaded iframe { opacity: 1; }

.game__loading,
.game__fallback,
.game__noscript {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
}
/* Screenshot of the game, shown behind the spinner and the fallback */
.game__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.game__loading {
  background: rgb(10 11 13 / 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.game__fallback {
  z-index: 1;
  background: linear-gradient(to top, rgb(10 11 13 / 0.95) 0%, rgb(10 11 13 / 0.86) 55%, rgb(10 11 13 / 0.7) 100%);
}
.game__fallback p { max-width: 30rem; }
.game__fallback-title { font-size: 1.35rem; font-weight: 700; color: var(--text); }
.game__fallback .btn { margin-top: 0.4rem; }
.game__fallback[hidden],
.game.is-loaded .game__loading,
.game.is-error .game__loading { display: none; }

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.project__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.project__actions .btn { flex: 1 1 100%; }
@media (min-width: 480px) {
  .project__actions .btn { flex: 0 0 auto; }
}
.project__note { margin-top: 1rem; font-size: 0.9rem; color: var(--text-muted); }

/* Several projects in one section */
.project + .project {
  margin-top: clamp(3rem, 8vw, 4.5rem);
  padding-top: clamp(3rem, 8vw, 4.5rem);
  border-top: 1px dashed var(--border);
}
.model-shot { margin: 0; }
.model-shot a {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.model-shot img { display: block; width: 100%; height: auto; }
.model-shot figcaption { margin-top: 0.6rem; font-size: 0.875rem; color: var(--text-muted); }
.project__tags { margin-top: 1.25rem; }
.project__subhead {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.project__subhead + .project__tags { margin-top: 0.75rem; }
.project__size { font-weight: 400; opacity: 0.75; }

/* Video */
.video__frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.video__frame video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: #0f172a;
}

/* Contact */
.contact { max-width: 42rem; }
.contact__heading { font-size: clamp(1.6rem, 4vw, 2rem); font-weight: 700; }
.contact__text { margin-top: 0.75rem; color: var(--text-muted); font-size: 1.05rem; }
.contact__address {
  margin-top: 1.5rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}
.contact__address[hidden] { display: none; }
.contact__phone {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  font-size: 1.05rem;
}
.contact__phone .icon { color: var(--text-muted); }
.contact__phone a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}
.contact__phone a:hover { color: var(--accent-strong); }
.contact__actions { margin-top: 1.25rem; }
.contact__status { min-height: 1.6em; margin-top: 0.75rem; font-size: 0.9rem; color: var(--accent); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2.5rem;
}
.visitors {
  padding-bottom: 2.5rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}
.visitors[hidden] { display: none; }
.visitors__title { font-size: 1rem; font-weight: 600; }
.visitors__note { margin-top: 0.35rem; font-size: 0.875rem; color: var(--text-muted); }
.visitors__empty { margin-top: 1.25rem; color: var(--text-muted); font-size: 0.925rem; }
.visitors__grid {
  display: grid;
  gap: 1.75rem;
  margin-top: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .visitors__grid { grid-template-columns: repeat(3, 1fr); }
}
.visitors__grid[hidden],
.visitors__empty[hidden] { display: none; }
.visitors__group h3 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.visitors__group li + li { margin-top: 0.6rem; }
.stat__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.875rem;
}
.stat__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat__value { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.stat__bar {
  height: 4px;
  margin-top: 0.3rem;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.stat__bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.footer__inner {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}
@media (min-width: 600px) {
  .footer__inner { flex-direction: row; justify-content: space-between; align-items: center; }
}
.footer__links { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer__links a { color: var(--text-muted); text-decoration: none; padding-block: 0.25rem; }
.footer__links a:hover { color: var(--accent); }
.footer__copy { color: var(--text-muted); font-size: 0.875rem; }

/* ==========================================================================
   Scroll reveal (only when JS is running)
   ========================================================================== */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .btn:hover { transform: none; }
}
