:root {
  color-scheme: light;
  --paper: #f5f3ee;
  --ink: #1b211e;
  --jade: #315c4b;
  --jade-deep: #164f36;
  --muted: #626b66;
  --line: rgba(22, 79, 54, 0.24);
  --display: "Newsreader", Georgia, serif;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
a {
  font: inherit;
  touch-action: manipulation;
}

button { cursor: pointer; }

.analysis-shell {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background-color: var(--paper);
  background-image: url('/assets/ink-mirror/analysis-transition-desktop-v101.jpg');
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.analysis-shell::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  background: radial-gradient(circle at 50% 44%, rgba(250, 249, 246, 0.32), transparent 35%);
}

button:focus-visible,
.secondary-action:focus-visible {
  outline: 2px solid var(--jade-deep);
  outline-offset: 4px;
}

.analysis-stage {
  width: min(100%, 1440px);
  min-height: 100svh;
  margin: 0 auto;
  padding: 96px 32px 64px;
  display: grid;
  place-items: center;
}

.analysis-state {
  width: min(100%, 680px);
  margin-top: -3.5vh;
  display: grid;
  justify-items: center;
  text-align: center;
  animation: state-enter 460ms ease-out both;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(38px, 3.45vw, 52px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.brush-stroke {
  width: clamp(246px, 24vw, 330px);
  height: auto;
  margin-top: 25px;
  opacity: 0.82;
  transform-origin: center;
  animation: brush-breathe 2.8s ease-in-out infinite;
}

.recovery-state {
  width: min(100%, 560px);
  margin-top: -2vh;
  text-align: center;
  animation: state-enter 360ms ease-out both;
}

.recovery-state .eyebrow {
  margin: 0 0 13px;
  color: var(--jade);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.recovery-state h1 {
  max-width: 14ch;
  margin-inline: auto;
}

.recovery-state > p:not(.eyebrow) {
  max-width: 46ch;
  margin: 17px auto 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.recovery-actions {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.primary-action,
.secondary-action {
  min-height: 48px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.primary-action {
  border: 1px solid var(--jade-deep);
  background: var(--jade-deep);
  color: #fffdf8;
}

.secondary-action {
  border: 1px solid var(--line);
  color: var(--jade-deep);
  background: rgba(248, 247, 243, 0.62);
}

.primary-action:hover { background: #103f2d; }
.secondary-action:hover { border-color: rgba(22, 79, 54, 0.5); }
.primary-action:active,
.secondary-action:active { transform: scale(0.985); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes state-enter {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes brush-breathe {
  0%, 100% { opacity: 0.68; transform: scaleX(0.985); }
  50% { opacity: 0.9; transform: scaleX(1); }
}

@media (max-width: 700px) {
  .analysis-shell {
    background-image: url('/assets/ink-mirror/analysis-transition-mobile-v101.jpg');
    background-position: center;
  }

  .analysis-shell::after {
    background: radial-gradient(circle at 50% 42%, rgba(250, 249, 246, 0.3), transparent 39%);
  }

  .analysis-stage {
    padding: 88px 24px 44px;
  }

  .analysis-state {
    margin-top: -2vh;
  }

  h1 {
    max-width: 12ch;
    font-size: clamp(32px, 9.2vw, 39px);
    line-height: 1.04;
  }

  .brush-stroke {
    width: min(52vw, 210px);
    margin-top: 22px;
  }

  .recovery-state {
    margin-top: -5vh;
  }

  .recovery-state > p:not(.eyebrow) {
    max-width: 32ch;
    font-size: 13px;
  }

  .recovery-actions {
    width: min(100%, 320px);
    margin-inline: auto;
    display: grid;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
    min-height: 50px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
