/* ===== Fuentes self-hosted ===== */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('fonts/cormorant-garamond-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/cormorant-garamond-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('fonts/space-grotesk-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/space-grotesk-400.woff2') format('woff2');
}

/* ===== Base ===== */
:root {
  --bg-base: #0E1114;
  --bg-deep: #08090B;
  --btn-fill: #131719;
  --hairline: #191D21;
  --chip-border: #22262B;
  --track-off: #262B31;
  --btn-border: #2C333B;
  --btn-border-hover: #3C444D;
  --pause: #3A4249;
  --numerals: #454D55;
  --hint: #4A5158;
  --tertiary: #5C646D;
  --controls: #6B737B;
  --chip-idle: #8D959E;
  --body-text: #949CA5;
  --accent: #A8B6C9;
  --accent-rgb: 168, 182, 201;
  --list-text: #C3C9D0;
  --primary: #DDE2E7;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --ease-enter: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-exit: cubic-bezier(0.33, 0, 0.24, 1);
}

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

html { -webkit-text-size-adjust: 100%; color-scheme: dark; }

body {
  background: var(--bg-base);
  transition: background-color 720ms var(--ease-enter);
  font-family: var(--sans);
  font-kerning: normal;
  color: var(--body-text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body.bg-deep { background: var(--bg-deep); }

::selection { background: rgba(var(--accent-rgb), 0.18); color: var(--primary); }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

:focus-visible {
  outline: 1px solid rgba(var(--accent-rgb), 0.45);
  outline-offset: 4px;
  border-radius: 2px;
}

/* ===== Atmósfera: luz y materia ===== */
.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  transition: opacity 720ms var(--ease-enter);
}
.atmosphere--base {
  opacity: 1;
  background:
    radial-gradient(130% 95% at 50% -12%, #182028 0%, #10141A 46%, #090C0F 100%);
}
.atmosphere--deep {
  opacity: 0;
  background:
    radial-gradient(115% 80% at 50% 42%, #0E1218 0%, #08090B 58%, #030405 100%);
}
body.bg-deep .atmosphere--base { opacity: 0; }
body.bg-deep .atmosphere--deep { opacity: 1; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  background-size: 160px 160px;
}

/* ===== Pantallas y crossfade ===== */
.screen {
  display: none;
  position: fixed;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 1;
  transition: opacity 720ms var(--ease-enter);
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }
.screen.is-active { display: block; }
.screen.is-leaving { opacity: 0; }
.screen.is-entering { opacity: 0; transition: none; }

.col {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* Coreografía de entrada: el contenido se asienta en cascada */
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Tipos compartidos ===== */
.section-label {
  font-family: var(--sans);
  font-weight: 400;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  color: var(--tertiary);
}

.kanji {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--primary);
  opacity: 0.16;
}

.link {
  font-family: var(--sans);
  font-weight: 300;
  text-decoration: none;
  transition: color 900ms var(--ease-enter), border-color 900ms var(--ease-enter);
}
.link--guia {
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--chip-idle);
  padding-bottom: 3px;
  border-bottom: 1px solid var(--chip-border);
}
.link--back {
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--tertiary);
  align-self: flex-start;
  padding: 6px 0;
}
.link--volver {
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--tertiary);
  padding: 8px 10px;
}
@media (hover: hover) {
  .link:hover { color: var(--accent); }
  .link--guia:hover { border-color: rgba(var(--accent-rgb), 0.4); }
}

