/* ================= Case study: Miln Town =================
   A heritage bungalow in Coonoor, documented in photographs and set into a table brochure.
   The page is the brochure: it waits on a round tea table, the camera leans in until it is square
   to the page, and scrolling turns it leaf by leaf. The photographs follow as a stack of prints.
   Colours come from the brochure itself; Fraunces stands in for its display serif. */
.mt { --m-night: #1d1e17; --m-olive: #22231b; --m-moss: #4b4f3e; --m-sage: #b3c595; --m-ochre: #c5b279;
  --m-cream: #fbf4e6; --m-paper: #f3e6cb; --m-ink: #1e1c16; --m-teak: #4a2f1c;
  --m-serif: 'Fraunces', Georgia, 'Times New Roman', serif; --m-gap: clamp(40px, 6vw, 96px);
  background: var(--m-olive); color: var(--m-cream); overflow-x: clip; }
.mt h1, .mt h2, .mt h3 { font-family: var(--m-serif); font-stretch: 100%; font-weight: 300; letter-spacing: -0.01em; font-variation-settings: 'SOFT' 100, 'WONK' 0; }
.mt .label { color: rgba(251, 244, 230, .62); }
.mt .crumbs { color: rgba(251, 244, 230, .7); }
.mt .crumbs a:hover { color: var(--m-cream); }

/* The stage: pinned under the header while the book section scrolls past */
.mt-book { position: relative; height: var(--mt-len, 900svh); background: var(--m-night); }
.mt-stage { position: sticky; top: var(--head-h); height: calc(100vh - var(--head-h)); height: calc(100svh - var(--head-h)); overflow: hidden; isolation: isolate; }
.mt-room { position: absolute; inset: -6%; z-index: -2; background: url(../img/milntown/room-blur.webp) center 40% / cover; transform-origin: 50% 70%; will-change: transform, opacity; }
.mt-vign { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: radial-gradient(120% 90% at 50% 55%, transparent 45%, rgba(10, 11, 8, .72) 100%); }
.mt-cam { position: absolute; inset: 0; perspective: 2400px; perspective-origin: 50% 50%; }
.mt-world { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; will-change: transform; }
.mt-world > *, .mt-bk, .mt-bk > *, .mt-leaf { position: absolute; transform-style: preserve-3d; }

/* The round tea table: a polished teak top on a moulded edge, with an inlaid border, a carved bead
   at the rim, window light across it and the window's reflection in the varnish */
