/* ==========================================================================
   Phones (Figma "Mobile: …" screens, 390 wide)
   Loaded for screens up to 767px wide (see each page's <head>), after
   css/styles.css, which it adjusts.
   - The layout is drawn at 390px and stretches with the screen: 1rem = 10px
     on a 390px screen, and spacing, images and the grid are in rem.
   - Text stays at the sizes in the mobile designs (px), whatever the width.
   - Every button and link has a click area at least 40px tall: as in Figma,
     buttons and links keep their desktop look, inside a 40px area.
   1. Tokens and text   2. Navigation and panels   3. Footer   4. Home
   5. Work and Lab      6. About                  7. Case study   8. 404
   ========================================================================== */

/* 1. Tokens and text
   -------------------------------------------------------------------------- */
html { overflow-x: clip; } /* nothing ever makes the page wider than the screen */

:root {
  --design-width: 390;       /* 1rem = 10px on a 390px screen */
  --page-margin: 1.2rem;     /* 12px either side */
  --grid-gap: 0.4rem;
  --nav-height: 4.8rem;
  --space-section: 14rem;    /* 140px above, between and below the Home sections */
  --color-transition: var(--color-linen); /* Figma "Mobile: Page Transition" */
}

/* One column: the desktop grid's column placements don't apply */
.grid { display: flex; flex-direction: column; }

/* Text styles (mobile values) */
body { font-size: 14px; line-height: 18px; }                    /* Paragraph 14/18 */
.h-2xxl,
.h-xxl { font-weight: 400; font-size: 40px; line-height: 50px; }  /* 40/50 */
.h-xl,
.h-l   { font-size: 32px; line-height: 32px; }                     /* 32/32 */
.h-m   { font-size: 24px; line-height: 24px; }                     /* 24/24 */
.h-sub { font-size: 20px; line-height: 20px; }                     /* Capability Title: Erode Medium 20/20, -4% */
/* Project Name: Erode Medium 20/24, -5% */
.work__name,
.work-card__name {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 20px;
  line-height: 24px;
  letter-spacing: -0.05em;
  font-feature-settings: "liga" 0;
}
.text-xs { font-size: 14px; line-height: 12px; }                   /* XS Sub-Heading 14/12 */
.label   { font-size: 12px; line-height: 12px; }                   /* Section Tag 12/12 */
.btn     { line-height: 16px; }                                    /* CTA Text 14/16 */
.case-hero__credits dd { line-height: 18px; }
.site-header,
.site-footer__bar,
.next-page__labels { font-size: 16px; line-height: 18px; }         /* Navigation 16/18 */

/* "XL Heading - Indent" on phones: no indent; the tag sits 32px above the heading */
.indented { display: flex; flex-direction: column; gap: 3.2rem; }
.indented > .h-xl { text-indent: 0; }
.indent-tag { position: static; order: -1; padding-top: 0; }

/* Buttons: as on desktop (24px tall), in a 40px row with a 40px click area */
.btn-group { min-height: 40px; align-items: center; }
.btn { position: relative; }
.btn::after { content: ""; position: absolute; inset: -8px 0; }

/* 2. Navigation and panels
   -------------------------------------------------------------------------- */
/* The bar (Figma "Navigation", mobile): "Mike T." and "Menu", 48px tall */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem var(--page-margin);
}
.site-header__nav,
.site-header__social { display: none; }
.site-header__brand,
.site-header__menu { display: flex; align-items: center; min-height: 40px; }

