:root {
  --bg: #ffffff;
  --ink: #111111;
  --dim: rgba(17, 17, 17, 0.32);
  --faint: rgba(17, 17, 17, 0.1);
  --accent: rgba(17, 17, 17, 0.6);
  --measure: 34rem;
}

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

html, body {
  height: 100%;
  height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: "EB Garamond", Garamond, Georgia, "Times New Roman", serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 8vh 6vw 0;
  position: relative;
}

/* soft vignette so thoughts dissolve into the dark at the top */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    var(--bg) 0%,
    rgba(255, 255, 255, 0.85) 12%,
    rgba(255, 255, 255, 0) 34%
  );
  z-index: 5;
}

#stream {
  width: 100%;
  max-width: var(--measure);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 1.55em;
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
  padding-bottom: 0.4em;
}

.thought {
  font-size: clamp(1.35rem, 2.7vw, 1.9rem);
  line-height: 1.5;
  font-weight: 300;
  letter-spacing: 0.005em;
  color: var(--ink);
  opacity: 0;
  transform: translateY(14px);
  animation: rise 1.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* older thoughts recede into the dark */
.thought.settled { color: var(--accent); }
.thought.fading  { color: var(--dim); }
.thought.ghost   { color: var(--faint); }

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

#cursor-line {
  width: 100%;
  max-width: var(--measure);
  flex: 0 0 auto;
  padding: 0.2em 0 8vh;
  font-size: clamp(1.35rem, 2.7vw, 1.9rem);
  line-height: 1.5;
  font-weight: 300;
  z-index: 6;
}

.thought.current { color: var(--ink); }

.caret {
  display: inline-block;
  margin-left: 0.04em;
  color: var(--accent);
  animation: blink 1.05s steps(1) infinite;
  font-weight: 300;
}

@keyframes blink {
  50% { opacity: 0; }
}

#footer {
  position: fixed;
  bottom: 1.4rem;
  right: 1.6rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  z-index: 6;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

@media (max-width: 640px) {
  body { padding: 5vh 8vw 0; }
  #stream { gap: 1.25em; }
  .thought, #cursor-line { font-size: 1.24rem; line-height: 1.45; }
  #cursor-line { padding-bottom: 12vh; }
  #footer { bottom: 1rem; right: 1rem; font-size: 0.62rem; letter-spacing: 0.1em; }
}

@media (prefers-reduced-motion: reduce) {
  .thought { animation-duration: 0.01s; }
  .caret { animation: none; }
}