.mt-tbl { left: -575px; top: -575px; width: 1150px; height: 1150px; border-radius: 50%; }
.mt-tbl i { position: absolute; inset: 0; border-radius: 50%; }
.mt-tbl .rim { box-shadow: inset 0 0 40px rgba(0, 0, 0, .35); }
.mt-tbl .top {
  background:
    radial-gradient(70% 60% at 36% 30%, rgba(255, 210, 150, .16), transparent 70%),
    radial-gradient(circle, transparent 58%, rgba(14, 7, 2, .38) 100%),
    linear-gradient(rgba(40, 20, 6, .22), rgba(40, 20, 6, .22)),
    url(../img/milntown/teak.webp) center / cover, #4a2d17;
  box-shadow: inset 0 0 0 2px rgba(255, 214, 160, .2), inset 0 0 0 9px rgba(28, 15, 6, .5), inset 0 0 0 10px rgba(255, 214, 160, .1), inset 0 -30px 60px rgba(0, 0, 0, .25);
}
.mt-tbl .bead { background: radial-gradient(closest-side, transparent 96.4%, rgba(10, 5, 2, .55) 96.8%, rgba(255, 222, 176, .28) 97.9%, rgba(120, 76, 40, .2) 98.7%, rgba(10, 5, 2, .5) 99.5%, transparent 99.8%); }
.mt-tbl .inlay { inset: 4.6%; border: 2px solid rgba(216, 178, 120, .5); box-shadow: 0 0 0 1px rgba(10, 5, 2, .45), inset 0 0 0 1px rgba(10, 5, 2, .45), 0 0 0 9px rgba(255, 214, 160, .035), 0 0 0 10px rgba(216, 178, 120, .28); }
.mt-tbl .sun { background: repeating-linear-gradient(112deg, transparent 0 80px, rgba(255, 236, 196, .13) 80px 190px, transparent 190px 210px); mix-blend-mode: soft-light; -webkit-mask: radial-gradient(closest-side at 35% 40%, #000 30%, transparent 100%); mask: radial-gradient(closest-side at 35% 40%, #000 30%, transparent 100%); }
.mt-tbl .gloss { --gx: 34%; --gy: 28%; mix-blend-mode: screen; opacity: .5;
  background:
    linear-gradient(90deg, transparent 0 calc(var(--gx) - 1.6%), rgba(12, 7, 3, 1) calc(var(--gx) - 1.6%) calc(var(--gx) - .9%), transparent 0),
    linear-gradient(180deg, transparent 0 calc(var(--gy) - 2%), rgba(12, 7, 3, 1) calc(var(--gy) - 2%) calc(var(--gy) - 1.3%), transparent 0),
    radial-gradient(22% 30% at var(--gx) var(--gy), rgba(255, 238, 210, .34), rgba(255, 230, 196, .12) 55%, transparent 100%);
  -webkit-mask: radial-gradient(closest-side, #000 93%, transparent 95%); mask: radial-gradient(closest-side, #000 93%, transparent 95%); }
@media (max-width: 900px) { .mt-tbl .top { background-image: radial-gradient(70% 60% at 36% 30%, rgba(255, 210, 150, .16), transparent 70%), radial-gradient(circle, transparent 58%, rgba(14, 7, 2, .38) 100%), linear-gradient(rgba(40, 20, 6, .22), rgba(40, 20, 6, .22)), url(../img/milntown/teak-s.webp); } }
.mt-shade { border-radius: 4px; background: rgba(8, 5, 2, .4); box-shadow: 0 0 26px 10px rgba(8, 5, 2, .38); }


/* The book: leaves turn about the spine; each has a front and a back face */
.mt-leaf { will-change: transform; }
.mt-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--m-paper) center / cover no-repeat; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .25); overflow: hidden; }
.mt-face::after { content: ""; position: absolute; inset: 0; background: linear-gradient(var(--mt-dir, 90deg), rgba(0, 0, 0, .28), transparent 9%, transparent 92%, rgba(255, 255, 255, .06)); opacity: calc(.55 + var(--sh, 0)); pointer-events: none; }
.mt-face.b::after { --mt-dir: 270deg; }

/* Copy over the stage */
.mt-copy { position: absolute; z-index: 3; left: 0; right: 0; top: 0; bottom: 0; pointer-events: none; }
.mt-copy .wrap { height: 100%; display: grid; align-content: center; gap: 0; }
.mt-copy .in { width: min(520px, 42%); pointer-events: auto; }
.mt-copy .crumbs { position: absolute; top: clamp(20px, 3vw, 36px); }
.mt-logo { width: 190px; height: auto; filter: invert(1); opacity: .9; margin-bottom: 26px; }
.mt-copy h1 { font-size: clamp(40px, 5.4vw, 84px); line-height: 1; }
.mt-copy h1 em { display: block; font-style: italic; color: var(--m-sage); font-weight: 300; }
.mt-copy .lede { color: rgba(251, 244, 230, .78); margin-top: 22px; font-size: clamp(16.5px, 1.3vw, 19px); }
.mt-cue { display: inline-flex; align-items: center; gap: 12px; margin-top: 32px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; font-stretch: 75%; color: rgba(251, 244, 230, .7); }
.mt-cue i { width: 1px; height: 38px; background: linear-gradient(var(--m-sage), transparent); animation: mtCue 1.8s var(--ease) infinite; transform-origin: top; }
@keyframes mtCue { 0% { transform: scaleY(0); } 60% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

/* Reading caption and page controls */
.mt-cap { position: absolute; z-index: 3; left: 0; right: 0; bottom: clamp(18px, 3.5vh, 40px); display: flex; justify-content: center; pointer-events: none; opacity: 0; }
.mt-cap .bar { pointer-events: auto; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px; width: min(720px, calc(100% - 32px)); padding: 12px 12px 12px 22px; border-radius: 999px; background: rgba(22, 23, 17, .72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(251, 244, 230, .12); }
.mt-cap .n { font-size: 12.5px; letter-spacing: .1em; font-stretch: 75%; text-transform: uppercase; color: rgba(251, 244, 230, .6); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mt-cap .t { min-width: 0; display: flex; align-items: baseline; gap: 12px; overflow: hidden; white-space: nowrap; }
.mt-cap .t b { font-family: var(--m-serif); font-weight: 300; font-size: clamp(19px, 1.7vw, 24px); font-variation-settings: 'SOFT' 100; color: var(--m-cream); }
.mt-cap .t span { color: rgba(251, 244, 230, .6); font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; }
.mt-cap .t.swap { animation: mtSwap .6s var(--ease); }
@keyframes mtSwap { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.mt-nav { display: flex; gap: 6px; }
.mt-nav button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(251, 244, 230, .25); background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--m-cream); transition: background .3s, color .3s, opacity .3s; }
.mt-nav button:hover { background: var(--m-cream); color: var(--m-ink); }
.mt-nav button:disabled { opacity: .3; pointer-events: none; }
.mt-nav svg { width: 16px; height: 16px; }
.mt-ticks { position: absolute; z-index: 3; right: clamp(16px, 2.5vw, 36px); top: 50%; translate: 0 -50%; display: grid; gap: 8px; opacity: 0; }
.mt-ticks i { width: 14px; height: 2px; background: rgba(251, 244, 230, .28); transition: width .4s var(--ease), background .4s; }
.mt-ticks i.on { width: 26px; background: var(--m-sage); }

/* Interlude between the book and the prints */
.mt-lead { background: var(--m-olive); padding: var(--m-gap) 0; }
.mt-lead-h { margin-bottom: clamp(32px, 4vw, 56px); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 24px clamp(32px, 6vw, 96px); align-items: end; }
.mt-lead h2 { font-size: clamp(34px, 4.4vw, 64px); line-height: 1.02; }
.mt-lead h2 em { font-style: italic; color: var(--m-ochre); }
.mt-lead p { color: rgba(251, 244, 230, .72); max-width: 46ch; }

/* The prints: each card pins and the next one settles on top of it */
.mt-stack { position: relative; padding-bottom: 12svh; }
.mt-card { margin: 0; position: sticky; top: calc(var(--head-h) + 3svh + var(--i) * 10px); height: min(78svh, 820px); margin-bottom: 14svh; border-radius: 20px; overflow: hidden; background: #15160f; box-shadow: 0 -18px 50px rgba(0, 0, 0, .35); transform-origin: 50% 0; will-change: transform; }
.mt-card:last-child { margin-bottom: 0; }
.mt-card img { width: 100%; height: 100%; object-fit: cover; }
.mt-card .dim { position: absolute; inset: 0; background: #0b0c08; opacity: 0; pointer-events: none; }
.mt-card figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: clamp(60px, 8vw, 120px) clamp(20px, 3vw, 40px) clamp(20px, 3vw, 36px); display: flex; align-items: end; justify-content: space-between; gap: 16px; background: linear-gradient(transparent, rgba(12, 12, 9, .72)); }
.mt-card h3 { font-size: clamp(26px, 3vw, 44px); line-height: 1; }
.mt-card p { color: rgba(251, 244, 230, .75); margin-top: 10px; font-size: 15.5px; max-width: 44ch; }
.mt-card .no { font-size: 12.5px; letter-spacing: .1em; font-stretch: 75%; text-transform: uppercase; color: rgba(251, 244, 230, .7); white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Portrait frames sit on a cream mount beside their caption */
.mt-card.pt { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--m-cream); color: var(--m-ink); }
.mt-card.pt .ph { position: relative; min-height: 0; padding: clamp(16px, 2.4vw, 32px); display: grid; place-items: center; }
.mt-card.pt img { width: auto; height: 100%; max-width: 100%; object-fit: contain; box-shadow: 0 18px 40px rgba(30, 24, 12, .25); }
.mt-card.pt figcaption { position: static; background: none; display: grid; align-content: space-between; padding: clamp(28px, 4vw, 64px); }
.mt-card.pt figcaption h3 { font-size: clamp(34px, 4.2vw, 64px); }
.mt-card.pt figcaption p { color: #5d574a; font-size: 16.5px; }
.mt-card.pt .no { color: #6f6858; }
.mt-card:not(.pt) .no { order: 2; }
.mt-card.pt.flip .ph { order: 2; }

/* What we made */
.mt-made { background: var(--m-cream); color: var(--m-ink); padding: var(--m-gap) 0; }
.mt-made .label { color: #6f6858; }
.mt-made h2 { font-size: clamp(34px, 4.4vw, 64px); line-height: 1.02; max-width: 16ch; }
.mt-made h2 em { font-style: italic; color: #6f7c52; }
.mt-made .lede { color: #4d483d; margin-top: 22px; }
.mt-three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-top: clamp(40px, 5vw, 72px); border-top: 1px solid rgba(30, 28, 22, .16); }
.mt-three > div { padding: 26px clamp(16px, 2vw, 28px) 0 0; min-width: 0; }
.mt-three > div + div { border-left: 1px solid rgba(30, 28, 22, .16); padding-left: clamp(16px, 2vw, 28px); }
.mt-three b { display: block; font-family: var(--m-serif); font-weight: 300; font-size: clamp(22px, 2vw, 28px); line-height: 1.1; font-variation-settings: 'SOFT' 100; }
.mt-three p { color: #5d574a; margin-top: 10px; font-size: 15.5px; }
.mt-three .k { font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; font-stretch: 75%; color: #8a826f; margin-bottom: 14px; display: block; }
.mt-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: clamp(40px, 5vw, 72px); background: var(--m-paper); border-radius: 18px; padding: 22px clamp(18px, 2.4vw, 32px); gap: 16px; }
.mt-meta div { display: grid; gap: 4px; min-width: 0; }
.mt-meta span { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-stretch: 75%; color: #7d7562; }
.mt-meta b { font-weight: 400; font-size: 15.5px; overflow-wrap: anywhere; }
.mt-made .row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }
.mt-made .btn-solid { background: var(--m-ink); border-color: var(--m-ink); color: var(--m-cream); --sweep: var(--m-moss); }
.mt-made .btn-ghost { color: var(--m-ink); --sweep: var(--m-ink); }
.mt-made .btn-ghost:hover { color: var(--m-cream); }

/* Work tile */
.tile .cover.mt-cover { background: #1d1e17; isolation: isolate; }
.mt-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .9s var(--ease); }
.tile:hover .mt-cover img.bg { transform: scale(1.05); }
.mt-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(14, 14, 10, .55), transparent 45%, rgba(14, 14, 10, .55)); }
.mt-cover img.lg { inset: 9% auto auto 50%; width: 46%; height: auto; translate: -50% 0; filter: invert(1); opacity: .92; z-index: 1; }
.mt-cover .cap { position: absolute; z-index: 1; left: 18px; bottom: 16px; right: 18px; display: flex; justify-content: space-between; color: rgba(251, 244, 230, .88); font-size: 13.5px; }

/* Without motion the book is shown open on the table and turned with the buttons */
.mt.still .mt-book { height: auto; }
.mt.still .mt-stage { position: relative; top: 0; height: min(86svh, 860px); }
.mt.still .mt-copy { display: none; }
.mt.still .mt-cap, .mt.still .mt-ticks { opacity: 1; }
.mt.still .mt-card { position: relative; top: 0; margin-bottom: 24px; }
.mt-still-intro { display: none; }
.mt.still .mt-still-intro { display: block; padding: clamp(40px, 6vw, 80px) 0; background: var(--m-olive); }
.mt.still .mt-still-intro .in { max-width: 640px; }
.mt.still .mt-still-intro h1 { font-size: clamp(40px, 5.4vw, 84px); line-height: 1; }
.mt.still .mt-still-intro h1 em { display: block; font-style: italic; color: var(--m-sage); }
.mt.still .mt-still-intro .lede { color: rgba(251, 244, 230, .78); margin-top: 22px; }

@media (max-width: 900px) {
  .mt-copy .wrap { align-content: start; padding-top: 64px; }
  .mt-copy .crumbs { top: 18px; }
  .mt-copy .in { width: 100%; }
  .mt-copy .mt-more { display: none; }
  .mt-logo { width: 132px; margin-bottom: 16px; }
  .mt-copy h1 { font-size: clamp(34px, 9.6vw, 52px); }
  .mt-copy .lede { margin-top: 14px; font-size: 15.5px; line-height: 1.55; }
  .mt-cue { margin-top: 18px; }
  .mt-cue i { height: 26px; }
  .mt-cap .bar { gap: 12px; padding: 10px 10px 10px 16px; }
  .mt-cap .t { display: grid; gap: 0; }
  .mt-cap .t span { font-size: 13px; }
  .mt-cap .n { display: none; }
  .mt-nav button { width: 40px; height: 40px; }
  .mt-ticks { display: none; }
  .mt-lead-h { margin-bottom: clamp(32px, 4vw, 56px); grid-template-columns: minmax(0, 1fr); }
  .mt-card { height: min(72svh, 640px); border-radius: 16px; top: calc(var(--head-h) + 2svh + var(--i) * 6px); }
  .mt-card figcaption { flex-direction: column; align-items: start; gap: 8px; }
  .mt-card p { font-size: 14.5px; }
  .mt-card.pt { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .mt-card.pt.flip .ph { order: 0; }
  .mt-card.pt .ph { padding: 16px 16px 0; }
  .mt-card.pt figcaption { padding: 18px 20px 22px; gap: 6px; display: flex; flex-direction: column-reverse; align-items: start; }
  .mt-card.pt figcaption h3 { font-size: 30px; }
  .mt-card.pt figcaption p { font-size: 14.5px; margin-top: 4px; }
  .mt-three, .mt-meta { grid-template-columns: minmax(0, 1fr); }
  .mt-three > div + div { border-left: 0; padding-left: 0; border-top: 1px solid rgba(30, 28, 22, .16); margin-top: 24px; }
  .mt-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .mt-cue i { animation: none; } .mt-cap .t.swap { animation: none; } }
