/* ---------- Fonts ----------
   Put your font files in /fonts and update the file names below.
   .woff2 is best; add a .woff line too if you have one. */
/* font-display: block = while your font is downloading, keep the text invisible
   (for up to ~3 seconds) instead of flashing a different font and then jumping.
   The files are preloaded in each page's <head>, so normally it's a split second. */
@font-face {
  font-family: "TitleFont";
  src: url("fonts/DarumadropOne-Regular.ttf") format("truetype");
  font-display: block;
}
@font-face {
  font-family: "TextFont";
  src: url("fonts/Cweyons-Regular.ttf") format("truetype");
  font-display: block;
}
/* Cweyons has no numbers, so digits (and the ↗ arrow) were falling back to a
   system font. This adds Gochi Hand (a thicker handwritten font) under the same "TextFont" name, but
   unicode-range limits it to just those characters, so words stay in Cweyons. */
@font-face {
  font-family: "TextFont";
  src: url("fonts/GochiHand-Regular.ttf") format("truetype");
  font-display: block;
  unicode-range: U+0030-0039, U+2197;
}
/* The body text inside the project pop-ups. It's an .otf file,
   so its format is "opentype" rather than "truetype". */
@font-face {
  font-family: "PopupFont";
  src: url("fonts/Tommy-Regular.otf") format("opentype");
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --green-deep: #2f4a33;
  --green-mid: #6f9a5a;
  --cream: #ffffff;
  --yellow: #f2c14e;

  /* Backup fonts, only used if yours fail to load: chunky rounded ones for titles,
     neat handwriting ones for text (Windows / Mac / Android in that order) */
  --font-title: "TitleFont", "Arial Rounded MT Bold", "Segoe UI Black", "Chalkboard SE", system-ui, sans-serif;
  --font-text: "TextFont", "Segoe Print", "Bradley Hand", "Chalkboard SE", system-ui, cursive;
  /* If Tommy can't load, fall back to a plain, rounded-ish system font */
  --font-popup: "PopupFont", "Trebuchet MS", system-ui, sans-serif;
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--green-deep);
  color: var(--cream);
  font-family: var(--font-text);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

a:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 6px;
  border-radius: 8px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
}

/* Background image. Slightly oversized so it can drift without showing edges.
   It's a flat WebP picture of background1.svg — the SVG's blur/noise filters were
   too slow to redraw on hover. If you change the art, re-export it as an image. */
.hero-bg {
  position: absolute;
  inset: -1.5%;
  z-index: -2;
  background:
    url("assets/background1.webp") 0 0 / 100% 100% no-repeat,
    radial-gradient(circle at 30% 20%, #9bc384, var(--green-mid) 60%, #4d7a45);
  will-change: transform;
}

/* ---------- Connect menu ---------- */
.connect {
  position: absolute;
  top: clamp(1rem, 2.5vw, 2rem);
  right: clamp(1rem, 2.5vw, 2rem);
  z-index: 10;
}

.connect-btn {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  cursor: pointer;
}
.connect-btn:hover,
.connect-btn[aria-expanded="true"] {
  text-decoration: underline wavy var(--yellow);
  text-underline-offset: 5px;
}
.connect-btn:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 6px;
  border-radius: 8px;
}

.connect-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  min-width: 13rem;

  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}

.connect-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s;
}

.connect-menu li {
  list-style: none;
  display: flex;
  justify-content: flex-end;   /* link hugs the right edge and shrinks to its content */
}

.connect-menu a {
  display: flex;
  align-items: center;
  justify-content: flex-end;   /* everything hugs the right edge */
  gap: 0.75rem;
  padding: 0.6rem 1.1rem;
  border-radius: 14px;
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  text-decoration: none;
  text-shadow: 0 1px 6px rgba(47, 74, 51, 0.45);
}

.connect-menu a:hover,
.connect-menu a:focus-visible {
  background: var(--yellow);
  color: var(--green-deep);
  text-shadow: none;
  outline: none;
}

.menu-icon {
  flex: none;
  width: 1.3em;
  height: 1.3em;
}

/* ---------- Centre content ---------- */
.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 1.75rem);
  padding: 2rem 1rem;
  text-align: center;
}

/* "hi, i'm" + name */
.intro {
  margin: 0;
  font-weight: normal;
  display: flex;
  flex-direction: column;
  align-items: center;   /* greeting sits left, above the name */
}

.intro-greeting {
  font-family: var(--font-text);
  font-size: clamp(1.25rem, 2.6vw, 2.1rem);
  margin-left: 2%;
  margin-bottom: -0.25em;
}

.intro-name {
  position: relative;        /* the cat is positioned against this */
  font-family: var(--font-title);
  font-size: clamp(3rem, 11vw, 7.5rem);
  line-height: 1;
  white-space: nowrap;
  color: var(--cream);
  /* yellow outline behind white fill */
  -webkit-text-stroke: 0.04em var(--yellow);
  paint-order: stroke fill;
  text-shadow: 0 0 0.25em rgba(242, 193, 78, 0.35);
}

/* Cat doodle: tweak top/right/width until it perches like in your mockup */
.intro-cat {
  position: absolute;
  top: -62%;
  right: -22%;
  width: 46%;
  height: auto;
  pointer-events: none;
  -webkit-text-stroke: 0;
}

