/* Animation choreography */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-0.42em); filter: blur(4px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(15%) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.86); }
  72% { opacity: 1; transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
  0% { transform: translateX(-120%) skewX(-18deg); opacity: 0; }
  18% { opacity: 0.9; }
  70%, 100% { transform: translateX(780%) skewX(-18deg); opacity: 0; }
}

@keyframes progressLoad {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes progressDot {
  from { left: 0; }
  to { left: 100%; }
}

@keyframes dotPulse {
  0%, 100% { opacity: 0.25; transform: scale(0.72); }
  45% { opacity: 1; transform: scale(1); }
}

@keyframes gentlePulse {
  0%, 100% { transform: scale(1); opacity: 0.68; }
  50% { transform: scale(1.06); opacity: 1; }
}

@keyframes arrowDrop {
  from { opacity: 0; transform: translateY(-32%) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes deductionEmphasis {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(255, 95, 103, 0)); transform: scale(1); }
  44% { filter: drop-shadow(0 0 12px rgba(255, 95, 103, 0.55)); transform: scale(1.035); }
}

@keyframes netEmphasis {
  0%, 100% { box-shadow: 0 15px 38px rgba(253, 105, 53, 0.23); filter: brightness(1); }
  46% { box-shadow: 0 18px 48px rgba(253, 105, 53, 0.36); filter: brightness(1.08); }
}

@keyframes tickRise {
  from { opacity: 0.16; transform: scaleY(0.28); }
  to { opacity: 0.88; transform: scaleY(1); }
}

@keyframes lineReveal {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes orbit {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.is-animating .slide-title {
  animation: fadeDown 560ms cubic-bezier(.2,.8,.2,1) both;
}

.is-animating .slide-subtitle,
.is-animating .cover-badge,
.is-animating .question-amounts,
.is-animating .verdict-visual,
.is-animating .overview-grid,
.is-animating .offer-ticket,
.is-animating .offer-snapshot,
.is-animating .comparison-scale,
.is-animating .big-cost,
.is-animating .cost-reveal,
.is-animating .cost-formula,
.is-animating .day-counter,
.is-animating .daily-meter,
.is-animating .rate-pill,
.is-animating .schedule-card,
.is-animating .deadline-stage,
.is-animating .deadline-caption,
.is-animating .timeline,
.is-animating .step-list,
.is-animating .verification-card,
.is-animating .context-banner,
.is-animating .check-columns,
.is-animating .permission-grid,
.is-animating .privacy-shield,
.is-animating .statement-copy,
.is-animating .warning-tape,
.is-animating .quote-card,
.is-animating .slide-list,
.is-animating .red-flag-stack,
.is-animating .audience-card,
.is-animating .checklist-grid,
.is-animating .final-verdict-card,
.is-animating .kwarta-mark,
.is-animating .store-pill,
.is-animating .sources-layout {
  animation: riseIn 620ms 140ms cubic-bezier(.2,.8,.2,1) both;
}

.is-animating .cover-orbit {
  animation: orbit 24s linear infinite;
}

.is-animating .number-card {
  animation: riseIn 520ms var(--delay) cubic-bezier(.18,.82,.25,1) both;
}

.is-animating .math-cliffhanger {
  animation: riseIn 520ms 820ms cubic-bezier(.18,.82,.25,1) both;
}

.is-animating .money-card {
  animation: riseIn 520ms var(--delay) cubic-bezier(.18,.82,.25,1) both;
}

.is-animating .money-flow-arrow {
  animation: arrowDrop 420ms var(--delay) cubic-bezier(.18,.82,.25,1) both;
}

.is-animating .money-card--deduction strong {
  animation: deductionEmphasis 680ms 1.08s ease-out 1 both;
}

.is-animating .money-card--net {
  animation-name: riseIn, netEmphasis;
  animation-duration: 520ms, 820ms;
  animation-delay: var(--delay), 1.36s;
  animation-timing-function: cubic-bezier(.18,.82,.25,1), ease-out;
  animation-fill-mode: both, both;
}

.is-animating .money-shimmer {
  animation: shimmer 1.35s 1.32s ease-in-out 1 both;
}

.is-animating .money-progress span {
  animation: progressLoad 1.1s 0.85s cubic-bezier(.18,.82,.25,1) both;
}

.is-animating .money-progress i {
  animation: progressDot 1.1s 0.85s cubic-bezier(.18,.82,.25,1) both;
}

.is-animating .cost-reveal__bridge {
  animation: popIn 540ms 620ms cubic-bezier(.18,.82,.25,1) both;
}

.is-animating .daily-ticks span {
  transform-origin: bottom;
  animation: tickRise 480ms var(--d) cubic-bezier(.18,.82,.25,1) both;
}

.is-animating .deadline-line span {
  transform-origin: left center;
  animation: lineReveal 820ms 520ms cubic-bezier(.18,.82,.25,1) both;
}

.is-animating .loading-accent span {
  animation: dotPulse 1.1s ease-in-out infinite;
}

.is-animating .loading-accent span:nth-child(2) { animation-delay: 0.18s; }
.is-animating .loading-accent span:nth-child(3) { animation-delay: 0.36s; }

.is-animating .privacy-pulse {
  animation: gentlePulse 2.4s ease-in-out infinite;
}

.is-reduced-motion * {
  animation-duration: 1ms !important;
  animation-iteration-count: 1 !important;
  scroll-behavior: auto !important;
  transition-duration: 1ms !important;
}

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

/* Toasts */
.toast-region {
  position: fixed;
  z-index: 999;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: min(360px, calc(100vw - 36px));
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  background: rgba(11, 24, 40, 0.96);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.35);
  font-size: 0.8rem;
  font-weight: 750;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast--success {
  border-color: rgba(72, 213, 151, 0.35);
}

.toast--danger {
  border-color: rgba(255, 95, 103, 0.38);
}

/* Responsive */
@media (max-width: 1100px) {
  .hero-panel {
    grid-template-columns: 1fr 0.8fr;
    gap: 30px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .project-card {
    grid-template-columns: minmax(220px, 0.65fr) 1fr;
  }

  .editor-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .form-grid--three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .presenter-workspace {
    grid-template-columns: minmax(0, 1fr) minmax(270px, 31vw);
  }

  .speaker-notes__header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 820px) {
  .page-wrap {
    width: min(100% - 24px, 720px);
  }

  .site-header {
    padding-inline: 14px;
  }

  .brand-lockup strong {
    font-size: 0.86rem;
  }

  .brand-lockup small {
    display: none;
  }

  .hero-panel {
    min-height: auto;
    grid-template-columns: 1fr;
    margin-top: 18px;
    padding: 34px 26px;
  }

  .hero-visual {
    min-height: 260px;
  }

  .dashboard-toolbar,
  .editor-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .editor-heading__actions {
    width: 100%;
  }

  .editor-heading__actions .btn {
    flex: 1;
  }

  .editor-layout {
    grid-template-columns: 1fr;
  }

  .source-meta-grid {
    grid-template-columns: 1fr;
  }

  .calculation-panel {
    position: relative;
    top: auto;
  }

  .presenter-shell {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .presenter-toolbar {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .presenter-toolbar .mode-switch {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
  }

  .presenter-toolbar__actions {
    grid-column: 2;
    grid-row: 1;
  }

  .presenter-workspace {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(260px, 1fr);
    overflow: auto;
  }

  .stage-area {
    min-height: auto;
    padding: 12px;
  }

  .stage-mount {
    width: 100%;
    max-height: none;
  }

  .speaker-notes {
    min-height: 46dvh;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .speaker-notes__header {
    align-items: center;
    flex-direction: row;
  }

  .speaker-notes__body p {
    font-size: calc(clamp(1.25rem, 5vw, 2rem) * var(--presenter-text-scale));
  }

  .mode-broll .presenter-workspace {
    display: grid;
    grid-template-rows: 1fr;
    overflow: hidden;
  }

  .mode-broll .stage-area {
    min-height: 0;
  }

  .mode-broll .stage-mount {
    width: min(100%, calc((100dvh - 190px) * 16 / 9));
  }

  .notes-focus .presenter-workspace {
    grid-template-rows: 1fr;
  }

  .notes-focus .speaker-notes {
    min-height: 0;
  }

  .presenter-controls {
    grid-template-columns: auto 1fr auto;
    gap: 8px;
  }

  .control-options {
    display: none;
  }
}

@media (max-width: 620px) {
  .site-header {
    min-height: 62px;
  }

  .header-actions .btn--ghost {
    display: none;
  }

  .brand-mark {
    width: 38px;
  }

  .header-actions .btn--primary {
    min-height: 40px;
    padding-inline: 12px;
    font-size: 0.75rem;
  }

  .hero-panel h1 {
    font-size: clamp(2.2rem, 13vw, 3.5rem);
  }

  .hero-actions,
  .toolbar-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .hero-visual {
    min-height: 210px;
  }

  .hero-stage-card--main {
    padding: 20px;
  }

  .dashboard-toolbar {
    margin-top: 52px;
  }

  .project-card {
    grid-template-columns: 1fr;
  }

  .project-card__preview {
    min-height: 180px;
  }

  .project-card__body {
    padding: 22px;
  }

  .project-card__actions .btn {
    flex: 1;
  }

  .ola-search-form,
  .ola-result {
    grid-template-columns: 1fr;
  }

  .ola-result .btn {
    justify-self: stretch;
  }

  .phone-share-tip {
    align-items: flex-start;
  }

  .editor-shell {
    padding-top: 28px;
  }

  .editor-heading__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .form-grid--two,
  .form-grid--three {
    grid-template-columns: 1fr;
  }

  .form-section {
    padding: 22px 18px;
  }

  .editor-bottom-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .presenter-toolbar {
    min-height: 56px;
    padding: 8px 10px;
  }

  .presenter-toolbar__left strong {
    max-width: 130px;
    font-size: 0.76rem;
  }

  .presenter-toolbar__left small {
    font-size: 0.58rem;
  }

  .presenter-toolbar__actions .icon-btn:nth-child(2) {
    display: none;
  }

  .mode-switch button {
    min-height: 30px;
    padding-inline: 18px;
  }

  .speaker-notes__header {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .speaker-notes__body {
    padding: 22px 18px;
  }

  .presenter-controls {
    min-height: 64px;
    padding-inline: 10px;
  }

  .control-arrow {
    width: 42px;
  }

  .slide-scrubber {
    grid-template-columns: 20px 1fr 20px;
    gap: 6px;
  }

  .toast-region {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

@media (display-mode: standalone) {
  .site-header,
  .presenter-toolbar {
    padding-top: calc(10px + env(safe-area-inset-top));
  }
}

@media print {
  body {
    background: #fff;
  }

  .presenter-toolbar,
  .speaker-notes,
  .presenter-controls {
    display: none !important;
  }

  .presenter-shell,
  .presenter-workspace,
  .stage-area {
    display: block;
    min-height: 0;
    background: #fff;
  }

  .stage-mount {
    width: 100%;
    border: 0;
    box-shadow: none;
  }
}
