/* ==========================================================
   Design system
   - Quirky handwritten font (--display) is reserved for "chrome":
     the logo, the hero greeting, section dividers and hub-page
     titles, and button/badge labels.
   - Everything that is actual content — a case study's own title,
     a project card's name, sub-headings — is the plain sans
     (--body), just bigger and bolder. Titles are never mixed with
     paragraph text in the same font by accident.
   - Never pure white: text is a soft lavender off-white
   - One type scale, one spacing scale, used everywhere
   ========================================================== */

:root {
  /* Colour */
  --bg: #241b3b;            /* page background: deep purple */
  --surface: #3b2a6b;       /* cards */
  --ink: #f1ebf7;           /* strong/emphasis text: warm lavender off-white */
  --text: #c7c1d9;          /* body text: soft lavender off-white */
  --muted: #a89fc0;         /* captions, footer, small print */
  --pink: #ff7fe8;          /* accent 1 */
  --yellow: #deff00;        /* accent 2 */
  --violet: #7b4dff;
  --lavender: #c9bfe6;
  --btn-ink: #483778;       /* text on the yellow Portfolio button */
  --paper: #f7f3ee;         /* off-white for the light radio page */
  --paper-ink: #3a3346;

  /* Fonts: quirky handwritten for titles/chrome, plain sans for reading text */
  --display: "Patrick Hand SC", "Comic Sans MS", cursive;
  --body: "Play", system-ui, sans-serif;

  /* Type scale */
  --fs-display: clamp(3rem, 9vw, 5rem);      /* hero title (oHello) */
  --fs-h1: clamp(2.25rem, 6vw, 3.25rem);      /* case-study title, plain+bold */
  --fs-h2: clamp(1.8rem, 4.5vw, 2.5rem);     /* section titles, quirky */
  --fs-h3: 1.25rem;                           /* item titles: project names, badges, buttons */
  --fs-h4: 1.05rem;                           /* sub-headings inside a case study */
  --fs-lead: 1.25rem;                         /* intro statements */
  --fs-body: 1.0625rem;                       /* 17px body */
  --fs-small: 0.9rem;                         /* captions, list detail */
  --fs-xs: 0.8rem;                            /* pills, footer */

  /* Spacing scale */
  --s1: 0.5rem;
  --s2: 1rem;
  --s3: 1.5rem;
  --s4: 2rem;
  --s5: 3rem;
  --s6: 4.5rem;
  --s7: 6rem;

  --gutter: var(--s3);
  --measure: 46rem;          /* comfortable line length for reading */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: var(--fs-body);
  line-height: 1.65;
}

a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }

/* ---------- Titles ----------
   Two tiers, matching how the original site actually uses its fonts:
   - "Chrome" titles (logo, hero greeting, section dividers, hub-page
     titles, buttons/badges) are quirky and only ever this short.
   - "Content" titles (a case-study's own name, a project card's name,
     sub-headings inside a case study) are plain and read like text,
     just bigger and bolder — never the quirky font.
------------------------------------------------------------------- */
h1, h2, h3 { margin: 0; line-height: 1.2; }

/* Content titles: plain, bold */
h1 { font-family: var(--body); font-size: var(--fs-h1); font-weight: 600; color: var(--ink); }
h3 { font-family: var(--body); font-size: var(--fs-h4); font-weight: 600; color: var(--ink); }

/* Chrome titles: quirky */
h2,
.brand span, .radio span, .btn,
.hello, .page-title {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0.01em;
}
h2 { font-size: var(--fs-h2); color: var(--pink); }

