:root {
  --bg: #d1c4bd;
  --projects-bg: #c2b0a6;
  --paper: rgba(250, 246, 242, 0.9);
  --ink: #24170f;
  --muted: #6f6259;
  --line: rgba(36, 23, 15, 0.18);
  --accent: #5a3522;

  --serif: "Italiana", "Times New Roman", serif;
  --sans: "DM Sans", Arial, sans-serif;

  --max: 1440px;
  --header-h: 86px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background: var(--bg);
  overflow-x: clip;
}

a {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

/* =========================================================
   BACKGROUND
   ========================================================= */

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-color: var(--bg);
  background-image: url("pictures/bakgrunn.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: .8;
}

main,
.hero,
.about,
.projects,
.projects-head,
.projects-stage,
.project,
.project-preview,
.thank-you {
  background: transparent;
}

/* =========================================================
   HEADER
   ========================================================= */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(24px, 4vw, 72px);
  background: transparent;
  transition: background .35s ease, backdrop-filter .35s ease;
}

.site-header.scrolled {
  background: rgba(209, 196, 189, .24);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.brand {
  color: inherit;
  text-decoration: none;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: -.02em;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.8vw, 44px);
}

.nav a,
.lang-toggle {
  position: relative;
  border: 0;
  background: none;
  padding: 8px 0;
  color: var(--ink);
  font-size: .88rem;
  text-decoration: none;
  cursor: pointer;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 2px;
  height: 1px;
  background: currentColor;
  transition: right .25s ease;
}

.nav a:hover::after,
.nav a:focus-visible::after {
  right: 0;
}

.lang-toggle {
  font-weight: 600;
}

.lang-toggle span:not(.active) {
  opacity: .42;
}

.nav-toggle {
  display: none;
}

/* =========================================================
   HERO
   ========================================================= */

.hero {
  height: 100svh;
  position: relative;
}

.hero-sticky {
  position: relative;
  height: 100svh;
  overflow: clip;
  display: grid;
  place-items: center;
}

.hero-corner-doodle {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: clamp(230px, 29vw, 520px);
  height: auto;
  overflow: visible;
  fill: none;
  stroke: rgba(36, 23, 15, .43);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.hero-content {
  position: relative;
  width: min(calc(100% - 1.6vw), 1820px);
  height: 100svh;
  transform-origin: center;
  will-change: transform, clip-path;
  opacity: 1;
  filter: none;
}

.hero-copy {
  position: absolute;
  z-index: 3;
  left: clamp(18px, 4.7vw, 86px);
  top: 31%;
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3rem, 5.2vw, 6.6rem);
  line-height: .9;
  letter-spacing: .01em;
}

.hero h1 span {
  display: block;
}

.hero h1 span:last-child {
  margin-top: .12em;
}

.hero-project-link {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  margin-top: clamp(50px, 8vh, 92px);
  text-decoration: none;
  font-family: var(--serif);
  font-size: clamp(1.1rem, 1.4vw, 1.55rem);
  letter-spacing: .22em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(36, 23, 15, .62);
  padding-bottom: 4px;
  transform-origin: left center;
  transition: transform .3s ease;
}

.hero-project-link:hover,
.hero-project-link:focus-visible {
  transform: scale(1.045);
}

.circle-arrow {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-family: var(--sans);
  letter-spacing: 0;
  transition: transform .3s ease, background .3s ease;
}

.hero-project-link:hover .circle-arrow {
  transform: rotate(45deg);
  background: rgba(255, 255, 255, .25);
}

.hero-role {
  position: absolute;
  left: 0;
  top: clamp(340px, 58vh, 620px);
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: rgba(36, 23, 15, .62);
}

.hero-role-main {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 3.8vw, 5rem);
  letter-spacing: .14em;
}

.hero-role-sub {
  font-family: var(--serif);
  font-size: clamp(.82rem, 1.05vw, 1.2rem);
  font-weight: 600;
  letter-spacing: .38em;
}

.hero-portrait-wrap {
  position: absolute;
  right: clamp(-42px, -1vw, -8px);
  bottom: -1px;
  width: min(66vw, 1140px);
  height: 100%;
  display: flex;
  align-items: end;
  justify-content: end;
}

.hero-portrait {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: right bottom;
  filter: saturate(.93) contrast(.98);
}

/* =========================================================
   SHARED
   ========================================================= */

.section-shell {
  width: min(calc(100% - 10vw), var(--max));
  margin-inline: auto;
}

/* =========================================================
   ABOUT
   ========================================================= */

.about {
  display: none;
  position: relative;
  z-index: 8;
  width: 100%;
  max-width: none;
  min-height: 118vh;
  margin: 0;
  padding: 120px 0;
  overflow: clip;
}

.about.is-open {
  display: block;
}

.about-close {
  position: absolute;
  top: 42px;
  right: clamp(24px, 4vw, 72px);
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid rgba(36, 23, 15, .45);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: 500 .72rem/1 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.about-close span {
  font-size: 1.15rem;
  font-weight: 400;
}

.about-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 55%) minmax(0, 45%);
  align-items: center;
}

.about-doodle {
  position: absolute;
  z-index: 2;
  width: clamp(250px, 24vw, 440px);
  height: auto;
  overflow: visible;
  fill: none;
  stroke: rgba(36, 23, 15, .42);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.about-doodle-left {
  bottom: clamp(45px, 7vh, 85px);
  left: -12px;
}

.about-doodle-right {
  top: clamp(45px, 7vh, 85px);
  right: -10px;
}

.about-copy {
  max-width: 580px;
  margin-left: clamp(80px, 8vw, 150px);
  padding-right: clamp(28px, 5vw, 80px);
}

.about-copy h2 {
  margin: 0 0 50px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 4.5vw, 5.2rem);
  line-height: .95;
}

.about-copy p {
  margin: 0 0 26px;
  font-family: Georgia, serif;
  font-size: clamp(1rem, 1.15vw, 1.22rem);
  line-height: 1.9;
}

.about-rise {
  will-change: transform;
}

.about-rise-copy {
  transform: translateY(240px);
}

.about-rise-card {
  transform: translateX(48vw) translateY(25px);
  opacity: 0;
}

.education-card {
  position: relative;
  width: 100%;
  min-height: 560px;
  padding: 40px clamp(42px, 6vw, 100px) 40px 92px;
  border-radius: 42px 0 0 42px;
  background: rgba(248, 244, 240, .74);
  box-shadow: 0 28px 80px rgba(73, 48, 34, .07);
  overflow: hidden;
}

.education-line {
  position: absolute;
  top: 30px;
  bottom: 30px;
  left: 45px;
  width: 1px;
  background: rgba(36, 23, 15, .45);
  transform-origin: top;
  will-change: transform;
}

.education-item {
  position: relative;
  padding: 20px 0 42px;
}

.education-item + .education-item {
  border-top: 1px solid rgba(36, 23, 15, .08);
  padding-top: 42px;
}

.education-dot {
  position: absolute;
  left: -53px;
  top: 80px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ad917f;
}

.education-item.current .education-dot {
  background: var(--ink);
}

.education-year {
  display: block;
  margin-bottom: 14px;
  font-size: .8rem;
  letter-spacing: .25em;
  text-transform: uppercase;
}