/* Menu (Figma "Mobile: Menu"): drops down from the top, as the Contact panel does */
.menu-panel {
  display: block;
  position: fixed;
  inset: 0 0 auto;
  z-index: 61;
  padding: 12rem var(--page-margin) 1.2rem;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-hairline);
  transform: translateY(-100%);
  visibility: hidden;
  transition: transform 1s var(--ease-in-out-cubic), visibility 0s linear 1s;
}
.menu-panel.is-open { transform: none; visibility: visible; transition: transform 1s var(--ease-in-out-cubic); }
.menu-panel__inner { display: flex; flex-direction: column; align-items: flex-start; gap: 4rem; }
/* The pages: Erode Regular 28/32, -5%, each in a 40px row */
.menu-panel__links > li > * {
  display: flex;
  align-items: center;
  min-height: 40px;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 28px;
  line-height: 32px;
  letter-spacing: -0.05em;
  font-feature-settings: "liga" 0;
}
/* The social links: Paragraph text, 12px apart with a divider between */
.menu-panel__social { display: flex; align-items: center; gap: 1.2rem; font-size: 14px; line-height: 12px; }
.menu-panel__social > a { display: flex; align-items: center; min-height: 40px; }
.menu-panel__social .divider { width: 1px; height: 12px; background: var(--color-outline); }
/* Links underline as in the bar: the current page stays underlined */
.menu-panel .nav-line { position: relative; }
.menu-panel .nav-line::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: var(--color-charcoal);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}
.menu-panel [aria-current="page"] .nav-line::after,
.menu-panel a:hover .nav-line::after,
.menu-panel button:hover .nav-line::after { transform: scaleX(1); transform-origin: left; }

/* Contact (Figma "Mobile: Contact Overlay"): the email 240px down, "Email Copied"
   just above it, then the social links */
.contact-panel { justify-content: flex-start; padding: 24rem var(--page-margin) 1.2rem; }
.contact-panel__inner { width: 100%; gap: 1.2rem; }
.contact-panel__email-row { display: flex; flex-direction: column; }
.contact-panel__email { font-size: 50px; line-height: 60px; align-self: flex-start; }
.contact-panel__copied {
  position: static;
  order: -1;
  min-height: 12px;
  font-size: 12px;
  line-height: 12px;
}
.contact-panel__links { min-height: 40px; }
.contact-panel__links > a { display: flex; align-items: center; min-height: 40px; }
.contact-panel__links a::after { bottom: 10px; }
.contact-panel__links .divider { height: 12px; }

/* Awards (Figma "Mobile: The Loeries Awards: Awards Slide Out"): the whole screen,
   with the Close button at the bottom over a fade */
/* The panel covers the whole screen, so the page behind isn't pushed aside (which
   would also make the page wider than the screen) */
.award-shown main,
.award-shown [data-footer] { transform: none; }
.award-panel { inset: 0; width: 100%; }
.award-panel__body {
  width: 100%;
  gap: 4rem;
  padding: 14rem var(--page-margin) 8rem;
  border-right: 0;
}
.award-panel__text { max-width: none; gap: 2rem; }
.award-gallery { width: 100%; }
.award-gallery > .media { height: 22.6rem; }
.award-gallery > .media--wide { height: 25.1rem; }
.award-gallery > .media--short { height: 21rem; }
.award-panel__close {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 8rem;
  margin: 0;
  background: linear-gradient(rgba(255, 255, 255, 0), var(--color-white) 60%);
}

/* 3. Footer
   -------------------------------------------------------------------------- */
/* Top (Figma "Mobile Footer"): the quote 140px down; the bar along the bottom with
   the legal line, then the email and the time on a 40px row */
.site-footer__top { height: 39.6rem; padding-top: 14rem; }
.site-footer__bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  row-gap: 0.4rem;
  padding: 1.2rem var(--page-margin) 0;
}
.site-footer__bar > :first-child { grid-column: 1 / -1; }
.site-footer__bar > a { grid-column: 1; margin-block: 11px; }
.site-footer__bar > a::before { content: ""; position: absolute; inset: -11px 0; }
.site-footer__time { grid-column: 2; align-self: center; }

/* "Next page": 398px tall, the labels at either end */
.next-page { height: 39.8rem; }
.next-page__labels { flex-direction: row; justify-content: space-between; padding: 1.2rem var(--page-margin); }
.next-page__hover { display: none; } /* no hover on phones */

/* Case studies: "Next Project", the project's name, and its services and type
   below; then its hero picture, 490px tall */
.site-footer--project .site-footer__top { height: 35.4rem; }
.site-footer__next { gap: 1rem; }
.site-footer--project .site-footer__bar { display: flex; flex-direction: column; gap: 1.2rem; padding: 2rem var(--page-margin); }
.site-footer__type { text-align: left; }
.next-page--project { height: 49rem; }
.next-page--project .case-hero__bg { height: calc(100svh + 29.2rem); } /* the hero's own box (below): a screen, the credits (232) and 60px */

/* 4. Home
   -------------------------------------------------------------------------- */