/* Small tagline */
.tagline {
  margin: 0;
  font-family: var(--font-text);
  font-size: clamp(0.85rem, 1.5vw, 1.3rem);
  letter-spacing: 0.1em;
}

/* ---------- Icon nav ---------- */
.icon-nav {
  display: flex;
  justify-content: center;
  gap: clamp(1.5rem, 5vw, 3.5rem);
  margin-top: clamp(0.25rem, 1vw, 0.75rem);
}

.icon-link {
  position: relative;
  display: block;
  line-height: 0;
  isolation: isolate;
  text-decoration: none;
}

.icon-link img {
  display: block;
  height: clamp(44px, 5vw, 80px);
  width: auto;
}

.icon-link--wide img {
  width: clamp(64px, 9vw, 104px);
}

/* The rough paper blob behind the icon. Its shape comes from icon-blob.png
   (a pre-drawn rough square), so the browser doesn't have to run a noise filter
   on every frame of the hover animation. The colour still comes from --blob. */
.icon-link::before {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: -1;
  background: var(--blob);
  -webkit-mask: url("assets/icon-blob.png") center / 100% 100% no-repeat;
          mask: url("assets/icon-blob.png") center / 100% 100% no-repeat;
  opacity: 0;
  transform: scale(0.8) rotate(var(--rot, 0deg));
  transition: opacity 0.2s ease, transform 0.25s ease;
}

/* The small label under the icon */
.icon-label {
  position: absolute;
  top: 100%;
  left: 50%;
  margin-top: 0.9rem;
  transform: translate(-50%, 4px);
  white-space: nowrap;
  line-height: 1;
  font-family: var(--font-text);
  font-size: clamp(0.85rem, 2vw, 1.5rem);
  letter-spacing: 0.08em;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  margin-top: 1.4rem;
}

.icon-link:hover::before,
.icon-link:focus-visible::before {
  opacity: 1;
  transform: scale(1) rotate(var(--rot, 0deg));
}

.icon-link:hover .icon-label,
.icon-link:focus-visible .icon-label {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Touch screens have no hover, so always show the labels there */
@media (hover: none) {
  .icon-label { opacity: 0.9; transform: translate(-50%, 0); }
}

/* ---------- Small screens ---------- */
@media (max-width: 600px) {
  .intro-cat { top: -70%; right: -12%; width: 40%; }
  .tagline { letter-spacing: 0.14em; max-width: 22ch; line-height: 1.6; }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .icon-link::before,
  .icon-label { transition: none; }
  .connect-menu { transition: none; }
}

/* ---------- Sub-pages ---------- */
.page {
  min-height: 100vh;
  background: var(--green-mid);
}

.back {
  display: inline-block;
  margin: clamp(1rem, 2.5vw, 2rem);
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  text-decoration: none;
}
.back:hover { text-decoration: underline wavy var(--yellow); text-underline-offset: 5px; }

.page-content {
  max-width: 48rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.page-content h1 {
  font-family: var(--font-title);
  font-weight: normal;
  font-size: clamp(2.5rem, 7vw, 5rem);
  margin: 0 0 1rem;
}
/* ---------- Projects page ---------- */
.projects-page {
  --stamp-yellow: #e9c46a;
  --title-tan: #e2c08a;

  height: auto;
  overflow-x: hidden;
  background: #3f9d5a linear-gradient(180deg, #1c3f24 0%, #2a6a3a 45%, #3f9d5a 100%) no-repeat;
}

/* Scrolling up past the top shrinks the vines (script.js), so switch off the
   browser's own bounce / pull-to-refresh there */
html:has(.projects-page) { overscroll-behavior-y: none; }

/* The page background is sized to <html>, which the reset makes one screen tall,
   so on a long page the gradient repeated every screen. Let <html> stretch to the
   full page here so the gradient runs top to bottom exactly once. */
html:has(.projects-page) {
  height: auto;
  min-height: 100%;
}

/* Fine grain over the whole page, like risograph paper */
.projects-page::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: soft-light;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Stacking inside the pond: vines (0) < stamps (1) < flowers (2) < text (3).
   The pond has the vine artwork's shape (1332 x 2250), so the page is long
   enough to scroll through the whole vine and flower animation even with only
   one project. If the projects ever get taller than that (lots of them, or
   phones), the pond simply grows to fit them.
   To make the page stop at the last frame again once there are more projects,
   remove the aspect-ratio line. overflow-y: clip then trims whatever of the
   artwork hangs below. Sideways nothing is trimmed, so flowers can still hang
   off the edges of the screen. */
.pond {
  position: relative;
  isolation: isolate;
  max-width: 1332px;
  margin: 0 auto;
  overflow-x: visible;
  overflow-y: clip;
}

/* No z-index here on purpose: it would lock the vines and flowers together
   as one layer. Without it, each can slot in at its own level around the stamps. */
/* Sideways, flowers may stick out past the pond; the page itself cuts them off
   at the edge of the screen (overflow-x: hidden on .projects-page). Up and down
   they're still trimmed to the pond, so nothing adds extra scrolling at the bottom. */
/* The layer keeps the mockup's proportions (1332 x 2250) so the vines and
   flowers line up with the projects exactly as before, even though the page
   now ends sooner. On narrow screens where the projects stack into one tall
   column, min-height stretches it to cover them all. */
.pond-deco {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  aspect-ratio: 1332 / 2250;
  min-height: 100%;
  overflow-x: visible;
  overflow-y: clip;
  pointer-events: none;
}

/* Your vines.svg gets loaded in here and stretched over the whole page;
   script.js grows each vine along its guide line */
.vines,
.vines > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.vines { z-index: 0; }  /* behind the stamps */

/* Lily pads + flowers bloom open when the vines reach them */
.deco {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 2;  /* in front of the stamps, behind the text */
  width: var(--w);
  height: auto;
  opacity: 0;
  transform: scale(0.4) rotate(calc(var(--rot, 0deg) - 25deg));
  transform-origin: 50% 70%;
  transition: opacity 0.6s ease, transform 1.1s cubic-bezier(0.2, 0.9, 0.3, 1.25);
}
.deco.is-in {
  opacity: 1;
  transform: scale(1) rotate(var(--rot, 0deg));
}

/* Flowers marked edge-left / edge-right are measured from the edge of the
   SCREEN instead of the edge of the pond, so a negative --x makes them hang
   off the screen. (100% - 100vw) / 2 is how far the screen's edge is outside
   the pond: zero on smaller screens, and the empty margin on wide ones. */
.deco.edge-left {
  left: calc((100% - 100vw) / 2 + var(--x));
}

/* Same idea from the right: --x is the distance from the right-hand edge
   of the screen to the right-hand side of the image. */
.deco.edge-right {
  left: auto;
  right: calc((100% - 100vw) / 2 + var(--x));
}

/* No padding at the bottom, so the page ends right after the last row of frames */
.pond-inner {
  padding: 0 4% 0;
  text-shadow:
  0 1px 2px rgba(10, 30, 15, 0.9),
  0 0 10px rgba(10, 30, 15, 0.75);
}

.pond-inner .back,
.projects-header {
  position: relative;
  z-index: 3;
}
/* Sits above the big "projects" title, which otherwise overlaps it and swallows
   clicks. The padding gives a bigger area to click or tap; the negative margin
   cancels it out so the text stays where it was. */
.pond-inner .back {
  z-index: 4;
  margin: calc(1rem - 0.5em) -0.75em 0;
  padding: 0.5em 0.75em;
}

.projects-header h1 {
  margin: 0;
  font-family: var(--font-title);
  font-weight: normal;
  font-size: clamp(2.5rem, 6vw, 5.5rem);
  line-height: 1.1;
  color: var(--title-tan);
}

.projects-date {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.5em 0 0;
  font-size: 0.8em;   /* a bit smaller than the description, and scales with it */
  color: var(--yellow);
}

.project-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 3%;
  padding: 2% 0;
  --stamp: var(--stamp-yellow);
}
/* The last row keeps a small gap under its frames, so the bottom edge of the
   stamps isn't pressed right against the bottom of the screen (and a stamp that
   grows on hover doesn't get its bottom trimmed off) */
.project-row:last-of-type { padding-bottom: 1.5rem; }

.project {
  /* Lets the text below size itself from this card's width (cqi units),
     so it grows and shrinks together with the stamp next to it */
  container-type: inline-size;
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr);
  gap: 4%;
  align-items: start;
}