.education-item h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.7rem, 2.8vw, 3rem);
  line-height: 1.06;
  letter-spacing: .06em;
}

.education-item p {
  margin: 18px 0 0;
  font-size: .95rem;
}

/* =========================================================
   PROJECTS — EDITORIAL ROWS
   ========================================================= */

.projects {
  position: relative;
  padding: 130px 0 0;
  background: transparent;
}

.projects-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .55fr);
  gap: 50px;
  align-items: end;
  margin-bottom: 24px;
}

.projects-solid-background,
.thank-you,
.footer {
  background: transparent;
}

.projects-solid-background {
  position: relative;
  margin-top: 0;
  padding-top: clamp(55px, 7vw, 95px);
}

.projects-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(4rem, 8vw, 8rem);
  font-weight: 400;
  line-height: .85;
}

.featured-project-scroll {
  display: none;
  gap: clamp(12px, 1.5vw, 24px);
  width: 100%;
  margin: 0;
  padding: 24px max(5vw, calc((100vw - var(--max)) / 2)) 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  scrollbar-width: thin;
  scrollbar-color: rgba(36, 23, 15, .34) transparent;
}

.featured-project-scroll.is-dragging {
  cursor: grabbing;
  -webkit-user-select: none;
  user-select: none;
}

.featured-project-image {
  flex: 0 0 clamp(560px, 72vw, 1120px);
  margin: 0;
  height: clamp(350px, 42vw, 610px);
  overflow: hidden;
}

.featured-project-link {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: #fff;
  cursor: pointer;
}

.featured-project-link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(20, 13, 9, .68) 0,
    rgba(20, 13, 9, .38) 16%,
    rgba(20, 13, 9, .08) 42%,
    transparent 62%
  );
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
}

.featured-project-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  transition: transform .45s cubic-bezier(.2, .65, .3, 1);
}

.featured-project-link > span {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 1;
  font-family: var(--sans);
  font-size: clamp(.8rem, .85vw, .94rem);
  font-weight: 500;
  letter-spacing: .03em;
  white-space: nowrap;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .45);
  opacity: 0;
  transform: translate(-50%, 7px);
  transition: opacity .3s ease, transform .3s ease;
}

.featured-project-link:hover::after,
.featured-project-link:focus-visible::after {
  opacity: 1;
}

.featured-project-link:hover img,
.featured-project-link:focus-visible img {
  transform: scale(1.015);
}

.featured-project-link:hover > span,
.featured-project-link:focus-visible > span {
  opacity: .9;
  transform: translate(-50%, 0);
}

.featured-project-scroll.is-dragging .featured-project-link {
  cursor: grabbing;
}

@media (max-width: 640px) {
  .featured-project-scroll {
    margin-bottom: 0;
    padding-inline: 15px;
  }

  .projects-solid-background {
    padding-top: 64px;
  }

  .featured-project-image {
    flex-basis: 88vw;
    height: 320px;
  }
}

.projects-intro {
  max-width: 520px;
  justify-self: end;
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(.98rem, 1.05vw, 1.12rem);
  line-height: 1.7;
  color: var(--muted);
}

.projects-stage {
  position: relative;
  width: min(calc(100% - 10vw), var(--max));
  margin-inline: auto;
  overflow: visible;
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: visible;
}

.project {
  width: 100%;
  min-height: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  scroll-margin-top: calc(var(--header-h) + 24px);

  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity .4s ease,
    transform .48s cubic-bezier(.22, .72, .2, 1);
}

.project:last-child {
  border-bottom: 1px solid var(--line);
}

.project.is-revealed,
.project.open {
  opacity: 1;
  transform: translateY(0);
}

.project-preview {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: clamp(44px, 6vw, 100px);
  align-items: center;
  min-height: 0;
  padding: clamp(38px, 4.5vw, 64px) 0;
}

.project-preview > .preview-marquee {
  position: relative;
  width: calc(100% + clamp(60px, 8vw, 145px));
  margin-left: clamp(-38px, -2vw, -18px);
}

/* Project copy */
.project-summary-text {
  min-width: 0;
}

.project-kicker {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 0 0 28px;
  font-size: clamp(.76rem, .8vw, .88rem);
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted);
}

.project-summary-text h3 {
  max-width: 760px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3rem, 5.2vw, 6.4rem);
  font-weight: 400;
  line-height: .93;
  letter-spacing: -.025em;
}

.project-summary-text > p {
  max-width: 520px;
  margin: 38px 0 0;
  font-family: Georgia, serif;
  font-size: clamp(1rem, 1.05vw, 1.16rem);
  line-height: 1.75;
  color: #55483f;
}

