/* Phones and tablets (below 1024px). The desktop compositions are fixed 1440px layouts that fit.js
   scales down; below this width that would shrink text to a few pixels, so instead the same content
   is laid out as a single readable column. Desktop is untouched: everything here sits inside the
   media query, and fit.js / script.js / theme.js take their mobile branches at the same width. */

.nav-menu-btn, .nav-panel { display: none; }

@media (max-width: 1023px) {

  /* ---------------------------------------------------------------- Menu (every page) */
  .nav-inner { width: 100% !important; height: 64px !important; zoom: 1 !important; }
  .nav-inner > a[aria-label="Home"] { left: 16px !important; top: 10px !important; width: 75px !important; height: 44px !important; }
  .nav-inner .nav-chip, .nav-inner .nav-item { display: none !important; }
  .theme-toggle { left: auto !important; right: 64px; top: 16px; }
  .nav-menu-btn { display: grid; place-items: center; position: absolute; right: 16px; top: 14px; width: 36px; height: 36px; padding: 0;
    border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--accent); cursor: pointer; }
  .nav-menu-btn i { position: absolute; left: 10px; right: 10px; height: 1.5px; border-radius: 1px; background: currentColor;
    transition: transform .4s cubic-bezier(.22,1,.36,1), opacity .25s ease; }
  .nav-menu-btn i:nth-child(1) { transform: translateY(-5px); }
  .nav-menu-btn i:nth-child(3) { transform: translateY(5px); }
  .nav.menu-open .nav-menu-btn i:nth-child(1) { transform: rotate(45deg); }
  .nav.menu-open .nav-menu-btn i:nth-child(2) { opacity: 0; }
  .nav.menu-open .nav-menu-btn i:nth-child(3) { transform: rotate(-45deg); }
  .nav-panel { display: block; position: absolute; left: 0; right: 0; top: 64px; padding: 6px 20px 18px;
    background: color-mix(in srgb, var(--bg) 97%, transparent);
    border-bottom: 1px solid var(--line); box-shadow: 0 28px 40px -24px rgba(40, 22, 100, .4);
    opacity: 0; visibility: hidden; transform: translateY(-10px);
    transition: opacity .3s ease, transform .45s cubic-bezier(.22,1,.36,1), visibility 0s linear .45s; }
  .nav.menu-open .nav-panel { opacity: 1; visibility: visible; transform: none; transition: opacity .3s ease, transform .45s cubic-bezier(.22,1,.36,1); }
  .nav-panel a { display: flex; align-items: center; gap: 14px; padding: 15px 2px; border-top: 1px solid var(--line);
    font-family: var(--serif); font-size: 24px; line-height: 1.1; color: var(--ink); }
  .nav-panel a:first-child { border-top: 0; }
  .nav-panel a svg { flex: none; width: 22px; height: 22px; color: var(--accent); }
  .nav-panel a[aria-current] { color: var(--accent); }
  .nav-panel a.chip span::after { content: "  ·  research & what's next"; font-family: var(--sans); font-size: 11px; letter-spacing: 1.4px;
    text-transform: uppercase; color: var(--muted); }
  @media (prefers-reduced-motion: reduce) { .nav-panel, .nav-menu-btn i { transition: none !important; } }

  /* ---------------------------------------------------------------- Home page */
  .stage { width: 100% !important; height: auto !important; zoom: 1 !important; overflow-x: clip; }
  .stage > .a { display: none; }

  /* Hero: the mgc letters with the portrait fill the width (scaled from the desktop artwork by
     --hs, set in fit.js); name and title below at a readable size. */
  .hero { position: relative; left: auto; top: auto; width: 100%; height: auto; overflow: clip; text-align: center;
    padding: calc(86px + 530px * var(--hs, .45)) 20px 40px; }
  .hero-letters { inset: auto !important; left: 0 !important; top: calc(84px - 140px * var(--hs, .45)) !important; width: 1440px; height: 706px;
    transform-origin: 0 0; transform: translateX(var(--hx, 0px)) scale(var(--hs, .45)); }
  .hero-name, .hero-tagline { position: relative; left: auto; top: auto; width: auto; translate: none; }
  .hero-name .n1 { font-size: clamp(30px, 8.6vw, 46px); line-height: 1.12; }
  .hero-name .n1 span { font-size: 14px; letter-spacing: 2px; }
  .hero-name .n2 { margin-top: 12px; font-size: clamp(19px, 5.4vw, 27px); line-height: 1.3; }
  .hero-tagline { margin: 16px auto 0; max-width: 34ch; font-size: 15px; line-height: 24px; }

  /* Invitation to Horizons: in the flow, between About and the journey. */
  .hz-invite { position: relative; left: auto; top: auto; width: auto; margin: 40px 20px 72px; grid-template-columns: 1fr;
    padding: 30px 24px 32px; gap: 14px; border-radius: 24px; }
  .hz-invite .hz-k { font-size: 10.5px; letter-spacing: 2.2px; flex-wrap: wrap; row-gap: 4px; }
  .hz-invite .sep { display: none; }
  .hz-invite .hz-t { font-size: 23px; line-height: 1.4; max-width: none; }
  .hz-invite .hz-go { justify-self: start; margin-top: 4px; }

  /* About: the three statements, one after another. On a phone they light up as they reach the
     middle of the screen (script.js), where on desktop they light up under the pointer. */
  .about { position: relative; left: auto; top: auto; width: auto; height: auto; overflow: visible; padding: 40px 20px 64px; }
  .about > .a.clip { position: static !important; inset: auto !important; overflow: visible; }
  .about .eyebrow, .about .statement { position: static !important; inset: auto !important; }
  .about .eyebrow { margin-top: 44px; font-size: 11px; letter-spacing: 2.6px; line-height: 1.5; }
  .about > .a.clip .eyebrow { margin-top: 0; }
  .about .statement { margin-top: 12px; font-size: clamp(26px, 7.2vw, 38px); line-height: 1.24 !important; letter-spacing: -.3px; }
  .reveal { opacity: .25; }
  .reveal.lit { opacity: 1; }

  /* Journey: title, lead and the three things first, then the water's surface where the lotus
     lands, then each chapter as a card on its own thread. */
  .journey { position: relative; left: auto !important; top: auto; width: auto; height: auto !important; overflow: clip;
    padding: 64px 20px 80px; display: flex; flex-direction: column; align-items: stretch; }
  .journey > h2, .journey > .title-rule, .journey > .lead, .journey > .span-note, .journey > .note-rule,
  .journey > .label, .journey > .intro, .journey > .point, .journey > .point-text {
    position: relative !important; left: auto !important; top: auto !important; width: auto !important; margin-left: 0 !important; white-space: normal !important; }
  .journey > .divider, .journey > .bullet { display: none; }
  .journey h2, .journey.is-open h2 { order: 1; font-size: 24px; font-weight: 400; font-style: italic; letter-spacing: 0; text-align: left; color: var(--accent); transition: none; }
  .journey .title-rule { order: 1; width: 120px !important; height: 1px; margin: 12px 0 26px; }
  .journey .lead { order: 1; font-size: clamp(30px, 8.4vw, 42px); line-height: 1.2; }
  .journey .span-note { order: 1; margin-top: 16px; font-size: 18px; line-height: 1.4; }
  .journey .note-rule { order: 1; height: 1px; margin-top: 12px; }
  .journey .label { order: 1; margin-top: 40px; white-space: normal; }
  .journey .intro { order: 1; margin-top: 12px; font-size: 16px; line-height: 26px; }
  .journey .intro p + p { margin-top: 12px; }
  .journey .point { order: 1; margin-top: 22px !important; font-size: 23px; padding-left: 18px; }
  .journey .point::before { content: ""; position: absolute; left: 0; top: .55em; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); }
  .journey .point-text { order: 1; margin-top: 6px; padding-left: 18px; font-size: 15px; line-height: 23px; }
  .journey .journey-glass { order: 0; }

  .water { width: 100% !important; top: var(--water-top, 860px) !important; }
  .lotus-reflection { left: calc(50% - 100px) !important; width: 200px !important; height: 160px !important; }
  .ripples { left: 50% !important; }
  .ripples i { width: 180px; height: 26px; margin: -13px 0 0 -90px; }
  .stem-thread { left: 0 !important; width: 100% !important; height: 150px !important; }
  .shaft.s1 { left: -60px; width: 200px; }
  .shaft.s2 { left: auto; right: -60px; width: 200px; }

  .weave { position: relative !important; left: auto !important; top: auto !important; width: auto !important; height: auto !important;
    order: 2; margin-top: 310px; }
  .weave-svg { display: none; }
  .w-cards { display: flex; flex-direction: column; gap: 30px; }
  .w-card, .w-card.is-now { position: relative; left: auto; top: auto !important; width: auto; padding-left: 26px; }
  .w-card::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: -16px; width: 3px; border-radius: 3px;
    background: linear-gradient(var(--c), color-mix(in srgb, var(--c) 25%, transparent)); transition: width .45s cubic-bezier(.22,1,.36,1), left .45s cubic-bezier(.22,1,.36,1); }
  .w-card::after { content: ""; position: absolute; left: 1px; bottom: -26px; width: 13px; height: 13px; border-radius: 50%;
    border: 2px solid var(--c); background: var(--bg); box-sizing: border-box; }
  .w-card.is-now::before { top: 0; background: linear-gradient(var(--accent-2), var(--accent) 40%, color-mix(in srgb, var(--accent) 25%, transparent)); }
  .w-card.is-now > a { padding: 24px 22px 26px; border-radius: 24px; }
  .w-card > a { gap: 8px; }
  .w-meta { flex-wrap: wrap; gap: 8px 12px; letter-spacing: 2px; }
  .w-card h4 { font-size: 26px; line-height: 30px; }
  .w-card.is-now h4 { font-size: 34px; line-height: 38px; }
  .w-desc, .w-card.is-now .w-desc { font-size: 15px; line-height: 24px; }
  .w-card.on > a { transform: none; }
  .w-card.on::before { left: 4.5px; width: 6px; }
  .weave.has-active .w-card:not(.on) > a { opacity: .55; }

  /* The lotus spans the phone width, faded, and closes to a bud on the surface (script.js). */
  .lotus-stem { width: 100% !important; }

  /* Contact */
  .contact { position: relative; left: auto; top: auto; width: auto; height: auto; overflow: visible; }
  .more { position: relative; left: auto; top: auto; display: block; width: auto; height: auto; padding: 32px 20px 20px;
    text-align: left; font-size: 24px; line-height: 1.3; }
  .more p { position: static; white-space: normal; }
  .more i { display: none; }
  .touch { position: relative; left: auto; top: auto; width: auto; height: auto; padding: 44px 20px 40px;
    display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
  .touch h2 { position: static; order: 1; width: auto; height: auto; font-size: clamp(42px, 12.5vw, 72px); line-height: 1.04; letter-spacing: -1px; }
  .touch-portrait { position: relative; left: auto; top: auto; order: 2; width: 170px; height: 204px; }
  .touch .details { position: static; order: 3; width: auto; font-size: clamp(19px, 5.6vw, 26px); line-height: 1.4; overflow-wrap: anywhere; }
  .touch > a.a { position: relative !important; left: auto !important; top: auto !important; order: 4; }
  .cv { position: relative; left: auto; top: auto; order: 5; }
  .touch .year { position: static; order: 6; margin-top: 10px; }
  .touch > div.a { position: relative !important; left: auto !important; top: auto !important; order: 7; }

  /* "More on my background", as a scrolling sheet */
  .bg-stage { width: calc(100% - 24px) !important; height: auto !important; zoom: 1 !important; margin: 12px auto !important;
    padding: 68px 22px 30px; display: flex; flex-direction: column; gap: 14px; }
  .bg-stage .card { left: 0; top: 0; width: 100%; height: 100%; border-radius: 26px; }
  .bg-stage > *:not(.card):not(.close) { position: relative !important; left: auto !important; top: auto !important; width: auto !important; z-index: 1; }
  .bg-modal[open] { display: block; }
  .bg-stage > * { flex-shrink: 0; }
  .bg-stage > .photo.portrait { align-self: center; width: 190px !important; height: 250px !important; border-radius: 95px; }
  .bg-stage .photo:not(.portrait) { height: auto !important; aspect-ratio: var(--ar, 4 / 3); }
  .bg-stage .name .n1 { font-size: 28px; line-height: 1.15; }
  .bg-stage .name .n1 span { font-size: 14px; }
  .bg-stage .name .n2 { margin-top: 6px; font-size: 18px; line-height: 1.35; }
  .bg-stage .tagline { font-size: 14px; line-height: 1.5; }
  .bg-stage .copy { font-size: 14px; line-height: 1.6 !important; text-align: left; }
  .bg-stage .close { position: absolute !important; left: auto !important; right: 16px; top: 16px !important; width: 34px !important; height: 34px !important; z-index: 2; }

  /* ---------------------------------------------------------------- Chapter pages
     Each chapter is a hand-placed 1440px composition. Here its pieces flow as one column in reading
     order (worked out by fit.js from where each piece sits on the desktop page): the header first,
     then each column top to bottom, the photos, and the closing band. Decorative shapes that only
     make sense in the composition are left out; pills and highlighted lines carry their own colour. */
  .chapter { width: 100% !important; height: auto !important; zoom: 1 !important; overflow: visible; padding: 84px 20px 52px;
    display: flex; flex-flow: row wrap; align-items: flex-start; align-content: flex-start; gap: 8px 10px; }
  /* every piece takes its own line, except small images (logos), which sit side by side and wrap */
  .chapter > * { flex: 0 0 100%; }
  .chapter > .back, .chapter > .c-white, .chapter > .photo-small { flex: 0 0 auto; }
  .chapter > .back { margin-right: 100%; }
  .chapter > *, .chapter > *:not(.full) { position: relative !important; left: auto !important; top: auto !important; right: auto !important;
    bottom: auto !important; margin-left: 0 !important; max-width: 100%; }
  .chapter > :not(.photo):not(.stat-grid):not(.stat-row) { width: auto !important; height: auto !important; }
  .chapter > [aria-hidden="true"]:not(.photo):not(.back) { display: none !important; }
  .chapter > :not(.pre):not(.m-chart), .chapter .nw, .chapter .nowrap { white-space: normal !important; }
  .chapter .back { width: auto !important; height: 30px; padding: 0 12px 0 9px; gap: 7px; }
  .chapter .back span { opacity: 1; }
  .chapter .crumb { margin-bottom: 6px; }
  .chapter h1, .chapter .display { font-size: clamp(32px, 9vw, 46px) !important; line-height: 1.1 !important; }
  .chapter .label { margin-top: 26px; white-space: normal; }
  .chapter p, .chapter h3 { max-width: 62ch; }
  .chapter > .c-white { color: #fff !important; background: var(--fill); padding: 3px 11px; border-radius: 12px; margin-top: 18px; }
  .chapter > .c-teal { padding: 4px 10px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
  .chapter .photo { width: 100% !important; height: auto !important; aspect-ratio: var(--ar, 4 / 3); border-radius: 10px; margin-top: 8px; }
  .chapter .photo.photo-small { width: min(100%, var(--pw)) !important; margin-top: 0; }
  .chapter .stat-grid { width: 100% !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; margin-top: 4px; }
  .chapter .pager { margin-top: 18px; white-space: normal; }
  .chapter .pager.prev { margin-top: 36px; }
}

/* Chapter 06's revenue chart: on phones a compact version with the same figures. */
.m-chart { display: none; }
@media (max-width: 1023px) {
  .chapter > .chart { display: none !important; }
  .chapter > .m-chart { display: grid; gap: 12px; width: 100% !important; margin-top: 6px; }
  .m-chart .r { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 4px 12px; align-items: center; }
  .m-chart .y { font-size: 12px; color: var(--muted); }
  .m-chart .b { height: 14px; width: var(--v); border-radius: 4px; background: color-mix(in srgb, var(--accent) 45%, transparent); }
  .m-chart .b.strong { background: var(--fill); }
  .m-chart .t { grid-column: 2; font-size: 13px; color: var(--text); }
  .m-chart .t b { font-weight: 700; color: var(--ink); }
}
