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

:root {
  --bg: #000;
  --fg: #f2f2f2;
  --dim: #7d7d7d;
  --soft: #f3c9c4; /* the nose */
}

html { background: var(--bg); scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.dim { color: var(--dim); }
.small { font-size: 0.95rem; letter-spacing: 0.02em; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible { outline: 1px solid var(--dim); outline-offset: 6px; border-radius: 999px; }

/* ---------- screens ---------- */

.screen {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2rem;
  padding: 6rem 1.5rem;
  text-align: center;
  position: relative;
}

.line p {
  font-size: clamp(1.4rem, 3.2vw, 2.25rem);
  font-weight: 400;
  line-height: 1.45;
  max-width: 22ch;
}

/* fade in as things come into view */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1.4s ease, transform 1.4s ease;
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- hero ---------- */

.hero { overflow: hidden; }

.hero-center {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 1.4rem;
}

.hero-line {
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  opacity: 0;
  animation: fade 2.4s ease 0.4s forwards;
}

.peek {
  position: absolute;
  right: -9vmin;
  bottom: -6vmin;
  width: min(62vmin, 560px);
  height: auto;
  transform: translate(30%, 30%);
  opacity: 0;
  animation: peek 1.8s cubic-bezier(.2,.7,.2,1) 1.6s forwards;
  pointer-events: none;
  user-select: none;
}

.scroll-hint {
  position: absolute;
  bottom: 1.75rem;
  left: 50%;
  translate: -50% 0;
  color: var(--dim);
  font-size: 1.1rem;
  opacity: 0;
  animation: fade 1.5s ease 3.6s forwards, bob 2.6s ease-in-out 3.6s infinite;
}

@keyframes fade { to { opacity: 1; } }
@keyframes peek { to { transform: translate(0, 0); opacity: 1; } }
@keyframes bob  { 50% { transform: translateY(6px); } }

/* ---------- ca, under the hello ---------- */

.ca-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  max-width: min(92vw, 34rem);
  min-height: 40px;
  padding: 0.5rem 0.9rem 0.5rem 0.6rem;
  border: 1px solid #222;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--dim);
  font-size: 0.82rem;
  opacity: 0;
  animation: fade 2s ease 1.4s forwards;
  transition: border-color 0.4s ease, color 0.4s ease, background 0.4s ease;
}
.ca-pill:not(:disabled):hover { border-color: #444; color: var(--fg); background: rgba(255, 255, 255, 0.04); }
.ca-tag {
  flex: none;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: #151515;
  color: #9a9a9a;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.ca-pill .ca-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8rem;
}
.ca-pill:disabled .ca-label { font-family: inherit; }
.ca-icon { flex: none; opacity: 0.7; }
.ca-pill:disabled .ca-icon { display: none; }
.ca-pill:disabled { opacity: 1; cursor: default; }

/* ---------- portrait ---------- */
/* the photo is cropped on its right and bottom edges, so the cat always
   sits in a screen corner: here mirrored into the bottom-left */

.portrait {
  overflow: hidden;
  justify-items: end;
  padding-right: max(8vw, 1.5rem);
}
.portrait img {
  position: absolute;
  left: 0;
  bottom: 0;
  width: min(92vmin, 760px);
  height: auto;
  transform: scaleX(-1);
  pointer-events: none;
}
.caption {
  position: relative;
  z-index: 1;
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  max-width: 18ch;
  text-align: right;
  text-wrap: balance;
}
.portrait img.reveal { transform: scaleX(-1) translateY(14px); }
.portrait img.reveal.in { transform: scaleX(-1); }

@media (max-width: 700px) {
  .portrait {
    align-content: start;
    justify-items: center;
    padding: 22vh 1.5rem 0;
  }
  .caption { text-align: center; max-width: 24ch; }
  .portrait img { width: min(96vw, 520px); }
}

/* ---------- breathe ---------- */

.breath {
  position: relative;
  width: min(62vmin, 320px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.breath-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid #2a2a2a;
  background: radial-gradient(circle, rgba(243, 201, 196, 0.10), rgba(243, 201, 196, 0) 70%);
  transform: scale(0.55);
  transition: transform 4s ease-in-out, border-color 4s ease, background 4s ease;
}
.breath.inhale .breath-ring {
  transform: scale(1);
  border-color: #4a4a4a;
  background: radial-gradient(circle, rgba(243, 201, 196, 0.18), rgba(243, 201, 196, 0) 70%);
}
.breath-label {
  position: relative;
  font-size: 1.05rem;
  color: var(--fg);
  transition: opacity 0.6s ease;
}

/* ---------- again ---------- */

.reassure {
  font-size: clamp(1.5rem, 3.6vw, 2.5rem);
  min-height: 3em;
  display: grid;
  place-items: center;
  max-width: 20ch;
  transition: opacity 0.5s ease;
}
.reassure.swap { opacity: 0; }

.again-btn {
  border: 1px solid #333;
  border-radius: 999px;
  padding: 0.85rem 1.6rem;
  font-size: 0.98rem;
  color: var(--fg);
  transition: border-color 0.3s ease, background 0.3s ease;
}
.again-btn:hover { border-color: #777; background: #0d0d0d; }
.again-btn:active { transform: translateY(1px); }

.count { min-height: 1.5em; }

/* ---------- footer ---------- */

footer {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  align-content: start;
  justify-items: center;
  text-align: center;
  gap: 0.4rem;
  padding: 26vh 1.5rem 0;
  position: relative;
  overflow: hidden;
}
footer > p:first-of-type { font-size: clamp(1.6rem, 3.4vw, 2.4rem); }
.foot-cat {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(48vmin, 440px);
  height: auto;
  pointer-events: none;
}
@media (max-width: 600px) { .foot-cat { width: 62vw; } }

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- x ---------- */

.corner {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  opacity: 0;
  animation: fade 1.5s ease 3.6s forwards;
}
.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1.25rem;
}
.links .x-link { margin-top: 0; }
.ca-foot:disabled { cursor: default; opacity: 0.6; }
.x-corner {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--dim);
  transition: color 0.3s ease, background 0.3s ease;
}
.x-corner:hover { color: var(--fg); background: #111; }

.x-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding: 0.7rem 1.3rem;
  border: 1px solid #333;
  border-radius: 999px;
  color: var(--fg);
  text-decoration: none;
  font-size: 0.95rem;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.x-link:hover { border-color: #777; background: #0d0d0d; }
.x-corner:focus-visible, .x-link:focus-visible { outline: 1px solid var(--dim); outline-offset: 4px; }

/* ---------- music ---------- */

.yt { position: fixed; width: 1px; height: 1px; left: -9999px; top: 0; opacity: 0; pointer-events: none; }

.music-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  height: 36px;
  padding: 0 0.95rem;
  border: 1px solid #2a2a2a;
  border-radius: 999px;
  color: var(--dim);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  background: rgba(0,0,0,0.6);
  transition: color 0.3s ease, border-color 0.3s ease;
}
.music-btn:hover { color: var(--fg); border-color: #666; }
.music-btn.on { color: var(--fg); }

.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; }
.bars i {
  display: block;
  width: 2px;
  height: 3px;
  background: currentColor;
  border-radius: 1px;
}
.music-btn.on .bars i { animation: eq 1.1s ease-in-out infinite; }
.music-btn.on .bars i:nth-child(2) { animation-delay: -0.4s; }
.music-btn.on .bars i:nth-child(3) { animation-delay: -0.8s; }
.music-btn.on .bars i:nth-child(4) { animation-delay: -0.2s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 11px; } }

@media (max-width: 600px) { .scroll-hint { display: none; } }

@media (max-width: 420px) {
  .music-btn:not(.muted) .music-label { display: none; }
  .music-btn { padding: 0 0.8rem; }
}
