/* ==========================================================================
   Layout system. Loaded last so every section follows one set of rules.
   Every project spread reads the same way:
     row 1  header line
     row 2  main film or image (columns 1-8, 16:9)  ·  copy (columns 9-12)
     row 3  one strip of stills, one row, the same height in every project
   ========================================================================== */
:root{
  --sec-y:clamp(56px,7vw,104px);   /* space above and below every section */
  --block:clamp(24px,2.8vw,40px);  /* space between the rows inside a section */
  --tile:clamp(4px,.55vw,8px);     /* gap between images in a strip or grid */
}

/* ---------- Rhythm: every section breathes the same ---------- */
.spread{padding-top:var(--sec-y)!important;padding-bottom:var(--sec-y)!important;row-gap:var(--block)!important}
.spread > .spread-head,.fuji-panel > .spread-head{padding-bottom:0!important;margin:0!important}
.fuji-panel{row-gap:var(--block)!important}
.social{padding:var(--sec-y) 0!important}
.social-head{padding-bottom:var(--block)!important}
.xh-strip,.d-strip,.pp-stills,.v-frames,.carousel,.twc-row,.global-grid,.lenses,.as-ran,.lin-strip,.xh-row{margin-top:0!important}
.spread-copy{gap:14px}

/* One title size everywhere */
.spread .title,.spread .pp-title{font-size:clamp(40px,5.6vw,84px)!important}
.pp-title span{display:inline!important;white-space:normal!important}

/* ---------- Strips: one row, same height, nothing scrolls sideways ----------
   Portrait strips: 9 tiles at 4:5. Landscape strips: 5 tiles at 3:2.
   Both come out the same height at every width. */
.lin-strip,.xh-row,.van-strip,.v-frames,.s-kirin .carousel-track,.s-ntt .twc-row,
.chase-strip,.sa-row,.d-strip,.pp-stills{
  grid-column:1/-1!important;grid-row:auto!important;display:grid!important;
  grid-template-columns:repeat(9,minmax(0,1fr))!important;grid-template-rows:none!important;grid-auto-flow:row!important;
  gap:var(--tile)!important;overflow:visible!important;height:auto!important;flex:none!important;padding:0!important;margin:0!important}
.chase-strip,.sa-row,.d-strip,.pp-stills{grid-template-columns:repeat(5,minmax(0,1fr))!important}

/* nested strips: let their tiles sit straight in the one row */
.v-frames .v-thumbs,.pp-stills .pp-grid,.s-ntt .twc-row .twc-grid,.s-kirin .carousel-track li{display:contents!important}
.v-frames .row-label,.pp-stills .row-label,.s-kirin .carousel-bar{display:none!important}
.v-frames .v-thumbs ~ .v-thumbs,.pp-stills .pp-grid ~ .pp-grid{display:none!important}
.s-kirin .carousel{grid-column:1/-1!important;margin:0!important}

.lin-strip > *,.xh-row > *,.van-strip > *,.v-thumbs > *,.s-kirin .carousel-track img,.s-ntt .twc-row video,.s-ntt .twc-grid > *{
  display:block;width:100%!important;height:auto!important;min-height:0!important;aspect-ratio:4/5!important;object-fit:cover;
  grid-column:auto!important;grid-row:auto!important;margin:0!important;border-radius:0}
.chase-strip > *,.sa-row > *,.d-strip > *,.pp-grid > *{
  display:block;width:100%!important;height:auto!important;min-height:0!important;aspect-ratio:3/2!important;object-fit:cover;
  grid-column:auto!important;grid-row:auto!important;margin:0!important}

/* only as many as fit in one row */
.lin-strip > :nth-child(n+10),.xh-row > :nth-child(n+10),.van-strip > :nth-child(n+10),
.v-thumbs > :nth-child(n+10),.s-kirin .carousel-track li:nth-child(n+10),.s-ntt .twc-grid > :nth-child(n+9),
.chase-strip > :nth-child(n+6),.sa-row > :nth-child(n+6),.d-strip > :nth-child(n+6),.pp-grid > :nth-child(n+6){display:none!important}

