/* ==========================================================
   Portfolio stylesheet
   Colours and fonts live in :root, change them there.
   ========================================================== */

:root {
  /* Greys */
  --paper: #ffffff;      /* page background */
  --surface: #f6f7f6;    /* light grey panels (About, tags) */
  --ink: #2b302d;        /* text, warm charcoal grey */
  --muted: #676d69;      /* secondary text */
  --line: #e2e5e3;       /* hairlines and borders */

  /* Pastel green, the one accent colour */
  --green: #cdeedb;      /* tags, header stripe, buttons */
  --green-hover: #b8e5cb;/* button hover */
  --green-wash: #eef9f2; /* hover background on project cards */
  --green-deep: #3d9a69; /* underlines, list dots, focus ring (dark enough to see on white) */

  --radius: 12px;        /* images */
  --radius-lg: 18px;     /* project cards */
  --shadow: 0 1px 2px rgba(30, 40, 35, 0.06), 0 4px 16px rgba(30, 40, 35, 0.06);
  --shadow-hover: 0 2px 4px rgba(30, 40, 35, 0.06), 0 14px 32px rgba(30, 40, 35, 0.12);
  --radius-sm: 8px;      /* buttons */

  --font: Arial, "Helvetica Neue", Helvetica, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: 1.75rem;
  --step-3: clamp(2rem, 4.2vw, 3rem);
  --step-4: clamp(2.6rem, 7vw, 5.25rem);

  --gutter: clamp(1rem, 4vw, 3rem);
  --max: 76rem;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img, video, iframe { display: block; max-width: 100%; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-color: var(--green-deep); }

:focus-visible {
  outline: 3px solid var(--green-deep);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--paper); padding: 0.5rem 1rem;
}
.skip:focus { left: 1rem; top: 1rem; z-index: 10; }

/* ---------- Header ---------- */

.site-header {
  border-bottom: 5px solid var(--green);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
  flex-wrap: wrap;
}
.site-name {
  font-weight: 700;
  font-size: var(--step-1);
  letter-spacing: -0.01em;
  text-decoration: none;
}
.site-nav { display: flex; gap: clamp(0.9rem, 2.5vw, 2rem); flex-wrap: wrap; }
.site-nav a { text-decoration: none; font-weight: 500; }
.site-nav a:hover { text-decoration: underline; text-decoration-color: var(--green-deep); text-decoration-thickness: 2px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  line-height: 1.2;
}
.btn-primary { background: var(--green); border-color: var(--green); color: var(--ink); }
.btn-primary:hover { background: var(--green-hover); border-color: var(--green-hover); }
.btn-ghost:hover { background: var(--surface); }

/* ---------- Intro ---------- */

.intro { padding-block: clamp(2rem, 5vw, 3.5rem) clamp(1.75rem, 4vw, 2.75rem); }
.intro h1 {
  margin: 0 0 0.9rem;
  font-size: clamp(2.2rem, 5vw, 3.75rem);
  line-height: 1;
  letter-spacing: -0.025em;
  font-weight: 700;
}
.intro p {
  margin: 0;
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  line-height: 1.45;
  color: var(--muted);
  max-width: 72ch;
}
.intro p strong { color: var(--ink); font-weight: 600; }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ---------- Section headings ---------- */

.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section + .section { border-top: 1px solid var(--line); }
.section-title {
  margin: 0 0 clamp(1.75rem, 4vw, 3rem);
  font-size: var(--step-3);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 700;
}

/* ---------- Work: featured project + tiles ---------- */

.work { background: var(--surface); padding-top: clamp(2rem, 4vw, 3rem); }
.work .section-title { font-size: var(--step-2); margin-bottom: clamp(1rem, 2.5vw, 1.5rem); }

/* Shared card look: white, rounded, soft shadow. Lifts a little on hover. */
.feature, .tile {
  position: relative;
  background: var(--paper);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}
.feature:hover, .feature:focus-within,
.tile:hover, .tile:focus-within {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  background: var(--green-wash);
}

.media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--ink);
  overflow: hidden;
}
.media img, .media video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.media video { opacity: 0; transition: opacity 0.3s, transform 0.4s ease; }
.media.is-playing video { opacity: 1; }
.feature:hover .media img, .feature:hover .media video,
.tile:hover .media img, .tile:hover .media video { transform: scale(1.04); }

