/* The Third Type — theme over scrollcraft.css. Two worlds: paper and screen. */

:root {
  --sc-canvas: #F2EDE3;
  --sc-surface: #EAE3D3;
  --sc-ink: #17130C;
  --sc-ink-soft: #5C5342;
  --sc-accent: #17130C;
  --sc-accent-ink: #F2EDE3;
  --sc-font-display: "EB Garamond", Georgia, serif;
  --sc-font-text: "EB Garamond", Georgia, serif;
  --tt-paper: #F2EDE3;
  --tt-paper-2: #E4DCC7;
  --tt-night: #100E0A;
  --tt-night-2: #201C15;
  --tt-bone: #F2EDE3;
  --tt-bone-soft: #B0A78F;
  --tt-label: "Archivo", system-ui, sans-serif;
  --tt-hair: 1px solid rgba(23, 19, 12, 0.35);
}

html { scrollbar-color: #5C5342 #F2EDE3; }
body { background: var(--tt-paper); color: var(--sc-ink); }

::selection { background: #17130C; color: #F2EDE3; }

/* ---------- shared bits ---------- */

.tt-label {
  font-family: var(--tt-label);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.tt-rule {
  width: 4.5rem;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
  border: 0;
  margin: 0;
}

.tt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 3rem;
  padding: 0.7rem 1.6rem;
  background: var(--sc-ink);
  color: var(--tt-paper);
  font-family: var(--tt-label);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid var(--sc-ink);
  cursor: pointer;
  transition: transform 140ms cubic-bezier(0.23, 1, 0.32, 1), background-color 140ms ease, color 140ms ease;
}
.tt-btn:hover { background: transparent; color: var(--sc-ink); }
.tt-btn:active { transform: translateY(1px); }
.tt-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.tt-btn--ghost { background: transparent; color: var(--sc-ink); }
.tt-btn--ghost:hover { background: var(--sc-ink); color: var(--tt-paper); }

/* ---------- site bar ---------- */

.site-bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(0.8rem + env(safe-area-inset-top)) clamp(1rem, 4vw, 2.4rem) 0.8rem;
  pointer-events: none;
  mix-blend-mode: exclusion;
  color: #F2EDE3;
}
.site-bar > * { pointer-events: auto; }
.site-bar .tt-mark {
  font-family: var(--sc-font-display);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: inherit;
}
.site-bar .tt-bar-cta {
  font-family: var(--tt-label);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  background: none;
  border-top: 0; border-left: 0; border-right: 0;
  cursor: pointer;
}
.site-bar .tt-bar-cta:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* ---------- act I: hero ---------- */

.tt-hero-stage { background: var(--tt-paper); }
.tt-hero-art {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.tt-hero-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 72% 20%;
  filter: contrast(1.02);
}
.tt-hero-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, #F2EDE3 0%, #F2EDE3 26%, rgba(242, 237, 227, 0.82) 44%, rgba(242, 237, 227, 0) 66%);
}
.tt-hero-copy { max-width: 34rem; }
/* The lead copy is bottom-anchored and grows UPWARD, so its own height is the
   constraint, not the width. On a short laptop viewport (720-860px tall) the
   full 7.5rem headline wraps to four lines, the block overflows the top of the
   stage and the first line slides under the fixed bar. Cap the display size
   against the viewport HEIGHT as well as its width: min() can only shrink it,
   so a tall desktop still gets the full --sc-t-4xl. */
.tt-hero-copy .sc-display {
  font-weight: 500;
  font-size: min(var(--sc-t-4xl), 12svh);
  line-height: 1.06;
  padding-bottom: 0.16em;
  margin-bottom: 0.45em;
}
@media (min-width: 861px) {
  /* a lower anchor keeps the kicker clear of the fixed header */
  .sc-copy.tt-hero-copy { bottom: 2.2rem; }
}
.tt-hero-copy .tt-kicker { color: var(--sc-ink-soft); margin-bottom: 1.4rem; }
.tt-hero-copy .sc-body { max-width: 27rem; color: var(--sc-ink-soft); }
.tt-hero-copy .tt-btn { margin-top: 2rem; }
/* on a short viewport the fixed rem gaps around the headline cost more than
   the headline itself; tighten them so the type stays as large as possible */
