/* ─────────────────────────────────────────────────────────────
   Atelier: a light, editorial catalogue. Warm paper, a serif voice,
   photographs presented like prints, small caps for the details.
   The only glass left is the floating nav.
   ───────────────────────────────────────────────────────────── */

:root {
  color-scheme: light;

  --bg: #f3eee6;      /* warm paper */
  --bg-deep: #ebe4d8; /* behind images while they load */
  --ink: #1d1a16;
  --soft: #6b635a;
  --gold: #8a6a2f;
  --rule: rgba(29, 26, 22, 0.14);

  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --page: min(1100px, calc(100% - 48px));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 19px/1.55 var(--serif);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }

/* Small caps label: the "printed catalogue" detail */
.label, .kicker, .nav-links, .filters button, .card-meta, .links, .services dt, .footer {
  font: 500 11px/1.4 var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.label, .kicker { color: var(--soft); }

/* Text links, underlined, instead of pill buttons */
.links { display: flex; flex-wrap: wrap; gap: 14px 28px; font-size: 12px; letter-spacing: 0.12em; }
.links a { padding-bottom: 6px; border-bottom: 1px solid currentColor; transition: color 150ms ease, border-color 150ms ease; }
.links a:hover { color: var(--gold); }
.links a.quiet { border-color: transparent; color: var(--soft); }
.links a.quiet:hover { color: var(--ink); }
.links a:active { transform: translateY(1px); }
.links { align-items: center; }
.links a.icon-link { display: inline-flex; padding: 0; border: 0; } /* icon instead of an underlined word */
.links a.icon-link svg { display: block; }

/* First-visit entrance: a short stagger, once per page load */
.in { animation: rise 600ms var(--ease-out) backwards; animation-delay: calc(var(--d, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ── Nav: the one piece of liquid glass ─────────────────── */
.nav {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: var(--page);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 10px 20px;
  border-radius: 999px;
  background: rgba(243, 238, 230, 0.55);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 0 0 1px rgba(29, 26, 22, 0.05), 0 10px 30px rgba(60, 40, 10, 0.06);
  transition: background-color 300ms ease;
}
.nav.scrolled { background: rgba(243, 238, 230, 0.82); }
.mark { display: block; margin: -4px 0; }
.mark img { height: 42px; width: auto; }
.nav-links { display: flex; gap: 6px; color: var(--soft); }
.nav-links a { padding: 8px 10px; transition: color 150ms ease; }
.nav-links a:hover { color: var(--ink); }
@media (prefers-reduced-transparency: reduce) {
  .nav { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  width: var(--page);
  margin: 0 auto;
  padding: 150px 0 80px;
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 64px;
  align-items: end;
}
.kicker { margin-bottom: 28px; }
.hero h1 {
  font-weight: 400;
  font-size: clamp(52px, 7vw, 96px);
  line-height: 0.98;
  letter-spacing: -0.015em;
}
.hero h1 em { color: var(--gold); }
.lede { font-size: 21px; line-height: 1.5; color: var(--soft); max-width: 32ch; margin: 30px 0 36px; }
/* Hero: his logo above a piece you can turn in 3D, straight on the paper */
.hero-figure { display: flex; flex-direction: column; align-items: center; }
.hero-logo { width: 42%; height: auto; margin-bottom: 4%; }
.hero-figure .spinner { width: 100%; }
.hero-figure figcaption { width: 100%; }

/* ── 3D spinner ─────────────────────────────────────────── */
.spinner {
  position: relative;
  cursor: grab;
  touch-action: pan-y; /* horizontal drags turn the piece; vertical swipes still scroll the page */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline-offset: 6px;
}
.spinner.grabbing { cursor: grabbing; }
.spinner canvas { display: block; width: 100%; }
/* Pieces shot on white: multiply makes the white vanish into the paper */
.light canvas, .light video, .light img {
  mix-blend-mode: multiply;
  /* Feather the edges: the studio white isn't perfectly even, so fade it out instead of showing a box */
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 62%, transparent 100%);
  mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 62%, transparent 100%);
}
.spin-hint { color: var(--soft); }
.caption-link {
  padding: 0;
  border: 0;
  background: none;
  font: italic 400 19px/1.4 var(--serif);
  color: var(--soft);
  cursor: pointer;
  text-align: left;
  transition: color 150ms ease;
}
.caption-link:hover { color: var(--ink); }

figcaption, .card-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-top: 12px;
}
figcaption span { font-style: italic; color: var(--soft); }
figcaption b, .card-meta, .spin-hint { font: 500 10.5px/1.4 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); white-space: nowrap; }

/* ── Sections ───────────────────────────────────────────── */
.section { width: var(--page); margin: 0 auto; padding: 28px 0 96px; border-top: 1px solid var(--rule); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; flex-wrap: wrap; margin-bottom: 32px; }
.count { margin-left: 14px; color: var(--soft); opacity: 0.7; }

/* Filters: plain words, the active one underlined */
.filters { display: flex; gap: 4px 22px; flex-wrap: wrap; }
.filters button {
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: none;
  color: var(--soft);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}
.filters button:hover { color: var(--ink); }
.filters button[aria-selected="true"] { color: var(--ink); border-color: var(--ink); }

/* ── Work grid: photographs as prints, no boxes ─────────── */
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-flow: dense; gap: 48px 28px; }
.card {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: zoom-in;
  /* backwards, not both: a transform left on the card would isolate it and stop light pieces blending into the paper */
  animation: rise 300ms var(--ease-out) backwards;
  animation-delay: calc(var(--i) * 35ms);
  transition: transform 160ms var(--ease-out);
}
.card:active { transform: scale(0.985); }
.card.wide { grid-column: span 2; }
.card-media { aspect-ratio: 1; overflow: hidden; background: #000; }
.card-media.light { background: none; }
/* Two square cells + one gap, so wide and square pieces line up row by row */
.card.wide .card-media { aspect-ratio: 2.12; }
.card-media img, .card-media video { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 300ms var(--ease-out); }
.card-media img.missing { visibility: hidden; } /* broken photo: keep the paper frame, hide the broken-image icon */
@media (hover: hover) and (pointer: fine) {
  .card:hover .card-media img, .card:hover .card-media video { transform: scale(1.03); }
}
.card-label { flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.card-title { max-width: 100%; font-size: 19px; font-style: italic; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { color: var(--soft); }

/* ── Studio ─────────────────────────────────────────────── */
.studio-body { display: grid; grid-template-columns: 1.1fr 1fr minmax(180px, 240px); gap: 56px; margin-top: 32px; align-items: start; }
.film { background: #000; aspect-ratio: 9 / 16; }
.film video { display: block; width: 100%; height: 100%; object-fit: cover; }
.studio-text { font-size: clamp(24px, 2.6vw, 32px); line-height: 1.35; }
.services div { padding: 16px 0; border-bottom: 1px solid var(--rule); }
.services div:first-child { padding-top: 6px; }
.services dt { color: var(--ink); margin-bottom: 4px; }
.services dd { color: var(--soft); font-style: italic; }

/* ── Contact ────────────────────────────────────────────── */
.contact-line { font-size: clamp(24px, 2.6vw, 32px); line-height: 1.35; max-width: 26ch; margin: 32px 0 24px; }
.phone {
  display: inline-block;
  font-size: clamp(44px, 7vw, 88px);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--gold);
  margin-bottom: 32px;
  font-variant-numeric: lining-nums;
  transition: color 150ms ease;
}
.phone:hover { color: var(--ink); }

.footer {
  width: var(--page);
  margin: 0 auto;
  padding: 24px 0 48px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  color: var(--soft);
}

/* ── Floating WhatsApp button ───────────────────────────── */
.wa-fab {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 20;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #25d366;
  box-shadow: 0 8px 24px rgba(37, 120, 60, 0.25), 0 2px 6px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  animation: fab-in 300ms var(--ease-out) 500ms backwards; /* backwards: don't pin transform after, so :hover/:active still scale */
  transition: transform 140ms var(--ease-out);
}
.wa-fab[hidden] { display: none; }
.wa-fab:active { transform: scale(0.92); }
@media (hover: hover) and (pointer: fine) {
  .wa-fab:hover { transform: scale(1.06); }
}
@keyframes fab-in { from { opacity: 0; transform: scale(0.9); } }

/* ── Detail sheet: a page from the catalogue ────────────── */
.sheet {
  position: fixed;
  inset: 0;
  margin: auto;
  height: fit-content;
  width: min(980px, calc(100% - 24px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(40, 28, 10, 0.25);
  overflow: auto;
  display: none;
  grid-template-columns: 1.1fr 1fr;
}
.sheet[open] { display: grid; }
.sheet::backdrop { background: rgba(29, 26, 22, 0.35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sheet-media { padding: 14px; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.sheet-media > img, .sheet-media > video { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #000; }
.sheet-media.light > img, .sheet-media.light > video { background: none; object-fit: contain; }
.sheet-media .spin-hint { text-align: center; margin: 0; }
.sheet-body { padding: 56px 40px 36px 24px; display: flex; flex-direction: column; }
.sheet-body h3 { font-weight: 400; font-size: 44px; line-height: 1.05; margin: 18px 0 18px; }
.sheet-desc { color: var(--soft); font-size: 20px; margin-bottom: 32px; }
.sheet-actions { margin-top: auto; }
.close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--bg);
  cursor: pointer;
  transition: transform 140ms var(--ease-out), border-color 150ms ease;
}
.close:hover { border-color: var(--ink); }
.close:active { transform: scale(0.92); }

/* ── Smaller screens ────────────────────────────────────── */
@media (max-width: 980px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  :root { --page: calc(100% - 40px); }
  .hero { grid-template-columns: 1fr; gap: 44px; padding-top: 112px; }
  .studio-body { grid-template-columns: 1fr; gap: 32px; }
  .film { width: min(280px, 70%); }
  .sheet { grid-template-columns: 1fr; }
  .sheet-body { padding: 8px 22px 26px; }
  .sheet-body h3 { font-size: 36px; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; gap: 40px; }
  .card.wide { grid-column: auto; }
  .card.wide .card-media { aspect-ratio: 16 / 9; }
  .footer { padding-bottom: 96px; } /* keep clear of the WhatsApp button */
  .nav-links { gap: 0; }
}

/* Reduced motion: gentler, not zero. Keep short opacity fades, drop movement and scaling. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .in, .card, .wa-fab { animation-name: fade; animation-duration: 200ms; animation-delay: 0ms; }
  .card:active, .wa-fab:active, .close:active, .links a:active { transform: none; }
  .card:hover .card-media img, .card:hover .card-media video, .wa-fab:hover { transform: none; }
}
@keyframes fade { from { opacity: 0; } }