/* ---------- Desktop: the same anatomy in every project ---------- */
@media (min-width:901px){
  .spread > .spread-head{grid-row:1}

  /* main film or image: columns 1-8, 16:9 */
  .spread > .spread-img:not(.film),.s-pp > .pp-film,.s-kirin > .kirin-reel,.s-xhalf .xh-film,.s-nt .nt-film{
    grid-column:1/span 8!important;grid-row:2!important;align-self:start!important;margin:0!important;max-width:none!important}
  .spread > .spread-img:not(.film) > img,.spread > .spread-img:not(.film) > video,.s-pp > .pp-film video,
  .s-kirin > .kirin-reel video,.s-xhalf .xh-film video,.s-nt .nt-film video,.s-wool .wool-hero video,.s-chase .chase-hero img,.s-sa .sa-film video{
    width:100%!important;height:auto!important;min-height:0!important;max-height:none!important;aspect-ratio:16/9!important;object-fit:cover}

  /* copy: columns 9-12, sitting on the bottom edge of the film */
  .spread:not(.s-lindelli) > .spread-copy,.s-xhalf .side-fit,.s-nt .nt-side{grid-column:9/span 4!important;grid-row:2!important;align-self:end!important}


  /* DNSW Summer: the two key visuals share the film's space */
  .s-dnsw .d-kv{align-self:end!important}
  .s-dnsw .d-kv img{aspect-ratio:1800/1272!important}

  /* Pan Pacific: film, copy beside it, the live site under the copy */
  .s-pp > .pp-film{grid-row:2/span 2!important}
  .s-pp > .pp-copy{grid-row:2!important;align-self:end!important}
  .s-pp > .pp-wild{grid-column:9/span 4!important;grid-row:3!important;align-self:start!important;margin:0!important}

  /* vivo: Sydney and China films side by side at the same height, copy beside them */
  .s-vivo > .spread-copy{grid-column:9/span 4!important}
  .s-vivo > .v-reel-syd{grid-column:1/span 6!important;grid-row:2!important;align-self:stretch!important}
  .s-vivo > .v-reel-cn{grid-column:7/span 2!important;grid-row:2!important;align-self:stretch!important}

  /* Red Centre: reel, grid, copy. Same height as a 16:9 film */

  .s-twc:not(.s-ntt) > .twc-row{display:contents!important}
  .s-twc:not(.s-ntt) .twc-reel{grid-column:1/span 4!important;grid-row:2!important;align-self:end!important;width:100%!important;height:auto!important;min-height:0!important;aspect-ratio:6/7!important}
  .s-twc:not(.s-ntt) .twc-grid{grid-column:5/span 4!important;grid-row:2!important;align-self:stretch!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;grid-template-rows:repeat(3,minmax(0,1fr))!important;gap:var(--tile)!important}
  .s-twc:not(.s-ntt) .twc-grid > *{grid-column:auto!important;grid-row:auto!important;width:100%!important;height:100%!important;min-height:0!important;aspect-ratio:auto!important;object-fit:cover;margin:0!important}
  .s-twc:not(.s-ntt) .twc-grid > :nth-child(n+10){display:none!important}
  .s-twc > .spread-copy{grid-column:9/span 4!important;grid-row:2!important;align-self:end!important}
  .s-ntt > .spread-img{grid-row:2!important}

  /* Fujifilm NT: film and copy like the others, lenses underneath */
  .s-nt .lenses{grid-column:1/-1!important}
}

/* ---------- Social: one row of six, no sideways scroll ---------- */
.social .reels{display:grid!important;grid-template-columns:repeat(6,minmax(0,1fr));gap:var(--tile)!important;overflow:visible!important;scroll-snap-type:none!important;
  padding:0 max(var(--pad),env(safe-area-inset-right,0px)) 0 max(var(--pad),env(safe-area-inset-left,0px))!important}
.social .reel{height:auto!important;width:auto!important;aspect-ratio:9/16;border-radius:0!important}
.social .reels > .reel:nth-child(n+7){display:none!important}

