/* Chit demo overrides. Tokens, layout shell, .btn/.pill from lab/. */

* { box-sizing: border-box; }

html, body { height: 100%; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  overflow: hidden;
}

a { color: inherit; }

/* -- Cover -- */
.hero {
  max-width: 44rem;
  margin: 0 auto;
  width: 100%;
  padding: clamp(2rem, 6vh, 3rem) clamp(1rem, 4vw, 2.5rem);
}
.hero-copy { text-align: center; }

.hero-brand {
  margin: 0 0 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  line-height: 1;
  animation: rise 0.8s var(--ease) both;
}
.hero-brand img {
  display: block;
  width: clamp(6.75rem, 18vw, 9.5rem);
  height: auto;
  background: transparent;
}
.hero-brand span {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero h1 {
  margin: 0 auto;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.45rem, 3.2vw, 2.2rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  max-width: 22ch;
  animation: rise 0.8s var(--ease) 0.08s both;
}

.hero-lede {
  margin: 1.15rem auto 0;
  max-width: 36rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
  animation: rise 0.8s var(--ease) 0.14s both;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1.75rem;
  animation: rise 0.8s var(--ease) 0.2s both;
}

.btn-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.btn-icon-ext {
  width: 11px;
  height: 11px;
  opacity: 0.88;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* Form buttons in demo panes (anchors use lab .btn) */
button {
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  border: 0;
  border-radius: 8px;
  padding: 0.65rem 1.05rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 120ms ease, filter 120ms ease, background 120ms ease;
}
button.primary {
  background: var(--ink);
  color: var(--paper);
}
button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.danger {
  background: var(--danger);
  color: #fff8f6;
}
button:hover { filter: brightness(1.05); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

/* -- Demo slide -- */
.demo-slide {
  justify-content: center;
  padding: clamp(1.5rem, 4vh, 2.5rem) clamp(1rem, 4vw, 2.5rem);
}
.demo-inner {
  width: min(900px, 100%);
  margin: 0 auto;
}

.demo-header {
  padding: 0.85rem 1rem 0.95rem;
  background: color-mix(in srgb, var(--paper) 70%, #fff);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.demo-header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}
.demo-header-left,
.demo-header-mid,
.demo-header-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.demo-header-mid {
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}
.demo-header-stats {
  margin-top: 0;
  justify-content: flex-end;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.demo-session {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.7rem 0.28rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--ink);
  background: color-mix(in srgb, var(--paper-2) 55%, #fff);
}
.mode-badge-icon {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
}
.mode-badge[data-mode="demo"] {
  border-color: color-mix(in srgb, var(--sea) 35%, var(--line));
  color: var(--ink);
  background: color-mix(in srgb, var(--sky) 40%, #fff);
}
.weather-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem 0.35rem 0.5rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: color-mix(in srgb, var(--paper-2) 50%, #fff);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 6%, transparent);
  animation: toastIn 220ms var(--ease);
}
.weather-chip[hidden] {
  display: none !important;
}
.weather-chip[data-condition="sunny"] {
  border-color: #e3a008;
  color: #8a5a00;
  background: linear-gradient(135deg, #fff7d6 0%, #ffe08a 100%);
}
.weather-chip[data-condition="cloudy"] {
  border-color: #8a93a3;
  color: #3d4654;
  background: linear-gradient(135deg, #eef1f5 0%, #cfd6e0 100%);
}
.weather-chip[data-condition="rainy"] {
  border-color: color-mix(in srgb, var(--sea) 70%, #1a4a7a);
  color: #0f3d66;
  background: linear-gradient(135deg, #d7ebff 0%, #8ec5f5 100%);
}
.weather-icon {
  display: inline-flex;
  width: 1.35rem;
  height: 1.35rem;
}
.weather-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.weather-temp {
  white-space: nowrap;
}
.demo-header .pill {
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.demo-header .pill.live {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--line));
  color: var(--ok);
}
.demo-header .pill.revoked {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  color: var(--danger);
}
.stat-unit {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  margin-left: 0.2rem;
  color: var(--ink);
  font-weight: 650;
  line-height: 1;
  vertical-align: middle;
}
.stat-unit img {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}
.demo-header-stats .stat {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem;
  line-height: 1.2;
}
.guide-meter {
  margin-top: 0.55rem;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.guide-meter-fill {
  height: 100%;
  background: var(--sea);
  transition: width 280ms var(--ease);
}

.toast-stack {
  position: fixed;
  top: clamp(0.75rem, 2vh, 1.25rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(28rem, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 88%, #fff);
  box-shadow: 0 8px 24px rgba(28, 36, 48, 0.1);
  overflow: hidden;
  animation: toastIn 200ms var(--ease);
}
.toast-out {
  animation: toastOut 200ms var(--ease) forwards;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-0.4rem); }
  to { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-0.35rem); }
}

.toast-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.7rem 0.75rem 0.55rem 0.9rem;
}
.toast-msg {
  margin: 0;
  flex: 1 1 auto;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--ink);
}
.toast-close {
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.15rem;
  line-height: 1;
}
.toast-close:hover {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  color: var(--ink);
}

.toast-bar {
  height: 3px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}
.toast-bar-fill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(1);
  background: var(--sea);
}

.toast-ok {
  border-color: color-mix(in srgb, var(--ok) 35%, var(--line));
}
.toast-ok .toast-bar-fill { background: var(--ok); }

.toast-warn {
  border-color: color-mix(in srgb, var(--warn) 40%, var(--line));
}
.toast-warn .toast-bar-fill { background: var(--warn); }

.toast-error {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
}
.toast-error .toast-bar-fill { background: var(--danger); }

.toast-info .toast-bar-fill { background: var(--sea); }

/* Role slideshow - fixed card height keeps tab bar steady */
.role-slideshow {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  margin-top: 1.1rem;
}

.slide-arrow {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 85%, #fff);
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ink);
  z-index: 2;
}

.role-viewport {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--paper) 78%, #fff);
  height: 22rem;
}

.role-track {
  width: 100%;
  height: 100%;
}

.role-slide {
  display: none;
  box-sizing: border-box;
  height: 22rem;
  padding: 1.35rem 1.5rem 1.4rem;
  overflow: hidden;
  text-align: left;
}

.role-slide.is-active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: roleIn 280ms var(--ease);
}

@keyframes roleIn {
  from { opacity: 0; transform: translateX(0.75rem); }
  to { opacity: 1; transform: none; }
}

.pane-head {
  margin: 0 0 1rem;
  width: 100%;
  max-width: 40rem;
  text-align: center;
}
.pane-role {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.pane-head h3 {
  margin: 0.25rem 0 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}
.pane-head .lede {
  margin: 0.45rem auto 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.4;
  max-width: 36rem;
  white-space: normal;
  text-wrap: balance;
}

/* One row for all fields (Operator has 3) — shared card height for every role. */
.field-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.85rem 1.15rem;
  width: 100%;
  max-width: 40rem;
  margin-bottom: 1rem;
}
.field-row > label {
  flex: 1 1 0;
  min-width: 0;
  margin-bottom: 0;
}
.field-single {
  width: min(16rem, 100%);
  max-width: 40rem;
  margin: 0 auto 1rem;
  align-self: center;
}

.field-with-tip { display: block; }
.field-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.tip-btn {
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 70%, #fff);
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
}

.role-slide label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.role-slide input,
.role-slide select {
  font: inherit;
  font-weight: 500;
  font-size: 1rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  width: 100%;
  min-width: 0;
  min-height: 2.6rem;
}
.role-slide select {
  cursor: pointer;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.25rem;
  width: 100%;
  max-width: 40rem;
}
.actions button {
  font-size: 0.98rem;
  padding: 0.7rem 1.15rem;
  min-height: 2.6rem;
}

.svc-card {
  width: 100%;
  max-width: 40rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  background: #fff;
  text-align: left;
}
.svc-card.ok {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--line));
}
.svc-status {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--ink-soft);
}
.svc-card.ok .svc-status { color: var(--ok); }
.svc-next {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 40rem;
  margin-top: 1rem;
}
.svc-next[hidden] {
  display: none !important;
}
.svc-next .primary {
  min-width: 10rem;
}
.log.compact {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.role-slide.flash-revoke {
  animation: flashRevoke 0.7s var(--ease);
}
@keyframes flashRevoke {
  0%, 100% { background: transparent; }
  40% { background: color-mix(in srgb, var(--danger) 12%, transparent); }
}

.role-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.9rem;
  min-height: 2.4rem;
  align-items: center;
}
.role-dots button {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.role-dots button[aria-selected="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* -- Use cases -- */
.use-cases-slide {
  padding: clamp(2rem, 6vh, 3.5rem) clamp(1rem, 4vw, 2.5rem);
}
.section-pad {
  width: min(640px, 100%);
  margin: 0 auto;
}
.section-head {
  text-align: center;
  margin-bottom: 1.75rem;
}
.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.section-head p {
  margin: 0.65rem 0 0;
  color: var(--ink-soft);
}

.use-case-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.use-case-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  min-height: 0;
  transition: transform 160ms var(--ease), border-color 160ms ease, box-shadow 160ms ease;
}
.use-case-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--sea) 40%, var(--line));
  box-shadow: 0 8px 24px rgba(28, 36, 48, 0.08);
}
.use-case-icon {
  flex: 0 0 auto;
  width: 3.25rem;
  height: 3.25rem;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--sky) 55%, var(--paper));
  color: var(--sea);
}
.use-case-icon svg {
  width: 1.75rem;
  height: 1.75rem;
}
.use-case-copy {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.use-case-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.use-case-card p {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.35;
  max-width: 36ch;
}

@media (max-width: 900px) {
  .slide-arrow { width: 2.1rem; height: 2.1rem; }
  .role-viewport,
  .role-slide { height: 26rem; }
  .field-row { flex-wrap: wrap; }
  .field-row > label { flex: 1 1 9rem; }
  .use-case-card h3 { white-space: normal; }
  .use-case-card p { max-width: 32ch; }
}

.home-mark {
  position: fixed;
  top: max(1.5rem, calc(env(safe-area-inset-top, 0px) + 1rem));
  left: max(1.5rem, calc(env(safe-area-inset-left, 0px) + 1rem));
  z-index: 15;
  display: block;
  line-height: 0;
  opacity: 0.72;
  transition: opacity 0.2s var(--ease);
}
.home-mark img {
  display: block;
  width: clamp(2.4rem, 7vw, 3.1rem);
  height: auto;
}
.home-mark:hover,
.home-mark:focus-visible {
  opacity: 1;
  outline: none;
}
.home-mark:focus-visible {
  outline: 2px solid var(--sea);
  outline-offset: 4px;
}