/* Project image */
.preview-marquee {
  min-width: 0;
  width: 100%;
  overflow: visible;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.preview-track {
  display: block;
  width: 100%;
  transform: none !important;
  transition: none !important;
}

.preview-card {
  display: none;
  width: 100%;
  margin: 0;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 0;
}

.preview-card:first-child {
  display: block;
}

.preview-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Participatory Design preview — same footprint as the other projects */
.project-image-stack {
  position: relative;
  min-width: 0;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(250, 246, 242, .42);
  box-shadow: 0 22px 70px rgba(65, 43, 30, .07);
}

.stack-image {
  position: absolute;
  bottom: -18%;
  width: 38%;
  margin: 0;
  overflow: hidden;
  border-radius: 6% / 3%;
  box-shadow: 0 18px 45px rgba(36, 23, 15, .18);
}

.stack-image-back {
  left: 17%;
  transform: rotate(-5deg);
}

.stack-image-front {
  right: 17%;
  z-index: 1;
  transform: rotate(5deg);
}

.stack-image img {
  display: block;
  width: 100%;
  height: auto;
}

/* Synthetic DHIS2 preview */
.dashboard-card {
  grid-template-columns: 27% 1fr;
  background: #f4f5f2;
}

.dashboard-card:first-child {
  display: grid;
}

.dashboard-sidebar {
  background: #182630;
}

.dashboard-content {
  padding: 22px;
}

.dashboard-search {
  height: 22px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: #fff;
}

.dashboard-map {
  position: relative;
  height: calc(100% - 34px);
  min-height: 150px;
  border-radius: 4px;
  background:
    linear-gradient(25deg, transparent 49%, rgba(151, 166, 150, .25) 50% 51%, transparent 52%),
    linear-gradient(145deg, transparent 49%, rgba(151, 166, 150, .22) 50% 51%, transparent 52%),
    #e8ece7;
}

.dashboard-map i {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #9b694d;
}

.dashboard-map i:nth-child(1) { left: 30%; top: 35%; }
.dashboard-map i:nth-child(2) { left: 55%; top: 50%; }
.dashboard-map i:nth-child(3) { left: 72%; top: 28%; }
.dashboard-map i:nth-child(4) { left: 46%; top: 72%; }
.dashboard-map i:nth-child(5) { left: 79%; top: 67%; }

.dashboard-table {
  height: 26px;
  margin-bottom: 10px;
  border-radius: 6px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #e5e7e3;
}

.dashboard-table.short {
  width: 72%;
}

/* Synthetic LiftOff preview */
.liftoff-card {
  padding: 30px;
  background: linear-gradient(155deg, #152831, #2f5a65);
  color: #eaf4f5;
}

.liftoff-card:first-child {
  display: block;
}

.weather-label {
  font-size: .62rem;
  letter-spacing: .18em;
  opacity: .7;
}

.liftoff-card strong {
  display: block;
  margin-top: 20px;
  font-family: var(--serif);
  font-size: clamp(4rem, 6vw, 7rem);
  font-weight: 400;
}

.weather-bars {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.weather-bars i {
  width: 42px;
  height: 6px;
  border-radius: 4px;
  background: #bdd1c5;
}

.weather-bars i:nth-child(2) { background: #d3b88f; }
.weather-bars i:nth-child(3) { background: #b87568; }

.mini-chart {
  height: 60%;
  margin-top: 36px;
  border-left: 1px solid rgba(255, 255, 255, .5);
  border-bottom: 1px solid rgba(255, 255, 255, .5);
  background: linear-gradient(
    150deg,
    transparent 45%,
    rgba(255, 255, 255, .18) 46% 49%,
    transparent 50%
  );
}

.threshold-row {
  height: 22px;
  margin-top: 20px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .12);
}

/* See more */
.project-toggle {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin: 46px 0 0;
  padding: 0 0 7px;
  border: 0;
  border-bottom: 1px solid rgba(36, 23, 15, .55);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: .82rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  transform-origin: left center;
  transition: transform .3s ease;
}

.project-toggle:hover,
.project-toggle:focus-visible {
  transform: scale(1.045);
}

.project-toggle > span:first-child {
  padding: 0;
}

.project-toggle-icon {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.3s ease;
  margin-top: -4px;
}

.project.open .project-toggle-icon {
  transform: rotate(225deg);
  margin-top: 4px;
}

/* =========================================================
   PROJECT DROPDOWN
   Closed = genuinely zero height.
   Open = unfolds underneath the unchanged preview row.
   ========================================================= */

.project-details {
  max-height: 0;
  margin: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  border-top: 0 solid transparent;
  background: rgba(229, 219, 213, .82);
  transform: translateY(-8px);
  transition:
    max-height .9s cubic-bezier(.22, .72, .18, 1),
    opacity .32s ease,
    transform .55s cubic-bezier(.22, .72, .18, 1),
    border-color .25s ease;
}

.project.open .project-details {
  max-height: 5000px;
  overflow: visible;
  opacity: 1;
  visibility: visible;
  border-top-width: 1px;
  border-top-color: rgba(36, 23, 15, .14);
  transform: translateY(0);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, .92fr);
  gap: clamp(55px, 7vw, 110px);
  align-items: start;
  padding: clamp(70px, 7vw, 105px) 0 clamp(90px, 9vw, 135px);
}

/* Created by prepareInlineProjectCases() in script.js */
.detail-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 54px;
}

.detail-text > * {
  width: 100%;
}

.detail-context {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .12em;
  line-height: 1.6;
  text-transform: uppercase;
}

.detail-context a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.detail-label {
  display: block;
  margin-bottom: 16px;
  font-size: 3rem;
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--muted);
}

.detail-lead h4 {
  max-width: 820px;
  margin: 12px 0 0;
  font-family: var(--serif);
  font-size: clamp(2.3rem, 4.4vw, 5rem);
  font-weight: 400;
  line-height: 1.02;
}

.detail-grid p {
  max-width: 720px;
  margin: 0;
  font-size: clamp(.98rem, 1vw, 1.1rem);
  line-height: 1.85;
  color: #44372f;
}

.process-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.process-list li {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.process-list b {
  display: none;
}

.process-list li > span {
  font-family: var(--sans);
  font-size: clamp(.98rem, 1vw, 1.1rem);
  font-weight: 400;
  line-height: 1.85;
  color: #44372f;
}

.project-details p strong,
.project-details li strong {
  font-weight: inherit;
}

.process-inline-image {
  grid-column: 1;
  width: 100%;
  margin: 18px 0 4px;
  overflow: hidden;
}

.process-inline-image img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  cursor: zoom-in;
}

.persona-process-image,
.platform-process-image {
  width: min(100%, 520px);
  margin-inline: auto;
}

#project-edutopia .process-list li:first-child .platform-process-image {
  width: min(100%, 350px);
}

#project-edutopia .process-list li:nth-child(2) .platform-process-image {
  width: min(100%, 390px);
}

:is(#project-tanum, #project-edutopia, #project-liftoff, #project-participatory, #project-sustained) .detail-story-row.single-column-row .detail-story-copy:has(.process-list) {
  width: min(100%, 1120px);
}

:is(#project-tanum, #project-edutopia, #project-liftoff, #project-participatory, #project-sustained) .process-list li.has-process-image {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: clamp(30px, 5vw, 72px);
  padding: clamp(34px, 4vw, 58px) 0;
}

:is(#project-tanum, #project-edutopia, #project-liftoff, #project-participatory, #project-sustained) .process-point-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  min-width: 0;
}

:is(#project-tanum, #project-edutopia, #project-liftoff, #project-participatory, #project-sustained) .process-point-copy > span {
  font-family: var(--sans);
  font-size: clamp(.98rem, 1vw, 1.1rem);
  font-weight: 400;
  line-height: 1.85;
  color: #44372f;
  text-align: justify;
  text-justify: inter-word;
  -webkit-hyphens: auto;
  hyphens: auto;
}

:is(#project-tanum, #project-edutopia, #project-liftoff, #project-participatory, #project-sustained) .process-list li.has-process-image .process-inline-image {
  grid-column: auto;
  width: min(82%, 460px);
  margin: 0;
  justify-self: center;
}

#project-tanum .process-list li.process-image-right .process-point-copy {
  grid-column: 1;
  grid-row: 1;
}

#project-tanum .process-list li.process-image-right .process-inline-image {
  grid-column: 2;
  grid-row: 1;
}

#project-tanum .process-list li.process-image-left .process-point-copy {
  grid-column: 2;
  grid-row: 1;
}

#project-tanum .process-list li.process-image-left .process-inline-image {
  grid-column: 1;
  grid-row: 1;
}

#project-tanum .process-list li:last-child:not(.has-process-image) {
  width: min(calc(100% - 56px), 720px) !important;
  max-width: 720px;
  margin-inline: auto;
  justify-self: center;
}

#project-liftoff .process-inline-image-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
}

#project-sustained .process-inline-image-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 12px;
}

#project-sustained .process-inline-image-pair img {
  width: 100%;
  height: clamp(180px, 18vw, 250px);
  object-fit: contain;
}

#project-sustained .process-list li:nth-child(1) .sustained-process-image,
#project-sustained .process-list li:nth-child(3) .sustained-process-image {
  width: min(62%, 320px);
}

#project-participatory .process-inline-image-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 12px;
}

#project-participatory .process-inline-image-pair img {
  display: block;
  width: 100%;
  height: clamp(220px, 23vw, 320px);
  max-height: none;
  object-fit: contain;
  object-position: center;
}

#project-participatory .process-inline-image-trio {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#project-participatory .process-list li:not(.has-process-image) {
  width: min(calc(100% - 56px), 720px) !important;
  max-width: 720px;
  margin-inline: auto;
  justify-self: center;
}

#project-liftoff .process-inline-image.process-inline-image-pair > img {
  display: block;
  width: auto;
  max-width: 100%;
  height: clamp(220px, 23vw, 310px);
  max-height: 310px;
  object-fit: contain;
  object-position: center;
  justify-self: center;
}

