*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --bg: #fafaf8;
  --fg: #1a1a1a;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  transition: background-color 1.2s ease, color 1s ease;
}

body.dark {
  background: #0a0a0c;
  color: #e0e0e0;
}

body.friction {
  background: #f0f0ec;
  color: #1a1a1a;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
  animation: grain 8s steps(10) infinite;
}

a {
  color: inherit;
  text-decoration: none;
}

p, h1, h2, h3 {
  margin: 0;
}

@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -10%); }
  30% { transform: translate(3%, -15%); }
  50% { transform: translate(12%, 9%); }
  70% { transform: translate(9%, 4%); }
  90% { transform: translate(-1%, 7%); }
}

.type-serif {
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
}

.section {
  width: 100%;
  position: relative;
}

.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url("./assets/zen-bg.jpeg");
  background-size: cover;
  background-position: center;
  opacity: 0;
  filter: saturate(0.3) contrast(0.9);
  transition: opacity 2.5s ease;
}

.visible .hero-bg {
  opacity: 0.35;
}

.hero-wash {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to bottom, rgba(250,250,248,0.6) 0%, rgba(250,250,248,0.85) 70%, rgba(250,250,248,1) 100%);
}

.center {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 1.5s ease, transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.visible .center,
.visible .fade {
  opacity: 1;
  transform: translateY(0);
}

.enso {
  width: 100px;
  height: 100px;
}

.enso circle {
  fill: none;
  stroke: #888;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 270 36;
  stroke-dashoffset: 306;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 2.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.visible .enso circle {
  stroke-dashoffset: 0;
}

.intro {
  color: #777;
  font-size: 13px;
  letter-spacing: 0.25em;
  text-align: center;
  line-height: 2.2;
  font-weight: 300;
}

.scroll-hint {
  position: absolute;
  bottom: 60px;
  z-index: 2;
  color: #aaa;
  font-size: 11px;
  letter-spacing: 0.3em;
  animation: breathe 4s ease-in-out infinite;
}

.countdown {
  position: absolute;
  bottom: 88px;
  z-index: 2;
  color: #aaa;
  font-size: 11px;
  letter-spacing: 0.3em;
  font-family: "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  animation: breathe 4s ease-in-out infinite;
}

.koan-links {
  position: absolute;
  right: clamp(18px, 4vw, 56px);
  top: 50%;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateY(-50%);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #8a8a86;
  text-align: right;
}

.koan-links a {
  opacity: 0.58;
  transition: opacity 180ms ease;
}

.koan-links a:hover,
.koan-links a.active {
  opacity: 1;
}

.reality-links {
  position: absolute;
  right: clamp(18px, 4vw, 56px);
  bottom: 42px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #777;
  text-align: right;
}

.reality-links a {
  opacity: 0.55;
  transition: opacity 180ms ease;
}

.reality-links a:hover,
.reality-links a.active {
  opacity: 1;
  color: #aaa;
}

.fade {
  max-width: 680px;
  padding: 0 24px;
  text-align: center;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1), transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.kicker {
  color: #aaa;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.35em;
  margin-bottom: 48px;
  text-transform: uppercase;
}

.case-title {
  color: var(--fg);
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.4;
  margin-bottom: 56px;
}

.case-text {
  color: #444;
  font-size: clamp(18px, 3vw, 24px);
  letter-spacing: 0.1em;
  line-height: 2;
}

.case-answer-line {
  margin-top: 24px;
}

.case-answer {
  color: var(--fg);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  margin: 0 6px;
}

.engine {
  position: absolute;
  bottom: 48px;
  opacity: 0;
  transition: opacity 1s ease 0.8s;
}

.visible .engine {
  opacity: 1;
}

.engine p {
  color: #aaa;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  animation: breathe 3s ease-in-out infinite;
}

.friction-screen,
.reality-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 0;
}

.panel {
  max-width: 720px;
  width: 100%;
  padding: 0 32px;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1), transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.visible .panel {
  opacity: 1;
  transform: translateY(0);
}

.friction-box {
  border-left: 1px solid #ccc;
  padding-left: 28px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.warning-title {
  color: #555;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 32px;
}

.friction-intro {
  color: #666;
  font-size: 14px;
  line-height: 2;
  margin-bottom: 36px;
}

.friction-items {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.friction-item {
  opacity: 0;
  transition: opacity 0.8s ease;
}

.visible .friction-item {
  opacity: 1;
}

.friction-item:nth-child(1) {
  transition-delay: 0.3s;
}

.friction-item:nth-child(2) {
  transition-delay: 0.5s;
}

.friction-item h3 {
  color: #333;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.friction-item p {
  color: #777;
  font-size: 13px;
  line-height: 1.9;
}

.system-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 48px;
  padding: 16px 20px;
  color: #555;
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.08);
  font-size: 13px;
  line-height: 1.8;
}

.cursor {
  font-weight: 600;
  animation: cursor-blink 1s step-end infinite;
}

.divider {
  width: 100%;
  height: 45vh;
  position: relative;
  overflow: hidden;
}

.divider-img {
  position: absolute;
  inset: 0;
  background-image: url("./assets/zen-bg.jpeg");
  background-size: cover;
  background-position: center 40%;
  filter: saturate(0.15) brightness(0.4);
}

.divider-wash {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(240,240,236,1) 0%, transparent 25%, transparent 75%, rgba(10,10,12,1) 100%);
}

.reality-screen {
  color: #bbb;
}

.reality-title {
  color: #888;
  text-align: center;
  font-family: "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 24px;
  margin-bottom: 56px;
}

.core {
  color: rgba(255,255,255,0.85);
  text-align: center;
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.8;
  margin-bottom: 64px;
  white-space: pre-line;
}

.reality-items {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.reality-item {
  opacity: 0;
  transition: opacity 1s ease;
}

.visible .reality-item {
  opacity: 1;
}

.reality-item:nth-child(1) {
  transition-delay: 0.5s;
}

.reality-item:nth-child(2) {
  transition-delay: 0.75s;
}

.reality-item:nth-child(3) {
  transition-delay: 1s;
}

.reality-item h3 {
  color: #999;
  font-family: "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.2em;
  margin-bottom: 10px;
}

.reality-item h3 span {
  opacity: 0.5;
}

.reality-item p {
  color: #888;
  font-size: 15px;
  line-height: 2;
}

.final {
  margin-top: 80px;
  padding-top: 56px;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.final-kicker {
  color: #666;
  font-family: "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.final-question {
  color: rgba(255,255,255,0.8);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.1em;
  margin-bottom: 24px;
}

.final-answer {
  max-width: 480px;
  margin: 0 auto;
  color: #777;
  font-size: 15px;
  font-style: italic;
  line-height: 2.2;
}

.bottom-space {
  height: 120px;
}

@media (max-width: 760px) {
  .koan-links {
    top: auto;
    right: 20px;
    bottom: 104px;
    transform: none;
    gap: 8px;
    font-size: 10px;
  }

  .countdown {
    bottom: 84px;
    font-size: 10px;
  }

  .reality-links {
    right: 20px;
    bottom: 28px;
    gap: 8px;
    font-size: 10px;
  }

  .intro {
    padding: 0 24px;
  }

  .friction-box {
    padding-left: 20px;
  }
}