/* ---------- Shared layout ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter) var(--s6); }

.site-header { padding: var(--s3) var(--gutter) 0; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  text-decoration: none;
  color: var(--yellow);
}
.brand span { font-size: clamp(1.6rem, 4.5vw, 2.25rem); color: var(--pink); }
.logo { width: 3rem; height: auto; }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s3) var(--s5);
  margin-top: var(--s6);
  padding: var(--s4) var(--gutter);
  border-top: 1px solid rgba(255, 127, 232, 0.2);
  font-size: var(--fs-xs);
  color: var(--muted);
}
.footer-item { display: flex; flex-direction: column; gap: 0.3rem; }
.footer-item span { color: var(--ink); font-weight: 600; }
.site-footer a { color: var(--text); }
.site-footer a:hover, .site-footer a:focus-visible { color: var(--pink); }
.site-footer .social { display: inline-flex; width: 24px; }
.site-footer .social svg { width: 100%; height: auto; border-radius: 4px; }
.site-footer .copyright { margin: 0; color: var(--muted); }

.hl { color: var(--pink); }
.back, .back-home a { color: var(--pink); text-decoration: none; font-size: var(--fs-small); }
.back { display: inline-block; margin-top: var(--s3); }
.back:hover, .back-home a:hover { text-decoration: underline; }
.back-home { margin: var(--s5) 0 0; }

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

/* ---------- Home ---------- */
.hello {
  font-size: var(--fs-display);
  text-align: center;
  color: var(--pink);
  margin-top: clamp(var(--s4), 8vw, var(--s7));
  padding-left: 12%;
}
.intro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s5);
  align-items: start;
  margin: var(--s2) auto 0;
  max-width: 1100px;
}
.photo { margin: 0; position: relative; text-align: center; }
.photo-shape { width: min(100%, 460px); margin: 0 auto; position: relative; }
.photo-shape img {
  aspect-ratio: 567 / 574;
  object-fit: cover;
  clip-path: polygon(34% 0%, 78% 12%, 100% 47%, 71% 90%, 36% 100%, 0% 70%);
  filter: saturate(0.9);
}
.photo-shape::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(60, 40, 140, 0.22);
  clip-path: polygon(34% 0%, 78% 12%, 100% 47%, 71% 90%, 36% 100%, 0% 70%);
  pointer-events: none;
}
.photo figcaption {
  margin: var(--s4) auto 0;
  max-width: 30rem;
  font-size: var(--fs-small);
  color: var(--text);
}
.photo figcaption a { color: var(--yellow); }

.radio {
  position: absolute;
  left: 0;
  top: 8%;
  width: clamp(110px, 30%, 150px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: var(--pink);
  text-decoration: none;
  transition: transform 0.2s;
}
.radio:hover, .radio:focus-visible { transform: scale(1.05); }
.radio svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-origin: 50% 50%;
  animation: spin-star 10s linear infinite;
}
.radio span {
  position: relative;
  color: var(--yellow);
  transform: rotate(-20deg);
  border-bottom: 2px solid var(--yellow);
  font-size: var(--fs-h3);
}

@keyframes spin-star {
  to { transform: rotate(360deg); }
}

.short { padding-top: var(--s6); }
.short h2 { margin-bottom: var(--s4); }
.short p { margin: 0 0 var(--s3); }
.short .lead { font-size: var(--fs-lead); }

.buttons { display: flex; gap: var(--s4); margin-top: var(--s6); flex-wrap: wrap; }
.btn {
  display: grid;
  place-items: center;
  width: 150px;
  height: 150px;
  text-decoration: none;
  font-size: var(--fs-h3);
  transition: transform 0.2s;
}
.btn:hover, .btn:focus-visible { transform: rotate(-4deg) scale(1.06); }
.btn span { border-bottom: 2px solid currentColor; transform: rotate(-6deg); }
.btn-portfolio {
  background: var(--yellow);
  color: var(--btn-ink);
  border: 5px solid var(--pink);
  width: 170px;
  clip-path: polygon(0 0, 100% 10%, 92% 70%, 78% 100%, 0 90%);
}
.btn-contact { position: relative; color: var(--pink); transform: rotate(-3deg); }
.btn-contact svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.btn-contact span { position: relative; color: var(--yellow); }

.resume { text-align: center; margin: var(--s6) 0 0; font-size: var(--fs-lead); }
.resume a { color: var(--text); }

/* ---------- Page titles (Portfolio, Contact) ---------- */
.page-title {
  font-size: var(--fs-display);
  color: var(--lavender);
  text-align: right;
  margin: clamp(var(--s4), 8vw, var(--s7)) 0 var(--s3);
}
.page-intro { text-align: center; max-width: var(--measure); margin: 0 auto var(--s6); }

/* ---------- Portfolio ---------- */
.portfolio { max-width: 1000px; }
.category { --c: var(--yellow); margin-bottom: var(--s6); }
.category.civic { --c: var(--violet); }
.category.play { --c: var(--pink); }
.category.strategy { --c: var(--lavender); }
.category h2 { color: var(--c); margin-bottom: var(--s4); }