#project-liftoff .process-list li:first-child .liftoff-process-image {
  width: min(100%, 340px);
  justify-self: center;
}

#project-liftoff .process-list li:nth-child(3) .liftoff-process-image {
  width: min(100%, 300px);
  justify-self: center;
}

#project-liftoff .process-list li:nth-child(3) .liftoff-process-image img {
  width: auto;
  max-width: 100%;
  height: clamp(220px, 23vw, 310px);
  max-height: 310px;
  margin-inline: auto;
  object-fit: contain;
}

:is(#project-edutopia, #project-liftoff, #project-participatory, #project-sustained) .process-list li.has-process-image:nth-child(odd) .process-point-copy {
  grid-column: 1;
  grid-row: 1;
}

:is(#project-edutopia, #project-liftoff, #project-participatory, #project-sustained) .process-list li.has-process-image:nth-child(odd) .process-inline-image {
  grid-column: 2;
  grid-row: 1;
}

:is(#project-edutopia, #project-liftoff, #project-participatory, #project-sustained) .process-list li.has-process-image:nth-child(even) .process-point-copy {
  grid-column: 2;
  grid-row: 1;
}

:is(#project-edutopia, #project-liftoff, #project-participatory, #project-sustained) .process-list li.has-process-image:nth-child(even) .process-inline-image {
  grid-column: 1;
  grid-row: 1;
}

.process-title {
  display: block;
  margin-bottom: 7px;
  font-family: var(--sans);
  font-weight: 600;
}

.detail-solution .detail-label:not(:first-child) {
  margin-top: 34px;
}

/* Sticky project imagery created by JS */
.detail-media {
  position: sticky;
  top: calc(var(--header-h) + 30px);
  align-self: start;
  display: grid;
  gap: 18px;
  max-height: calc(100vh - var(--header-h) - 60px);
  overflow: hidden;
}

.detail-media-card {
  width: 100%;
  margin: 0;
  overflow: hidden;
  border-radius: 7px;
  background: rgba(255, 255, 255, .42);
  box-shadow: 0 14px 45px rgba(60, 39, 28, .06);
}

.detail-media-card:first-child {
  display: block;
  height: min(48vh, 430px);
  aspect-ratio: auto;
}

.detail-media-card:nth-child(2) {
  display: block;
  height: min(24vh, 220px);
  aspect-ratio: auto;
}

.detail-media-card:nth-child(n + 3) {
  display: none;
}

.detail-media-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-media-card.dashboard-card {
  display: grid;
  grid-template-columns: 27% 1fr;
}

.detail-media-card.liftoff-card {
  display: block;
  padding: 26px;
}

/* Image gallery shown inside the expanded Edutopia case */
.case-gallery {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
  border-top: 1px solid rgba(36, 23, 15, .10);
  background: rgba(72, 64, 51, .92);
}

.case-gallery-card {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  background: #f5f1eb;
}

.case-gallery-card-tall {
  grid-row: span 2;
  aspect-ratio: auto;
}

.case-gallery-card-phone {
  aspect-ratio: 4 / 5;
}

.case-gallery-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Next project */
.next-project-bar {
  min-height: 118px;
  padding: 30px 0;
  border-top: 1px solid rgba(36, 23, 15, .16);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  cursor: pointer;
}

.next-project-copy {
  text-align: right;
}

.next-project-copy span {
  display: block;
  margin-bottom: 7px;
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.next-project-copy strong {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2vw, 2.2rem);
  font-weight: 400;
}

.next-project-button {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(36, 23, 15, .28);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 1.15rem;
  transition: transform .3s ease, background .3s ease;
}

.next-project-bar:hover .next-project-button {
  transform: translateX(5px);
  background: rgba(255, 255, 255, .3);
}

/* =========================================================
   THANK YOU
   ========================================================= */

.thank-you {
  min-height: 142vh;
  overflow: clip;
}

