:root {
  --bg: #ffffff;
  --bg-2: #f3f1ec;
  --ink: #141110;
  --ink-soft: #6b6660;
  --ink-faint: #a6a09a;
  --line: rgba(0, 0, 0, 0.10);
  --accent: #141110;
  --radius-card: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

/* film grain overlay — disabled on the light theme */
.grain { display: none; }

/* ---------- header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px clamp(20px, 5vw, 64px);
  position: relative;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-logo {
  height: 34px; width: auto; display: block;
}
.brand-mark {
  width: 22px; height: 22px; border-radius: 50%;
  background: conic-gradient(from 210deg, var(--accent), #b07e63, #6d5a8a, var(--accent));
  box-shadow: 0 0 0 1px rgba(255,255,255,0.15) inset;
}
.brand-name { font-family: "Fraunces", serif; font-weight: 500; letter-spacing: 0.32em; font-size: 18px; }

/* minimal layout: vertically center the carousel between header and viewport */
.minimal main {
  min-height: calc(100dvh - 92px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.nav-eyebrow { color: var(--ink-faint); font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; }

/* ---------- hero ---------- */
.hero { text-align: center; padding: clamp(28px, 6vw, 70px) clamp(20px, 5vw, 64px) 10px; }
.eyebrow {
  color: var(--accent); font-size: 12px; letter-spacing: 0.42em;
  text-transform: uppercase; margin-bottom: 22px;
}
.display {
  font-family: "Fraunces", serif;
  font-weight: 300;
  font-size: clamp(36px, 7vw, 84px);
  line-height: 1.02;
  letter-spacing: -0.01em;
}
.display-muted { color: var(--ink-soft); font-style: italic; }
.lede {
  max-width: 560px; margin: 26px auto 0;
  color: var(--ink-soft); font-size: clamp(15px, 1.4vw, 18px); font-weight: 300;
}

/* ---------- stage / carousel ---------- */
.stage-wrap { position: relative; display: flex; flex-direction: column; align-items: center; margin-bottom: 20px; }
.stage {
  width: 100%;
  height: clamp(420px, 56vh, 600px);
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 2600px;
  perspective-origin: 50% 50%;
  outline: none;
  cursor: grab;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.stage.dragging { cursor: grabbing; }
.stage:focus-visible { box-shadow: inset 0 0 0 1px var(--line); }

.ring {
  position: relative;
  width: var(--card-w, 240px);
  height: var(--card-h, 340px);
  transform-style: preserve-3d;
  will-change: transform;
}

/* outer element is a pure positioning slot on the ring */
.card {
  position: absolute;
  top: 0; left: 0;
  width: var(--card-w, 240px);
  height: var(--card-h, 340px);
  transform-style: preserve-3d;
}
/* the inner is the actual visible card — it turns sideways at rest
   and flips front-facing on hover */
.card-inner {
  position: absolute; inset: 0;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 24px 50px -28px rgba(0,0,0,0.45), 0 0 0 1px rgba(0,0,0,0.04) inset;
  transform: rotateY(var(--rest-turn, 54deg));
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.5s ease;
  /* NOTE: keep this a flat plane. With preserve-3d the inner's background
     and the child <img> become coplanar at z=0 and z-fight (bg hides image). */
  backface-visibility: hidden;
}
.card-inner::after {
  /* depth fog: cards turned away fade toward the white background */
  content: "";
  position: absolute; inset: 0;
  background: var(--bg);
  opacity: var(--fog, 0);
  pointer-events: none;
}
/* hover: flip this card front-facing and pop it forward */
.card:hover .card-inner {
  transform: rotateY(0deg) translateZ(var(--hover-z, 150px));
  box-shadow: 0 55px 95px -30px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,0,0,0.06) inset;
}

.card img {
  width: 100%; height: 100%;
  /* show the entire source image, including its baked-in caption + logo */
  object-fit: contain;
  object-position: center;
  display: block;
  /* No opacity fade here: opacity transitions/animations hang indefinitely
     on children of a continuously re-composited preserve-3d scene. The
     shimmer overlay (below) provides the loading state instead and is
     hidden the instant the image paints. */
}

/* loading shimmer */
.card .shimmer {
  position: absolute; inset: 0;
  background: linear-gradient(100deg, #e8e5df 30%, #f3f1ec 50%, #e8e5df 70%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}
.card img.loaded + .shimmer { opacity: 0; animation: none; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.card-label {
  /* hidden: the real Mira card images carry their own captions */
  display: none;
  position: absolute; left: 14px; bottom: 12px; z-index: 2;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink); text-shadow: 0 1px 12px rgba(0,0,0,0.8);
  flex-direction: column; gap: 2px;
}
.card-label small { color: var(--accent); font-size: 9px; letter-spacing: 0.3em; }

.stage-hint {
  display: flex; align-items: center; gap: 10px;
  margin-top: 8px; color: var(--ink-faint);
}
.hint-key {
  font-size: 11px; letter-spacing: 0.08em; padding: 4px 9px;
  border: 1px solid var(--line); border-radius: 6px; color: var(--ink-soft);
}
.hint-label { font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; }

/* ---------- CTA ---------- */
.cta-row {
  position: relative;
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
  gap: 18px; flex-wrap: wrap; padding: 56px 20px 10px;
}
.btn-download {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--ink); color: #ffffff;
  padding: 16px 30px; border-radius: 100px;
  font-weight: 600; font-size: 15px; letter-spacing: 0.01em;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  box-shadow: 0 18px 40px -18px rgba(0,0,0,0.5);
}
.btn-download:hover { transform: translateY(-2px); background: #2c2723; box-shadow: 0 24px 50px -18px rgba(0,0,0,0.55); }
.btn-download:active { transform: translateY(0); }
.chrome-glyph { color: #ffffff; }

.btn-ghost {
  background: none; border: 1px solid var(--line); color: var(--ink-soft);
  padding: 15px 26px; border-radius: 100px; font: inherit; font-size: 14px;
  cursor: pointer; transition: border-color 0.25s, color 0.25s;
}
.btn-ghost:hover { border-color: var(--ink-soft); color: var(--ink); }

/* ---------- tweak panel ---------- */
.tweak {
  max-width: 980px; margin: 14px auto 0; padding: 28px clamp(20px, 4vw, 40px);
  border: 1px solid var(--line); border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0));
  backdrop-filter: blur(6px);
  animation: fade 0.4s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tweak-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 26px; }
.tweak-group h3 {
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px; font-weight: 500;
}
.tweak-group label {
  display: flex; flex-direction: column; gap: 7px;
  font-size: 12px; color: var(--ink-soft); margin-bottom: 16px;
}
.tweak-group label span { color: var(--ink); font-variant-numeric: tabular-nums; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 3px;
  background: var(--line); border-radius: 3px; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); cursor: pointer; box-shadow: 0 0 0 4px rgba(233,220,201,0.12);
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border: none; border-radius: 50%;
  background: var(--accent); cursor: pointer;
}
select {
  background: var(--bg-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px;
}
.tweak-reset {
  margin-top: 8px; background: none; border: none; color: var(--ink-faint);
  font: inherit; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer; text-decoration: underline; text-underline-offset: 4px;
}
.tweak-reset:hover { color: var(--ink); }

/* ---------- features ---------- */
.features { max-width: 1100px; margin: 0 auto; padding: clamp(60px, 9vw, 130px) clamp(20px, 5vw, 64px); }
.features-title {
  font-family: "Fraunces", serif; font-weight: 300;
  font-size: clamp(26px, 3.6vw, 44px); text-align: center; margin-bottom: 56px;
}
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.feature { background: var(--bg); padding: 32px 28px; transition: background 0.3s ease; }
.feature:hover { background: var(--bg-2); }
.feature-num { color: var(--ink-faint); font-size: 12px; letter-spacing: 0.2em; }
.feature h4 { font-family: "Fraunces", serif; font-weight: 400; font-size: 20px; margin: 14px 0 8px; }
.feature p { color: var(--ink-soft); font-size: 14px; font-weight: 300; }

/* ---------- footer ---------- */
.site-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 30px clamp(20px, 5vw, 64px); border-top: 1px solid var(--line);
  color: var(--ink-faint); font-size: 13px; letter-spacing: 0.04em;
}
.site-footer span:first-child { font-family: "Fraunces", serif; letter-spacing: 0.3em; color: var(--ink-soft); }

@media (max-width: 560px) {
  .stage-hint .hint-key:nth-child(n+3) { display: none; }
  .display br { display: none; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card .shimmer { animation: none; }
  .card img { opacity: 1; animation: none; }
  .card-inner, .card { transition: none; }
  .tweak { animation: none; }
}
