/* 2023 portfolio (recreated from the Figma prototype, edited down) */

@font-face {
  font-family: "Formular";
  src: url("fonts/Formular-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #000;
  --muted: #6b6b6b;
  --line: #a8a8a8;
  --pad: clamp(20px, 2.9vw, 56px);          /* 56px at 1920 */
  --gap: 24px;                               /* between images */
  --body: clamp(16px, 1.05vw, 20px);         /* 20px at 1920 */
  --statement: clamp(26px, 2.5vw, 48px);     /* 48px at 1920 */
  --menu-fade: 40px;
  --panel-w: clamp(400px, 33.3vw, 640px);   /* 640px at 1920 */
  --panel-dur: 600ms;
  --panel-ease: cubic-bezier(.65, 0, .35, 1);
  --sans: "Formular", "Helvetica Neue", Arial, sans-serif;
  --display: "Inter", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: #fff; scroll-behavior: smooth; overflow-x: clip; }

/* Page slide (slide.js): an arriving page starts off-screen, on the side
   it's coming from, then slides into place */
html.slide-in-left body  { transform: translateX(100%); }
html.slide-in-right body { transform: translateX(-100%); }
html.slide-in-left.slid body,
html.slide-in-right.slid body {
  transform: none;
  transition: transform 550ms cubic-bezier(.16, 1, .3, 1);
}
body {
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: var(--body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }

/* ---------- Underlined links: line slide ----------
   The underline is a drawn line (not text-decoration) so it can move: on
   hover it slides away to the right, then grows back in from the left. */
.project-link, .back, .menu .info-toggle, .menu .home-link span {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) left bottom / 100% var(--u-thick) no-repeat;
}
.project-link:hover, .project-link:focus-visible,
.back:hover, .back:focus-visible,
.menu .home-link:hover span, .menu .home-link:focus-visible span,
.menu .info-toggle:hover, .menu .info-toggle:focus-visible {
  animation: line-slide 700ms cubic-bezier(.65, 0, .35, 1);
  outline: none;
}
@keyframes line-slide {
  0%     { background-position: right bottom; background-size: 100% var(--u-thick); }
  50%    { background-position: right bottom; background-size: 0% var(--u-thick); }
  50.01% { background-position: left bottom;  background-size: 0% var(--u-thick); }
  100%   { background-position: left bottom;  background-size: 100% var(--u-thick); }
}
@media (prefers-reduced-motion: reduce) {
  .project-link, .back, .menu .info-toggle, .menu .home-link span { animation: none !important; }
}

/* ---------- Home ---------- */
/* Intro at the top, case studies pinned to the bottom of the screen; on
   short screens they keep at least 40px apart and the page scrolls */
.home {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding: var(--pad);
}
.home-intro {
  font-family: var(--display);
  font-size: clamp(18px, 1.7vw, 32px);
  line-height: 1.4;
}
.projects {
  list-style: none;
  margin-top: auto;          /* pushes the list to the bottom */
  display: flex;
  flex-direction: column;
  gap: clamp(32px, 2.1vw, 40px);
}
.project-link {
  display: inline-block;
  font-size: clamp(40px, 5.4vw, 104px);
  line-height: 1.2;
  --u-thick: 0.06em;
}
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tag {
  background: #e9e9e9;
  border-radius: 80px;
  padding: 4px 20px;
  font-size: var(--body);
  line-height: 1.6;
}

/* ---------- Case study: menu ---------- */
.menu {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  /* Solid white behind the menu, fading to transparent over its last
     --menu-fade px, so content scrolls up under it softly */
  padding: clamp(16px, 2.2vw, 42px) var(--pad) calc(clamp(16px, 2.2vw, 42px) + var(--menu-fade));
}
/* The white-to-transparent backing only shows once the page has scrolled
   (JS adds .is-scrolled); at the top it would wash out the hero's edge */
.menu::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to bottom, #fff calc(100% - var(--menu-fade)), rgba(255, 255, 255, 0));
  opacity: 0;
  transition: opacity 200ms linear;
}
.menu.is-scrolled::before { opacity: 1; }
/* Content starts within the fade, so the extra height doesn't push it down */
.menu + .layout { margin-top: calc(var(--menu-fade) * -1); }
/* Home: the icon and "All projects" (underlined, like Show info), one link */
.menu .home-link {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(16px, 1.05vw, 20px);
  text-decoration: none;
  white-space: nowrap;
}
.menu .home-link:focus-visible { outline: none; }
.menu .home-link svg { flex: none; width: 40px; height: 40px; }
.menu .home-link span {
  --u-thick: 2px;
  padding-bottom: 0.15em;
}
.menu { column-gap: 12px; }
/* Phones: no room for the icon beside the title; the words say it */
@media (max-width: 600px) {
  .menu .home-link svg { display: none; }
}
.menu .title { font-size: clamp(18px, 1.25vw, 24px); }
.menu .info-toggle {
  justify-self: end;
  font: inherit;
  font-size: clamp(16px, 1.05vw, 20px);
  border: 0;
  color: inherit;
  cursor: pointer;
  --u-thick: 2px;          /* thicker than a default underline */
  padding-bottom: 0.15em;
}

/* ---------- Case study: layout ----------
   The content column and the info panel sit side by side. Opening the
   panel grows its column from 0 to --panel-w (the panel itself slides in
   from the right as it does), so the content column narrows in step and
   everything in it scales down: the "squish" from the prototype. */
.layout {
  display: flex;
  align-items: flex-start;
  padding: 0 var(--pad) 200px;
}
.content { flex: 1 1 auto; min-width: 0; }
.panel-slot {
  flex: 0 0 auto;
  width: 0;
  overflow: hidden;
  position: sticky;
  top: calc(var(--menu-h, 120px) - var(--menu-fade));
  height: calc(100vh - var(--menu-h, 120px) + var(--menu-fade));   /* header to the bottom of the screen */
  transition: width var(--panel-dur) var(--panel-ease);
}
.info-open .panel-slot { width: calc(var(--panel-w) + 40px); }
.panel {
  width: var(--panel-w);
  margin-left: 40px;
  height: 100%;              /* fills its column, so the border runs to the bottom of the screen */
  padding-bottom: var(--pad);
  overflow-y: auto;
  overflow-x: hidden;        /* never a horizontal scrollbar; contents wrap instead */
  container-type: inline-size;
  border-left: 1.5px solid var(--ink);
  padding-left: 40px;
  transform: translateX(100%);
  transition: transform var(--panel-dur) var(--panel-ease);
}
.info-open .panel { transform: none; }

/* Info panel rows */
.panel dl { display: flex; flex-direction: column; gap: 8px; }
.panel .row { display: flex; gap: 8px; }
.panel dt { flex: 0 0 33%; }                                  /* labels: a third */
.panel dd { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }   /* values: the rest */
.panel .process { padding-top: 8px; }
.panel .process dd { display: flex; flex-direction: column; gap: 8px; }
.stage { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stage-name { font-size: 14px; white-space: nowrap; }
.stage-name::after { content: " →"; }
.chip {
  border: 1.5px solid var(--line);
  border-radius: 80px;
  padding: 2px 12px;
  font-size: 16px;
  max-width: 100%;           /* long tags wrap rather than overflow */
}
.panel .deliverables { padding-top: 24px; }

/* When the panel itself is narrow (it is its own container), stack each
   label above its value, with more space between rows for hierarchy */
@container (max-width: 380px) {
  .panel dl { gap: 24px; }
  .panel .row { flex-direction: column; gap: 4px; }
  .panel dt { flex: none; color: var(--muted); }
  .panel .process, .panel .deliverables { padding-top: 0; }
}

/* ---------- Case study: hero ----------
   Built from separate parts: the cover image, the logo and the title. */
.hero {
  position: relative;
  container-type: inline-size;
  aspect-ratio: 1808 / 1017;
  overflow: hidden;
}
.hero img.cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero .hero-text {
  position: absolute;
  top: 5.5%;
  bottom: 5.5%;
  left: 3.1%;
  width: 48.7%;
  display: flex;
  flex-direction: column;
  padding-bottom: 2.2cqw;
}
.hero .logo { height: 3.3cqw; width: auto; align-self: flex-start; }
.hero h1 {
  flex: 1;
  display: flex;
  align-items: center;
  font-family: var(--display);
  font-weight: 400;
  font-size: 4.42cqw;      /* 80px at 1808 */
  line-height: 1.3;
}
.hero.light h1 { color: #fff; }

/* ---------- Case study: challenge and impact ---------- */
.intro {
  max-width: 800px;
  margin: 0 auto;
  padding: clamp(40px, 4.2vw, 80px) 0;
  display: flex;
  flex-direction: column;
  gap: clamp(48px, 5vw, 96px);
}
.intro .label { margin-bottom: 24px; }
.statement { font-size: var(--statement); line-height: 1.2; }
.lead { font-size: var(--statement); line-height: 1.2; }   /* Approach: same size as the challenge */
.stats { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.stats img { width: 40px; height: 40px; margin-bottom: 8px; }

/* ---------- Case study: images ---------- */
.gallery { display: flex; flex-direction: column; gap: var(--gap); }
.gallery figcaption {
  margin-top: 16px;
  text-align: center;
  color: var(--muted);
  font-size: clamp(14px, 0.85vw, 16px);
}

/* ---------- Case study: footer ---------- */
.back-wrap { text-align: center; margin-top: clamp(80px, 8vw, 160px); }
.back {
  display: inline-block;
  font-size: clamp(32px, 3.3vw, 64px);
  line-height: 1.2;
  --u-thick: 0.06em;
}

/* ---------- Narrow screens: the panel overlays instead of squishing ---------- */
@media (max-width: 900px) {
  .stats { grid-template-columns: 1fr; }
  .panel-slot {
    position: fixed;
    top: calc(var(--menu-h, 72px) - var(--menu-fade));   /* right below the header (not its fade strip) */
    right: 0;
    bottom: 0;
    height: auto;
    background: #fff;
    z-index: 5;
  }
  .info-open .panel-slot { width: min(100%, var(--panel-w)); }
  .panel { width: min(100vw, var(--panel-w)); margin-left: 0; height: 100%; padding: 0 var(--pad) var(--pad); }
}

@media (prefers-reduced-motion: reduce) {
  .panel-slot, .panel { transition: none; }
}