/* The whole card is clickable through the title link */
.feature h3 a, .tile h3 a { text-decoration: none; }
.feature h3 a::after, .tile h3 a::after { content: ""; position: absolute; inset: 0; z-index: 3; }
.feature h3 a:focus-visible, .tile h3 a:focus-visible { outline: none; }
.feature:has(h3 a:focus-visible), .tile:has(h3 a:focus-visible) { outline: 3px solid var(--green-deep); outline-offset: 3px; }
.feature:hover h3 a, .feature:focus-within h3 a,
.tile:hover h3 a, .tile:focus-within h3 a {
  text-decoration: underline;
  text-decoration-color: var(--green-deep);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.18em;
}

/* Featured project: big picture, info underneath */
.feature .media { aspect-ratio: 21 / 9; }
.feature-body {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  gap: 1.5rem 3rem;
  align-items: end;
  padding: clamp(1.25rem, 3vw, 2.25rem);
}
.feature h3 {
  margin: 0 0 0.6rem;
  font-size: var(--step-3);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.feature-text p { margin: 0; max-width: 56ch; }
.feature-side { display: grid; gap: 1.1rem; justify-items: end; }
.feature-side .tags { justify-content: flex-end; }

.more-title { margin-top: clamp(3rem, 7vw, 4.5rem); font-size: var(--step-2); }

/* Smaller project tiles */
.tiles {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: clamp(1rem, 2.5vw, 1.75rem);
}
.tile { display: flex; flex-direction: column; }
.tile-body { padding: 1rem 1.15rem 1.25rem; order: 2; }
.tile h3 { margin: 0; font-size: var(--step-1); line-height: 1.2; letter-spacing: -0.01em; }
.tile .meta { margin-bottom: 0.55rem; }

/* Tile description. On phones it's just shown under the title... */
.tile-info { order: 3; padding: 0 1.15rem 1.25rem; }
.tile-info p { margin: 0 0 0.75rem; font-size: var(--step--1); line-height: 1.5; }

/* ...on devices with a mouse it slides up over the picture on hover. */
@media (hover: hover) {
  .tile-info {
    position: absolute;
    left: 0; right: 0; bottom: auto;
    top: 0;
    aspect-ratio: 16 / 9;
    padding: 0;
    display: flex;
    align-items: flex-end;
    pointer-events: none;
    overflow: hidden;      /* keeps the hidden panel out of sight */
    z-index: 2;
  }
  .tile-info-panel {
    width: 100%;
    padding: 0.9rem 1.15rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(101%);
    transition: transform 0.3s ease;
  }
  .tile:hover .tile-info-panel, .tile:focus-within .tile-info-panel { transform: translateY(0); }
}

/* "Coming soon" tiles: no picture yet, just the name on soft green */
.media-soon {
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(61, 154, 105, 0.07) 14px 15px),
    var(--green-wash);
}
.media-soon span {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #9fcdb3;
  transition: transform 0.4s ease;
}
.tile-soon:hover .media-soon span { transform: scale(1.04); }
.tile-soon h3 { color: var(--muted); }
.kind-soon { background: var(--paper); color: var(--muted); border-style: dashed; }

@media (prefers-reduced-motion: reduce) {
  .feature, .tile, .media img, .media video, .tile-info-panel { transition: none; }
  .feature:hover, .tile:hover, .feature:focus-within, .tile:focus-within { transform: none; }
  .feature:hover .media img, .feature:hover .media video,
  .tile:hover .media img, .tile:hover .media video { transform: none; }
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.9rem;
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: var(--step--1);
}
.kind {
  display: inline-block;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}
