/* ==========================================================================
   Fonts
   ========================================================================== */

@font-face {
  font-family: "Nunito";
  src: url("../fonts/nunito-var-latin.woff") format("woff");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   Tokens (QuakeAlert Android Color.kt & Dimens.kt)
   ========================================================================== */

:root {
  --bg-top: #00182a;
  --bg-base: #000000;
  --surface-card: #222222;
  --surface-pill: #373737;
  --surface-section-pill: #2d2d2d;

  --border-card: rgba(255, 255, 255, 0.1);
  --border-light: rgba(255, 255, 255, 0.3);

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.65);

  --accent-blue: #00557d;
  --accent-active: #003346;
  --accent-cyan: #4fc3d9;

  --status-ok-bg: #0c3600;
  --status-ok-dot: #4caf50;
  --status-warn-bg: #3a2a02;
  --status-warn-accent: #f39f1d;
  --status-err-bg: #460808;
  --status-err-dot: #f31d1d;

  --about-grad: linear-gradient(180deg, #013136 0%, #00121b 100%);

  --radius-card: 14px;
  --radius-btn: 12px;
  --radius-small: 10px;
  --radius-pill: 9999px;

  --container-max: 1040px;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */

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

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

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

body {
  margin: 0;
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg-base);
  background-image: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-base) 520px);
  background-repeat: no-repeat;
  color: var(--text-primary);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.icon {
  width: 1.15em;
  height: 1.15em;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-pill);
  color: var(--text-primary);
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-circle {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.15rem;
}

.badge-circle-accent {
  background: var(--accent-active);
  color: var(--accent-cyan);
  border: 3px solid rgba(79, 195, 217, 0.6);
}

.badge-circle-muted {
  background: var(--surface-pill);
  color: var(--text-secondary);
  border: 3px solid var(--border-light);
}

/* ==========================================================================
   Layout
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

.section {
  padding: 36px 0;
}

@media (min-width: 840px) {
  .section {
    padding: 48px 0;
  }
}

.section-pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 14px;
  margin: 0 0 16px;
  border-radius: var(--radius-small);
  background: var(--surface-section-pill);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 700;
}

.section-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-head-row .section-pill {
  margin: 0;
}

/* ==========================================================================
   Top Bar & Language Toggle
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(0, 12, 22, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-card);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-nav {
  display: none;
  align-items: center;
  gap: 18px;
}

@media (min-width: 640px) {
  .topbar-nav {
    display: inline-flex;
  }
}

.topbar-nav a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
}

.topbar-nav a:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.lang-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 2px;
}

.lang-btn {
  appearance: none;
  border: 1.5px solid var(--border-light);
  background: rgba(22, 22, 22, 0.28);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  min-height: 36px;
  border-radius: var(--radius-small);
  cursor: pointer;
}

.lang-btn[aria-pressed="true"] {
  background: var(--accent-active);
  color: var(--text-primary);
  border-color: var(--accent-cyan);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 11px 18px;
  border-radius: var(--radius-btn);
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid var(--border-light);
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-blue);
  color: var(--text-primary);
}

.btn-primary:hover {
  background: #006694;
}

.btn-secondary {
  background: var(--surface-card);
  color: var(--text-primary);
  border-color: var(--border-card);
}

.btn-secondary:hover {
  background: #2c2c2c;
}

/* ==========================================================================
   Hero & Auto-Sliding Carousel
   ========================================================================== */

.hero {
  padding: 40px 0 36px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 36px;
  align-items: center;
}

@media (min-width: 840px) {
  .hero {
    padding: 56px 0 48px;
  }
  .hero-grid {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 48px;
  }
}

.hero-copy,
.phone-showcase,
.step-card,
.history-card,
.about-copy {
  min-width: 0;
}

.hero-copy h1 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  margin: 0 0 24px;
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 46ch;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.version-chip {
  font-size: 0.74rem;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-active);
  color: var(--accent-cyan);
}

