/* CARDS — Pantone-style typography swatch deck */
:root {
  --paper: #f5f3ee;
  --ink: #0a0a0a;
}

/* ---- INTERFACE FONT ----------------------------------------------------- */
@font-face { font-family: 'Monologo'; src: url('fonts/Monologo-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'MonologoVF'; src: url('fonts/Monologo_VF.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

/* ---- RESISTENZA TYPE FONTS ---------------------------------------------- */
@font-face { font-family: 'Sidera'; src: url('fonts/Sidera_VF.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Effimera'; src: url('fonts/Effimera_VF.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Gotti'; src: url('fonts/Gotti_VF.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Onni'; src: url('fonts/Onni_VF.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Ordine'; src: url('fonts/Ordine_VF.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Performa'; src: url('fonts/Performa_VF.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Squadra'; src: url('fonts/Squadra_VF.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Superpop'; src: url('fonts/Superpop_VF.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'TotalBlack'; src: url('fonts/TotalBlack_VF.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Nautica'; src: url('fonts/Nautica-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Industria'; src: url('fonts/Industria_VF.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Piccola'; src: url('fonts/Piccola_VF.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Furbo'; src: url('fonts/Furbo_VF.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Groupie'; src: url('fonts/Groupie-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'LeKick'; src: url('fonts/LeKick-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Flipante'; src: url('fonts/Flipante_VF.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Pressato'; src: url('fonts/Pressato_VF.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Norman'; src: url('fonts/Norman_VF.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'ModernLove'; src: url('fonts/ModernLove-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Revolute'; src: url('fonts/Revolute_VF.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

* { box-sizing: border-box; }
html, body, #root { margin: 0; padding: 0; height: 100%; width: 100%; overflow: hidden; }
body { background: #000; font-family: 'Monologo', monospace; }

/* ---- STAGE ----------------------------------------------------------- */
.stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.4s ease;
  cursor: pointer;
}

.stage-label {
  position: absolute;
  top: 24px;
  left: 24px;
  text-align: left;
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stage-label-sub {
  color: rgba(255,255,255,0.35);
  font-size: 10px;
}

.beta-blink {
  display: inline-block;
  color: #ff5a1f;
  animation: betaBlink 1.1s steps(2, end) infinite;
  letter-spacing: 0.05em;
}
@keyframes betaBlink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

.stage-back-link {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 20;
  background: #ff5a1f;
  color: #fff;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 9px 16px;
  border-radius: 999px;
  transition: background 0.15s ease, transform 0.15s ease;
  font-weight: 500;
}
.stage-back-link:hover {
  background: #ff4500;
  transform: scale(1.04);
}

.stage-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.4);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  z-index: 10;
  pointer-events: none;
}

/* ---- FAN ------------------------------------------------------------- */
.fan-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}
.fan {
  position: absolute;
  /* Pivot point sits in lower-middle so cards fan UPWARD with breathing room */
  left: 50%;
  top: calc(88% - 100px);
  width: 0;
  height: 0;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Pivot point — the binding ring is at the BOTTOM of the cards.
   Cards rotate around their own bottom-center. */
.card-pivot {
  position: absolute;
  /* origin point: where the binding ring sits */
  left: 0;
  top: 0;
  transform-origin: center bottom;
  transition: transform 0.55s cubic-bezier(0.2, 0.85, 0.2, 1);
  cursor: pointer;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.card-pivot.active {
  transition: transform 0.65s cubic-bezier(0.2, 0.85, 0.2, 1);
}

/* The card itself sits centered horizontally on the pivot, with bottom at pivot Y */
/* Loader */
#loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: #0a0a0a;
  color: #f5f3ee;
  transition: opacity 0.6s ease;
}
#loader.hidden {
  opacity: 0;
  pointer-events: none;
}
.loader-card {
  font-size: 140px;
  line-height: 1;
  animation: loader-spin 1.6s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  transform-origin: 50% 60%;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.5));
}
.loader-text {
  font-family: 'Monologo', monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.7;
}
@keyframes loader-spin {
  0%   { transform: rotate(-12deg); }
  50%  { transform: rotate(12deg); }
  100% { transform: rotate(-12deg); }
}

.card {
  position: absolute;
  left: -110px;   /* half of cardW (220) */
  bottom: 0;
  border-radius: 14px 14px 4px 4px;
  padding: 26px 18px 38px;
  display: flex;
  flex-direction: column;
  /* paper texture */
  background-image:
    radial-gradient(rgba(0,0,0,0.025) 1px, transparent 1px),
    radial-gradient(rgba(0,0,0,0.02) 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 2px;
  box-shadow:
    0 6px 14px rgba(0,0,0,0.35),
    0 1px 0 rgba(255,255,255,0.6) inset;
  /* GPU rendering — prevents blurry text on rotated/scaled elements */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
}

/* punch hole near bottom for the binding ring */
.card-hole {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #000;
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,0.4),
    inset 0 -1px 1px rgba(0,0,0,0.6);
}

/* ---- COVER CARD ----------------------------------------------------- */
.cover-card { padding: 30px 18px 50px; }
.cover-inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.cover-title {
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 700;
  color: #0a0a0a;
}

/* embossed (pt) mark — uses text-shadow to fake letterpress deboss */
.deboss-mark {
  margin-top: auto;
  margin-bottom: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  color: transparent;
  font-family: 'Monologo', monospace;
  font-weight: 400;
  font-size: 78px;
  letter-spacing: -0.04em;
  line-height: 1;
  overflow: hidden;
  text-shadow:
    0 1px 0 rgba(255,255,255,0.9),
    0 -1px 1px rgba(0,0,0,0.18),
    1px 0 1px rgba(0,0,0,0.05);
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.08));
  opacity: 0.85;
}
.deboss-paren { font-weight: 300; }
.deboss-text { font-weight: 700; }

.cover-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 8px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: rgba(0,0,0,0.55);
  text-transform: uppercase;
}

/* ---- SPECIMEN CARD INNER -------------------------------------------- */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(0,0,0,0.55);
  border-bottom: 0.5px solid rgba(0,0,0,0.25);
  padding-bottom: 8px;
  margin-bottom: 14px;
  gap: 6px;
}
.card-num { white-space: nowrap; }
.card-class {
  text-align: right;
  font-size: 7px;
}

.card-name {
  font-size: 38px;
  line-height: 0.95;
  margin-bottom: 12px;
  word-break: break-word;
  overflow-wrap: break-word;
  letter-spacing: 0 !important;
}

.card-glyph {
  font-size: 110px;
  line-height: 0.85;
  margin: 4px 0 14px;
  text-align: center;
}

.card-alphabet {
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0.02em;
  margin-bottom: 16px;
  word-break: break-all;
  padding: 10px 0;
  border-top: 0.5px solid rgba(0,0,0,0.18);
  border-bottom: 0.5px solid rgba(0,0,0,0.18);
  text-align: center;
}

.card-pangram {
  font-size: 13px;
  line-height: 1.3;
  margin-bottom: 14px;
}

.card-quote-block {
  margin-top: auto;
  margin-bottom: 14px;
  position: relative;
  padding-top: 8px;
}
.card-quote-mark {
  font-family: 'Playfair Display', serif;
  font-size: 38px;
  line-height: 0.5;
  font-weight: 700;
  margin-bottom: 6px;
}
.card-quote {
  font-size: 11px;
  line-height: 1.35;
  margin-bottom: 8px;
}
.card-quote-by {
  font-size: 7px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(0,0,0,0.55);
}

.card-meta {
  position: absolute;
  bottom: 38px;
  left: 18px;
  right: 18px;
  font-size: 7px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(0,0,0,0.6);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.card-meta-row {
  display: flex;
  justify-content: space-between;
}
/* BUY BUTTON ----------------------------------------------------------- */
.card-buy {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  background: #ff5a1f;
  border: none;
  border-radius: 999px;
  padding: 6px 13px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
  z-index: 4;
  font-weight: 500;
}
.card-buy:hover {
  background: #ff4500;
  transform: translateX(-50%) scale(1.05);
}

/* ---- WEIGHT CONTROL (for active variable card) ----------------------- */
.weight-control {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,20,0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 12px 16px;
  width: 280px;
  z-index: 1000;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeUp 0.3s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.weight-control-label {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
}
.weight-slider {
  width: 100%;
  margin: 0;
}

/* ---- LEFT-SIDE SPREAD PANEL (always visible) ------------------------ */
.spread-panel {
  position: absolute;
  bottom: 80px;
  left: 24px;
  background: rgba(20,20,20,0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 14px 16px;
  width: 200px;
  z-index: 50;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.spread-panel-row {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
}
.spread-panel-slider {
  width: 100%;
  margin: 0;
}

/* Custom thin slider styling (applies to spread + weight) */
.spread-panel-slider,
.weight-slider {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  height: 14px; /* hit area */
  outline: none;
}
.spread-panel-slider::-webkit-slider-runnable-track,
.weight-slider::-webkit-slider-runnable-track {
  height: 2px;
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
}
.spread-panel-slider::-moz-range-track,
.weight-slider::-moz-range-track {
  height: 2px;
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
}
.spread-panel-slider::-webkit-slider-thumb,
.weight-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: none;
  margin-top: -5px; /* center on 2px track */
  cursor: pointer;
}
.spread-panel-slider::-moz-range-thumb,
.weight-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
}
.spread-panel-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.spread-panel-actions button {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  padding: 6px 4px;
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
}
.spread-panel-actions button:hover {
  background: rgba(255,255,255,0.14);
}

/* ---- MOBILE / NARROW SCREENS ---------------------------------------- */
@media (max-width: 768px) {
  /* With initial spread 20°, cards stack — scale less aggressively
     so the front card is readable. */
  .fan {
    transform: scale(0.78);
    transform-origin: center bottom;
    top: 88%;
  }

  /* Top bar: stack label + back link on top of each other, smaller */
  .stage-label {
    top: 14px;
    left: 14px;
    right: auto;
    max-width: 60%;
  }
  .stage-label span:first-child {
    font-size: 11px;
    line-height: 1.3;
  }
  .stage-label-sub {
    font-size: 9px;
  }
  .stage-back-link {
    top: 14px;
    right: 14px;
    font-size: 9px;
    padding: 7px 11px;
    letter-spacing: 0.08em;
  }

  /* Spread panel: bottom-left, full width minus margins, compact */
  .spread-panel {
    bottom: 14px;
    left: 14px;
    right: auto;
    width: calc(50% - 22px);
    max-width: 200px;
    padding: 10px 12px 12px;
  }

  /* Weight/axis control: bottom-right when card active, mirrors spread */
  .weight-control {
    bottom: 14px;
    left: auto;
    right: 14px;
    transform: none;
    width: calc(50% - 22px);
    max-width: 220px;
    padding: 10px 12px 12px;
  }
  @keyframes fadeUp {
    from { opacity: 0; transform: translate(0, 8px); }
    to { opacity: 1; transform: translate(0, 0); }
  }

  /* Hide the bottom hint to save space */
  .stage-hint {
    display: none;
  }
}

@media (max-width: 480px) {
  .fan {
    transform: scale(0.62);
    top: 86%;
  }
  .stage-label {
    max-width: 55%;
  }
  .stage-label span:first-child {
    font-size: 10px;
  }
  .stage-back-link {
    font-size: 8px;
    padding: 6px 9px;
  }
  /* Stack panels vertically, full width */
  .spread-panel,
  .weight-control {
    width: calc(100% - 28px);
    max-width: none;
    left: 14px;
    right: 14px;
  }
  .weight-control {
    bottom: 14px;
  }
  .spread-panel {
    bottom: 14px;
  }
}