/* ===== Inicio ===== */
.col--home {
  position: relative;
  padding: calc(96px + env(safe-area-inset-top, 0px)) 30px calc(40px + env(safe-area-inset-bottom, 0px));
}
.kanji-mark {
  position: absolute;
  top: calc(88px + env(safe-area-inset-top, 0px));
  right: 22px;
  writing-mode: vertical-rl;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 84px;
  line-height: 1.04;
  letter-spacing: 0.08em;
  color: var(--accent);
  opacity: 0.07;
  pointer-events: none;
  user-select: none;
  animation: kanji-mark-in 1800ms var(--ease-enter) 260ms both;
}
@keyframes kanji-mark-in {
  from { opacity: 0; }
  to   { opacity: 0.07; }
}
@media (max-width: 359px) {
  .kanji-mark { display: none; }
}
.wordmark {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 48px;
  line-height: 1.0;
  letter-spacing: 0.05em;
  color: var(--primary);
  animation: rise 960ms var(--ease-enter) 60ms both;
}
/* Degradé en el trazo solo donde background-clip: text existe;
   en cualquier otro navegador queda el color pleno, nunca invisible. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .wordmark {
    background: linear-gradient(180deg, #F2F4F7 0%, #B7BEC7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}
.practice-list {
  margin-top: 76px;
  display: flex;
  flex-direction: column;
}
.practice-row {
  position: relative;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 28px;
  letter-spacing: 0.01em;
  color: var(--list-text);
  text-align: left;
  padding: 25px 0;
  transition: color 900ms var(--ease-enter), padding-left 900ms var(--ease-enter);
  animation: rise 960ms var(--ease-enter) both;
}
.practice-row:nth-child(1) { animation-delay: 150ms; }
.practice-row:nth-child(2) { animation-delay: 220ms; }
.practice-row:nth-child(3) { animation-delay: 290ms; }
.practice-row:nth-child(4) { animation-delay: 360ms; }
.practice-row::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, #262D35 0%, var(--hairline) 50%, rgba(25, 29, 33, 0) 100%);
}
.practice-row::before {
  content: '';
  position: absolute;
  right: 4px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -4px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  opacity: 0.28;
  transition: opacity 900ms var(--ease-enter), transform 900ms var(--ease-enter);
}
@media (hover: hover) {
  .practice-row:hover { color: var(--accent); padding-left: 10px; }
  .practice-row:hover::before { opacity: 0.9; transform: scale(1.25); }
}
.home-spacer { flex: 1; min-height: 56px; }
.home-foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 28px;
  animation: rise 900ms var(--ease-enter) 480ms both;
}
.home-foot .link--guia { align-self: flex-start; }

/* ===== Guía ===== */
.col--guia {
  padding: calc(72px + env(safe-area-inset-top, 0px)) 30px calc(64px + env(safe-area-inset-bottom, 0px));
}
.col--guia .link--back { animation: rise 900ms var(--ease-enter) 40ms both; }
.guia-title {
  margin-top: 54px;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 37px;
  letter-spacing: 0.02em;
  color: var(--primary);
  animation: rise 960ms var(--ease-enter) 110ms both;
}
.guia-blocks {
  margin-top: 44px;
  display: flex;
  flex-direction: column;
  gap: 34px;
}
.guia-block { animation: rise 900ms var(--ease-enter) both; }
.guia-block:nth-child(1) { animation-delay: 190ms; }
.guia-block:nth-child(2) { animation-delay: 250ms; }
.guia-block:nth-child(3) { animation-delay: 310ms; }
.guia-block:nth-child(4) { animation-delay: 370ms; }
.guia-block:nth-child(5) { animation-delay: 430ms; }
.guia-block p {
  margin-top: 12px;
  font-weight: 300;
  font-size: 15px;
  line-height: 1.78;
  color: var(--body-text);
}