/* "More projects coming soon" note: the message sits in the middle of a
   blank stamp, in the same yellow as the project titles.
   (Both class names are used so this beats the later ".stamp-photo
   { display: block }" rule for clickable stamps.) */
.stamp-photo.stamp-note {
  display: grid;
  place-items: center;
  padding: 6%;
  text-align: center;
}
.stamp-note p {
  margin: 0;
  font-size: clamp(0.85rem, 1.4vw, 1.15rem);
  line-height: 1.5;
  color: var(--yellow);
}

/* Postage stamp: circles bitten out of the edges, solid inside */
.stamp {
  --r: clamp(4px, 0.6vw, 8px);
  position: relative;
  z-index: 1;
  padding: calc(2 * var(--r));
  background:
    radial-gradient(var(--r), #0000 98%, var(--stamp)) round
      calc(-1.5 * var(--r)) calc(-1.5 * var(--r)) / calc(3 * var(--r)) calc(3 * var(--r)),
    linear-gradient(var(--stamp) 0 0) no-repeat
      50% / calc(100% - 3 * var(--r)) calc(100% - 3 * var(--r));
}

/* Every stamp's picture window has the same wide shape as the Focus Cat
   screen (1917 × 1028 pixels once its title bar is cut off), so a whole
   app screenshot fits without losing its sides */
.stamp-photo {
  aspect-ratio: 1917 / 1028;
  background: #24502e;
  overflow: hidden;
}
.stamp-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Screenshot of a desktop window: the picture is made a bit bigger than the
   frame and slid up and left, so the grey title bar (top 49px) and the black
   strip (left 36px) fall outside the frame and get hidden.
   The numbers come from the image: 1953 × 1077 in total, 1917 × 1028 of app. */
.stamp-photo img.stamp-crop {
  position: absolute;
  max-width: none;
  width: calc(1953 / 1917 * 100%);    /* full image width vs. the app part */
  height: calc(1077 / 1028 * 100%);   /* full image height vs. the app part */
  left: calc(-36 / 1917 * 100%);      /* slide left past the black strip */
  top: calc(-49 / 1028 * 100%);       /* slide up past the grey title bar */
}

.project-text {
  position: relative;
  z-index: 3;
  /* 1cqi = 1% of the card's width. clamp() keeps it between a readable
     minimum and a sensible maximum on very small or very big screens. */
  font-size: clamp(0.7rem, 2.6cqi, 1.15rem);
  line-height: 1.4;
}
.project-text h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-title);
  font-weight: normal;
  font-size: clamp(1.3rem, 5.2cqi, 2.6rem);   /* sized so "homeBuddy" fits its column */
  line-height: 1.15;
  color: var(--yellow);
}
/* Award tag under a project's date. Same look as the pop-up badges
   (.dialog-highlights li): yellow border around a faint yellow tint. */