@media (min-width: 861px) and (max-height: 800px) {
  .sc-copy.tt-hero-copy { bottom: 1.6rem; }
  .tt-hero-copy .tt-kicker { margin-bottom: 0.9rem; }
  .tt-hero-copy .tt-btn { margin-top: 1.4rem; }
}

/* ---------- portrait sections (Purist / Third) ---------- */

.tt-plate {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2rem, 6vw, 5.5rem);
  align-items: center;
}
.tt-plate--flip { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }
.tt-plate figure { margin: 0; position: relative; }
.tt-plate figure img {
  width: 100%;
  height: auto;
  display: block;
  border: var(--tt-hair);
  outline: 1px solid rgba(23, 19, 12, 0.35);
  outline-offset: 6px;
}
.tt-plate figcaption {
  margin-top: 0.9rem;
  color: var(--sc-ink-soft);
  font-style: italic;
  font-size: 0.95rem;
}
.tt-plate .sc-display { font-weight: 500; }
.tt-plate .sc-body { color: var(--sc-ink-soft); max-width: 33rem; }
.tt-type-no {
  font-family: var(--sc-font-display);
  font-size: 1rem;
  letter-spacing: 0.3em;
  color: var(--sc-ink-soft);
  display: block;
  margin-bottom: 0.6rem;
}

/* ---------- act III: automaton (night world) ---------- */

.tt-night {
  --sc-ink: #F2EDE3;
  --sc-ink-soft: #B0A78F;
  --sc-accent: #F2EDE3;
  --sc-accent-ink: #100E0A;
  color: var(--sc-ink);
  background: var(--tt-night);
}
.tt-night-stage { background: var(--tt-night); }
.tt-night-art {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: flex-end;
}
.tt-night-art img {
  height: 100%;
  width: auto;
  max-width: 62%;
  object-fit: cover;
  object-position: center;
  opacity: 0.92;
}
.tt-night-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #100E0A 30%, rgba(16, 14, 10, 0.65) 55%, rgba(16, 14, 10, 0.15) 80%);
}
.tt-night-copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 clamp(1.2rem, 6vw, 5rem);
  max-width: 40rem;
}
.tt-night-copy .sc-display { font-weight: 500; }
.tt-night-copy p.tt-roast {
  font-size: clamp(1.15rem, 2.1vw, 1.5rem);
  line-height: 1.5;
  margin-top: 1.1rem;
  max-width: 30rem;
}

/* ---------- act V: the question / close ---------- */