/* Tag colours: Professional = pastel green, Student = light grey, Personal = white */
.kind-professional { background: var(--green); border-color: var(--green); }
.kind-student { background: #e9ecea; border-color: #e9ecea; }
.kind-personal { background: var(--paper); }

.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags li {
  font-size: var(--step--1);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
}
.work .tags li { background: #eef0ef; }

/* Placeholder cards, delete these once you have real projects */
.media-placeholder {
  display: grid; place-items: center;
  background:
    repeating-linear-gradient(135deg, transparent 0 12px, rgba(20,32,51,0.06) 12px 13px),
    var(--surface);
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: var(--step--1);
}

/* ---------- About ---------- */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(2rem, 5vw, 4rem);
}
.about-grid p { margin: 0 0 1.1rem; max-width: 60ch; }
.about-grid .lead { font-size: var(--step-1); line-height: 1.45; }

.skills { margin: 0; display: grid; gap: 1.25rem; align-content: start; }
.skills dt { font-weight: 700; margin-bottom: 0.2rem; }
.skills dd { margin: 0; color: var(--muted); }

/* ---------- Contact ---------- */

.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.contact-list a { font-size: var(--step-2); font-weight: 600; letter-spacing: -0.015em; }

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 2rem;
  color: var(--muted);
  font-size: var(--step--1);
}

/* ==========================================================
   Project pages
   ========================================================== */

.back { display: inline-block; margin-block: 2rem 0; font-weight: 500; }

.project-head { padding-block: clamp(1.5rem, 4vw, 3rem) clamp(1.5rem, 4vw, 2.5rem); }
.project-head h1 {
  margin: 0 0 1rem;
  font-size: var(--step-4);
  line-height: 0.98;
  letter-spacing: -0.025em;
  max-width: 16ch;
}
.project-head .summary {
  margin: 0;
  font-size: var(--step-1);
  line-height: 1.45;
  color: var(--muted);
  max-width: 50ch;
}

.hero-media {
  aspect-ratio: 16 / 9;
  width: 100%;
  background: var(--ink);
  border-radius: var(--radius);
  object-fit: cover;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1.25rem 2rem;
  margin: 0;
  padding-block: 1.75rem;
  border-bottom: 1px solid var(--line);
}
.facts dt { font-size: var(--step--1); color: var(--muted); margin-bottom: 0.15rem; }
.facts dd { margin: 0; font-weight: 600; }

/* A content block: text on one side, media on the other.
   Add class "flip" to put the media on the left. */
.block {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
}
.block + .block { border-top: 1px solid var(--line); }
.block.flip .block-text { order: 2; }
.block.full { grid-template-columns: minmax(0, 1fr); }

.block h2 {
  margin: 0 0 1rem;
  font-size: var(--step-2);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.block-text p { margin: 0 0 1rem; max-width: 58ch; }
.block-text ul { margin: 0 0 1rem; padding-left: 1.2rem; max-width: 58ch; }
.block-text li { margin-bottom: 0.5rem; }
.block-text li::marker { color: var(--green-deep); }

.block-media { display: grid; gap: 0.75rem; }
.block-media img, .block-media video { width: 100%; border-radius: var(--radius); }
.block-media figure { margin: 0; }
.block-media figcaption { margin-top: 0.4rem; font-size: var(--step--1); color: var(--muted); }

.embed { position: relative; aspect-ratio: 16 / 9; width: 100%; background: var(--ink); border-radius: var(--radius); overflow: hidden; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.next {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding-block: 2.5rem;
  border-top: 1px solid var(--line);
}

/* ---------- Key-art header (a project with a logo) ---------- */
/* The h1 is the game's logo image, laid over a darkened screenshot. */

.keyart {
  position: relative;
  aspect-ratio: 21 / 9;
  margin-top: clamp(1.5rem, 4vw, 3rem);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--ink);
  display: grid;
  align-items: end;
}
.keyart > img.keyart-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 15%; /* move the crop: 0% = top, 100% = bottom */
}
.keyart::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(8, 20, 24, 0.85) 0%, rgba(8, 20, 24, 0.35) 55%, rgba(8, 20, 24, 0.1) 100%);
}
.keyart h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: clamp(1rem, 4vw, 2.75rem);
}
.keyart h1 img { width: clamp(13rem, 38vw, 28rem); height: auto; }
.keyart + .project-head { padding-top: clamp(1.25rem, 3vw, 2rem); }