.thank-you-sticky {
  position: sticky;
  top: 0;
  height: 90vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.thank-you-text {
  position: relative;
  display: grid;
  place-items: center;
  width: min(96vw, 1700px);
  min-height: clamp(300px, 44vw, 720px);
  margin: 0;
  text-align: center;
  font-family: var(--serif);
  color: var(--ink);
}

.contact-doodle {
  position: absolute;
  z-index: 0;
  width: clamp(120px, 12vw, 210px);
  height: auto;
  overflow: visible;
  fill: none;
  stroke: rgba(36, 23, 15, .68);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.contact-doodle-top {
  top: clamp(65px, 9vh, 110px);
  left: -28px;
}

.contact-doodle-bottom {
  right: -28px;
  bottom: 0;
  transform: rotate(180deg);
}

.thank-line {
  position: absolute;
  display: block;
  width: 100%;
  text-align: center;
  font-family: var(--serif);
  font-weight: 400;
  line-height: .78;
  letter-spacing: .05em;
  color: var(--ink);
  will-change: transform, opacity;
}

.thank-line-top {
  top: 25%;
  z-index: 2;
  font-size: clamp(5.7rem, 12.5vw, 14rem);
  opacity: .04;
  transform: translateY(190px);
}

.thank-line-bottom {
  top: 52%;
  z-index: 1;
  font-size: clamp(4.7rem, 10vw, 11.5rem);
  opacity: .045;
  transform: translateY(45px);
}

.contact-links {
  position: absolute;
  left: 50%;
  top: 79.5%;
  transform: translateX(-50%);
  display: flex;
  align-items: end;
  justify-content: center;
  gap: clamp(70px, 14vw, 230px);
  width: min(88vw, 980px);
  font-family: var(--sans);
  font-size: clamp(.85rem, 1vw, 1rem);
  letter-spacing: .05em;
}

.contact-links a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: min(38vw, 450px);
  min-width: 300px;
  color: var(--ink);
  text-decoration: none;
  opacity: 0;
  transform: translateY(80px);
}

.contact-address {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.contact-note {
  position: static;
  display: block;
  padding: 0 0 96px;
  font-family: "Allura", cursive;
  font-size: clamp(2.05rem, 2.9vw, 3.25rem);
  font-weight: 400;
  line-height: .9;
  letter-spacing: 0;
  text-align: center;
}

.contact-email .contact-note {
  align-self: flex-start;
  margin-left: 12px;
}

.contact-linkedin .contact-note {
  align-self: flex-end;
  margin-right: 12px;
}

.contact-note > span:first-child {
  display: block;
  transform: rotate(-4deg);
}

.contact-note-linkedin > span:first-child {
  transform: rotate(-3deg);
}

.contact-note-arrow {
  position: absolute;
  left: 50%;
  bottom: 34px;
  width: clamp(48px, 5vw, 72px);
  height: clamp(52px, 5.4vw, 78px);
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translateX(-78%);
}

.contact-note-linkedin .contact-note-arrow {
  right: auto;
  left: 50%;
  transform: translateX(-22%) scaleX(-1);
}

@media (max-width: 640px) {
  .contact-links {
    top: 75%;
    flex-direction: column;
    align-items: center;
    gap: 18px;
  }

  .contact-note {
    font-size: 1.85rem;
    padding-bottom: 78px;
  }

  .contact-links a {
    width: min(86vw, 420px);
    min-width: 0;
  }

  .contact-email .contact-note,
  .contact-linkedin .contact-note {
    align-self: center;
    margin-right: 0;
    margin-left: 0;
  }

  .contact-doodle {
    width: 82px;
    opacity: .7;
  }
}

/* =========================================================
   FOOTER
   ========================================================= */

.footer {
  position: relative;
  border-top: 1px solid rgba(36, 23, 15, .10);
}

.footer-bottom {
  min-height: 76px;
  padding: 0 max(4.5vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  font-size: .88rem;
}

.footer-bottom a {
  color: inherit;
  text-decoration: none;
}

/* =========================================================
   ACCESSIBILITY
   ========================================================= */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (min-width: 981px) {
  .education-edge {
    justify-self: stretch;
    margin-right: 0;
  }
}

@media (max-width: 980px) {
  :root {
    --header-h: 72px;
  }

  .site-header {
    padding-inline: 22px;
  }

  .brand {
    max-width: 120px;
    line-height: 1.1;
  }

  .nav {
    gap: 15px;
  }

  .nav a {
    display: none;
  }

  .hero-content {
    width: 100%;
  }

  .hero-copy {
    left: 7vw;
    top: 25%;
  }

  .hero h1 {
    font-size: clamp(2.8rem, 10vw, 5.2rem);
  }

  .hero-portrait-wrap {
    right: -20vw;
    width: 92vw;
    height: 68%;
  }

  .hero-role {
    top: 52vh;
  }

  .about-inner {
    grid-template-columns: 1fr;
    gap: 60px;
  }

  .about-copy {
    margin-left: 6vw;
    margin-right: 6vw;
    padding-right: 0;
  }

  .about-doodle {
    width: 190px;
    opacity: .58;
  }

  .about-doodle-left {
    left: -55px;
  }

  .about-doodle-right {
    top: 45px;
    right: -58px;
  }

  .education-card {
    width: calc(100% - 5vw);
    margin-left: 5vw;
    border-radius: 28px 0 0 28px;
  }

  .projects-head {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .projects-intro {
    justify-self: start;
  }

  .project-preview {
    grid-template-columns: 1fr;
    gap: 38px;
    padding: 44px 0;
  }

  .project-preview > .preview-marquee {
    width: 100%;
    margin-left: 0;
  }

  .project-summary-text h3 {
    font-size: clamp(2.8rem, 9vw, 5rem);
  }

  .detail-grid {
    grid-template-columns: 1fr;
    gap: 50px;
  }

  .detail-media {
    position: relative;
    top: auto;
    max-height: none;
    order: -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-media-card:first-child,
  .detail-media-card:nth-child(2) {
    height: auto;
    aspect-ratio: 4 / 3;
  }
}

@media (max-width: 640px) {
  .hero {
    min-height: 100svh;
  }

  .hero-sticky {
    min-height: 100svh;
  }

  .hero-copy {
    top: 20%;
  }

  .hero h1 {
    font-size: clamp(2.55rem, 11.4vw, 4.5rem);
  }

  .hero-project-link {
    margin-top: 38px;
  }

  .hero-role {
    top: 46vh;
  }

  .hero-portrait-wrap {
    right: -30vw;
    bottom: -1vh;
    width: 110vw;
    height: 60%;
  }

  .education-card {
    padding: 28px 28px 28px 58px;
    border-radius: 24px;
  }

  .education-line {
    left: 27px;
  }

  .education-dot {
    left: -37px;
  }

  .projects {
    padding-top: 90px;
  }

  .projects-stage {
    width: min(calc(100% - 30px), var(--max));
  }

  .project-preview {
    padding: 38px 0;
  }

  .project-summary-text h3 {
    font-size: clamp(2.5rem, 13vw, 4rem);
  }

  .preview-card {
    aspect-ratio: 4 / 3;
  }

  .project-image-stack {
    aspect-ratio: 4 / 3;
  }

  .stack-image {
    bottom: -10%;
    width: 43%;
  }

  .stack-image-back {
    left: 10%;
  }

  .stack-image-front {
    right: 10%;
  }

  .detail-grid {
    padding: 52px 0 72px;
  }

  .detail-media {
    grid-template-columns: 1fr;
  }

  .detail-media-card:nth-child(n + 2) {
    display: none;
  }

  .process-list li {
    grid-template-columns: 44px 1fr;
  }

  .thank-line-top {
    top: 37%;
    font-size: clamp(4.4rem, 19vw, 7rem);
  }

  .thank-line-bottom {
    top: 53%;
    font-size: clamp(3.5rem, 15vw, 6rem);
  }
}

/* Shared project image viewer: show every image uncropped */
.detail-media-gallery {
  position: sticky;
  display: grid;
  grid-template: minmax(0, 1fr) auto / 1fr;
  gap: 12px;
}

.detail-media-gallery .detail-media-card,
.detail-media-gallery .detail-media-card:nth-child(n) {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-area: 1 / 1;
  background: #f5f1eb;
}

.detail-media-gallery .detail-media-card.is-active,
.detail-media-gallery .detail-media-card.is-active:nth-child(n) {
  display: block;
}

.detail-media-gallery .detail-media-card img {
  width: 100%;
  height: 100%;
  padding: 10px;
  object-fit: contain;
}

.detail-media-controls {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  grid-area: 2 / 1;
  color: #fff;
}

.detail-media-control {
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
}

.detail-media-control:hover,
.detail-media-control:focus-visible {
  background: #fff;
  color: #484033;
}

.detail-media-counter {
  justify-self: center;
  font-size: .72rem;
  letter-spacing: .14em;
}

@media (max-width: 980px) {
  .detail-media-gallery {
    position: relative;
    height: min(72vw, 560px);
    grid-template: minmax(0, 1fr) auto / 1fr;
  }
}

@media (max-width: 640px) {
  .detail-media-gallery {
    height: 390px;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  .project {
    opacity: 1;
    transform: none;
  }
}


/* =========================================================
   PROJECT CASE — FINAL COMPACT LAYOUT
   Restores the intended open-case layout after CSS cleanup.
   ========================================================= */

.project.open .project-details {
  max-height: 5000px;
  overflow: visible;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Compact two-column case */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(310px, .95fr);
  gap: 0;
  align-items: stretch;
  padding: 0;
}

/* Left text column */
.detail-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 36px 48px 48px;
  border-right: 1px solid rgba(36, 23, 15, .10);
}

.detail-text > * {
  width: 100%;
  padding: 0 0 28px;
  margin: 0 0 30px;
  border-bottom: 1px solid rgba(36, 23, 15, .08);
}

.detail-text > *:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.detail-label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--muted);
  font-weight: bold;
}

/* The problem statement should be strong, but not dominate the page */
.detail-text .detail-lead h4 {
  max-width: 900px;
  margin: 8px 0 0;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 3.1vw, 3.8rem);
  font-weight: 400;
  line-height: 1.05;
}

.detail-text p,
.detail-text li {
  max-width: 780px;
  font-family: var(--sans);
  font-size: .96rem;
  line-height: 1.7;
  color: #50473f;
}

.process-list {
  margin: 0;
  padding: 0;
  border-top: 0;
}

.process-list li {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 18px 0;
  border-bottom: 1px solid rgba(36, 23, 15, .08);
}

.process-list li:last-child {
  border-bottom: 0;
}

/* Right sticky visual column */
.detail-media {
  position: sticky;
  top: var(--header-h);
  align-self: start;
  height: calc(100vh - var(--header-h));
  max-height: none;
  overflow: hidden;
  padding: 0;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  background: transparent;
}

.detail-media-card {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  border-radius: 6px;
  background: #f5f1eb;
  box-shadow: none;
}

.detail-media-card:first-child,
.detail-media-card:nth-child(2) {
  display: block;
  height: auto;
  aspect-ratio: auto;
}

.detail-media-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-media-card.dashboard-card {
  display: grid;
  grid-template-columns: 27% 1fr;
}

.detail-media-card.liftoff-card {
  display: block;
  padding: 26px;
}

/* Bottom navigation sits below both columns */
.next-project-bar {
  min-height: 100px;
  padding: 24px 0;
}

/* Mobile */
@media (max-width: 980px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-text {
    border-right: 0;
    padding: 30px 28px 40px;
  }

  .detail-media {
    position: relative;
    top: auto;
    height: 420px;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
    order: -1;
  }

  .detail-text .detail-lead h4 {
    font-size: clamp(2rem, 6vw, 3.2rem);
  }
}

@media (max-width: 640px) {
  .detail-media {
    height: 300px;
    grid-template-columns: 1fr;
  }

  .detail-media-card:nth-child(2) {
    display: none;
  }

  .detail-text {
    padding: 24px 20px 34px;
  }

  .case-gallery {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .case-gallery-card,
  .case-gallery-card-tall {
    grid-row: auto;
    aspect-ratio: 16 / 10;
  }
}

/* Keep project images fully visible in both preview and expanded viewer. */
.project .preview-card img {
  padding: 0;
  object-fit: contain;
  background: transparent;
}

#project-participatory .participatory-pair-preview:first-child {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  justify-items: center;
  gap: 18px;
  aspect-ratio: auto;
  overflow: visible;
}

#project-participatory .participatory-pair-preview img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: clamp(300px, 34vw, 480px);
  object-fit: contain;
  border-radius: clamp(16px, 2vw, 28px);
  clip-path: inset(0 round clamp(16px, 2vw, 28px));
}

#project-participatory .participatory-pair-preview img:first-child {
  justify-self: end;
}