/* ---------- Phones: same rhythm, strips fold into short grids ---------- */
@media (max-width:900px){
  .lin-strip,.xh-row,.van-strip,.v-frames,.s-kirin .carousel-track,.s-ntt .twc-row{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .chase-strip,.sa-row,.d-strip,.pp-stills{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .lin-strip > :nth-child(n+7),.xh-row > :nth-child(n+7),.van-strip > :nth-child(n+7),
  .v-thumbs > :nth-child(n+7),.s-kirin .carousel-track li:nth-child(n+7),.s-ntt .twc-grid > :nth-child(n+6),
  .chase-strip > :nth-child(n+5),.sa-row > :nth-child(n+5),.d-strip > :nth-child(n+5),.pp-grid > :nth-child(n+5){display:none!important}
  .sa-row > :first-child,.chase-strip > :first-child{grid-column:auto!important}
  .social .reels{grid-template-columns:repeat(3,minmax(0,1fr))}
}

/* X half: stronger selectors to beat its older inline rules */
.spread.s-xhalf .xh-row{grid-template-columns:repeat(9,minmax(0,1fr))!important}
@media (min-width:901px){
  .spread.s-xhalf .side-fit{contain:none!important;height:auto!important;display:flex!important;flex-direction:column;gap:var(--block)!important;align-self:end!important}
  .spread.s-xhalf .side-shot{flex:none!important}
  .spread.s-xhalf .side-shot a{aspect-ratio:16/10!important;height:auto!important}
}
@media (max-width:900px){.spread.s-xhalf .xh-row{grid-template-columns:repeat(3,minmax(0,1fr))!important}}

/* Red Centre: the 3×3 grid matches the reel beside it */
@media (min-width:901px){
  .spread.s-twc:not(.s-ntt) .twc-grid{align-self:end!important;aspect-ratio:6/7;height:auto!important;min-height:0!important;overflow:hidden}
}

/* Every reel and portrait film: square corners, like every other image */
.social .reel,.twc-reel{border-radius:0!important}
@media (max-width:900px){
  .social .reels{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .social .reels > .reel:nth-child(n+5){display:none!important}
}

/* ==========================================================================
   Case study pages: same hero size for films and stills, same gaps
   ========================================================================== */
.cs-top{padding-bottom:var(--block)!important}
.cs-top .cs-film video,.cs-hero img{width:min(100%,calc(62svh * 16 / 9),1080px)!important;height:auto!important;aspect-ratio:16/9!important;object-fit:cover!important}
.proj-sec{padding-top:var(--block)!important;padding-bottom:var(--block)!important}
.proj-stills,.vgrid,.film-pair{gap:var(--tile)!important}
.proj-stills.masonry{column-gap:var(--tile)!important}
.proj-stills.masonry img{margin-bottom:var(--tile)!important}

/* ==========================================================================
   Home: projects alternate sides. Odd projects have the film on the left,
   even projects have it on the right.
   ========================================================================== */
@media (min-width:901px){
  main > article.spread:nth-of-type(even) > .spread-img:not(.film),
  main > article.spread:nth-of-type(even) > .pp-film,
  main > article.spread:nth-of-type(even) > .kirin-reel,
  main > article.spread:nth-of-type(even) .xh-film,
  main > article.spread:nth-of-type(even) .nt-film{grid-column:5/span 8!important}
  main > article.spread:nth-of-type(even):not(.s-lindelli) > .spread-copy,
  main > article.spread:nth-of-type(even) > .pp-wild,
  main > article.spread:nth-of-type(even) .side-fit,
  main > article.spread:nth-of-type(even) .nt-side{grid-column:1/span 4!important}

  main > article.spread.s-vivo:nth-of-type(even) > .v-reel-syd{grid-column:5/span 6!important}
  main > article.spread.s-vivo:nth-of-type(even) > .v-reel-cn{grid-column:11/span 2!important}

  main > article.spread.s-twc:nth-of-type(even):not(.s-ntt) .twc-grid{grid-column:5/span 4!important}
  main > article.spread.s-twc:nth-of-type(even):not(.s-ntt) .twc-reel{grid-column:9/span 4!important}

  main > article.spread.s-lindelli:nth-of-type(even) > .lin-wild{grid-column:1/span 6!important}
  main > article.spread.s-lindelli:nth-of-type(even) > .spread-copy{grid-column:7/span 3!important}
  main > article.spread.s-lindelli:nth-of-type(even) > .lin-reel{grid-column:10/span 3!important}

  /* vivo: captions hang below the films, so the copy lines up with the films' bottom edge */
  .s-vivo > .v-reel{position:relative}
  .s-vivo > .v-reel figcaption{position:absolute!important;top:calc(100% + 8px)!important;bottom:auto!important;left:0}
  .s-vivo > .v-reel-cn{padding-bottom:0!important}
  .s-vivo > .v-reel-cn video{height:100%!important}
}
@media (min-width:901px){
  .s-lindelli > .lin-reel,.s-lindelli > .spread-copy,.s-lindelli > .lin-wild{grid-row:2!important;align-self:center!important}
  .s-lindelli > .lin-reel{align-self:start!important}
}

/* Fujifilm NT: the full film at its own 4:3, six columns like the other 4:3 films */
.s-nt .nt-square{position:relative}
.s-nt .nt-square video{aspect-ratio:4/3!important;object-fit:cover;width:100%!important;height:auto!important;max-height:none!important}
.s-nt .nt-square.full .pp-play{display:none}
@media (min-width:901px){
  .s-nt .nt-film.nt-square{grid-column:1/span 6!important}
  .s-nt .nt-side{grid-column:9/span 4!important}
  main > article.spread:nth-of-type(even) .nt-film.nt-square{grid-column:7/span 6!important}
  main > article.spread:nth-of-type(even) .nt-side{grid-column:1/span 4!important}
}

/* ---------- Every home film at its own shape: nothing cropped ----------
   4:3 films take six columns, so they stand as tall as a 16:9 film in eight. */
.spread.s-wool .wool-hero video,.spread.s-kirin > .kirin-reel video,.spread.s-sa .sa-film video,.spread.s-vivo .v-reel-syd video{aspect-ratio:4/3!important;object-fit:cover}
.spread.s-vivo .v-reel-cn video{aspect-ratio:404/720!important;height:auto!important}
.spread.s-twc:not(.s-ntt) .twc-reel{aspect-ratio:9/16!important}
@media (min-width:901px){
  .spread.s-wool .wool-hero,.spread.s-kirin > .kirin-reel,.spread.s-sa .sa-film{grid-column:1/span 6!important}
  main > article.spread.s-wool:nth-of-type(even) .wool-hero,main > article.spread.s-kirin:nth-of-type(even) > .kirin-reel,
  main > article.spread.s-sa:nth-of-type(even) .sa-film{grid-column:7/span 6!important}
  /* vivo: Sydney 4:3 and China 9:16 side by side at one height */
  main > article.spread.s-vivo > .v-reel-syd{grid-column:1/span 5!important}
  main > article.spread.s-vivo > .v-reel-cn{grid-column:6/span 2!important}
  main > article.spread.s-vivo:nth-of-type(even) > .v-reel-syd{grid-column:6/span 5!important}
  main > article.spread.s-vivo:nth-of-type(even) > .v-reel-cn{grid-column:11/span 2!important}
  .spread.s-vivo > .v-reel-cn video{height:auto!important}
  /* Red Centre: the reel at 9:16 sets the height and the grid fills beside it */
  .spread.s-twc:not(.s-ntt) .twc-reel{grid-column:1/span 3!important;width:100%!important;height:auto!important}
  .spread.s-twc:not(.s-ntt) .twc-grid{grid-column:4/span 5!important;align-self:stretch!important;aspect-ratio:auto!important;height:auto!important}
  main > article.spread.s-twc:nth-of-type(even):not(.s-ntt) .twc-reel{grid-column:10/span 3!important}
  main > article.spread.s-twc:nth-of-type(even):not(.s-ntt) .twc-grid{grid-column:5/span 5!important}
}
/* NT Tourism strip: the reel keeps 9:16 in a narrower first tile */
.spread.s-ntt .twc-row{grid-template-columns:minmax(0,.703fr) repeat(8,minmax(0,1fr))!important}
.spread.s-ntt .twc-row video{aspect-ratio:auto!important;height:100%!important}
@media (max-width:900px){.spread.s-ntt .twc-row{grid-template-columns:minmax(0,.703fr) repeat(2,minmax(0,1fr))!important}}
/* vivo: both films share the eight film columns, widths worked out so they stand the same height */
@media (min-width:901px){
  main > article.spread.s-vivo > .v-reel-syd,main > article.spread.s-vivo > .v-reel-cn{grid-column:1/span 8!important;grid-row:2!important}
  main > article.spread.s-vivo:nth-of-type(even) > .v-reel-syd,main > article.spread.s-vivo:nth-of-type(even) > .v-reel-cn{grid-column:5/span 8!important}
  main > article.spread.s-vivo > .v-reel-syd{width:calc((100% - var(--tile)) / 1.4208)!important;justify-self:start!important}
  main > article.spread.s-vivo > .v-reel-cn{width:calc((100% - var(--tile)) * .4208 / 1.4208)!important;justify-self:end!important}
  main > article.spread.s-vivo > .v-reel video{width:100%!important;height:auto!important}
}
/* Red Centre: the grid never grows past the reel's height */
@media (min-width:901px){
  .spread.s-twc:not(.s-ntt) .twc-grid{contain:size!important;overflow:hidden!important;grid-template-rows:repeat(3,minmax(0,1fr))!important}
}
/* Phones: films full width at their own shape */
@media (max-width:900px){
  .spread .s-nt .nt-film,.spread.s-nt .nt-film{grid-column:1/-1!important}
  main > article.spread.s-vivo{grid-template-columns:minmax(0,1fr) minmax(0,.4208fr)!important}
  /* the NT reel already plays in Socials, so the phone strip keeps to stills */
  .spread.s-ntt .twc-row{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .spread.s-ntt .twc-row > video{display:none!important}
  .spread.s-ntt .twc-grid > :nth-child(n+7){display:none!important}
  .spread.s-ntt .twc-grid > :nth-child(-n+6){display:block!important}
}