/* Hero: the details at the top, the statement and buttons at the bottom */
.hero { align-items: stretch; padding: 8rem 0; }
.hero__inner { justify-content: space-between; gap: 12rem; }
.hero__lead { max-width: none; }

/* Portraits: one under another, small left, large centred, small right */
.portraits { padding: 1.2rem; }
.portraits__inner { display: flex; flex-direction: column; align-items: flex-start; gap: 1.2rem; width: 100%; }
.portraits__item--left,
.portraits__item--right { width: 18.1rem; margin: 0; }
.portraits__item--right { align-self: flex-end; }
.portraits__item--main { width: 27.4rem; align-self: center; }
.portraits__item--left .portraits__figure,
.portraits__item--right .portraits__figure { aspect-ratio: 181 / 135; }
.portraits__item--main .portraits__figure { aspect-ratio: 274 / 366; }
/* The side images grow in where they are (there's nothing beside the centre one to come from) */
.js .portraits:not(.is-in) .portraits__item--left .portraits__figure,
.js .portraits:not(.is-in) .portraits__item--right .portraits__figure { transform: scale(0.5); }

.about { padding-block: 1.2rem; }
.about__inner { gap: 3.2rem; }

/* Capabilities: cards that stack up as you scroll (after studio-pic.com). Each
   card sticks 44px lower than the one before, so the earlier cards' titles stay
   in view as the next card slides up over them; they all leave together. */
.capabilities { padding-block: 0; }
.capabilities .grid { padding-inline: 0; }
.capabilities__heading { padding: 1.2rem; border-bottom: 0; margin-bottom: 2.2rem; }
.capabilities__body { display: block; }
.capabilities__media { display: none; }
.capability {
  position: sticky;
  display: flex;
  flex-direction: column;
  padding: 0 var(--page-margin) 4rem;
  background: var(--color-white);
}
.capability:nth-child(1) { top: 0; }
.capability:nth-child(2) { top: 4.4rem; }
.capability:nth-child(3) { top: 8.8rem; }
.capability:nth-child(4) { top: 13.2rem; }
.capability + .capability { border-top: 0; }
.capability .h-sub { padding-block: 1.2rem; }
.capability + .capability .h-sub { box-shadow: inset 0 1px 0 var(--color-hairline); }
.capability__media { display: block; width: 18.1rem; aspect-ratio: 181 / 210; margin-top: 1.2rem; }
.capability__media > img { inset: -10% 0 auto; height: 120%; will-change: transform; } /* glides inside its frame (js/main.js) */
.capability__detail { gap: 2.8rem; margin-top: 3.6rem; padding-bottom: 1.2rem; }

/* Selected works: one column, each project's name under its image */
.work { padding-block: 0; }
.work__heading { position: static; width: auto; height: auto; overflow: visible; clip-path: none; padding: 1.2rem; }
.work__columns { align-items: stretch; gap: 4rem; padding: 1.2rem; margin-top: 1.2rem; }
.work__column { display: contents; }
.work__item { display: flex; flex-direction: column; gap: 1.2rem; }
.work__name { display: block; }
.work__title-layer { display: none; }

/* Who I work with: the two kinds of client, no pictures */
.clients { padding-block: 0; }
.clients .grid { padding-inline: 0; gap: 3.2rem; }
.clients__heading { padding: 1.2rem; }
.clients__list { gap: 4rem; padding: 1.2rem; }
.client { display: block; }
.client__media { display: none; }
.client__actions { margin-top: 1.2rem; }

/* 5. Work and Lab
   -------------------------------------------------------------------------- */
.page-container--work { gap: 8rem; padding-block: 14rem 8rem; }
.work-list { gap: 4rem; padding: 1.2rem; }
.work-card,
.work-card--small { width: 100%; display: flex; flex-direction: column; gap: 1.2rem; }
.work-card__link { display: flex; flex-direction: column; gap: 1.2rem; }
.work-card__media { order: -1; } /* the name under the image */

.page-container--lab { padding-block: 8rem; }
.lab-intro { padding: 0 var(--page-margin); }
.lab-grid { display: flex; flex-direction: column; align-items: stretch; gap: 4rem; padding: 3.2rem var(--page-margin) 1.2rem; }
.lab-card--framed { display: block; aspect-ratio: auto; }
.lab-card--framed > .lab-card__media { width: 100%; }