.meta-pills {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.release-line {
  margin: 12px 0 0;
  font-size: 0.83rem;
  color: var(--text-secondary);
  max-width: 52ch;
}

.release-line strong {
  color: var(--accent-cyan);
  font-weight: 700;
}

.phone-showcase {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.phone-shell {
  width: min(260px, 100%);
  padding: 10px 9px 11px;
  border-radius: 34px;
  background: #121212;
  border: 1.5px solid var(--border-light);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
}

.phone-earpiece {
  width: 48px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  margin: 0 auto 8px;
}

.carousel-viewport {
  overflow: hidden;
  border-radius: 23px;
  background: #000000;
}

.carousel-track {
  display: flex;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.carousel-slide {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  flex: 0 0 100%;
  width: 100%;
  cursor: zoom-in;
  display: block;
}

.carousel-slide img {
  display: block;
  width: 100%;
  height: auto;
}

.slide-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.slide-tab {
  position: relative;
  overflow: hidden;
  appearance: none;
  border: 1px solid var(--border-card);
  background: var(--surface-card);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 10px;
  height: 30px;
  border-radius: var(--radius-small);
  cursor: pointer;
}

.slide-tab[aria-selected="true"] {
  background: var(--accent-active);
  color: var(--text-primary);
  border-color: var(--accent-cyan);
}

.slide-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--accent-cyan);
  transform-origin: left;
  transform: scaleX(0);
  opacity: 0;
}

.slide-tab[aria-selected="true"] .slide-progress {
  opacity: 1;
  animation: slideProgress 4s linear forwards;
}

.phone-showcase.is-paused .slide-tab[aria-selected="true"] .slide-progress {
  animation-play-state: paused;
}

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

/* ==========================================================================
   How It Works (QuakeAlert Card Proportions)
   ========================================================================== */

.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 720px) {
  .steps-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.step-card {
  background: var(--surface-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.step-body h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
}

.step-body p {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   History & Server Status
   ========================================================================== */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--border-card);
  background: var(--status-warn-bg);
  color: var(--text-primary);
  white-space: nowrap;
}

.status-pill[data-state="ok"] {
  background: var(--status-ok-bg);
}

.status-pill[data-state="offline"] {
  background: var(--status-err-bg);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-warn-accent);
  flex-shrink: 0;
}

.status-pill[data-state="ok"] .status-dot {
  background: var(--status-ok-dot);
}

.status-pill[data-state="offline"] .status-dot {
  background: var(--status-err-dot);
}

.history-card {
  background: var(--surface-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 18px 20px;
}

.event-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.event-info {
  min-width: 0;
}

.stat-value {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.stat-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.mmi-badge {
  font-weight: 900;
  font-size: 0.95rem;
  background: #462c08;
  color: #f39f1d;
  border: 3px solid #f39f1d;
}

.mmi-badge.severe {
  background: #460808;
  color: #f31d1d;
  border-color: #f31d1d;
}

.event-info .pill {
  margin-top: 8px;
}

/* ==========================================================================
   Community Sensor Banner
   ========================================================================== */

.about-card {
  background: var(--about-grad);
  border: 1px solid rgba(79, 195, 217, 0.24);
  border-radius: var(--radius-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

@media (min-width: 780px) {
  .about-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.about-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-head-icon {
  display: flex;
  align-items: center;
  gap: 12px;
}

.about-card h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.about-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-secondary);
  max-width: 54ch;
}

.about-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  margin-top: 24px;
  padding: 32px 0 40px;
  border-top: 1px solid var(--border-card);
  color: var(--text-secondary);
  font-size: 0.84rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 720px) {
  .footer-grid {
    grid-template-columns: 1.4fr 1fr;
    gap: 48px;
    align-items: start;
  }
}

.footer-brand-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 800;
  font-size: 1.15rem;
}

.footer-brand-row img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
}

.footer-tagline {
  margin: 10px 0 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 44ch;
}

.footer-note {
  margin: 14px 0 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
  max-width: 60ch;
}

.footer-note .icon {
  color: var(--status-warn-accent);
  vertical-align: -2px;
  margin-right: 6px;
}

.footer-note strong {
  color: var(--text-primary);
}

.footer-nav {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}

.footer-group-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.footer-links-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links-list a {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.88rem;
}

.footer-links-list a:hover {
  color: var(--accent-cyan);
}

.footer-bottom {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border-card);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ==========================================================================
   Lightbox Dialog
   ========================================================================== */

dialog.lightbox {
  border: 1px solid var(--border-light);
  border-radius: 18px;
  background: #111111;
  color: var(--text-primary);
  padding: 14px;
  max-width: min(92vw, 400px);
}

dialog.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.82);
}

.lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.lightbox-close {
  appearance: none;
  border: 1px solid var(--border-light);
  background: var(--surface-pill);
  color: var(--text-primary);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

dialog.lightbox img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
}

/* ==========================================================================
   Pages (Privacy & 404)
   ========================================================================== */

.card {
  background: var(--surface-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 20px;
}

.prose {
  padding-top: 36px;
  padding-bottom: 48px;
  max-width: 740px;
}

.prose h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  font-weight: 900;
}

.prose .updated {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 24px;
}

.prose h2 {
  margin: 24px 0 8px;
  font-size: 1.15rem;
  font-weight: 800;
}

.prose p,
.prose li {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
}
