/* ==========================================================================
   DAPOTTERY motion layer (2026-11)
   Scroll and hover behaviour that sits on top of site.css / homepage.css.
   Everything here is progressive: without JavaScript, or with
   "reduce motion" switched on, every page reads as a normal static page.
   The JavaScript side is motion.js (GSAP + ScrollTrigger, bundled in
   assets/vendor/gsap, nothing loads from outside the site).
   ========================================================================== */

:root {
  --m-ink: #43281c;
  --m-ivory: #fffaf4;
  --m-paper: #f4e6d7;
  --m-terracotta: #9c4529;
  --m-coral: #d99070;
  --m-ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Reading progress line ---------- */
.m-progress { height: 2px; left: 0; pointer-events: none; position: fixed; right: 0; top: 0; z-index: 30; }
.m-progress span { background: var(--m-terracotta); display: block; height: 100%; transform: scaleX(0); transform-origin: 0 50%; }

/* ---------- Nav tucks away while reading down, returns on scroll up ---------- */
.motion-on .site-nav { transition: transform .45s var(--m-ease); }
.motion-on .site-nav.is-tucked { transform: translateY(-101%); }

/* ---------- Portrait hero: opening (pure CSS so there is no flash) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .has-js .portrait-hero__photo, .has-js .competition-hero-image { animation: m-unveil 1.25s cubic-bezier(.7, 0, .2, 1) both; }
  .has-js .portrait-hero__photo img, .has-js .competition-hero-image img { animation: m-settle 2s var(--m-ease) both; }
  .has-js .portrait-hero__copy > *, .has-js .competition-hero-copy > * { animation: m-rise .95s var(--m-ease) both; }
  .has-js .portrait-hero__copy > :nth-child(1), .has-js .competition-hero-copy > :nth-child(1) { animation-delay: .15s; }
  .has-js .portrait-hero__copy > :nth-child(2), .has-js .competition-hero-copy > :nth-child(2) { animation-delay: .3s; }
  .has-js .portrait-hero__copy > :nth-child(3), .has-js .competition-hero-copy > :nth-child(3) { animation-delay: .45s; }
  .has-js .portrait-hero__copy > :nth-child(4), .has-js .competition-hero-copy > :nth-child(4) { animation-delay: .6s; }
}
@keyframes m-unveil { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes m-settle { from { scale: 1.14; } to { scale: 1; } }
@keyframes m-rise { from { opacity: 0; translate: 0 28px; } to { opacity: 1; translate: 0 0; } }
.portrait-hero__photo img, .competition-hero-image img { will-change: transform; }

/* ---------- Existing fade-ins: move them onto `translate` so GSAP can own `transform` ---------- */
.has-js.motion-on .reveal { transform: none; translate: 0 12px; transition: opacity .65s ease, translate .65s ease; }
.has-js.motion-on .reveal.is-visible { translate: 0 0; }

/* ---------- Hero photo is a little taller than its frame so it can drift ---------- */
.motion-on .portrait-hero__photo img.m-drift { height: 110%; }
.motion-on .competition-hero-image img.m-drift { height: 110%; }

/* ---------- Split headings: each line rises out of a mask ---------- */
.m-line-mask { display: block; overflow: clip; padding-bottom: .06em; margin-bottom: -.06em; }

/* ---------- Statement quotes fill word by word ---------- */
.m-fill .m-word { opacity: .16; transition: none; }

/* ---------- Image reveals ---------- */
.motion-on .m-img { overflow: hidden; }
.motion-on .m-img img { will-change: transform; }

/* ---------- Marquee bands ---------- */
.marquee { --mq-size: clamp(64px, 11vw, 190px); background: var(--mq-bg, var(--m-ivory)); border-bottom: 1px solid var(--m-ink); border-top: 1px solid var(--m-ink); color: var(--m-ink); overflow: hidden; padding: clamp(14px, 2vw, 28px) 0; position: relative; user-select: none; }
.marquee__track { display: flex; gap: .45em; white-space: nowrap; width: max-content; will-change: transform; }
.marquee__track span { font-family: 'Instrument Serif', Georgia, serif; font-size: var(--mq-size); letter-spacing: -.05em; line-height: .9; }
.marquee__track span:nth-child(even) { color: transparent; font-style: italic; -webkit-text-stroke: 1px var(--mq-stroke, var(--m-terracotta)); }
.marquee__track span::after { color: var(--m-terracotta); content: '·'; font-style: normal; margin-left: .45em; -webkit-text-stroke: 0; }
.marquee--dark { --mq-bg: var(--m-ink); --mq-stroke: var(--m-coral); color: var(--m-paper); }
.marquee--terracotta { --mq-bg: var(--m-terracotta); --mq-stroke: var(--m-paper); color: var(--m-ivory); }
.marquee--terracotta .marquee__track span::after { color: var(--m-paper); }

/* ---------- Count-up figures keep their width while counting ---------- */
.m-count { font-variant-numeric: tabular-nums; }

/* ---------- "View" cursor bubble over images (mouse only) ---------- */
.m-cursor { align-items: center; background: var(--m-terracotta); border-radius: 50%; color: var(--m-ivory); display: flex; font-family: 'DM Mono', monospace; font-size: 11px; height: 92px; justify-content: center; left: 0; letter-spacing: .06em; opacity: 0; pointer-events: none; position: fixed; text-transform: uppercase; top: 0; transform: translate(-50%, -50%) scale(.3); width: 92px; z-index: 40; }
@media (hover: none), (pointer: coarse) { .m-cursor { display: none; } }

/* ---------- Horizontal scroll rows (Work "Four ways", Shop "Doppio") ---------- */
.h-scroll { position: relative; }
.h-scroll__track { display: flex; gap: clamp(14px, 1.6vw, 26px); }
.h-scroll__count { font-family: 'DM Mono', monospace; font-size: 12px; text-transform: uppercase; }
/* Without the pinned scroll (phones, reduced motion, no JS) the row swipes sideways */
.h-scroll:not(.is-pinned) .h-scroll__viewport { overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.h-scroll:not(.is-pinned) .h-scroll__track > * { scroll-snap-align: start; }
.h-scroll.is-pinned .h-scroll__viewport { overflow: hidden; }

/* Work: the four series cards become one sideways row */
#practice.h-scroll .series-grid { display: flex; gap: clamp(14px, 1.6vw, 26px); }
#practice.h-scroll .series-card { flex: 0 0 min(560px, 78vw); min-height: 620px; }
#practice.h-scroll .h-scroll__viewport { margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad) 8px; }
#practice.h-scroll .h-scroll__head { align-items: end; display: flex; justify-content: space-between; }
#practice.h-scroll .h-scroll__head .section-head { flex: 1; margin-bottom: clamp(30px, 4vw, 56px); }
#practice.is-pinned { box-sizing: border-box; display: flex; flex-direction: column; height: 100vh; justify-content: center; padding-bottom: clamp(24px, 3vh, 40px); padding-top: clamp(24px, 4vh, 48px); }
#practice.is-pinned .h-scroll__head .section-head { margin-bottom: clamp(18px, 3vh, 34px); }
#practice.is-pinned .section-head h2 { font-size: clamp(56px, min(7vw, 10vh), 120px); }
#practice.is-pinned .series-card { flex-basis: clamp(360px, 34vw, 520px); min-height: 0; }
#practice.is-pinned .series-card .card-number { margin: 14px 0 18px; }
#practice.is-pinned .series-card h3 { font-size: clamp(36px, min(3.6vw, 6vh), 60px); margin-bottom: 12px; }
#practice.is-pinned .series-card p { font-size: 15px; line-height: 1.5; }
#practice.is-pinned .series-card .meta { margin-top: 18px; }
#practice.is-pinned .series-card img { aspect-ratio: auto; height: clamp(170px, 30vh, 320px); width: 100%; }

/* ---------- Doppio showcase (Shop) ---------- */
.doppio { background: var(--m-ink); border-bottom: 1px solid var(--m-ink); color: var(--m-paper); overflow: hidden; padding: clamp(46px, 6vw, 90px) var(--pad) clamp(40px, 5vw, 70px); }
.doppio.is-pinned { align-content: center; display: grid; min-height: 100vh; }
.doppio__head { align-items: end; display: grid; gap: 30px; grid-template-columns: 5fr 4fr 2fr; margin-bottom: clamp(26px, 3.4vw, 46px); }
.doppio__head .eyebrow { color: var(--m-coral); display: block; margin-bottom: 18px; }
.doppio__head h2 { font-family: 'Instrument Serif', Georgia, serif; font-size: clamp(84px, 12vw, 200px); font-weight: 400; letter-spacing: -.07em; line-height: .78; margin: 0; }
.doppio__head h2 em { color: var(--m-coral); }
.doppio__head p { font-size: clamp(15px, 1.2vw, 18px); line-height: 1.6; margin: 0; max-width: 520px; }
.doppio__head .h-scroll__count { color: var(--m-coral); justify-self: end; }
.doppio .h-scroll__viewport { margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad) 6px; }
.doppio-card { color: inherit; display: flex; flex: 0 0 clamp(250px, 24vw, 360px); flex-direction: column; text-decoration: none; }
.doppio-card figure { aspect-ratio: 4 / 5; background: #2f1c14; margin: 0 0 14px; overflow: hidden; position: relative; }
.doppio-card img { height: 100%; object-fit: cover; transition: transform .9s var(--m-ease); width: 100%; }
.doppio-card:hover img, .doppio-card:focus-visible img { transform: scale(1.05); }
.doppio-card .glaze { color: var(--m-coral); font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.doppio-card strong { font-family: 'Instrument Serif', Georgia, serif; font-size: clamp(30px, 2.6vw, 42px); font-weight: 400; letter-spacing: -.04em; line-height: 1; margin: 6px 0 4px; }
.doppio-card span:last-child { font-family: 'DM Mono', monospace; font-size: 11px; opacity: .75; text-transform: uppercase; }
.doppio-group { border-left: 1px solid rgba(244,230,215,.35); display: flex; flex: 0 0 clamp(200px, 17vw, 260px); flex-direction: column; justify-content: flex-end; padding: 0 0 6px 18px; }
.doppio-group b { font-family: 'Instrument Serif', Georgia, serif; font-size: clamp(42px, 4vw, 64px); font-style: italic; font-weight: 400; letter-spacing: -.05em; line-height: .9; }
.doppio-group span { color: var(--m-coral); font-family: 'DM Mono', monospace; font-size: 11px; margin-top: 10px; text-transform: uppercase; }

/* ---------- Product cards: second photo on hover ---------- */
.product-card figure { position: relative; }
.product-card .m-alt { inset: 0; height: 100%; object-fit: cover; opacity: 0; position: absolute; transition: opacity .5s ease; width: 100%; }
.product-card:hover .m-alt, .product-card:focus-within .m-alt { opacity: 1; }

/* ---------- Journal: staggered columns ---------- */
@media (min-width: 901px) {
  .motion-on .journal-grid .journal-card:nth-child(even) { margin-top: 120px; }
}

/* ---------- Phones ---------- */
@media (max-width: 900px) {
  .doppio__head { grid-template-columns: 1fr; }
  .doppio__head .h-scroll__count { justify-self: start; }
  .doppio-card { flex-basis: 72vw; }
  .doppio-group { flex-basis: 46vw; }
  #practice.h-scroll .series-card { flex-basis: 82vw; min-height: 520px; }
}

/* ---------- Reduced motion: everything static and fully visible ---------- */
@media (prefers-reduced-motion: reduce) {
  .m-progress, .m-cursor { display: none; }
  .m-fill .m-word { opacity: 1; }
  .marquee__track { flex-wrap: wrap; white-space: normal; width: auto; }
}