/* 6. About
   -------------------------------------------------------------------------- */
.about-intro { gap: 5.2rem; padding: 13.2rem var(--page-margin) 1.2rem; }
.about-intro__statement,
.about-intro__story { width: 100%; margin-left: 0; }

/* Photo wave (Figma "Mobile: About Page", "Group 9"), along its own diagonal */
.story__photos { height: 41.8rem; }
.story__photo--4 { left: 1.2rem; top: 34.1rem; width: 3rem; height: 3.7rem; }
.story__photo--3 { left: 4.3rem; top: 27.7rem; width: 6rem; height: 7.5rem; }
.story__photo--2 { left: 10.4rem; top: 9.5rem; width: 18.2rem; height: 22.8rem; }
.story__photo--1 { left: 28.7rem; top: 6.6rem; width: 6rem; height: 7.5rem; }
.story__photo--0 { left: 34.8rem; top: 4rem; width: 3rem; height: 3.7rem; }

.experience { padding: 8rem var(--page-margin); }
.experience__inner { width: 100%; align-items: stretch; gap: 5.2rem; }
.experience__column { width: 100%; gap: 5.2rem; }
.experience__lists { gap: 3.2rem; }
/* Rows 40px tall; a short dash between the name and the detail, 16px either side */
.credit { min-height: 40px; padding-block: 0; gap: 1.6rem; line-height: 12px; }
.credit__detail { gap: 1.2rem; }
.credit__detail::before { width: 10px; height: 1px; margin-right: 0.4rem; }
.credits--experience .credit__role,
.credit__org { min-width: 0; }

/* 7. Case study
   -------------------------------------------------------------------------- */
/* Hero (Figma "Mobile: Case Study Details Page", with Mike's notes), over the picture:
   - the first screen: the title always in the middle of the phone's screen, and the
     description always at the bottom of it (40px up);
   - then the credits, and 60px more of the picture. */
.case-hero { display: block; height: auto; padding-bottom: 6rem; }
.case-hero__title-track {
  position: absolute;
  inset: 0 0 auto;
  z-index: 1; /* above the picture */
  display: flex;
  align-items: center;
  height: 100svh;
  padding: 0 var(--page-margin);
}
.case-hero__details-track { position: relative; inset: auto; width: auto; } /* above the picture */
.case-hero__title { position: static; padding: 0; white-space: normal; }
.case-hero__details { position: static; display: block; height: auto; padding: 0; }
.case-hero__row { display: flex; flex-direction: column; gap: 1.2rem; }
.case-hero__row:first-child { justify-content: flex-end; min-height: 100svh; padding: 1.2rem var(--page-margin) 4rem; }
.case-hero__row + .case-hero__row { padding: 1.2rem var(--page-margin); }
.case-hero__row + .case-hero__row > .label:first-child { display: none; } /* no "Credits" heading on phones */
.case-hero__bg--goodman-gallery > img { top: -4.16%; left: 0; width: 100%; height: 111.86%; } /* the gallery wall and floor out of frame, as on desktop */

.case-body { gap: 0.4rem; padding-block: 0; }
.case-statement { gap: 5.2rem; padding: 14rem var(--page-margin); }
.case-statement__heading,
.case-statement__text { width: 100%; margin-left: 0; }
.case-pair { flex-direction: column; gap: 0.4rem; padding-inline: var(--page-margin); }
.case-pair > .media { width: 100%; }
.case-wide > .media { height: 20.6rem; }
.case-focus { padding: 14rem var(--page-margin); }
.case-focus__inner { width: 100%; align-items: stretch; gap: 5.2rem; }
.case-focus__image { width: 100%; height: 49rem; }

/* 8. 404 and the preloader
   -------------------------------------------------------------------------- */
.not-found {
  justify-content: space-between;
  gap: 4rem;
  padding: 32rem var(--page-margin) 8rem;
  touch-action: none; /* a finger dragged here moves the 404 (js/mousegrid.js) */
}
.not-found__art { width: 35.8rem; height: 14rem; }
.not-found__text { width: 100%; gap: 2rem; }

/* Preloader name: Erode Regular 32/32 (Figma "Mobile: Proloader") */
.loader__name { top: calc(50% - 16px); font-size: 32px; line-height: 32px; }
.loader__caret { height: 26px; vertical-align: -4px; }