#project-participatory .participatory-pair-preview img:last-child {
  justify-self: start;
}

#project-participatory .preview-card:first-child,
#project-liftoff .preview-card:first-child {
  height: clamp(300px, 34vw, 480px);
  aspect-ratio: auto;
}

#project-participatory .preview-card:first-child img,
#project-liftoff .preview-card:first-child img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#project-participatory .detail-media-card.case-gallery-card-phone,
#project-participatory .detail-media-card.case-gallery-card-phone img {
  overflow: hidden;
  border-radius: clamp(16px, 2vw, 28px);
  clip-path: inset(0 round clamp(16px, 2vw, 28px));
}

#project-participatory .detail-media.detail-media-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto;
  grid-auto-rows: auto;
  align-items: start;
  gap: 16px 8px;
}

#project-participatory .detail-media-gallery > .detail-media-card:nth-child(n) {
  position: relative;
  inset: auto;
  min-width: 0;
  max-width: 100%;
  transform: none;
}

#project-participatory .detail-media-gallery > .detail-media-card:nth-child(1) {
  grid-area: 1 / 1 / 2 / 3;
}

#project-participatory .detail-media-gallery > .detail-media-card:nth-child(2) {
  grid-area: 2 / 1 / 3 / 3;
}

#project-participatory .detail-media-gallery > .detail-media-card:nth-child(-n + 2) {
  width: 100%;
  height: auto;
  aspect-ratio: auto;
}

#project-participatory .detail-media-gallery > .detail-media-card:nth-child(-n + 2) img {
  width: 100%;
  height: auto;
}

#project-participatory .detail-media-gallery > .detail-media-card:nth-child(3) {
  grid-area: 3 / 1 / 4 / 2;
}

#project-participatory .detail-media-gallery > .detail-media-card:nth-child(4) {
  grid-area: 3 / 2 / 4 / 3;
}

#project-participatory .detail-media-gallery > .detail-media-card:nth-child(5) {
  grid-area: 4 / 1 / 5 / 2;
}

#project-participatory .detail-media-gallery > .detail-media-card:nth-child(6) {
  grid-area: 4 / 2 / 5 / 3;
}

#project-participatory .detail-media-gallery > .detail-media-card.case-gallery-card-phone {
  width: 100%;
  aspect-ratio: auto;
}

#project-participatory .detail-media-gallery > .detail-media-card.case-gallery-card-phone img {
  width: 100%;
  height: auto;
}

#project-participatory .detail-media-slideshow {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  #project-participatory .participatory-pair-preview img {
    max-height: 280px;
  }

  #project-participatory .preview-card:first-child,
  #project-liftoff .preview-card:first-child {
    height: 280px;
  }
}

#project-edutopia .platforms-final-preview:first-child {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: start;
  padding: 0;
  aspect-ratio: auto;
  overflow: visible;
  background: transparent;
}

#project-edutopia .preview-marquee {
  overflow: visible;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#project-edutopia .platforms-final-preview img {
  min-width: 0;
  height: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
}

#project-edutopia .detail-media-gallery > .detail-media-card,
#project-edutopia .detail-media-gallery > .detail-media-card:nth-child(n) {
  aspect-ratio: auto;
  overflow: visible;
  border-radius: 0;
  background: transparent;
}

#project-edutopia .detail-media-gallery > .detail-media-card img {
  height: auto;
  padding: 0;
  background: transparent;
}

@media (max-width: 640px) {
  #project-edutopia .platforms-final-preview:first-child {
    grid-template-columns: 1fr 1fr;
  }
}

.detail-media.detail-media-gallery {
  display: grid;
  grid-template: minmax(0, 1fr) auto / 1fr;
  gap: 12px;
}

@media (max-width: 980px) {
  .detail-media.detail-media-gallery {
    height: min(72vw, 560px);
    grid-template: minmax(0, 1fr) auto / 1fr;
  }
}

@media (max-width: 640px) {
  .detail-media.detail-media-gallery {
    height: 390px;
  }
}

/* Sequential case imagery; only an overflow set becomes a slideshow. */
.detail-media.detail-media-gallery {
  position: relative;
  top: auto;
  display: flex;
  flex-direction: column;
  height: auto;
  max-height: none;
  gap: 16px;
  overflow: visible;
}

.detail-media-gallery > .detail-media-card,
.detail-media-gallery > .detail-media-card:nth-child(n) {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  border-radius: 0;
  background: transparent;
}

.detail-media-gallery > .detail-media-card img {
  display: block;
  width: 100%;
  height: auto;
  padding: 0;
  object-fit: contain;
  background: transparent;
}

.detail-media-slideshow .detail-media-card img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  object-fit: contain;
  background: transparent;
}

.detail-media-gallery > .detail-media-card.case-gallery-card-full {
  aspect-ratio: auto;
}

.detail-media-gallery > .detail-media-card.case-gallery-card-full img {
  display: block;
  width: 100%;
  height: auto;
}

.detail-media-slideshow {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
}

.detail-media-slideshow .detail-media-card {
  background: transparent;
}