.project {
  display: grid;
  grid-template-columns: minmax(180px, 400px) 1fr;
  gap: var(--s5);
  align-items: center;
  margin-bottom: var(--s4);
}
.project h3 { font-size: var(--fs-h3); margin-bottom: var(--s1); }
.project h3 a { color: var(--ink); }
.project p { margin: 0; font-size: var(--fs-small); color: var(--text); }

.frame {
  --poly: polygon(34% 0%, 78% 12%, 100% 47%, 71% 90%, 36% 100%, 0% 70%);
  aspect-ratio: 1;
  background: var(--c);
  clip-path: var(--poly);
  padding: 7%;
}
.frame.poly1 { --poly: polygon(28% 0%, 100% 8%, 96% 62%, 80% 100%, 8% 90%, 0% 42%); }
.frame.poly2 { --poly: polygon(0% 8%, 60% 0%, 100% 32%, 96% 68%, 62% 100%, 4% 88%); }
.frame.poly3 { --poly: polygon(30% 0%, 82% 10%, 88% 55%, 55% 100%, 6% 82%, 0% 30%); }
.frame.poly4 { --poly: polygon(50% 0%, 100% 30%, 92% 85%, 40% 100%, 0% 62%, 8% 18%); }
.frame.poly5 { --poly: polygon(20% 0%, 100% 6%, 100% 74%, 68% 100%, 0% 94%, 0% 30%); }
.frame img { width: 100%; height: 100%; object-fit: cover; object-position: center; clip-path: var(--poly); }
.frame img.pos-right { object-position: right center; }

/* ---------- Project pages ---------- */
.project-page { max-width: 900px; }

/* CARDI: white showcase strip, full-bleed, between the header and the body text */
.cardi-showcase { background: #fff; }
.cardi-showcase-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--s6) var(--gutter);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s6) var(--s5);
  align-items: center;
}
.cardi-showcase-grid img { width: 100%; height: auto; display: block; }
div.project-page.cardi-text {
  margin: 0 auto;
  padding: var(--s6) var(--gutter) var(--s6);
}
.project-page h1 { margin: var(--s3) 0 var(--s1); }
.subtitle { margin: 0 0 var(--s3); font-size: var(--fs-lead); color: var(--text); }

