/* ==========================================================================
   Valhalla — mobile layout (≤ 899px)
   Source: Pencil › Mobile (375px frames: Homepage, About Us, Projects grid/list,
   Project details, Articles, Article detail, Terms/Privacy, Contact, Preloader).
   Load AFTER every other stylesheet: it only overrides, and desktop (≥ 900px)
   is untouched.
   ========================================================================== */

@media (max-width: 899px) {
  /* ---------- Tokens ---------------------------------------------------- */
  :root {
    --gutter: 16px;
    --gutter-sm: 16px;

    /* type scale from the 375 frames */
    --fs-h1: 60px;
    --fs-h2: 48px;
    --fs-s1: 44px;
    --fs-s2: 34px;
    --fs-s3: 26px;
    --fs-s6: 18px;
    --fs-card: 20px;
    --text-body-1: 16px;
    --text-button-1: 16px;

    --sp-96: 64px;
    --sp-104: 64px;
    --sp-152: 80px;

    --button-lg-w: 211px;
    --button-lg-h: 60px;
    --button-sm-w: 124px;
    --button-sm-h: 40px;
  }

  body { min-width: 0; }

  /* ---------- Shared ---------------------------------------------------- */
  .grid,
  .about-grid {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--space-24);
  }
  .btn--sm { font-size: 14px; }

  /* ---------- Header + menu -------------------------------------------- */
  .site-header { inset: 16px 16px auto; align-items: center; }
  .site-header__logo img { width: 113px; height: auto; }
  .site-header__actions .btn,
  .site-header__notch { display: none; }
  .menu-toggle { width: 40px; height: 40px; gap: 5px; }
  .menu-toggle[aria-expanded="true"] .menu-toggle__row:first-child { transform: translateY(3.5px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] .menu-toggle__row:last-child { transform: translateY(-3.5px) rotate(-45deg); }

  .site-menu {
    height: auto;
    min-height: 480px;
    padding: 104px var(--gutter) 56px;
  }
  .site-menu__list a { font-size: 40px; }

  /* ---------- Hero ------------------------------------------------------ */
  .hero {
    height: 100svh;
    min-height: 560px;
  }
  .hero__bg > img { left: 0; top: -8%; width: 100%; height: 116%; object-position: 30% 50%; }
  .hero__title { left: var(--gutter); right: var(--gutter); top: 150px; }
  /* long titles (e.g. "Elevating Brand") wrap on narrow screens: let the clip grow with its lines
     instead of hiding the wrapped words; padding keeps descenders from being cut */
  .hero__title .line-clip { height: auto; padding-bottom: 0.22em; }

  .hero__bottom {
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0 var(--gutter) 24px;
    border-top: 0;
  }
  .hero__tag,
  .hero__intro,
  .hero__video,
  .hero__scroll { position: static; }
  .hero__tag { order: 1; }
  .hero__divider {
    order: 2;
    position: static;
    align-self: stretch;
    width: auto;
    height: 1px;
    margin: 12px calc(var(--gutter) * -1) 20px;
  }
  .hero__intro { order: 3; width: auto; max-width: 20em; font-size: 18px; }
  .hero__video,
  .hero__scroll { order: 4; margin-top: 28px; }

  /* "Watch Showreel": the thumbnail becomes a text link with a small play button */
  .hero__video {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: auto;
    aspect-ratio: auto;
    background: none;
  }
  .hero__video > img { display: none; }
  .hero__video-label { display: inline; font-size: 14px; letter-spacing: var(--tracking-body-2); }
  .play-icon img { width: 34px; height: 34px; }
  .hero__video:hover .play-icon { transform: none; }

  /* ---------- Why choose us -------------------------------------------- */
  .about { padding: var(--sp-96) var(--gutter) var(--sp-152); }
  .about .grid > div:empty { display: none; }
  .about__media { row-gap: var(--space-16); margin-block: 48px; }
  .about__img--sm,
  .about__img--lg { aspect-ratio: 343 / 248; }

  /* ---------- Stats ----------------------------------------------------- */
  .stats__list { grid-template-columns: minmax(0, 1fr); padding-inline: 0; }
  .stat {
    height: auto;
    min-height: 234px;
    padding: var(--space-24) var(--gutter) var(--space-32) 148px;
    border-right: 0;
    border-bottom: var(--border-hairline);
  }
  .stat:last-child { border-bottom: 0; }
  .stat + .stat { border-top: 0; }
  .stat__body { margin-top: var(--space-48); }
  .stat__text { max-width: none; margin-top: 20px; font-size: 14px; }

  /* ---------- Projects (pinned slide) ---------------------------------- */
  .projects {
    --card-w: 208px;
    height: calc(var(--count) * 100svh);
    min-height: calc(var(--count) * 600px);
  }
  .projects__sticky { height: 100svh; min-height: 600px; }

  .projects__titles {
    left: 0;
    right: 0;
    top: calc(50% - 203px);
    max-width: none;
    margin-top: 0;
    font-size: var(--fs-s2);
    text-align: center;
  }
  .projects__card { top: 50%; }

  /* counter / progress / details leave their wrapper so each can sit on its own */
  .projects__info { display: contents; }
  .projects__counter {
    position: absolute;
    z-index: 1;
    left: 0;
    right: 0;
    top: calc(50% - 233px);
    justify-content: center;
    font-size: 12px;
  }
  .projects__progress { display: none; }
  .projects__details {
    position: absolute;
    z-index: 1;
    left: var(--gutter);
    right: var(--gutter);
    top: calc(50% + 130px + 36px);
    margin-top: 0;
    text-align: center;
  }
  .projects__detail { flex-direction: column; align-items: center; justify-content: flex-start; gap: var(--space-16); }
  .projects__desc { flex: none; max-width: 12em; font-size: 18px; }
  .projects__services { width: auto; font-size: 14px; }
  .projects__cursor { display: none; }

  /* ---------- Capabilities --------------------------------------------- */
  .capabilities { padding: var(--sp-104) var(--gutter) var(--sp-152); }
  .statement--cap { max-width: none; margin-top: var(--space-24); }
  .capabilities__stage { margin-top: 48px; }
  .capabilities__preview { display: none; }

  /* two photo cards per row, name under the photo (thumbs are added by js/main.js) */
  .capabilities__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-bottom: var(--border-hairline);
  }
  .capability {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: auto;
    padding: var(--space-16) 0 var(--space-24);
  }
  .capability:nth-child(odd) { padding-right: 8px; }
  .capability:nth-child(even) { padding-left: 8px; }
  .capability:last-child { border-bottom: 0; }
  .capability::before { display: none; }
  /* an odd last card leaves the right half empty: carry its top rule across */
  .capability:last-child:nth-child(odd)::after {
    content: "";
    position: absolute;
    left: 100%;
    top: -1px;
    width: 100%;
    height: 1px;
    background: var(--color-black-20);
  }
  .capability .capability__thumb {
    display: block;
    order: -1;
    aspect-ratio: 164 / 205;
    margin-bottom: var(--space-16);
  }
  .capability__num,
  .capability__name {
    color: var(--color-black);
    mix-blend-mode: normal;
  }
  .capability__num {
    margin-top: 0;
    font-size: 12px;
  }
  .capability__name {
    grid-column: auto;
    grid-row: auto;
    margin-top: 4px;
    font-size: 18px;
    line-height: 1.12;
    white-space: normal;
  }
  .capabilities__cta { margin: 48px 0 0; }

  /* ---------- Latest insights (swipeable row) -------------------------- */
  .insights { padding: var(--sp-96) 0 var(--sp-104); }
  .insights__title { padding-inline: var(--gutter); }
  .insights > .btn { margin-left: var(--gutter); }
  .insights__grid {
    display: flex;
    margin-block: 48px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .insights__grid::-webkit-scrollbar { display: none; }
  .insights__grid > li:nth-child(n) {
    flex: 0 0 328px;
    scroll-snap-align: start;
    border-top: 0;
    border-right: var(--border-hairline);
  }
  .insights__grid > li:last-child:nth-child(n) { border-right: 0; }

  .post { min-height: 0; padding: var(--space-16) var(--space-16) var(--space-24); }
  .post__meta { margin-top: 20px; font-size: 12px; }
  .post__title { max-width: none; margin-top: var(--space-16); margin-bottom: var(--space-32); }
  .post__link { width: 124px; height: 40px; }
  .post:hover .post__frame { clip-path: inset(0); }
  .post:hover .post__image { transform: none; }

  .insights--more { padding-top: var(--sp-96); }
  .insights__title--sm { font-size: var(--fs-s3); }

  /* ---------- CTA ------------------------------------------------------- */
  .cta { height: 100svh; min-height: 600px; }
  .cta__img { left: 0; top: -6%; width: 100%; height: 112%; }
  .cta__content {
    left: var(--gutter);
    right: var(--gutter);
    top: auto;
    bottom: 40px;
  }
  .cta__text { max-width: 272px; margin-top: var(--space-24); }
  .cta__btn { margin-top: var(--space-24); width: 211px; }

  /* ---------- Footer ---------------------------------------------------- */
  .site-footer__top {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--space-48);
    min-height: 0;
    padding-block: 64px var(--space-48);
  }
  .site-footer__top .footer-col:nth-of-type(1) { order: 1; }
  .site-footer__top .footer-col:nth-of-type(2) { order: 2; }
  .footer-nav { grid-column: auto; display: grid; grid-template-columns: 132px minmax(0, 1fr); }
  .footer-nav ul { margin-top: 0; gap: var(--space-16); }
  .footer-nav a { letter-spacing: -0.03em; }
  .footer-col .link-list { margin-top: var(--space-16); }
  .footer-col:last-child .link-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-16);
  }
  .footer-col:last-child .link-list li:last-child:nth-child(odd) { border-bottom: var(--border-hairline); }
  .link-list a.link-list__tall { padding-bottom: 24px; }

  .site-footer__bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 12px;
    padding-block: 24px 28px;
  }
  .site-footer__bar > :first-child { order: 3; flex-basis: 100%; }
  .site-footer__legal { order: 1; }
  .site-footer__bar > :nth-child(3) { order: 2; }
  .site-footer__bar > :nth-child(3)::before { content: "/"; margin-right: 12px; }

  /* ==================== Inner pages ==================== */

  /* ---------- CMS page heroes ------------------------------------------ */
  .page-hero {
    min-height: clamp(480px, 75svh, 720px);
    padding: 120px var(--gutter) 48px;
  }
  .page-hero--plain { padding-top: 120px; }
  .page-hero__title--article { max-width: none; font-size: 28px; line-height: 1.04; }
  .page-hero__back { margin-top: var(--space-32); }

  .prose {
    max-width: none;
    padding: 0 var(--gutter) var(--sp-152);
    font-size: 16px;
  }
  /* ---------- Article detail: one column, quote above the body ---------- */
  .story { padding-top: 120px; }
  .story__meta { grid-template-columns: 1fr auto; row-gap: var(--space-8); font-size: 14px; }
  .story__meta > :nth-child(2) { text-align: right; }
  .story__meta > :nth-child(3) { grid-column: 1 / -1; text-align: left; }
  .story__meta > [hidden] { display: none; }
  .story__title { max-width: none; margin-top: var(--space-32); font-size: 40px; line-height: 1.04; }
  .story__cover { aspect-ratio: 343 / 226; margin-top: var(--space-32); }
  .story__columns { --pad: 48px; grid-template-columns: minmax(0, 1fr); margin-top: var(--space-32); }
  .story__aside { padding: var(--pad) 0 0; }
  .story__quote { position: static; max-width: none; font-size: 28px; }
  .story__body { gap: 40px; padding: var(--pad) 0 var(--sp-152); border-left: 0; }
  .story__text { max-width: none; font-size: 16px; }
  .story__next .post { min-height: 0; }

  /* ---------- Projects index ------------------------------------------- */
  [data-page="projects"] .work { padding: 112px 0 var(--sp-152); }
  .work__bar {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 0;
    margin-top: 96px;
    padding: 0;
    border-top: 0;
  }
  .view-toggle { grid-column: 1 / -1; margin-left: var(--gutter); }
  .view-toggle__btn { font-size: 14px; padding: 0 var(--space-16); }
  .work__intro,
  .work__count {
    margin-top: 12px;
    padding-top: 20px;
    border-top: var(--border-hairline);
    font-size: 16px;
  }
  .work__intro { grid-column: 1; width: auto; max-width: 17em; padding-left: var(--gutter); }
  .work__count { grid-column: 2; padding-right: var(--gutter); }

  [data-view-panel] { margin-top: 48px; padding-inline: 48px; }
  [data-view-panel="list"] { padding-inline: var(--gutter); }

  .work-grid { grid-template-columns: minmax(0, 1fr); row-gap: 48px; }
  .work-grid .work-card:nth-child(n) { grid-column: 1 / -1; }
  .work-card__media { aspect-ratio: 280 / 330; cursor: auto; }
  .work-card:nth-child(even) .work-card__media { aspect-ratio: 280 / 348; }
  .work-card__title,
  .work-card__services { max-width: none; }
  .work-card__title { margin-top: var(--space-16); }
  .work-card__services { margin-top: 8px; font-size: 14px; }
  .details-bubble { display: none; }

  .work-list { grid-template-columns: minmax(0, 1fr); }
  .work-list__aside { display: none; }
  .work-list__rows { grid-column: 1 / -1; gap: var(--space-32); }
  .work-row__link {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "industry industry"
      "title    year"
      "services services";
    column-gap: var(--space-16);
    font-size: 16px;
  }
  .work-row__services { flex-direction: row; flex-wrap: wrap; gap: 0 var(--space-8); color: var(--color-black-60); }

  /* ---------- Project detail ------------------------------------------- */
  .case { padding: 112px var(--gutter) 0; }
  .case__meta {
    display: block;
    margin-top: 48px;
    padding-top: 0;
    font-size: 14px;
    line-height: 21px;
  }
  .case__meta > div {
    display: flex;
    gap: var(--space-16);
    padding: 7px 0 7px;
    border-top: var(--border-hairline);
  }
  .case__meta > div:last-child { border-bottom: var(--border-hairline); }
  .case__meta dt { flex: none; width: 96px; }
  .case__meta dd { margin-top: 0; }
  .case__meta div:has(dd[hidden]) { display: none; }

  .case__hero { aspect-ratio: 343 / 412; margin-top: var(--space-24); }
  .case__intro { flex-direction: column; gap: var(--space-32); margin-top: var(--space-32); }
  .case__lead,
  .case__body { width: 100%; }
  .case__services { margin-top: var(--space-24); }
  .case__body { columns: 1; }
  .case__body p:first-child + p { break-before: auto; }

  .case__gallery { grid-template-columns: minmax(0, 1fr); gap: var(--space-16); margin-top: 48px; }
  .case__shot--square { aspect-ratio: 1; }
  .case__shot--wide { aspect-ratio: 343 / 168; }
  .case__shot--tall { aspect-ratio: 343 / 412; }
  .case__shot--small { grid-column: 1; justify-self: stretch; width: auto; aspect-ratio: 343 / 412; }
  .case__caption { max-width: none; margin-block: 48px 32px; }
  .case__shot--small + .case__shot--square,
  .case__shot--small + .case__shot--square + .case__shot--square { margin-top: 0; }

  .next-case {
    --card-w: 208px;
    height: clamp(560px, 100svh, 720px);
    margin-top: 80px;
  }
  .next-case__title {
    left: 0;
    right: 0;
    top: calc(50% - 203px);
    max-width: none;
    font-size: var(--fs-s2);
    text-align: center;
    transform: none;
  }
  .next-case__info { display: contents; }
  .next-case__label {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(50% - 233px);
    font-size: 12px;
    text-align: center;
  }
  .next-case__line { display: none; }
  .next-case__detail {
    position: absolute;
    left: var(--gutter);
    right: var(--gutter);
    top: calc(50% + 130px + 36px);
    flex-direction: column;
    align-items: center;
    margin-top: 0;
    text-align: center;
  }
  .next-case__summary { flex: none; max-width: 12em; font-size: 18px; }
  .next-case__services { width: auto; font-size: 14px; }

  /* ---------- Articles index ------------------------------------------- */
  .journal { padding: 150px 0 var(--sp-152); }
  .journal__title { padding-inline: var(--gutter); }
  .journal__grid {
    display: block;
    margin-block: 48px var(--sp-96);
    overflow: visible;
  }
  .journal__grid > li:nth-child(n) { border-right: 0; border-top: 0; }
  .journal__grid > li + li:nth-child(n) { border-top: var(--border-hairline); }
  .journal .post { min-height: 0; }
  .journal .post:hover { background: none; }

  /* ---------- Legal ----------------------------------------------------- */
  .legal { display: block; padding-top: 112px; }
  .legal__title { padding-inline: var(--gutter); margin-bottom: var(--space-32); }
  .legal__updated {
    padding: 0 var(--gutter) var(--space-16);
    border-top: 0;
    border-right: 0;
    border-bottom: var(--border-hairline);
    font-size: 14px;
  }
  .legal__body {
    padding: var(--space-24) var(--gutter) var(--sp-152);
    border-top: 0;
    font-size: 16px;
  }
  .legal__body h2,
  .legal__body h3 { margin-top: 48px; }
  .legal__body h2 + *,
  .legal__body h3 + * { margin-top: var(--space-16); }

  /* ---------- About ----------------------------------------------------- */
  .intro { padding: var(--sp-96) var(--gutter) 64px; }
  .intro__statement { max-width: none; }
  .intro__pillars { margin-top: 48px; }
  .pillar {
    grid-template-columns: 88px minmax(0, 1fr);
    row-gap: var(--space-32);
    min-height: 0;
    padding-top: var(--space-24);
    padding-bottom: 48px;
  }
  .pillar__num { font-size: 16px; }
  .pillar__title { font-size: 28px; }
  .pillar__text { max-width: none; margin-top: var(--space-24); }
  .pillar__image { grid-column: 1 / -1; aspect-ratio: 343 / 238; }

  .approach { padding: 220px var(--gutter) var(--sp-152); }
  .approach__bg { height: 640px; min-height: 0; }
  .approach__head,
  .approach__body { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-24); }
  .approach__head > * { grid-column: 1; }
  .approach__head .statement { max-width: none; margin-top: 0; }
  .approach__body { margin-top: 48px; row-gap: 56px; }
  .approach__aside { width: 100%; }
  .approach__photo { aspect-ratio: 343 / 232; }
  .approach__quote { column-gap: var(--space-16); font-size: 18px; }
  .approach__stats {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 48px;
    max-width: none;
  }
  .approach-stat__value { padding-bottom: var(--space-24); }
  .approach-stat__title { margin-top: var(--space-24); }
  .approach-stat__text { max-width: none; font-size: 14px; }

  .clients { margin-top: var(--sp-96); }
  .clients__marquee { margin-top: var(--space-24); }
  .clients__item { width: 168px; height: 120px; }

  main:not([data-page]) .work { padding: var(--sp-96) var(--gutter) var(--sp-152); }
  .work__statement { max-width: none; margin-top: var(--space-24); }
  .work__viewport { margin-top: 48px; }
  .work__track { gap: var(--space-16); }
  .principle { width: 300px; }
  .principle__image { margin-top: var(--space-16); aspect-ratio: 300 / 372; }
  .principle__title { margin-top: var(--space-24); padding: var(--space-24) 0 0; }
  .principle__text { max-width: none; margin-top: var(--space-16); font-size: 14px; }

  .team { padding: var(--sp-96) var(--gutter) var(--sp-152); }
  .team__title { margin-top: var(--space-24); font-size: var(--fs-s3); line-height: 1.12; }
  .team__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-32) var(--space-16);
    margin-top: 48px;
  }
  .member:nth-child(3n + 1) { grid-column: auto; }
  .member__photo { aspect-ratio: 164 / 205; }
  .member__name { margin-top: var(--space-16); font-size: 16px; }
  .member__role { margin-top: 8px; font-size: 14px; }

  /* ---------- Contact popover ------------------------------------------ */
  .contact__panel {
    top: var(--space-16);
    right: var(--space-16);
    bottom: var(--space-16);
    left: var(--space-16);
    width: auto;
    padding: 56px var(--space-16) var(--space-16);
  }
  .contact__close { top: var(--space-8); right: var(--space-8); }
  .contact__title { font-size: 40px; }
  .contact__intro { max-width: none; margin-top: var(--space-24); font-size: 14px; }
  .contact__form { gap: var(--space-24); margin-top: 40px; }
  .contact__field input,
  .contact__field textarea { font-size: 16px; }
  .contact__field textarea { height: 140px; }
  .contact__submit { width: 124px; height: 56px; }

  /* ---------- Preloader ------------------------------------------------- */
  .preloader__logo { width: 180px; }
  .preloader__foot { top: calc(50% + 16px + 24px); }
}