.project-tag {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.35em 0.95em;   /* em = scales with the text size */
  border: 1.5px solid var(--yellow);
  border-radius: 999px;
  background: color-mix(in srgb, var(--yellow) 16%, transparent);
  color: var(--yellow);
  font-size: 0.85em;
}
.project-text p { margin: 0; }
.project-text p + p { margin-top: 0.4rem; }

/* Links to a project's date */
.project-date, .project-link {
  color: var(--yellow);
  text-decoration: none;
}
.project-link:hover { text-decoration: underline wavy; text-underline-offset: 4px; }


/* ---------- Clickable project stamps ---------- */

/* A stamp that opens a pop-up is a <button>. Clear the browser's default button
   look (grey box, border, centred text) so only the stamp design shows. */
button.stamp {
  display: block;
  width: 100%;
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.25);
}
/* Inside a button the photo is a <span>, which is inline by default;
   make it a block so it keeps its 4:3 shape */
.stamp-photo {
  display: block;
  position: relative;
}

/* Hovering (or tabbing to) the stamp opens it out a little, and lifts it
   above the lily pads so nothing covers it while it's playing */
button.stamp:hover,
button.stamp:focus-visible {
  transform: scale(1.1);
  z-index: 3;
}
button.stamp:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 4px;
}

/* The preview video fills the photo window, hidden until it actually starts
   playing (so a missing video file just leaves the plain window showing) */
.stamp-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.stamp-video.is-playing { opacity: 1; }

/* ---------- Project pop-up ---------- */

/* The pop-up box: two thirds of the screen's width, centred left to right,
   and the full height of the screen from top to bottom.
   100dvh is the screen's height, adjusted on phones for the address bar
   showing or hiding; 100vh on the line before is the fallback for older browsers.
   margin-block: 0 removes the browser's automatic gap above and below. */
.project-dialog {
  width: 66vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin-block: 0;
  padding: 0;
  /* It touches the top and bottom of the screen, so the yellow border and
     rounded corners only appear on the left and right sides */
  border: 0 solid var(--stamp-yellow);
  border-inline-width: 3px;
  border-radius: 0;
  background: #1c3f24;
  color: var(--cream);
  /* All the text inside uses Tommy; the headings set their own title font,
     so they keep it */
  font-family: var(--font-popup);
  overflow: hidden;
}

/* Everything behind the pop-up is dimmed and softly blurred */
.project-dialog::backdrop {
  background: rgba(10, 25, 14, 0.6);
  backdrop-filter: blur(3px);
}

/* The pop-up eases in, rising slightly as it appears */
.project-dialog[open] {
  animation: dialog-in 0.5s ease;
}
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
}

/* The inside of the pop-up scrolls on its own. overscroll-behavior stops the
   page behind from scrolling when you reach the end of the pop-up. */
.project-dialog-body {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(1.5rem, 4vw, 3rem);
}

.project-dialog h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-title);
  font-weight: normal;
  font-size: clamp(2rem, 4vw, 3.25rem);
  color: var(--title-tan);
}
.project-dialog h3 {
  margin: 0 0 0.75rem;
  font-family: var(--font-title);
  font-weight: normal;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  color: var(--yellow);
}
.project-dialog-section { margin-top: 2.5rem; }

/* ---------- Pop-up content (laid out like the portfolio PDF) ---------- */

/* Keep lines of text a comfortable reading length, centred in the box,
   with a little more space between lines than the cards use */
.project-dialog-body > * {
  max-width: 46rem;
  margin-left: auto;
  margin-right: auto;
}
.project-dialog p,
.project-dialog li { line-height: 1.6; }

/* Bold sentences (like the survey result) stand out in yellow */
.project-dialog strong { color: var(--yellow); font-weight: normal; }

/* The one-line summary under the title, a little larger than body text */
.dialog-lead { font-size: 1.15rem; }