.detail-media-slideshow .detail-media-slide,
.detail-media-slideshow .detail-media-slide:nth-child(n) {
  position: absolute;
  inset: 0 0 52px;
  display: none;
  width: 100%;
  height: auto;
  border-radius: 0;
}

.detail-media-slideshow .detail-media-slide.is-active,
.detail-media-slideshow .detail-media-slide.is-active:nth-child(n) {
  display: block;
}

.detail-media-slideshow .detail-media-controls {
  position: absolute;
  right: 12px;
  bottom: 6px;
  left: 12px;
  color: #484033;
}

.detail-media-slideshow .detail-media-control {
  border-color: rgba(72, 64, 51, .45);
}

.detail-media-slideshow .detail-media-control:hover,
.detail-media-slideshow .detail-media-control:focus-visible {
  background: #484033;
  color: #fff;
}

/* Alternating case-study rows pair relevant images with the related copy. */
.detail-grid.detail-story-layout {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.project-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid rgba(36, 23, 15, .16);
  border-bottom: 1px solid rgba(36, 23, 15, .16);
  background: transparent;
}

.project-fact {
  min-width: 0;
  padding: clamp(16px, 1.8vw, 24px) clamp(20px, 2.8vw, 44px);
  border-right: 1px solid rgba(36, 23, 15, .13);
}

.project-fact:last-child {
  border-right: 0;
}

.project-fact span,
.project-fact strong {
  display: block;
}

.project-fact span {
  margin-bottom: 13px;
  color: var(--muted);
  font-size: .62rem;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.project-fact strong {
  font-size: clamp(.9rem, 1.05vw, 1.08rem);
  font-weight: 500;
  line-height: 1.45;
}

.detail-story-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: clamp(36px, 6vw, 96px);
  min-width: 0;
  padding: clamp(42px, 5vw, 76px) clamp(28px, 4vw, 64px);
  border-bottom: 1px solid rgba(36, 23, 15, .09);
}

.detail-story-row:last-child {
  border-bottom: 0;
}

.detail-story-copy,
.detail-story-copy > * {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

#project-participatory .detail-story-copy p + p {
  margin-top: 18px;
}

#project-sustained .detail-story-copy p + p {
  margin-top: 18px;
}

.detail-story-media {
  width: 100%;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  background: transparent;
}

.detail-story-media img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(68vh, 680px);
  object-fit: contain;
  cursor: zoom-in;
}

.detail-story-row.image-left .detail-story-media {
  grid-column: 1;
  grid-row: 1;
}

.detail-story-row.image-left .detail-story-copy {
  grid-column: 2;
  grid-row: 1;
}

.detail-story-row.text-only,
.detail-story-row.context-only {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
}

.detail-story-row.single-column-row {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
}

.detail-story-row.single-column-row .detail-story-copy {
  width: min(100%, 820px);
  margin-inline: auto;
  justify-self: center;
  text-align: left;
}

.detail-story-row.single-column-row .detail-label {
  text-align: center;
}

.detail-story-row.single-column-row .detail-story-media {
  width: min(100%, 1120px);
  margin-inline: auto;
  grid-column: 1;
  grid-row: auto;
}

.detail-story-row.single-column-row.image-left .detail-story-copy,
.detail-story-row.single-column-row.image-left .detail-story-media {
  grid-column: 1;
  grid-row: auto;
}

#project-edutopia .detail-story-media {
  width: min(100%, 520px);
  justify-self: center;
}

#project-edutopia .detail-story-media img {
  max-height: 360px;
}

.detail-story-row.text-only .detail-story-copy {
  width: min(100%, 820px);
  margin-inline: auto;
  justify-self: center;
  text-align: left;
}

.detail-story-row.text-only .detail-label {
  text-align: center;
}

.detail-story-copy p,
.detail-story-copy .process-list li > span {
  text-align: justify;
  text-justify: inter-word;
  -webkit-hyphens: auto;
  hyphens: auto;
}

.detail-story-copy p {
  margin-inline: auto;
}

.project-facts + .detail-story-row.text-only,
.project-facts + .detail-story-row.text-only + .detail-story-row.text-only,
.project-facts + .detail-story-row.text-only + .detail-story-row.text-only + .detail-story-row.text-only {
  padding-top: clamp(28px, 3vw, 42px);
  padding-bottom: clamp(28px, 3vw, 42px);
}

.detail-story-row.compact-text-row {
  padding-top: clamp(26px, 2.7vw, 38px);
  padding-bottom: clamp(26px, 2.7vw, 38px);
}

.detail-story-row.context-only {
  padding-top: 24px;
  padding-bottom: 24px;
}

.detail-final-solution {
  padding: clamp(30px, 3.5vw, 48px) clamp(28px, 4vw, 64px);
  border-top: 1px solid rgba(36, 23, 15, .09);
}

.detail-final-solution > .detail-label {
  display: block;
  margin-bottom: 16px;
  text-align: center;
}

.detail-final-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: clamp(10px, 1.4vw, 20px);
  width: min(100%, 1120px);
  margin-inline: auto;
}

.detail-final-gallery figure {
  min-width: 0;
  margin: 0;
}

.detail-final-gallery figure:first-child:last-child,
.detail-final-gallery figure:nth-child(3):last-child {
  grid-column: 1 / -1;
}

.detail-final-gallery img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 430px;
  object-fit: contain;
  cursor: zoom-in;
}

#project-sustained .detail-final-gallery {
  gap: 6px;
}

#project-edutopia .detail-final-gallery {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, 900px);
}

#project-edutopia .detail-final-gallery img {
  max-height: 300px;
}

#project-liftoff .detail-final-gallery {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, 860px);
}

#project-liftoff .detail-final-gallery img {
  max-height: 290px;
}

#project-liftoff .detail-final-gallery figure:nth-child(n) {
  grid-column: auto;
}

#project-participatory .detail-final-gallery {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#project-participatory .detail-final-gallery img {
  border-radius: 20px;
}

#project-edutopia .detail-final-gallery figure:nth-child(n),
#project-participatory .detail-final-gallery figure:nth-child(n) {
  grid-column: auto;
}

@media (max-width: 800px) {
  :is(#project-tanum, #project-edutopia, #project-liftoff, #project-participatory, #project-sustained) .process-list li.has-process-image {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  :is(#project-tanum, #project-edutopia, #project-liftoff, #project-participatory, #project-sustained) .process-list li.has-process-image:nth-child(n) .process-point-copy,
  :is(#project-tanum, #project-edutopia, #project-liftoff, #project-participatory, #project-sustained) .process-list li.has-process-image:nth-child(n) .process-inline-image {
    grid-column: 1;
    grid-row: auto;
  }

  :is(#project-tanum, #project-edutopia, #project-liftoff, #project-participatory, #project-sustained) .process-list li.has-process-image:nth-child(n) .process-point-copy {
    order: 1;
  }

  :is(#project-tanum, #project-edutopia, #project-liftoff, #project-participatory, #project-sustained) .process-list li.has-process-image:nth-child(n) .process-inline-image {
    order: 2;
  }

  #project-participatory .process-inline-image-trio {
    grid-template-columns: 1fr;
  }

  .project-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-fact:nth-child(2) {
    border-right: 0;
  }

  .project-fact:nth-child(-n + 2) {
    border-bottom: 1px solid rgba(36, 23, 15, .13);
  }

  .detail-story-row,
  .detail-story-row.image-left {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 38px 22px;
  }

  .detail-story-row.image-left .detail-story-copy,
  .detail-story-row.image-left .detail-story-media {
    grid-column: 1;
    grid-row: auto;
  }

  .detail-story-row .detail-story-copy {
    order: 1;
  }

  .detail-story-row .detail-story-media {
    order: 2;
  }

  .detail-final-gallery {
    grid-template-columns: 1fr;
  }

  #project-liftoff .detail-final-gallery {
    grid-template-columns: 1fr;
    width: min(100%, 360px);
  }

  .detail-final-gallery figure:nth-child(n) {
    grid-column: auto;
  }
}