/* ===== Preparación ===== */
.col--prep {
  padding: calc(72px + env(safe-area-inset-top, 0px)) 30px calc(44px + env(safe-area-inset-bottom, 0px));
}
.col--prep > * { animation: rise 900ms var(--ease-enter) both; }
.col--prep > :nth-child(1) { animation-delay: 40ms; }
.col--prep > :nth-child(2) { animation-delay: 110ms; }
.col--prep > :nth-child(3) { animation-delay: 180ms; }
.col--prep > :nth-child(4) { animation-delay: 250ms; }
.col--prep > :nth-child(5) { animation-delay: 310ms; }
.col--prep > :nth-child(6) { animation-delay: 370ms; }
.col--prep > :nth-child(7) { animation: none; }
.col--prep > :nth-child(8) { animation-delay: 440ms; }
.prep-title {
  margin-top: 48px;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 34px;
  letter-spacing: 0.02em;
  color: var(--primary);
}
.prep-lines {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.prep-lines p {
  font-weight: 300;
  font-size: 15px;
  line-height: 1.66;
  color: var(--body-text);
}
.prep-label { margin-top: 52px; }
.chips {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.chip {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 13.5px;
  letter-spacing: 0.02em;
  color: var(--chip-idle);
  padding: 10px 15px;
  border-radius: 999px;
  border: 1px solid var(--chip-border);
  transition: color 650ms var(--ease-enter),
              border-color 650ms var(--ease-enter),
              background-color 650ms var(--ease-enter),
              box-shadow 650ms var(--ease-enter),
              transform 220ms var(--ease-exit);
}
.chip:active { transform: scale(0.96); }
@media (hover: hover) {
  .chip:hover { color: var(--accent); border-color: rgba(var(--accent-rgb), 0.3); }
}
.chip.is-active {
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.6);
  background: rgba(var(--accent-rgb), 0.09);
  box-shadow: 0 0 22px rgba(var(--accent-rgb), 0.1),
              inset 0 0 14px rgba(var(--accent-rgb), 0.07);
}
.toggles { margin-top: 46px; }
.toggle-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 0;
  cursor: pointer;
}
.toggle-row::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, #262D35 0%, var(--hairline) 50%, rgba(25, 29, 33, 0) 100%);
}
.toggle-label {
  font-weight: 300;
  font-size: 14.5px;
  color: var(--list-text);
  transition: color 650ms var(--ease-enter);
}
@media (hover: hover) {
  .toggle-row:hover .toggle-label { color: var(--primary); }
}
.toggle-hint {
  margin-top: 3px;
  font-weight: 300;
  font-size: 11.5px;
  color: var(--hint);
}
.toggle {
  flex: none;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--track-off);
  background: var(--track-off);
  transition: border-color 700ms var(--ease-enter),
              background-color 700ms var(--ease-enter),
              box-shadow 700ms var(--ease-enter);
}
.knob {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--hint);
  margin-top: 3px;
  transform: translateX(3px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  transition: transform 700ms var(--ease-enter),
              background-color 700ms var(--ease-enter),
              box-shadow 700ms var(--ease-enter);
}
.toggle[aria-checked="true"] {
  border-color: rgba(var(--accent-rgb), 0.5);
  background: rgba(var(--accent-rgb), 0.09);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.07);
}
.toggle[aria-checked="true"] .knob {
  transform: translateX(21px);
  background: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 0 9px rgba(var(--accent-rgb), 0.35);
}
.prep-spacer { flex: 1; min-height: 40px; }
.btn-start {
  width: 100%;
  height: 64px;
  border-radius: 2px;
  border: 1px solid #39424C;
  background: linear-gradient(180deg, #1A2027 0%, #141920 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04),
              0 12px 32px rgba(0, 0, 0, 0.35),
              0 0 20px rgba(var(--accent-rgb), 0.04);
  font-family: var(--sans);
  font-weight: 400;
  text-transform: uppercase;
  font-size: 14.5px;
  letter-spacing: 0.16em;
  color: var(--primary);
  transition: border-color 900ms ease,
              letter-spacing 900ms ease,
              box-shadow 900ms ease,
              transform 220ms var(--ease-exit);
}
.btn-start:active { transform: translateY(1px); }
@media (hover: hover) {
  .btn-start:hover {
    border-color: rgba(var(--accent-rgb), 0.35);
    letter-spacing: 0.2em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04),
                0 12px 32px rgba(0, 0, 0, 0.35),
                0 0 30px rgba(var(--accent-rgb), 0.09);
  }
}