/* Small headings that introduce a list or images ("built with", "design mockups") */
.dialog-label {
  margin: 1rem 0 0.4rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

/* The quick-facts panel under the summary */
.dialog-facts {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
}
.dialog-facts .dialog-label { margin-top: 0; }

/* "built with" tools as a plain bulleted list, with yellow bullets to match
   the numbers in the features list */
.dialog-built {
  margin: 0 0 0.75rem;
  padding-left: 1.4rem;
}
.dialog-built li { margin-bottom: 0.15rem; }
.dialog-built li::marker { color: var(--yellow); }

/* The "view the code on github" link under the title, styled as a yellow
   pill-shaped button so it stands out as the main thing to click */
/* The row can hold more than one button: they sit side by side with a small
   gap, and wrap onto a second line if the pop-up is too narrow */
.dialog-github-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.25rem 0 1.25rem;
}
.dialog-github {
  display: inline-block;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  background: var(--yellow);
  color: #1c3f24;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
/* On hover it lifts slightly and turns a lighter yellow */
.dialog-github:hover {
  background: #f7d27e;
  transform: translateY(-2px);
}
/* A visible ring when reached with the Tab key */
.dialog-github:focus-visible {
  outline: 3px solid var(--cream);
  outline-offset: 3px;
}

/* "built for a real client!" as an outlined label: yellow border and text,
   no fill. Only the solid yellow GitHub button looks clickable, so this reads
   as information rather than something to press. */
.dialog-badge {
  display: inline-block;
  margin: 0 0 0.5rem;
  padding: 0.2rem 0.75rem;
  background: transparent;
  color: var(--yellow);
}

/* Headline facts ("3rd place", "built in 7h") as a row of badges: a yellow
   border around a faint yellow tint. They stand out, but the see-through fill
   keeps them looking different from the solid yellow buttons you can click.
   margin-block only sets top and bottom, so the row stays lined up with the text. */
.dialog-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-block: 1rem 0;
  padding: 0;
  list-style: none;
}
.dialog-highlights li {
  padding: 0.35rem 0.95rem;
  border: 1.5px solid var(--yellow);
  border-radius: 999px;
  background: color-mix(in srgb, var(--yellow) 16%, transparent);
  color: var(--yellow);
  font-size: 1rem;
}

/* The numbered features: the feature name sits in yellow at the start of each line */
.dialog-features { padding-left: 1.4rem; }
.dialog-features li { margin-bottom: 0.5rem; }
.dialog-features li::marker { color: var(--yellow); }

/* Images (and their placeholders) with an optional caption underneath */
.dialog-figure { margin: 1.5rem auto; }
.dialog-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}
.dialog-figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  text-align: center;
  opacity: 0.75;
}

/* The big preview video at the top of the pop-up: full width of the text
   column, keeping its own shape, with the same rounded corners as the images */
.dialog-video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}

/* Placeholder box shown until a real image is added: same shape as a
   screenshot, dashed outline, and its name written in the middle */
.figure-placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
  opacity: 0.8;
}

/* The big "gif of it running" at the top is a bit more noticeable */
.dialog-figure--hero { margin-top: 1rem; }

/* The four design mockups in a 2 x 2 grid (one column on phones, below) */
.dialog-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.dialog-gallery .dialog-figure { margin: 0; }

/* Lists inside lists ("future improvements") are slightly smaller and dimmer */
.project-dialog ul ul {
  font-size: 0.95em;
  opacity: 0.9;
}

/* The closing note at the very bottom */
.dialog-footnote {
  margin-top: 2.5rem;
  font-size: 0.85rem;
  text-align: center;
  opacity: 0.6;
}

/* The little form holding the × sticks to the top of the box while the content
   scrolls underneath. It has no height of its own, so it doesn't push the title
   down, and it spans the full width so the × sits in the box's right corner. */
.project-dialog-body > form {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 0;
  max-width: none;
}

/* The × button itself, in the top-right corner */
.project-dialog-close {
  float: right;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: var(--yellow);
  color: #1c3f24;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

/* While a pop-up is open, stop the page behind it from scrolling */
html:has(.project-dialog[open]) { overflow: hidden; }

/* ---------- Enlarged image viewer ---------- */

/* Images in a project pop-up show a magnifying-glass cursor, a hint that
   clicking makes them bigger */
.dialog-figure img { cursor: zoom-in; }
.dialog-figure img:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 4px;
}

/* The viewer box itself is invisible: no border or background, just the
   picture and caption floating over the darkened page */
.image-viewer {
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cream);
  font-family: var(--font-popup);
  overflow: visible;
}

/* A darker backdrop than the project pop-up, so the picture stands out */
.image-viewer::backdrop { background: rgba(5, 15, 8, 0.85); }

.image-viewer figure { margin: 0; }

/* The enlarged picture: up to 1100px wide (or 90% of the screen on smaller
   screens), and never taller than 85% of the screen. Small pictures are scaled
   up to that size, so every image opens bigger than it was. object-fit: contain
   keeps tall pictures (like the UML diagrams) in proportion instead of squashing them. */
.image-viewer-img {
  display: block;
  width: min(90vw, 1100px);
  height: auto;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 10px;
}

/* The caption under the enlarged picture (hidden when the image has none) */
.image-viewer-caption {
  margin-top: 0.75rem;
  text-align: center;
  font-size: 0.95rem;
}
.image-viewer-caption:empty { display: none; }

