/**
 * Mezzo — Try It Page Styles
 * Three-state page: mic permission → calibration landing → returning user.
 * Uses design token custom properties exclusively.
 */

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

.hidden {
  display: none !important;
}

/* ── Base ── */
html {
  overflow-y: scroll;
}

body {
  background: var(--surface);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════════
   Page Layout
   ═══════════════════════════════════════════ */

.page {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: background 0.3s ease, backdrop-filter 0.3s ease, -webkit-backdrop-filter 0.3s ease;
}

.nav-scrolled {
  background: var(--surface-nav, rgba(240, 235, 226, 0.9));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.type-nav-wordmark {
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-link {
  text-decoration: none;
  font-family: var(--font-body);
  font-weight: var(--weight-regular);
  font-size: 14px;
  transition: opacity 0.2s ease;
}

.nav-link:hover {
  opacity: 0.7;
}

.nav-link-quiet {
  color: var(--text-subdued);
}

.nav-link-active {
  color: var(--text-default);
  cursor: default;
  padding-bottom: 3px;
  border-bottom: 4px solid rgba(194, 92, 65, 0.5);
}

.nav-link-active:hover {
  opacity: 1;
}

/* ═══════════════════════════════════════════
   State Views (centered content)
   ═══════════════════════════════════════════ */

.page-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10vh 32px 32px;
}

/* Fade transitions between states (opacity only, no translateY) */
.state-view {
  transition: opacity 300ms ease;
}

/* 6-column centered container within the content area */
.state-col {
  width: 100%;
  max-width: 520px;
}

/* ═══════════════════════════════════════════
   Content Spacing
   ═══════════════════════════════════════════ */

.state-heading {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-heading-to-content);
}

.state-body {
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-circle-to-button);
}

.state-micro {
  margin-top: var(--space-button-to-micro);
}

.state-micro-revoke {
  margin-top: 8px;
  color: var(--text-subdued);
  font-family: var(--font-body);
  font-weight: var(--weight-light);
  font-size: 12px;
  line-height: 150%;
}

/* ═══════════════════════════════════════════
   Ready to Monitor (State C / Complete)
   ═══════════════════════════════════════════ */

.state-ready .state-col {
  margin-bottom: 0;
}

.state-footer {
  margin-top: 72px;
  text-align: center;
}

.state-footer-text {
  color: var(--text-subdued);
  margin-top: 2px;
}

.btn-recalibrate-link {
  display: block;
  background: none;
  border: none;
  color: var(--hanko-text);
  font-family: var(--font-body);
  font-weight: var(--weight-regular);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  margin: 48px auto 0;
  text-decoration: none;
  transition: var(--transition-hover);
}

.btn-recalibrate-link:hover {
  text-decoration: underline;
}

/* ═══════════════════════════════════════════
   Calibration Content Area (crossfade)
   Heading stays static; pre-content and
   listen-content swap via .state-listening.
   ═══════════════════════════════════════════ */

.cal-content-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 220px;
  width: 100%;
}

.cal-pre-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: absolute;
  top: 0;
  width: 100%;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Reset state-body bottom margin inside cal-pre-content (spacing is handled by the content-area) */
.cal-pre-content .state-body {
  margin-bottom: 40px;
}

.cal-listen-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: absolute;
  top: 0;
  width: 100%;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease 0.3s, transform 0.5s ease 0.3s;
  pointer-events: none;
}

/* Active listening state */
#state-b.state-listening .cal-pre-content {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

#state-b.state-listening .cal-listen-content {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.cal-countdown {
  font-family: var(--font-body);
  font-weight: var(--weight-light);
  font-size: 17px;
  color: var(--hanko-text);
  letter-spacing: 0.2px;
  margin-bottom: 24px;
}

/* ═══════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════ */

.btn-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  width: 14px;
  height: 19px;
  flex-shrink: 0;
}

.btn-wide {
  padding: 16px 64px;
  min-width: 240px;
}

/* ═══════════════════════════════════════════
   Ring Circle (Calibrating View)
   ═══════════════════════════════════════════ */

.ring-container {
  position: relative;
  width: var(--circle-within);
  height: var(--circle-within);
  margin-inline: auto;
  margin-bottom: var(--space-circle-to-button);
}

.ring-variant {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.ring-variant.active {
  opacity: 1;
}

@keyframes gentle-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.ring-container.pulsing {
  animation: gentle-pulse 3s ease-in-out infinite;
}

/* ═══════════════════════════════════════════
   Recalibrate Button
   ═══════════════════════════════════════════ */

.btn-recalibrate {
  background: none;
  border: none;
  color: var(--hanko-text);
  font-family: var(--font-body);
  font-weight: var(--weight-regular);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 16px;
  margin-top: var(--space-heading-to-content);
  transition: var(--transition-hover);
}

.btn-recalibrate:hover {
  opacity: 0.7;
}

/* ═══════════════════════════════════════════
   Long Microcopy (Calibration Complete)
   ═══════════════════════════════════════════ */

.state-micro-long {
  margin-top: var(--space-page-gap);
}

/* ═══════════════════════════════════════════
   Denied Help Text
   ═══════════════════════════════════════════ */

.denied-help {
  margin-top: var(--space-heading-to-content);
  color: var(--text-subdued);
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

/* ═══════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════ */

@media (min-width: 900px) {
  .nav {
    padding-left: 120px;
    padding-right: 120px;
  }

  .state-col {
    max-width: calc((100vw - 240px) / 2);
  }

  .state-heading {
    max-width: 700px;
  }
}
