:root {
  --bg: #0e0e0e;
  --surface: #181818;
  --text: #f2f2f2;
  --muted: #9a9a9a;
  --accent: #FFF800;
  --border: #2a2a2a;
  --radius: 6px;
  --max: 1200px;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

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

body.no-scroll { overflow: hidden; }

a { color: inherit; }
img, video { display: block; max-width: 100%; }

h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; font-weight: 600; }
h1 { font-size: clamp(2rem, 6vw, 4.5rem); letter-spacing: -0.02em; max-width: 14ch; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1rem; }

section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 80px 24px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: rgba(14, 14, 14, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.logo { font-weight: 700; letter-spacing: 0.15em; text-decoration: none; }

.site-header nav a {
  margin-left: 24px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-header nav a:hover { color: var(--text); }

/* ---------- Hero ---------- */
.hero { padding-top: 120px; padding-bottom: 120px; }
.hero p { color: var(--muted); max-width: 55ch; font-size: 1.1rem; }

.btn {
  display: inline-block;
  margin-top: 24px;
  padding: 16px 32px;      /* button size: vertical horizontal */
  font-size: 1.1rem;       /* text size */
  background: var(--accent);
  color: #000;
  text-decoration: none;
  font-weight: 600;
  border-radius: var(--radius);
  width: fit-content;
  align-self: start;
  justify-self: start;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--text); }

/* ---------- Work ---------- */
.work-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 32px;
}

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
}
.filters button[aria-selected="true"] {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.card {
  all: unset;
  cursor: pointer;
  display: block;
}
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.card:hover .card-thumb img { transform: scale(1.04); }

.play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
}
.play::after {
  content: "";
  position: absolute;
  left: 22px;
  top: 18px;
  border-style: solid;
  border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent #fff;
}

.card-info { padding-top: 12px; }
.card-info h3 { margin: 0; }
.card-meta { margin: 2px 0 0; color: var(--muted); font-size: 0.85rem; }

/* ---------- About / Contact ---------- */
.about-text p { margin: 0 0 1.25em; }
.about-text p:last-child { margin-bottom: 0; }
.about-cols {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 48px;
}
.about p { color: var(--muted); font-size: 1.1rem; max-width: 60ch; margin-top: 0; }

.skills {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: start;
}
.skills li {
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
}

.contact p a { font-size: clamp(1.25rem, 3vw, 2rem); }
.links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 24px; }
.links a { color: var(--muted); }
.links a:hover { color: var(--text); }

.site-footer {
  display: flex;
  justify-content: space-between;
  padding: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Lightbox ---------- */
.lightbox {
  width: min(1100px, 94vw);
  max-height: 92vh;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  overflow-y: auto;
}
.lightbox::backdrop { background: rgba(0, 0, 0, 0.85); }

.lb-close {
  position: sticky;
  top: 8px;
  float: right;
  margin: 8px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}

.lb-media { background: #000; }
.lb-media img, .lb-media video { width: 100%; max-height: 75vh; object-fit: contain; }

.ratio { position: relative; aspect-ratio: 16 / 9; }
.ratio iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.lb-info { padding: 24px; }
.lb-meta { color: var(--muted); margin-top: -4px; }
.lb-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.lb-gallery img { width: 100%; border-radius: var(--radius); }

/* ---------- Mobile ---------- */
@media (max-width: 700px) {
  section { padding: 56px 16px; }
  .hero { padding-top: 72px; padding-bottom: 72px; }
  .about-cols { grid-template-columns: 1fr; gap: 24px; }
  .grid { grid-template-columns: 1fr; }
  .site-header nav a { margin-left: 16px; }
}

/* ---------- Hero with photo ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: center;
}
.hero-photo { margin: 0; }
.hero-photo img {
  width: 100%;
  max-width: 350px;   /* change to resize */
  height: auto;
  border-radius: var(--radius);
}

/* ---------- Groups ---------- */
.group + .group { margin-top: 56px; }
.group-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 700px) {
  .hero { grid-template-columns: 1fr; }
  .hero-photo { max-width: 280px; order: -1; }
}

/* ---------- Project gallery (lightbox) ---------- */
.lb-links { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 4px; }
.lb-links:empty { display: none; }
.lb-links a { color: var(--accent); text-decoration: none; }
.lb-links a:hover { text-decoration: underline; }

.lb-gallery-project {
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 28px;
}
.lb-gallery-project:empty { display: none; }

.lb-item { margin: 0; }
.lb-item-video { grid-column: 1 / -1; }   /* videos span the full width */
.lb-item img,
.lb-item video { width: 100%; border-radius: var(--radius); }
.lb-item .ratio { border-radius: var(--radius); overflow: hidden; background: #000; }
.lb-item figcaption { margin-top: 6px; color: var(--muted); font-size: 0.85rem; }

.ratio-portrait {
  aspect-ratio: 9 / 16;
  height: 80vh;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
}

@media (max-width: 700px) {
  .lb-gallery-project { grid-template-columns: 1fr; }
}

/* ---------- Pixel background (bg.js) ---------- */
#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  image-rendering: pixelated;
  pointer-events: none;
}

/* =========================================================
   Interaction states (hover + keyboard focus)
   Anything that opens something shifts colour slightly.
   ========================================================= */
:root {
  --accent-hover: #FFFB8A;            /* lighter tint of --accent */
  --tint: rgba(255, 248, 0, 0.14);    /* accent wash over thumbnails */
  --ease: 0.2s ease;
}

/* Shared transition for every interactive element */
a, button, .card-thumb::after {
  transition: color var(--ease), background-color var(--ease),
              border-color var(--ease), opacity var(--ease);
}

/* Keyboard focus ring (mouse clicks don't show it) */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* --- Yellow buttons: View Portfolio, Download CV --- */
.btn:hover,
.btn:focus-visible {
  background-color: var(--accent-hover);
  color: #000;
}
.btn:active { background-color: #E6DF00; }

/* --- Text links: nav, logo, contact --- */
.logo:hover,
.logo:focus-visible,
.site-header nav a:hover,
.site-header nav a:focus-visible,
.links a:hover,
.links a:focus-visible,
.contact p a:hover,
.contact p a:focus-visible {
  color: var(--accent);
}

/* --- Project / work cards: yellow wash + title colour --- */
.card-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--tint);
  opacity: 0;
  pointer-events: none;
}
.card:hover .card-thumb::after,
.card:focus-visible .card-thumb::after { opacity: 1; }

.card h3 { transition: color var(--ease); }
.card:hover h3,
.card:focus-visible h3 { color: var(--accent); }

/* --- Filter pills (Works section) --- */
.filters button:hover,
.filters button:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}
.filters button[aria-selected="true"]:hover {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #000;
}

/* --- Lightbox: links + close button --- */
.lb-links a:hover,
.lb-links a:focus-visible {
  color: var(--accent-hover);
  text-decoration: underline;
}
.lb-close:hover,
.lb-close:focus-visible {
  background-color: var(--accent);
  color: #000;
}

/* Respect "reduce motion" */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .card:hover .card-thumb img { transform: none; }
}