/* The × sits just off the top-right corner of the picture */
.image-viewer-close {
  position: absolute;
  top: -1rem;
  right: -1rem;
  z-index: 1;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: var(--yellow);
  color: #1c3f24;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

/* The picture grows in from slightly smaller as it opens */
.image-viewer[open] { animation: viewer-in 0.25s ease; }
@keyframes viewer-in {
  from { opacity: 0; transform: scale(0.94); }
}

@media (max-width: 760px) {
  .project-row { grid-template-columns: 1fr; row-gap: 1.5rem; padding: 1.5rem 0; }
}
@media (max-width: 420px) {
  .project { grid-template-columns: 1fr; }
  /* Text now sits under the stamp with the full width, so it can be bigger */
  .project-text { font-size: 0.95rem; }
  .project-text h2 { font-size: 1.8rem; }
}

/* On phones two thirds of the screen is cramped, so the pop-up uses most of its
   width (it already fills the full height everywhere) */
@media (max-width: 760px) {
  .project-dialog { width: 92vw; }
  .dialog-gallery { grid-template-columns: 1fr; }
}

/* For people who prefer less motion: no blooming, no growing stamps,
   and the pop-up simply appears */
@media (prefers-reduced-motion: reduce) {
  .deco { transition: none; }
  button.stamp { transition: none; }
  .project-dialog[open] { animation: none; }
  .image-viewer[open] { animation: none; }
}

/* ---------- About page ---------- */

/* Colours from the Figma "about me" styles */
.about-page {
  --about-cream: #fbefc8;
  --about-light: #bada90;
  --about-mid: #62944b;
  --about-dark: #0e4d0d;
  --about-yellow: #f5dd43;
  background: var(--about-cream);
  color: var(--about-dark);
  overflow-x: hidden;
}

/* "back home" link floats over the top-left corner of the page */
.about-page .back {
  position: absolute;
  z-index: 5;
  color: var(--about-dark);
}

/* The page. --u is "one Figma pixel" at the current width (the Figma frame is 1532 wide),
   so calc(100 * var(--u)) = 100 Figma px. Everything sized with --u grows and shrinks with the screen. */
.about {
  position: relative;
  container-type: inline-size;
  overflow: hidden;
  --u: calc(100cqw / 1532);
  padding-bottom: calc(150 * var(--u));
}

/* ----- Background decorations -----
   The only things still layered on top of each other: spirals, dots and colour blocks
   behind the content. Their spots come from Figma: left is a percentage of the page
   width, top scales with the page, so they move with the screen size. */
.about-deco { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.about-deco > * {
  position: absolute;
  left: calc(var(--x) / 1532 * 100%);
  top: calc(var(--y) * var(--u));
  width: calc(var(--w) * var(--u));
  height: calc(var(--h) * var(--u));
}
/* Decorative images; --rot spins one, .flip mirrors one left-to-right */
.about-deco .art { display: block; transform: rotate(var(--rot, 0deg)); }
.about-deco .art.flip { transform: scaleX(-1); }

/* Solid colour blocks; .torn wobbles the edges using the SVG filter in about.html */
.block--light { background: var(--about-light); }
.block--dark  { background: var(--about-dark); }
.torn { filter: url(#torn); }

/* Dot patterns: a small circle repeated on a grid. Change --dot to recolour. */
.dots {
  background-image: radial-gradient(circle, var(--dot) 32%, transparent 36%);
  background-size: calc(10 * var(--u)) calc(10 * var(--u));
}
.dots--yellow { --dot: var(--about-yellow); }
.dots--light  { --dot: var(--about-light); }
.dots--dark   { --dot: var(--about-dark); }

/* ----- Top section: two columns -----
   The column widths are the Figma proportions: 177 margin, 579 left column,
   49 gap, 561 right column, 166 margin. fr units keep those ratios at any width. */
.about-intro {
  position: relative;
  z-index: 2;   /* above the skills section, whose top edge overlaps the "contact me" / "resume" links */
  display: grid;
  grid-template-columns: 177fr 579fr 49fr 561fr 166fr;
  align-items: start;
}
.about-left  { grid-column: 2; padding-top: calc(142 * var(--u)); position: relative; z-index: 0; }
.about-right { grid-column: 4; }

/* Stamp frame + photo: both sit in the same grid cell so they overlap,
   and the photo window is placed inside the frame using Figma's margins.
   Every number is a share of the frame, so it scales with it. */
.stamp-frame { display: grid; position: relative; z-index: 1; }
.stamp-frame > * { grid-area: 1 / 1; }
.stamp-frame-art { display: block; width: 100%; height: auto; }
.crop { position: relative; overflow: hidden; }
.crop img { position: absolute; max-width: none; }
/* A photo that simply fills its window, trimming the edges (used for the garden photo) */
.crop img.crop-fill { inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Mirror a photo left-to-right */
.crop img.flip { transform: scaleX(-1); }

/* Cafe stamp (579 x 412): photo window 524 x 362, 28 in and 24 down */
.stamp-frame--cafe .crop {
  width: calc(524 / 579 * 100%);
  aspect-ratio: 524 / 362;
  margin: calc(24 / 579 * 100%) 0 0 calc(28 / 579 * 100%);
}
/* Selfie stamp (260 x 341): photo window 233 x 314, 15 in and 13 down */
.stamp-frame--selfie .crop {
  width: calc(233 / 260 * 100%);
  aspect-ratio: 233 / 314;
  margin: calc(13 / 260 * 100%) 0 0 calc(15 / 260 * 100%);
}
/* Garden stamp (410 x 269): photo window 381 x 240, 15 in and 15 down */
.stamp-frame--garden .crop {
  width: calc(381 / 410 * 100%);
  aspect-ratio: 381 / 240;
  margin: calc(15 / 410 * 100%) 0 0 calc(15 / 410 * 100%);
}

/* Dark green square (285 x 487). It starts 203 in from the stamp's left edge and
   tucks 146 up under the stamp's bottom, like in Figma. The stamp is drawn on top of it. */
.about-dark-block {
  position: relative;
  z-index: 0;
  width: calc(285 / 579 * 100%);
  aspect-ratio: 285 / 487;
  margin: calc(-146 / 579 * 100%) 0 0 calc(203 / 579 * 100%);
  background: var(--about-dark);
}
/* Leaf branch on the dark square, poking out to the right (sizes are shares of the square).
   z-index 2 puts it over the stamp's bottom edge, like in Figma. */
.about-leaf {
  position: absolute;
  z-index: 2;
  left: calc(-30.4 / 285 * 100%);
  top: calc(78.2 / 487 * 100%);
  width: calc(493.4 / 285 * 100%);
  height: auto;
  max-width: none;
}

/* Two photos that overlap: selfie at the top right, garden at the bottom left.
   The box is 540 x 515 and starts 144 left of the right column (it pokes into the gap). */
.photo-pair {
  display: grid;
  width: calc(540 / 561 * 100%);
  aspect-ratio: 540 / 515;
  margin: calc(56 * var(--u)) 0 0 calc(-144 / 561 * 100%);
}
.photo-pair > * { grid-area: 1 / 1; }
.stamp-frame--selfie { width: calc(260 / 540 * 100%); justify-self: end; align-self: start; }
.stamp-frame--garden { width: calc(410 / 540 * 100%); justify-self: start; align-self: end; z-index: 2; }

/* Big headings ("about me" in dark green, "skills" in yellow) with their soft shadows */
.about-title {
  margin: 0;
  font-family: var(--font-title);
  font-weight: normal;
  font-size: calc(100 * var(--u));
  line-height: 1.3;
  white-space: nowrap;
  color: var(--about-dark);
  text-shadow: calc(4 * var(--u)) calc(6 * var(--u)) calc(4 * var(--u)) #e6c761;
}
/* "about me" sits just right of the bio's left edge, as in Figma */
.about-right > .about-title { margin-left: calc(15 / 561 * 100%); }
.about-title--skills {
  color: var(--about-yellow);
  text-shadow: calc(4 * var(--u)) calc(4 * var(--u)) calc(4 * var(--u)) #91720c;
}

/* Bio paragraph */
.about-bio {
  margin: 0;
  font-family: var(--font-popup);   /* Tommy, same as the project pop-ups */
  font-size: calc(16 * var(--u));   /* Tommy is wider than Cweyons, so smaller than Figma's 20 */
  position: relative;
  z-index: 3;                       /* sits in front of the leaf branch */
  line-height: normal;
}
.about-bio p { margin: 0; }
/* blank line between paragraphs */
.about-bio p + p { margin-top: 1lh; }   /* one empty line between paragraphs, like Figma */

/* Text links on the about page: same colour as the text around them, no underline,
   and they turn the site's yellow on hover (or when reached with the Tab key) */
.about-link {
  color: inherit;
  /* thin dotted underline, sitting a little below the text */
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.15s ease;
}
.about-link:hover,
.about-link:focus-visible { color: var(--yellow); }
/* Lighter green version ("see my projects") */
.about-link--mid { color: var(--about-mid); }
/* A small ↗ arrow added just after the text, raised up so it sits at the top-right corner.
   It's part of the link, so it turns yellow on hover too. */
.about-link--arrow::after {
  content: "↗";
  display: inline-block;
  margin-left: 0.15em;
  font-size: 0.6em;
  vertical-align: 0.6em;
}

/* Co-op text under the dark square, right-aligned. Figma: 392 wide, starting
   76 left of the stamp, 48 below the dark square. */
.about-traits {
  position: relative;
  width: calc(392 / 579 * 100%);
  margin: calc(48 / 579 * 100%) 0 0 calc(-76 / 579 * 100%);
  padding: 0;
  list-style: none;
  text-align: right;
  z-index: 2;   /* in front of the swirls */
  font-size: calc(30 * var(--u));
  line-height: calc(50 * var(--u));
}

/* Skills section: title, then the grid centred on the page */
.about-skills {
  position: relative;
  z-index: 1;
  width: calc(1196 / 1532 * 100%);
  margin: calc(20 * var(--u)) auto 0;   /* gap above "skills"; raise to move it further down */
}
/* Skills: 5 columns of 172px squares, 256px apart, rows 280px apart */
.skills-grid {
  margin: calc(20 * var(--u)) 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, calc(172 * var(--u)));
  column-gap: calc(84 * var(--u));
  row-gap: calc(50 * var(--u));
  font-size: calc(30 * var(--u));
  line-height: calc(50 * var(--u));
  text-align: center;
}
/* Cream square with the logo centred inside */
.skill-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  padding: calc(16 * var(--u));
  background: #feffe3;
}
/* Logo: as big as fits in the square without stretching */
.skill-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* multiply makes the white behind a logo take on the cream box colour */
  mix-blend-mode: multiply;
}
/* The Figma logo image is wide with lots of empty space, so it fills the
   whole square edge to edge and trims the extra space instead */
.skill-icon:has(.skill-logo-fill) { padding: 0; }
.skill-icon img.skill-logo-fill { object-fit: cover; }
/* Under each square: the skill name, then the time on the line below, packed a bit closer */
.skill-name,
.skill-years { display: block; line-height: calc(34 * var(--u)); }
.skill-name { padding-top: calc(8 * var(--u)); }
.skill-years { color: var(--about-mid); }   /* time in the lighter green */

/* ---------- Projects page loading ----------
   Flowers and lily pads stay closed until the page is ready, then the ones
   on screen bloom open with their usual animation */
html.is-loading .deco.is-in {
  opacity: 0;
  transform: scale(0.4) rotate(calc(var(--rot, 0deg) - 25deg));
}

/* ---------- Projects page: contact icons ---------- */
/* Column of icons stuck to the bottom-right of the screen, even while scrolling */
.contact-icons {
  position: fixed;
  right: clamp(1rem, 2.5vw, 2rem);
  bottom: clamp(1rem, 2.5vw, 2rem);
  z-index: 10;
  display: flex;
  flex-direction: column;   /* stack them top to bottom */
  gap: 0;                   /* no extra space; the click areas below already space them out */
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Just the icon, no circle behind it. The icon's lines use the text colour,
   so changing color on hover turns the outline yellow */
.contact-icons a {
  display: grid;
  place-items: center;
  width: 2.75rem;            /* keeps a comfy click area around the icon */
  height: 2.1rem;            /* shorter click area = icons sit closer together */
  color: var(--cream);
  transition: color 0.2s ease;
}
.contact-icons a:hover,
.contact-icons a:focus-visible {
  color: var(--yellow);
  outline: none;
}

/* ---------- About page: phones and small tablets ----------
   Below 1000px the two-column layout would make the text too small to read, so
   everything drops into one centred column, top to bottom. Sizes still scale with
   the screen: --u is now based on a 640-wide design instead of 1532. */
@media (max-width: 1000px) {
  .about {
    --u: calc(100cqw / 640);
    padding: calc(110 * var(--u)) 1rem 3rem;   /* room for "back home" and "lets connect!" */
  }
  /* Decorations only make sense in the wide layout */
  .about-deco { display: none; }

  /* One column. display: contents lets the left/right column wrappers dissolve,
     so their pieces can be put in reading order with the order property. */
  .about-intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(40 * var(--u));
    max-width: 640px;
    margin-inline: auto;
  }
  .about-left, .about-right { display: contents; }
  .about-right > .about-title { order: 1; margin: 0; }
  .about-bio                  { order: 2; }
  .stamp-frame--cafe          { order: 3; width: 100%; }
  .about-traits               { order: 4; }
  .photo-pair                 { order: 5; }
  .about-dark-block           { display: none; }   /* the dark square + leaf are decoration here */

  .about-title { line-height: 1.1; }
  .about-bio { font-size: 0.9rem; line-height: 1.45; }
  .about-traits {
    width: auto;
    margin: 0;
    text-align: center;
    font-size: 1.4rem;
    line-height: 1.6;
  }
  .photo-pair { width: 100%; margin: 0; }

  .about-skills { width: 100%; max-width: 640px; margin: calc(60 * var(--u)) auto 0; text-align: center; }
  /* Skills: 3 squares per row, sharing the column width */
  /* minmax(0, 1fr) makes every column exactly the same width, even when a long
     name like "javascript" would otherwise push its column (and box) wider */
  .skills-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: calc(36 * var(--u));
    row-gap: calc(36 * var(--u));
    font-size: 1rem;
  }
  /* Padding as a share of the box, so logos stay a good size inside smaller boxes */
  .skill-icon { padding: 10%; }
  /* Smaller, tighter text under the boxes so the long names fit on one line */
  .skill-name,
  .skill-years { line-height: 1.4; }
}
/* Tablets in the one-column layout: skills fit 5 across (2 even rows) */
@media (min-width: 600px) and (max-width: 1000px) {
  .skills-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* ---------- About page: fade in on load and on scroll ----------
   A tiny script in about.html's <head> adds .reveal-on to <html> before anything is drawn,
   so these pieces start see-through and a little lower. script.js then adds .is-visible
   to each one as it comes into view, and it slowly fades in and rises into place.
   "translate" is used (not "transform") so it doesn't undo the spirals' rotate/flip.
   Change 1.2s to make the fade slower or faster. */
html.reveal-on :is(
  .about-deco > *,
  .about-title,
  .about-bio p,
  .stamp-frame,
  .about-dark-block,
  .about-traits li,
  .skill
) {
  opacity: 0;
  translate: 0 calc(30 * var(--u, 1px));
  transition: opacity 1.2s ease, translate 1.2s ease;
}
/* Same list plus .is-visible, so this rule always outranks the hiding rule above */
html.reveal-on :is(
  .about-deco > *,
  .about-title,
  .about-bio p,
  .stamp-frame,
  .about-dark-block,
  .about-traits li,
  .skill
).is-visible {
  opacity: 1;
  translate: 0 0;
}
/* People who prefer reduced motion: never hide anything */
@media (prefers-reduced-motion: reduce) {
  html.reveal-on :is(.about-deco > *, .about-title, .about-bio p, .stamp-frame,
                     .about-dark-block, .about-traits li, .skill) {
    opacity: 1;
    translate: none;
    transition: none;
  }
}