/* Project header with cover art beside the title */
.project-head.with-cover {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2rem;
  align-items: center;
}
.project-head .cover {
  width: clamp(8rem, 16vw, 13rem);
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Smaller headings inside a section's text */
.block-text h3 { margin: 1.5rem 0 0.5rem; font-size: var(--step-1); }

/* Square video shouldn't grow taller than the text next to it */
.block-media .square { max-width: 26rem; }

/* Two images side by side with one caption */
.block-media .pair {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 0.75rem;
  align-items: center;
}
.block-media .pair img { border: 1px solid var(--line); }
.block-media .pair figcaption { grid-column: 1 / -1; margin-top: 0; }

/* Portrait art (box covers, posters) shouldn't fill a whole column */
.block-media .portrait { max-width: 22rem; }

/* ---------- Code excerpts ---------- */

.code-list { display: grid; gap: 1.75rem; margin-top: 0.5rem; }
.code { margin: 0; max-width: 52rem; }
.code figcaption { font-size: var(--step--1); margin-bottom: 0.4rem; }
.code figcaption a { color: var(--muted); }
.code pre {
  margin: 0;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;            /* long lines scroll inside the box, not the page */
  font-family: ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 0.84rem;
  line-height: 1.6;
  tab-size: 4;
}
.code .line { white-space: pre; }
.code .line::before {
  counter-increment: line;
  content: counter(line);
  display: inline-block;
  width: 2.2em;
  margin-right: 1em;
  text-align: right;
  color: #a7ada9;
  user-select: none;
}
.code-note { margin: 0.5rem 0 0; font-size: var(--step--1); color: var(--muted); max-width: 70ch; }

/* syntax colours: greys plus the site's green */
.c-k, .c-kt { color: #2b7a52; font-weight: 700; }
.c-n { color: var(--ink); }
.c-na { color: #6f7a74; }
.c-mf, .c-mi { color: #1d6d6a; }
.c-s, .c-s2 { color: #5a7a3a; }
.c-c1, .c-cm, .c-cs { color: #8b918d; font-style: italic; }
.c-o, .c-p { color: #676d69; }

/* ---------- Gallery ---------- */

.gallery {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 0.75rem;
}
.gallery a {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: var(--ink);
  overflow: hidden;
  box-shadow: 0 0 0 0 var(--green);
  transition: box-shadow 0.25s ease;
}
.gallery img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
/* soft wash on hover: a pastel green ring and a slight zoom */
.gallery a:hover { box-shadow: 0 0 0 5px var(--green); }
.gallery a:hover img { transform: scale(1.04); }
@media (prefers-reduced-motion: reduce) { .gallery a:hover img { transform: none; } }
.gallery .media-placeholder { aspect-ratio: 16 / 9; display: grid; place-items: center; border-radius: var(--radius); }

/* ---------- Lightbox ---------- */

.lightbox {
  width: 100vw; height: 100vh;
  max-width: none; max-height: none;
  margin: 0; padding: 0;
  border: 0;
  background: #1d211f;
  color: #fff;
}
.lightbox::backdrop { background: transparent; }
.lightbox[open] {
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.lightbox-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1rem;
  font-size: var(--step--1);
  color: #c5cedb;
}
.lightbox-stage {
  display: grid; place-items: center;
  min-height: 0;
  padding: 0 clamp(0.5rem, 6vw, 5rem);
  position: relative;
}
.lightbox-stage img {
  max-width: 100%;
  max-height: calc(100vh - 8rem);
  object-fit: contain;
  border-radius: 2px;
}
.lightbox-caption { margin: 0; padding: 0.75rem 1rem 1.25rem; text-align: center; color: #c5cedb; font-size: var(--step--1); min-height: 1.5em; }
.lightbox button {
  font: inherit;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
}
.lightbox button:hover { background: rgba(255, 255, 255, 0.16); }
.lightbox .nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 2.75rem; height: 2.75rem; padding: 0;
  font-size: 1.4rem; line-height: 1;
}
.lightbox .prev { left: 0.75rem; }
.lightbox .next-img { right: 0.75rem; }

/* ---------- Small screens ---------- */

@media (max-width: 760px) {
  .about-grid, .block, .feature-body { grid-template-columns: minmax(0, 1fr); }
  .feature .media { aspect-ratio: 16 / 9; }
  .project-head.with-cover { grid-template-columns: minmax(0, 1fr); }
  .project-head .cover { width: 9rem; }
  .feature-side { justify-items: start; }
  .feature-side .tags { justify-content: flex-start; }
  .block.flip .block-text { order: 0; }
  .keyart { aspect-ratio: 4 / 3; }
  .lightbox .nav { top: auto; bottom: -3.25rem; transform: none; }
}