.tt-close-stage {
  background: var(--tt-paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 1.4rem;
}
.tt-close-stage .sc-display { font-weight: 500; max-width: 17ch; }
.tt-close-stage .tt-btn { margin-top: 2.4rem; }
.tt-foot {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.6rem;
  align-items: center;
  justify-content: center;
  padding: 1.1rem 1.4rem calc(1.1rem + env(safe-area-inset-bottom));
  border-top: var(--tt-hair);
  color: var(--sc-ink-soft);
  font-size: 0.86rem;
}
.tt-foot a { color: inherit; text-underline-offset: 3px; }

/* ---------- quiz layer ---------- */

.tt-quiz {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  background: var(--tt-paper);
  color: #17130C;
  transition: background-color 550ms ease, color 550ms ease;
  overflow: hidden;
}
.tt-quiz.is-open { display: block; }
.tt-quiz.w1 { background: #E4DCC7; }
.tt-quiz.w2 { background: #3A342A; color: #F2EDE3; }
.tt-quiz.w3 { background: #100E0A; color: #F2EDE3; }

.tt-quiz-inner {
  height: 100%;
  max-width: 44rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: calc(1rem + env(safe-area-inset-top)) 1.4rem calc(1.4rem + env(safe-area-inset-bottom));
}
.tt-quiz-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3rem;
}
.tt-quiz-top .tt-label { opacity: 0.75; }
.tt-quiz-back {
  background: none;
  border: 0;
  color: inherit;
  font-family: var(--tt-label);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0.6rem 0;
  opacity: 0.7;
}
.tt-quiz-back:hover { opacity: 1; }
.tt-quiz-back:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.tt-quiz-back[hidden] { visibility: hidden; display: block; }

.tt-progress {
  display: flex;
  gap: 5px;
  margin-top: 0.4rem;
}
.tt-progress i {
  flex: 1;
  height: 2px;
  background: currentColor;
  opacity: 0.18;
}
.tt-progress i.on { opacity: 0.9; }

.tt-q {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 0;
}
.tt-q h2 {
  font-family: var(--sc-font-display);
  font-size: clamp(1.6rem, 4.6vw, 2.5rem);
  font-weight: 500;
  line-height: 1.16;
  text-wrap: balance;
  margin: 0 0 2rem;
}
.tt-opts { display: flex; flex-direction: column; gap: 0.8rem; }
.tt-opt {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid currentColor;
  color: inherit;
  font-family: var(--sc-font-text);
  font-size: clamp(1.02rem, 2.4vw, 1.18rem);
  line-height: 1.45;
  padding: 1rem 1.2rem;
  min-height: 3.4rem;
  cursor: pointer;
  transition: background-color 130ms ease, color 130ms ease, transform 130ms cubic-bezier(0.23, 1, 0.32, 1);
}
.tt-opt:hover { background: currentColor; }
.tt-opt:hover span { color: var(--tt-paper); }
.tt-quiz.w2 .tt-opt:hover span, .tt-quiz.w3 .tt-opt:hover span { color: #100E0A; }
.tt-opt:active { transform: translateY(1px); }
.tt-opt:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.tt-opt span { pointer-events: none; }

.tt-silence {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 2rem;
  background: #100E0A;
  color: #F2EDE3;
}
.tt-silence.is-on { display: flex; }
.tt-silence p {
  font-family: var(--sc-font-display);
  font-size: clamp(1.3rem, 3.4vw, 2rem);
  font-style: italic;
  opacity: 0;
  animation: tt-appear 900ms cubic-bezier(0.23, 1, 0.32, 1) 250ms forwards;
}
@keyframes tt-appear { to { opacity: 1; } }

/* ---------- result layer ---------- */

.tt-result {
  position: relative;
  display: none;
  background: var(--tt-paper);
  color: #17130C;
  min-height: 100dvh;
}
.tt-result.is-open { display: block; }
.tt-result-inner {
  max-width: 46rem;
  margin: 0 auto;
  padding: calc(2.6rem + env(safe-area-inset-top)) 1.4rem 4rem;
}
.tt-verdict-label { color: var(--sc-ink-soft); }
.tt-band {
  font-family: var(--sc-font-display);
  font-size: clamp(2.6rem, 8.5vw, 4.6rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 0.7rem 0 0;
  text-wrap: balance;
}
.tt-verdict {
  font-size: clamp(1.08rem, 2.4vw, 1.25rem);
  line-height: 1.6;
  color: var(--sc-ink-soft);
  max-width: 36rem;
  margin-top: 1.4rem;
}

.tt-meter { margin: 2.6rem 0 0.4rem; }
.tt-meter-track {
  position: relative;
  height: 1px;
  background: rgba(23, 19, 12, 0.4);
}
.tt-meter-track::before, .tt-meter-track::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 1px;
  height: 9px;
  background: rgba(23, 19, 12, 0.4);
}
.tt-meter-track::before { left: 0; }
.tt-meter-track::after { right: 0; }
.tt-meter-mid {
  position: absolute;
  left: 50%;
  top: -4px;
  width: 1px;
  height: 9px;
  background: rgba(23, 19, 12, 0.4);
}
.tt-needle {
  position: absolute;
  top: -11px;
  width: 3px;
  height: 23px;
  background: #17130C;
  transform: translateX(-50%);
  transition: left 900ms cubic-bezier(0.23, 1, 0.32, 1);
}
.tt-meter-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.7rem;
  color: var(--sc-ink-soft);
}

.tt-arch {
  margin-top: 3rem;
  border: var(--tt-hair);
  outline: 1px solid rgba(23, 19, 12, 0.35);
  outline-offset: 5px;
  padding: 1.6rem 1.6rem 1.7rem;
}
.tt-arch h3 {
  font-family: var(--sc-font-display);
  font-size: clamp(1.7rem, 4.6vw, 2.4rem);
  font-weight: 600;
  margin: 0.5rem 0 0.7rem;
}
.tt-arch p { color: var(--sc-ink-soft); font-size: 1.05rem; line-height: 1.55; margin: 0; }

.tt-quads { margin-top: 3rem; }
.tt-quad { margin-top: 1.5rem; }
.tt-quad-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.tt-quad-head .sc-nums { font-family: var(--tt-label); font-size: 0.8rem; font-weight: 600; }
.tt-quad-bar {
  height: 7px;
  border: 1px solid rgba(23, 19, 12, 0.55);
  margin-top: 0.5rem;
}
.tt-quad-bar i {
  display: block;
  height: 100%;
  background: repeating-linear-gradient(-45deg, #17130C 0, #17130C 2px, transparent 2px, transparent 5px);
  width: 0;
  transition: width 900ms cubic-bezier(0.23, 1, 0.32, 1);
}
.tt-quad-note { color: var(--sc-ink-soft); font-size: 0.98rem; line-height: 1.5; margin-top: 0.55rem; max-width: 36rem; }

.tt-action {
  margin-top: 3rem;
  background: var(--tt-night);
  color: #F2EDE3;
  padding: 1.7rem 1.6rem 1.8rem;
}
.tt-action .tt-label { opacity: 0.7; }
.tt-action h3 {
  font-family: var(--sc-font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
  margin: 0.6rem 0 0.7rem;
}
.tt-action p { color: #B0A78F; line-height: 1.55; margin: 0 0 1.4rem; }
.tt-action .tt-btn { background: #F2EDE3; color: #100E0A; border-color: #F2EDE3; }
.tt-action .tt-btn:hover { background: transparent; color: #F2EDE3; }

.tt-share { margin-top: 3rem; }
.tt-share p { color: var(--sc-ink-soft); margin: 0.5rem 0 1.2rem; }
.tt-share-row { display: flex; flex-wrap: wrap; gap: 0.8rem; }

.tt-result-foot {
  margin-top: 4rem;
  padding-top: 1.2rem;
  border-top: var(--tt-hair);
  color: var(--sc-ink-soft);
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.tt-result-foot a { color: inherit; text-underline-offset: 3px; }
.tt-retake {
  background: none; border: 0; padding: 0;
  color: inherit; font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  align-self: flex-start;
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .tt-plate, .tt-plate--flip { grid-template-columns: 1fr; gap: 1.6rem; }
  .tt-plate--flip figure { order: -1; }
  .tt-plate figure { max-width: 26rem; }
  .tt-hero-art img { object-position: 62% 18%; }
  .tt-hero-art::after {
    background: linear-gradient(180deg, rgba(242, 237, 227, 0.97) 0%, rgba(242, 237, 227, 0.93) 46%, rgba(242, 237, 227, 0.45) 100%);
  }
  .tt-night-art img { max-width: 100%; opacity: 0.5; }
  .tt-night-art::after {
    background: linear-gradient(180deg, rgba(16, 14, 10, 0.72) 0%, rgba(16, 14, 10, 0.45) 100%);
  }
}

@media (max-width: 700px) {
  .tt-hero-copy .sc-display { font-size: var(--sc-t-2xl, 2.6rem); }
}

@media (prefers-reduced-motion: reduce) {
  .tt-needle, .tt-quad-bar i, .tt-quiz { transition: none; }
  .tt-silence p { animation: none; opacity: 1; }
}
