:root {
  --gold: #ffd400;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: #f3f3f3;
  font-family: var(--sans);
}
body { overflow: hidden; }
button, a { font-family: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
img { -webkit-user-drag: none; user-select: none; }

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  background: #000;
}

.topbar {
  position: absolute;
  z-index: 6;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 16px 0 max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  pointer-events: none;
}
.topbar .tools,
.topbar .seg,
.topbar button { pointer-events: auto; }

.brand { min-width: 0; flex: 1 1 140px; }
.brand p {
  margin: 0 0 2px;
  color: #e7d7a1;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(18px, 2.4vw, 28px);
  font-weight: 400;
  line-height: 1.15;
  color: #f4f4f4;
}

.tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; align-items: center; }

.seg {
  display: none;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
}
body.is-phone .seg:not([hidden]) { display: flex; }
.seg button,
.text-btn {
  border: 0;
  color: #f4f4f4;
  background: transparent;
}
.seg button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.seg button[aria-pressed="true"] {
  background: var(--gold);
  color: #1a140c;
}
.text-btn {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #f4f4f4;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.text-btn[aria-pressed="true"] {
  background: var(--gold);
  color: #1a140c;
  border-color: var(--gold);
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #000;
  cursor: ew-resize;
  touch-action: none;
}
.stage.axis-y { cursor: ns-resize; }
.stage.is-zoom { cursor: zoom-in; }
.stage.is-zoom.loupe-on { cursor: none; }

.slide { position: absolute; inset: 0; }

.plate {
  position: absolute;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.full {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0;
  pointer-events: none;
}
.full.is-ready { opacity: 1; }

.rule {
  position: absolute;
  z-index: 3;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.handle {
  position: absolute;
  z-index: 4;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.28);
  color: #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}
.handle-chevs { display: flex; }
.handle-chevs svg { width: 16px; height: 16px; }
.axis-y .handle-chevs { transform: rotate(90deg); }

.tag {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow: 0 1px 2px #000, 0 0 10px rgba(0, 0, 0, 0.65);
}
.axis-x .tag-avant { left: 12px; bottom: 12px; }
.axis-x .tag-apres { right: 12px; bottom: 12px; }
.axis-y .tag-avant { top: 12px; left: 50%; transform: translateX(-50%); }
.axis-y .tag-apres { bottom: 12px; left: 50%; transform: translateX(-50%); }
.stage:has(.hint.is-on) .tag { opacity: 0; }

.hint {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 28px;
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.72);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.hint.is-on { opacity: 1; }

.nav {
  position: absolute;
  z-index: 5;
  top: 50%;
  width: 64px;
  height: 88px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  color: #d0d0d0;
  background: transparent;
  transform: translateY(-50%);
}
.nav svg { width: 46px; height: 46px; }
.nav.prev { left: max(0px, env(safe-area-inset-left)); }
.nav.next { right: max(0px, env(safe-area-inset-right)); }
.nav:disabled, .film-arrow:disabled { opacity: 0.35; }

.slide.from-right { animation: in-right 0.42s ease; }
.slide.from-left { animation: in-left 0.42s ease; }
.slide.to-left { animation: out-left 0.42s ease; }
.slide.to-right { animation: out-right 0.42s ease; }
@keyframes in-right { from { transform: translateX(100%); } to { transform: none; } }
@keyframes in-left { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes out-left { from { transform: none; } to { transform: translateX(-100%); } }
@keyframes out-right { from { transform: none; } to { transform: translateX(100%); } }

.loupe {
  position: fixed;
  z-index: 20;
  left: 0;
  top: 0;
  width: 250px;
  height: 250px;
  pointer-events: none;
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.45));
}
.loupe[hidden] { display: none !important; }
.loupe-glass {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background-color: #141618;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.28);
}
.loupe-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.loupe-label {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -120%);
  color: #d5d8dc;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  white-space: nowrap;
  text-shadow: 0 1px 2px #000;
}

.dock {
  position: absolute;
  z-index: 8;
  left: 0;
  right: 0;
  bottom: 0;
  background: #7a7a7a;
  padding-bottom: env(safe-area-inset-bottom);
  transform: none;
  transition: transform 0.28s ease;
}
body.dock-hidden .dock { transform: translateY(100%); }

.dock-hide {
  position: absolute;
  left: 50%;
  top: -22px;
  width: 64px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px 8px 0 0;
  background: #7a7a7a;
  color: #fff;
  transform: translateX(-50%);
}
.dock-hide svg { width: 18px; height: 18px; transform: rotate(180deg); }
body.dock-hidden .dock-hide svg { transform: none; }

.dock-row {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 10px 8px 12px;
}
.film-arrow {
  flex: none;
  width: 36px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  color: #fff;
  background: transparent;
}
.film-arrow svg { width: 22px; height: 22px; }
.thumbs {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 4px;
  scroll-snap-type: x proximity;
}
.thumbs::-webkit-scrollbar { height: 0; }

.thumb {
  flex: none;
  width: 86px;
  padding: 0;
  border: 0;
  scroll-snap-align: center;
  background: transparent;
}
.thumb-frame {
  position: relative;
  display: block;
  height: 62px;
  overflow: hidden;
  border: 2px solid #fff;
  background: #111;
}
.thumb.is-active .thumb-frame {
  border-color: var(--gold);
  border-width: 3px;
}
.thumb-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumb-apres { clip-path: inset(0 0 0 50%); }
.badge, .cap { display: none; }

.status {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 46%;
  width: min(420px, calc(100% - 48px));
  margin: 0;
  padding: 14px 16px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.88);
  color: #f4f4f4;
  font-size: 14px;
  line-height: 1.45;
}
.boot { padding: 24px; }

body.is-phone { background: #000; }
body.is-phone .app {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 390px;
  height: 693px;
  margin: -346.5px 0 0 -195px;
  transform-origin: center center;
}
body.is-phone .brand h1 {
  font-size: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.is-phone .brand p { font-size: 10px; }
body.is-phone .seg button { padding: 0 10px; font-size: 11px; letter-spacing: 0.04em; }
body.is-phone .thumb { width: 72px; }
body.is-phone .thumb-frame { height: 52px; }
body.is-phone .loupe { width: 210px; height: 210px; }
body.is-phone .hint { max-width: 260px; white-space: normal; text-align: center; }
body.is-phone .nav { width: 36px; }
body.is-phone .nav svg { width: 30px; height: 30px; }
body.is-phone .plate { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28); }

@media (prefers-reduced-motion: reduce) {
  .slide.from-right,
  .slide.from-left,
  .slide.to-left,
  .slide.to-right,
  .dock { animation: none; transition: none; }
}