.skills { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s6); }
.skills-label { color: var(--ink); font-size: var(--fs-small); }
.skills ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s1); }
.skills li { padding: 0.15rem var(--s2); border-radius: 999px; font-size: var(--fs-xs); color: var(--ink); }
.pill-a { background: #a04a9a; }
.pill-b { background: #3a9aa8; }

.project-page p { max-width: var(--measure); margin: 0 0 var(--s3); }
.statement { font-size: var(--fs-lead); font-weight: 500; color: var(--ink); }

.project-page h2 { margin: var(--s6) 0 var(--s2); }
.project-page h3.sub { margin: var(--s4) 0 var(--s1); }

.bullets { max-width: var(--measure); margin: 0 0 var(--s3); padding-left: var(--s3); }
.bullets li { margin-bottom: var(--s1); }
ol.bullets li { margin-bottom: var(--s2); }

.fig { margin: var(--s5) 0; }
.fig img { width: 100%; height: auto; }
.fig figcaption, .gallery figcaption { font-size: var(--fs-small); color: var(--muted); font-style: italic; margin-top: var(--s1); }

.gallery { display: grid; gap: var(--s2); margin: var(--s5) 0; align-items: start; grid-template-columns: 1fr; }
.gallery figure { margin: 0; min-width: 0; }
.gallery img, .gallery video { width: 100%; height: auto; display: block; }
.gallery video { background: #000; }
.gallery img { background: var(--ink); }
.gallery.no-bg img { background: none; }
.gallery.cols-1 { grid-template-columns: 1fr; max-width: 700px; margin-left: auto; margin-right: auto; }
.gallery.cols-2 { grid-template-columns: repeat(2, 1fr); }
.gallery.cols-3 { grid-template-columns: repeat(3, 1fr); }
.gallery.cols-1.wide { max-width: none; }

/* Compact, packed layout for photo dumps: natural aspect ratios, no gaps, like tetris */
.gallery.masonry { display: block; columns: 3; column-gap: var(--s2); margin: var(--s5) 0; }
.gallery.masonry figure { break-inside: avoid; margin: 0 0 var(--s2); }
.gallery.masonry img { width: 100%; height: auto; display: block; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin: var(--s5) 0; }
.pair img { width: 100%; aspect-ratio: 1; object-fit: cover; }

.collage {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  grid-template-areas: "fist shower" "fist card";
  gap: var(--s2);
  margin: var(--s5) 0;
  align-items: start;
}
.collage .fist {
  grid-area: fist;
  width: 100%;
  height: 100%;
  min-height: 260px;
  object-fit: cover;
  border-radius: 45% 55% 60% 40% / 60% 45% 55% 40%;
}
.collage .shower { grid-area: shower; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

.card {
  grid-area: card;
  background: var(--surface);
  border-radius: var(--s3);
  padding: var(--s3);
  font-size: var(--fs-small);
}
.card h3 { margin-bottom: var(--s1); }
.card ul { margin: 0; padding-left: var(--s3); }
.card.wide { margin: var(--s4) 0; max-width: 32rem; }

.video-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--s4); align-items: center; margin: var(--s5) 0; }
.video-row > * { min-width: 0; }
.video-row video, .video-row > img { width: 100%; height: auto; background: #000; }
.video-row video.short { aspect-ratio: 9 / 8; object-fit: cover; }
.video-row > img { background: none; }
.video-row h3 { margin-bottom: var(--s1); }
.video-row p { font-size: var(--fs-small); margin: 0 0 var(--s2); }
.video-row .video-copy p { font-size: var(--fs-body); max-width: none; margin: 0 0 var(--s3); }
.video-copy.quote p { font-style: italic; }
.video-caption { font-size: var(--fs-small); color: var(--muted); font-style: italic; margin: var(--s1) 0 0; }

.video-row.reverse { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
.video-row .card { grid-area: auto; max-width: none; margin: 0; align-self: stretch; }
.video-row .card p, .video-row .card ul { font-size: var(--fs-body); max-width: none; }
.video-row .card ul { margin: 0 0 var(--s3); padding-left: var(--s3); }
.video-row .card ul li { margin-bottom: 0.3rem; }
.video-row .card h3 { margin-bottom: var(--s2); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); align-items: start; margin: var(--s5) 0; }
.two-col > div { min-width: 0; }
.two-col p { max-width: none; }
.two-col img { width: 100%; height: auto; margin-top: var(--s3); }
.two-col ol { margin: 0 0 var(--s3); }
.two-col-media img { margin-top: 0; }

/* ASHA device diagram: two overlapping device photos with orange callout markers */
.asha-diagram { position: relative; margin: var(--s6) 0; height: 460px; }
.diagram-devices { position: relative; height: 460px; }
.diagram-devices img {
  position: absolute;
  top: 1.5%;
  height: 97%;
  width: auto;
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.35));
}
.diagram-devices .device-back { left: 22.7%; }
.diagram-devices .device-front { left: 27.7%; z-index: 1; }

/* Three left callouts share the full height, evenly spaced regardless of text length */
.diagram-callouts-left {
  position: absolute;
  left: 2%;
  top: 0;
  height: 100%;
  width: 300px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Text sits on top of the dot, overlapping its edge, like a marker behind a label */
.diagram-callout { position: relative; width: 300px; }
.diagram-callout .dot {
  position: absolute;
  left: 0;
  top: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #ef6a1e;
  z-index: 0;
}
.diagram-callout p {
  position: relative;
  z-index: 1;
  margin: 0;
  padding-top: 22px;
  margin-left: 26px;
  font-weight: 600;
  color: var(--ink);
  font-size: var(--fs-small);
}
.diagram-callout[data-pos="4"] { position: absolute; left: 79%; top: 20%; width: 160px; }

.callout { text-align: center; font-weight: 600; color: var(--ink); max-width: var(--measure); margin: var(--s5) auto; }

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

.game-demo { position: relative; }
.gallery img.game-demo-char { display: block; width: 15%; min-width: 70px; height: auto; margin: -15% 0 var(--s2) 4%; position: relative; z-index: 2; pointer-events: none; }

/* ---------- Contact ---------- */
.contact { max-width: 900px; }
.contact .page-title { text-align: left; color: var(--pink); margin-bottom: 0; }
.contact-lead { font-size: var(--fs-lead); color: var(--text); margin: var(--s1) 0 0; }

.contact-columns {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: var(--s6);
  align-items: start;
  margin: var(--s5) 0;
}

.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s1) var(--s3);
  padding: var(--s3) 0;
  border-bottom: 2px solid rgba(255, 127, 232, 0.35);
  font-size: var(--fs-body);
}
.contact-list li:first-child { padding-top: 0; }
.contact-list span { width: 6rem; color: var(--ink); font-weight: 600; }
.contact-list a { color: var(--text); overflow-wrap: anywhere; }
.contact-list a:hover, .contact-list a:focus-visible { color: var(--pink); }

