/* Portrait folder at ≤700px (Figma 274:4996 closed / 274:5019 open).
   Tabs sit on the right edge; content stays upright, flat and pixel aligned.
   The shell is sized and placed in whole pixels by motion.js. */

@media(max-width:700px){
  /* Corners: on a phone every control and card shares a 14px outer corner
     (owner's handoff), and a surface set inside one takes 14 minus its real
     inset: 10 behind a 4px rim, 6 behind 8. */
  :root{--radius-lg:14px}
  .g-layout-control button,.contact-item,.tag-popover .tag-button,.g-film-frame img,.g-film-player,.film-overlay-frame .g-film-player{border-radius:10px}
  .np-art{border-radius:6px}
  /* Type: the paper is about 220px wide on a phone, so a 16px description
     crowds it and reads louder than the 16px title above. Descriptions step
     down to 14/20 in the regular weight; long reading (About, essays, case
     studies) stays at 16/24. */
  .g-intro,.section-intro,.project-role,.project-excerpt{font-family:var(--font);font-size:var(--text-note);line-height:var(--leading-note);font-weight:400}
  .g-collection-title{font-size:var(--text-note);line-height:var(--leading-note)}
  .scene-header,.scene[data-mode=closed] .scene-header{top:max(24px,7dvh,env(safe-area-inset-top))}
  .scene-control>img{width:48px}
  .reading-progress{width:48px}
  .landscape{width:180vw;min-width:180vw;height:108dvh}

  /* Shell */
  .folder-shell{
    --frame-radius:40px;--paper-radius:30px;--cover-inset:10px;--paper-rim:10px;
    --paper-top:10px;--file-tab-height:25px;--radius-viewport:20px;
    left:var(--mobile-left);top:var(--mobile-top);width:var(--mobile-width);height:var(--mobile-height);
    perspective:none;transform:none;transform-origin:50% 50%;
  }
  .scene:not([data-mode=closed]):not([data-transition=closing]) .folder-shell{transform:none}
  .scene[data-mode=closed] .folder-shell,.scene[data-transition=closing] .folder-shell{transform:translateY(var(--rest-offset-y)) scale(.76)}

  .paper,.paper-layer{top:10px;bottom:10px;height:auto}
  .paper{left:10px;right:54px}
  .layer-one{left:22px;right:42px}
  .layer-two{left:18px;right:46px}
  .layer-three{left:14px;right:50px}
  .paper-viewport{padding:var(--space-32) var(--content-gutter);scroll-padding-block:24px;-webkit-overflow-scrolling:touch}
  .paper[data-controls=true] .paper-viewport{bottom:80px}
  .content-frame{width:100%;min-width:0}
  .scene[data-section=about] .paper-viewport{overflow:auto}
  .scene[data-section=about] .content-frame{height:auto;min-height:100%}
  .about-layout{grid-template-rows:none}

  /* Side tabs: only the native artwork turns; hit areas stay generous */
  .folder-tab,.folder-tab[aria-current=page]{left:calc(100% - 17px - var(--file-rank,3) * 4px);width:96px;height:25px;font-size:var(--text-caption);line-height:var(--leading-caption);transform:rotate(90deg);transform-origin:0 0}
  .tab-articles{top:calc(20.5% - 48px)}
  .tab-gallery{top:calc(37.5% - 48px)}
  .tab-work{top:calc(55% - 48px)}
  .tab-about{top:calc(71% - 48px)}
  .folder-tab span{top:4px}
  /* Playground is the longest label, so its tab is drawn longer to hold it:
     the same artwork, stretched along its length only. */
  .tab-gallery img{transform:translateY(-40.2425%) scaleX(1.4)}
  .folder-tab::after{top:-8px;bottom:-12px;clip-path:polygon(0 100%,0 30%,20% 0,80% 0,100% 30%,100% 100%)}
  .folder-tab:focus-visible span{left:16%;right:16%}

  /* Upright cover that hinges open to the left; its perspective lives here, not on the content */
  .folder-cover-stage{display:block;position:absolute;inset:0;z-index:12;perspective:1600px;pointer-events:none}
  .scene[data-mode=closed] .folder-cover-stage,.scene[data-transition] .folder-cover-stage{z-index:18}
  .folder-front,.scene[data-mode=closed] .folder-front,.scene[data-transition=closing] .folder-front{left:0;top:0;width:calc(100% - 44px);height:100%}
  .folder-front{border-radius:var(--frame-radius);filter:none;transform-origin:0 50%;transform:rotateY(-124deg);transition:transform var(--dur-story) cubic-bezier(.25,.03,.17,1)}
  .scene[data-mode=closed] .folder-front,.scene[data-transition=closing] .folder-front{transform:rotateY(0deg)}
  .folder-front .glass-frost{border:1px solid #d9edf35e;border-radius:inherit;-webkit-mask:none;mask:none;background:linear-gradient(135deg,#c8e2eb45,transparent 34%,#92bac82b),#a4c7d3e8;box-shadow:inset 2px 2px 3px #effbffc4,inset -4px -8px 12px #315e6f50,inset 4px 0 8px #e7faff5c}
  .folder-front .glass-rim{display:none}
  .folder-front::after{border:1px solid #d9edf35e;border-radius:inherit;-webkit-mask:none;mask:none;background:linear-gradient(145deg,#c0dbe5,#a1c2cf 55%,#86aeba);box-shadow:inset 2px 2px 3px #effbff9c,inset -4px -8px 12px #315e6f45;transform:rotateY(180deg) translateZ(.5px)}
  .open-copy{left:50%;top:50%;font-size:24px;line-height:32px;transform:translate(-50%,-50%)}
  .folder-open-trigger{inset:10px 54px 10px 10px}

  .folded-stack{perspective:1600px}
  .page-turn-sheet{transform-origin:10px 50%}
  .scene[data-transition=closing] .folded-stack .page-turn-sheet{transform:rotateY(0deg) translateZ(1px)!important}

  /* Reading surface: no filter, transform or perspective at rest */
  .scene[data-mode=closed] .paper-viewport{filter:none}
  .scene[data-mode=reading]:not([data-transition]) .paper-viewport,
  .scene[data-mode=reading]:not([data-transition]) .content-frame{filter:none;transform:none;will-change:auto}

  /* About: the paper itself is the note on a phone; the sidebar becomes a top row */
  .about-layout{display:flex;flex-direction:column;gap:var(--space-24);width:100%;max-width:none}
  /* Top-aligned with the portrait; on a phone Contact is an icon */
  .about-aside{flex-direction:row;align-items:flex-start;justify-content:space-between;gap:var(--space-16);width:100%;padding:0}
  .contact-button{width:var(--touch-target);height:var(--touch-target);padding:0;border-radius:var(--control-radius)}
  .sound-toggle{width:var(--touch-target);height:var(--touch-target)}
  /* Menus on touch: 44 rows, like iOS */
  .contact-item,.contact-copy,.contact-social{height:var(--touch-target)}
  .contact-copy,.contact-social{width:var(--touch-target)}
  .tag-popover .tag-button{height:var(--touch-target)}
  .contact-icon{display:block}
  .contact-label{display:none}
  .portrait{width:64px;height:72px;border-radius:var(--radius-md)}
  .portrait-button{border-radius:var(--radius-md)}
  .portrait-cue{right:-8px;bottom:-8px;width:24px;height:24px}
  .portrait-cue svg{width:12px;height:12px}
  .about-aside{position:relative}
  .about-portrait,.about-contact{position:static}
  .contact-menu{top:calc(100% + var(--space-12));bottom:auto;right:0;width:auto}
  .now-playing{top:calc(100% + var(--space-12));right:0;width:auto}
  .about-note{max-width:none;padding:0;overflow:visible;background:none;box-shadow:none}

  /* Work: one still page. The cover flexes to the height left over, so the
     case-study action is always in view; the excerpt keeps four lines here
     and is read in full inside the case study. */
  .scene[data-section=work][data-view=overview] .content-frame{height:100%;min-height:0}
  .work-layout{display:flex;flex-direction:column;gap:var(--space-16);flex:1;min-height:0;margin:0}
  .project-cover{flex:1 1 0;height:auto;min-height:80px;max-height:240px}
  .project-copy{flex:none;gap:var(--space-16)}
  .project-lead{margin-top:0}
  .project-excerpt{display:-webkit-box;margin-top:var(--space-8);overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:4}
  .tags{flex-wrap:nowrap;margin-top:var(--space-16)}
  .project-lead>.draft-label{margin-top:var(--space-8)}
  .work-footer .story-link{height:auto;min-height:var(--control-height);font-size:var(--text-label);line-height:var(--leading-label);text-align:left}
  .work-footer{gap:var(--space-8)}
  /* Every phone control is 44 tall */
  .project-copy>.button,.work-footer .direction-button{height:var(--touch-target)}
  /* Chips never run past the paper: one tag leads and the rest wait in the
     "+N" menu; a very long lead tag shortens. The row itself doesn't clip, so
     the menu can open above it. */
  .tags{min-width:0}
  .tags>.tag-button:not(.tag-lead-second){flex-shrink:1;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:block;line-height:var(--control-compact)}
  .g-slide img{height:240px}
  .tag-lead-second,.tag-more-wide{display:none}
  .tag-more-narrow{display:inline}
  .tag-menu-second{display:inline-flex}
  .tag-more-narrow-only{display:block}
  .tag-popover{top:auto;bottom:calc(100% + var(--space-8))}

  /* Reading */
  .detail-view h1,.articles-overview>h1,.g-detail-body h1{font-size:var(--text-title);line-height:var(--leading-title);letter-spacing:var(--tracking-title)}
  .case-body{margin-top:var(--space-32)}
  .case-body h2,.article-card-title{font-size:var(--text-body);line-height:var(--leading-body);letter-spacing:var(--tracking)}
  .article-lede{font-family:var(--font)!important;font-size:var(--text-body)!important;line-height:var(--leading-body)!important;font-weight:500!important}
  .case-figure{margin-block:var(--space-24) var(--space-32)}
  .case-pair-images{grid-template-columns:1fr}
  .detail-cover{max-height:240px}
  .article-card{margin-top:var(--space-24);padding:var(--space-16) var(--space-48) var(--space-16) var(--space-16);border:1px solid var(--hairline);border-radius:var(--radius-lg);background:#f5f6f6}
  .article-card-arrow{right:var(--space-16)}

  /* Back on a phone: a 44 chevron key with the same corners as Contact
     (Figma 370:309). Its label stays for VoiceOver; the page title below says
     where you are. */
  .soft-back{justify-content:center;width:var(--touch-target);height:var(--touch-target);margin-bottom:var(--space-24);padding:0;border-radius:var(--control-radius);box-shadow:var(--lift-raised)}
  .soft-back::after{display:none}
  /* Text scrolling up under the Back key fades into the paper before it gets
     there, so the key never sits on top of a line of words. */
  .detail-view:not(.g-gallery)::before{content:"";position:sticky;top:calc(-1 * var(--space-32));z-index:2;display:block;height:104px;margin:calc(-1 * var(--space-32)) calc(-1 * var(--content-gutter)) -72px;background:linear-gradient(var(--paper) 60px,transparent);pointer-events:none}
  .soft-back-chevron{width:20px;height:20px}
  .soft-back-label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}

  /* Media */
  .g-toolbar{padding:var(--space-24) var(--content-gutter) var(--space-16)}
  .g-detail>.soft-back,.g-collection-view>.soft-back{top:var(--space-24);margin:var(--space-24) 0 0 var(--content-gutter)}
  /* Icon controls on the right; the size slider opens from an icon into a
     small frosted popover. */
  .g-toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:var(--space-8)}
  .g-toolbar-head{display:contents}
  /* Like an iPhone large title: the controls sit in the top row, the title beneath */
  /* The view switch runs the width of the page, its three keys equal, with
     the size key at its end: nothing hangs off to one side. */
  .g-toolbar .g-toolbar-controls{grid-column:1/-1;grid-row:1;justify-self:stretch;margin-top:0;gap:var(--space-8)}
  .g-layout-control,.g-layout-control button{flex:1 1 0}
  .g-toolbar .g-intro{grid-column:1/-1;grid-row:2;margin-top:var(--space-16)}
  .g-layout-label{display:none}
  .g-layout-control button{padding:0}
  .g-size-toggle{display:grid;place-items:center;width:var(--control-height);height:var(--control-height);padding:0;border:0;border-radius:var(--control-radius);background:var(--tint-neutral);color:var(--ink);box-shadow:var(--lift-soft);transition:background-color var(--dur-quick) var(--ease-soft),transform var(--dur-press) var(--ease-soft)}
  .g-size-toggle:active{transform:scale(.94)}
  .g-size-toggle[aria-expanded=true]{background:#e6e5e3}
  .g-size{display:none;position:absolute;z-index:6;top:calc(100% + var(--space-8));right:0;background:#fffffff2;-webkit-backdrop-filter:blur(24px) saturate(1.3);backdrop-filter:blur(24px) saturate(1.3);box-shadow:inset 0 0 0 1px #ffffffcc,var(--lift-float);animation:menu-reveal 250ms var(--ease-soft) both;transform-origin:100% 0;outline:1px solid transparent;outline-offset:-1px}
  .g-size-wrap.is-open .g-size{display:flex}
  .g-size-track{width:144px;height:var(--touch-target)}
  .g-size{height:var(--space-48);padding:0 var(--space-16)}
  .g-size-range{height:var(--touch-target)}
  .g-size-ticks{bottom:var(--space-8)}
  /* Touch sizes: every Media control is 44 tall, as on iPhone (4 inset → 36 segments) */
  .g-layout-control{height:var(--touch-target)}
  .g-layout-control button{height:36px}
  .g-size-toggle{width:var(--touch-target);height:var(--touch-target)}
  .g-step{width:48px;height:var(--touch-target);border-radius:var(--control-radius)}
  .g-share{height:var(--touch-target);padding:0 var(--control-padding) 0 var(--space-12);border-radius:var(--control-radius)}
  .g-collection-head{flex-wrap:wrap;align-items:flex-start}
  /* On a phone the film pop-up hides the page outright: a see-through scrim
     over small print reads as clutter. */
  .film-overlay-scrim{background:#faf7f0;-webkit-backdrop-filter:none;backdrop-filter:none}
  .g-layout-control button{padding:0}
  .g-day{padding:var(--space-24) var(--content-gutter) var(--space-12)}
  .g-gallery{--g-card:80px;--g-gap:24px}
  .g-gallery[data-size="0"]{--g-card:64px;--g-row:48px;--g-gap:24px;--g-zoom:.8}
  .g-gallery[data-size="2"]{--g-card:96px;--g-row:64px;--g-gap:32px;--g-zoom:1.2;--g-title:var(--text-caption);--g-title-leading:var(--leading-caption)}
  .g-gallery[data-size="3"]{--g-card:112px;--g-row:72px;--g-gap:40px;--g-zoom:1.4;--g-title:var(--text-label);--g-title-leading:var(--leading-label)}
  .g-note{max-width:112px;font-size:var(--text-caption);line-height:var(--leading-caption)}
  .g-layout-grid .g-days{gap:var(--space-24) var(--space-16)}
  /* Collections sit two across; the pile shrinks to leave its fanned prints room. */
  .g-collections{grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--space-24) var(--space-8);padding:var(--space-24) var(--content-gutter) var(--space-32)}
  .g-collection{min-width:0}
  .g-pile{width:min(96px,calc(100% - 28px));height:auto;aspect-ratio:1;margin-bottom:var(--space-12)}
  .g-collection-head{padding:var(--space-24) var(--content-gutter) 0}
  .g-collection-head h1{font-size:var(--text-title);line-height:var(--leading-title);letter-spacing:var(--tracking-title)}
  .g-canvas-tools{left:var(--space-16);right:var(--space-16);bottom:var(--space-16);gap:var(--space-8)}
  .g-canvas-reset{height:var(--touch-target);padding:0 var(--control-padding);font-size:var(--text-label);line-height:var(--leading-label)}
  .g-detail-body{padding:var(--space-24) var(--content-gutter) var(--space-32)}
  .g-images{gap:var(--space-24);margin-block:var(--space-24)}
}

@media(max-width:600px){
  .g-position-1{grid-column:1/span 3}
  .g-position-3{grid-column:3/span 3}
}

@media(max-width:360px){
  /* The email wraps rather than cutting off */
  .contact-email .contact-item{height:auto;min-height:var(--touch-target);padding-block:var(--space-8)}
  .contact-address{white-space:normal;overflow-wrap:anywhere}
  .g-toolbar .g-toolbar-controls{gap:var(--space-4)}
  .about-aside{gap:var(--space-8)}
  .portrait{width:56px;height:64px}
  /* The smallest phones: keep Work on one page */
  .project-excerpt{-webkit-line-clamp:3}
  .work-layout,.project-copy{gap:var(--space-8)}
  .up-next-text{display:none}
  .up-next-card{padding-right:var(--space-4)}
  .scene[data-section=work][data-view=overview] .paper-viewport{padding-block:var(--space-16)}
}