/* ===== Sesión ===== */
.session-stage {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pause-label {
  position: absolute;
  top: calc(54px + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  text-align: center;
  font-weight: 300;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--pause);
  opacity: 0;
  transition: opacity 1400ms var(--ease-enter);
  pointer-events: none;
}
.session--paused .pause-label { opacity: 1; }
.time-display {
  font-family: var(--serif);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  font-size: 112px;
  line-height: 1.0;
  letter-spacing: 0.02em;
  color: #525B66;
  text-shadow: 0 0 52px rgba(var(--accent-rgb), 0.12);
}
.breath-circle {
  position: relative;
  width: 128px;
  height: 128px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  animation: breathe 14000ms cubic-bezier(0.37, 0, 0.63, 1) infinite;
}
.breath-circle::before {
  content: '';
  position: absolute;
  inset: -52%;
  border-radius: 50%;
  background: radial-gradient(closest-side,
    rgba(var(--accent-rgb), 0.2) 0%,
    rgba(var(--accent-rgb), 0.07) 55%,
    rgba(var(--accent-rgb), 0) 78%);
}
@keyframes breathe {
  0%   { transform: scale(0.94); opacity: 0.32; }
  42%  { transform: scale(1.15); opacity: 0.75; }
  54%  { transform: scale(1.15); opacity: 0.72; }
  100% { transform: scale(0.94); opacity: 0.32; }
}
.session--paused .breath-circle { animation-play-state: paused; }
.session-controls {
  position: absolute;
  bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 34px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1900ms var(--ease-exit);
}
.session-controls.is-visible {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 520ms var(--ease-exit);
}
.session-controls.no-fade { transition: none; }
.session-btn {
  padding: 12px 14px;
  font-family: var(--sans);
  font-weight: 300;
  text-transform: uppercase;
  font-size: 13.5px;
  letter-spacing: 0.12em;
  color: var(--controls);
  transition: color 700ms var(--ease-enter), opacity 220ms var(--ease-exit);
}
.session-btn:active { opacity: 0.6; }
@media (hover: hover) {
  .session-btn:hover { color: var(--body-text); }
}

/* ===== Fin ===== */
.end-stage {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 220px;
  height: 220px;
  margin: -110px 0 0 -110px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.30);
  animation: ring-out 5400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: none;
}
.ring.r2 { animation-delay: 900ms; }
.ring.r3 { animation-delay: 1800ms; }
@keyframes ring-out {
  0%   { transform: scale(0.30); opacity: 0; }
  12%  { opacity: 0.42; }
  100% { transform: scale(2.6); opacity: 0; }
}
.ring-single { display: none; }
.end-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 460px;
  height: 460px;
  margin: -230px 0 0 -230px;
  border-radius: 50%;
  background: radial-gradient(closest-side,
    rgba(var(--accent-rgb), 0.09) 0%,
    rgba(var(--accent-rgb), 0.03) 55%,
    rgba(var(--accent-rgb), 0) 78%);
  opacity: 0;
  animation: fade-in 3200ms ease 900ms forwards;
  pointer-events: none;
}
.end-center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 30px;
}
.closing-line {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 31px;
  letter-spacing: 0.03em;
  color: var(--list-text);
  text-wrap: balance;
  opacity: 0;
  animation: line-in 1800ms var(--ease-enter) 1100ms forwards;
}
@keyframes line-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.end-center .link--volver {
  margin-top: 46px;
  opacity: 0;
  animation: fade-in 2000ms ease 2600ms forwards;
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.kanji--end {
  position: absolute;
  bottom: calc(46px + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  text-align: center;
  opacity: 0;
  animation: kanji-in 3000ms ease 3400ms forwards;
}
@keyframes kanji-in {
  from { opacity: 0; }
  to   { opacity: 0.16; }
}

/* ===== Movimiento reducido ===== */
@media (prefers-reduced-motion: reduce) {
  @keyframes rise {
    from { opacity: 0; transform: none; }
    to   { opacity: 1; transform: none; }
  }
  .breath-circle {
    animation: none;
    transform: scale(1.04);
    opacity: 0.52;
  }
  .ring { animation: none; opacity: 0; }
  .ring-single {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 220px;
    height: 220px;
    margin: -110px 0 0 -110px;
    border: 1px solid var(--accent);
    border-radius: 50%;
    opacity: 0;
    animation: ring-fade 2000ms ease forwards;
    pointer-events: none;
  }
  @keyframes ring-fade {
    0%   { opacity: 0; }
    50%  { opacity: 0.42; }
    100% { opacity: 0; }
  }
  @keyframes line-in {
    from { opacity: 0; transform: none; }
    to   { opacity: 1; transform: none; }
  }
}