/* Contact form */
.contact-form { display: flex; flex-direction: column; gap: var(--s3); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.field { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--fs-small); color: var(--muted); }
.field input, .field textarea {
  font: inherit;
  font-size: var(--fs-body);
  color: var(--ink);
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: 0.6rem;
  padding: var(--s2);
  resize: vertical;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--pink);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }

.btn-submit {
  align-self: flex-start;
  font-family: var(--display);
  font-size: var(--fs-h3);
  color: var(--btn-ink);
  background: var(--yellow);
  border: 3px solid var(--pink);
  border-radius: 999px;
  padding: 0.5rem var(--s4);
  cursor: pointer;
  transition: transform 0.2s;
}
.btn-submit:hover, .btn-submit:focus-visible { transform: scale(1.05); }
.btn-submit:disabled { opacity: 0.6; cursor: wait; transform: none; }

.form-status { min-height: 1.5em; font-size: var(--fs-small); margin: 0; }
.form-status.ok { color: var(--yellow); }
.form-status.err { color: var(--pink); }

/* ---------- Radio (light page, like the original) ---------- */
.page-radio { background: var(--paper); color: var(--paper-ink); }
.page-radio .site-footer { color: #6b6378; border-top-color: rgba(58, 51, 70, 0.15); }
.page-radio .site-footer a { color: #6b6378; }
.page-radio .footer-item span { color: var(--paper-ink); }
.radio-page { max-width: 1000px; }
.radio-grid { display: grid; grid-template-columns: 340px 1fr; gap: var(--s5); align-items: start; margin-top: var(--s6); }
.radio-grid .player { width: 100%; max-width: 340px; height: 400px; border: 0; justify-self: center; }
.chat h2 { font-size: var(--fs-h3); margin-bottom: var(--s1); }
.chat iframe { width: 100%; max-width: 520px; height: 340px; border: 0; }

/* ---------- Mobile ---------- */
@media (max-width: 800px) {
  :root { --gutter: var(--s2); }
  .hello { padding-left: 0; }
  .intro { grid-template-columns: 1fr; gap: var(--s2); }
  .short { padding-top: var(--s2); text-align: center; }
  .short h2 { text-align: center; }
  .buttons { justify-content: center; margin-top: var(--s5); }

  .page-title, .contact .page-title { text-align: center; }
  .contact-lead { text-align: center; }
  .contact-columns { grid-template-columns: 1fr; gap: var(--s4); margin: var(--s4) 0; }
  .field-row { grid-template-columns: 1fr; }
  .btn-submit { align-self: stretch; text-align: center; }
  .page-intro { text-align: left; }
  .project { grid-template-columns: 1fr; gap: var(--s2); text-align: center; }
  .frame { max-width: 320px; margin: 0 auto; width: 100%; }
  .category h2 { text-align: center; }

  .pair, .gallery.cols-2, .video-row, .video-row.reverse, .two-col { grid-template-columns: 1fr; }

  .asha-diagram { height: auto; }
  .diagram-devices { position: static; height: auto; display: flex; justify-content: center; gap: var(--s2); padding: var(--s3) 0; }
  .diagram-devices img { position: static; height: auto; width: 45%; filter: none; }
  .diagram-callouts-left { position: static; height: auto; width: auto; display: block; }
  .diagram-callout, .diagram-callout[data-pos="4"] { position: static; width: auto; display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3); }
  .diagram-callout .dot { position: static; width: 50px; height: 50px; min-width: 50px; }
  .diagram-callout p { padding-top: 0; margin-left: 0; }
  .gallery.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .gallery.videos.cols-3 { grid-template-columns: 1fr; }
  .gallery.masonry { columns: 2; }
  .cardi-showcase-grid { grid-template-columns: 1fr; gap: var(--s4); padding: var(--s4) var(--gutter); }
  .collage { grid-template-columns: 1fr; grid-template-areas: "fist" "shower" "card"; }
  .collage .fist { height: auto; aspect-ratio: 3 / 2; min-height: 0; }

  .radio-grid { grid-template-columns: 1fr; gap: var(--s4); margin-top: var(--s4); }

  .site-footer { flex-direction: column; }
  .site-footer .copyright { order: 99; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