@media (max-width: 980px) {
  .detail-media.detail-media-gallery {
    height: auto;
    order: initial;
  }
}

@media (max-width: 640px) {
  .detail-media.detail-media-gallery {
    height: auto;
  }
}

/* Projects end with their case content; navigation happens from the project list. */
.next-project-bar {
  display: none;
}

.project-external-link-wrap {
  display: flex;
  justify-content: center;
  padding: 28px 0;
}

.project-external-link {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 0 0 7px;
  border-bottom: 1px solid rgba(36, 23, 15, .55);
  color: var(--ink);
  font-size: .74rem;
  letter-spacing: .16em;
  text-decoration: none;
  text-transform: uppercase;
}

.project-external-link span:last-child {
  font-size: 1rem;
  transition: transform .25s ease;
}

.project-external-link:hover span:last-child,
.project-external-link:focus-visible span:last-child {
  transform: translate(3px, -3px);
}

.project-close-wrap {
  display: flex;
  justify-content: center;
  padding: 28px 0 34px;
  border-top: 1px solid rgba(36, 23, 15, .16);
}

.project-close-button {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 0 0 7px;
  border: 0;
  border-bottom: 1px solid rgba(36, 23, 15, .55);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: .74rem;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.project-close-button span:last-child {
  font-size: 1rem;
  transition: transform .25s ease;
}

.project-close-button:hover span:last-child,
.project-close-button:focus-visible span:last-child {
  transform: translateY(-3px);
}

/* Full-screen project image viewer */
.project-preview img,
.detail-media img {
  cursor: zoom-in;
}

body.lightbox-open {
  overflow: hidden;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  grid-template-columns: minmax(48px, 1fr) minmax(0, 1200px) minmax(48px, 1fr);
  align-items: center;
  gap: 18px;
  padding: clamp(18px, 4vw, 56px);
  background: rgba(24, 19, 16, .94);
}

.image-lightbox.is-open {
  display: grid;
}

.image-lightbox-figure {
  min-width: 0;
  max-height: calc(100svh - 80px);
  margin: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  justify-items: center;
  gap: 10px;
}

.image-lightbox-image {
  display: block;
  width: 100%;
  height: min(76svh, 820px);
  object-fit: contain;
}

.image-lightbox-caption {
  max-width: 760px;
  color: rgba(255, 255, 255, .88);
  font-family: var(--serif);
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.4;
  text-align: center;
}

.image-lightbox-counter {
  color: rgba(255, 255, 255, .58);
  font-size: .7rem;
  letter-spacing: .16em;
}

.image-lightbox-close,
.image-lightbox-arrow {
  border: 1px solid rgba(255, 255, 255, .48);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.image-lightbox-close:hover,
.image-lightbox-close:focus-visible,
.image-lightbox-arrow:hover,
.image-lightbox-arrow:focus-visible {
  background: #fff;
  color: #181310;
}

.image-lightbox-close {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 46px;
  height: 46px;
  font-size: 1.8rem;
}

.image-lightbox-arrow {
  width: 48px;
  height: 48px;
  font-size: 1.15rem;
}

.image-lightbox-previous {
  justify-self: end;
}

.image-lightbox-next {
  justify-self: start;
}

@media (max-width: 700px) {
  .image-lightbox {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 68px 16px 20px;
  }

  .image-lightbox-figure {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .image-lightbox-image {
    height: 65svh;
  }

  .image-lightbox-arrow {
    grid-row: 2;
  }

  .image-lightbox-previous {
    justify-self: end;
  }

  .image-lightbox-next {
    justify-self: start;
  }
}

/* Collapsible navigation for phones and tablets */
@media (max-width: 980px) {
  body.mobile-nav-open {
    overflow: hidden;
  }

  body.mobile-nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 98;
    background: rgba(36, 23, 15, .18);
  }

  .site-header {
    padding-inline: 24px;
  }

  .nav-toggle {
    position: relative;
    z-index: 102;
    display: grid;
    gap: 5px;
    width: 38px;
    height: 38px;
    padding: 9px 7px;
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
  }

  .nav-toggle span {
    display: block;
    width: 24px;
    height: 1.5px;
    margin: auto;
    background: currentColor;
    transition: transform .32s ease, opacity .2s ease;
  }

  .nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .nav {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 101;
    width: min(82vw, 360px);
    height: 100svh;
    padding: 110px 34px 42px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 24px;
    background: var(--projects-bg);
    box-shadow: -18px 0 45px rgba(36, 23, 15, .10);
    transform: translateX(105%);
    visibility: hidden;
    transition: transform .38s cubic-bezier(.22, .72, .18, 1), visibility .38s;
  }

  .nav.is-open {
    transform: translateX(0);
    visibility: visible;
  }

  .nav a,
  .nav .lang-toggle {
    display: block;
    font-family: var(--serif);
    font-size: 1.45rem;
  }

  .nav .lang-toggle {
    margin-top: 14px;
  }
}

/* Mobile layout refinements */
@media (max-width: 640px) {

  .hero-copy {
    top: 17%;
    left: 50%;
    width: min(90vw, 560px);
    text-align: center;
    transform: translateX(-50%);
  }

  .hero h1 {
    font-size: clamp(2.15rem, 8.2vw, 3.4rem);
    line-height: .98;
  }

  .hero-project-link {
    margin-top: clamp(96px, 12vh, 140px);
    transform-origin: center;
  }

  .hero-role {
    display: none;
  }

  .hero-portrait-wrap {
    right: 50%;
    bottom: 0;
    width: 96vw;
    height: 64%;
    justify-content: center;
    transform: translateX(50%);
  }

  .hero-portrait {
    max-width: none;
    object-position: center bottom;
  }

  .project.open .project-details {
    max-height: none;
    overflow: hidden;
  }

  #project-liftoff .detail-final-solution {
    overflow: hidden;
  }

  #project-liftoff .detail-final-gallery {
    width: min(100%, 330px);
    margin-inline: auto;
  }

  #project-liftoff .detail-final-gallery img {
    width: 100%;
    max-width: 100%;
    height: auto;
  }

  .thank-you {
    min-height: 112svh;
  }

  .thank-you-sticky {
    height: 100svh;
  }

  .thank-you-text {
    width: 100%;
    min-height: 100svh;
  }

  .thank-line-top {
    top: 15%;
    font-size: clamp(3.5rem, 16vw, 5.3rem);
    line-height: .88;
  }

  .thank-line-bottom {
    top: 27%;
    font-size: clamp(3.2rem, 14vw, 4.8rem);
    line-height: .88;
  }

  .contact-links {
    top: 43%;
    gap: 28px;
  }
}
