/* NightScout — landing page
 * Stessa palette dell'app (src/theme/variables.scss, --ns-* / --ion-color-*),
 * copiata qui perché questo sito statico non passa dalla build Angular.
 * Se la palette dell'app cambia, aggiornare anche questi valori a mano.
 */

:root {
  --ion-color-primary: #5b5fe9;
  --ion-color-primary-tint: #6b6fec;
  --ion-color-primary-shade: #5054ce;
  --ion-color-success: #34d399;
  --ion-color-warning: #fbbf24;

  --ns-bg: #0a0e1c;
  --ns-surface: #131a2e;
  --ns-surface-raised: #1a2238;
  --ns-border: #232b45;
  --ns-text: #f2f3f7;
  --ns-text-muted: #8a8fa3;

  --ns-glass-bg: rgba(26, 34, 56, 0.55);
  --ns-glass-border: rgba(242, 243, 247, 0.12);
  --ns-glass-blur: 20px;

  --ns-score-excellent: #34d399;
  --ns-score-fair: #fbbf24;

  --ns-accent-orange: #fb923c;
  --ns-accent-pink: #f472b6;
  --ns-accent-teal: #2dd4bf;
  --ns-accent-blue: #38bdf8;
  --ns-gradient: linear-gradient(135deg, var(--ion-color-primary), var(--ns-accent-orange));

  --ns-radius: 16px;
  --ns-max-width: 1080px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ns-bg);
  color: var(--ns-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  /* Stelle statiche in radial-gradient, coerenti col tema notturno dell'app
     (vedi --ns-nightcard-star in variables.scss) invece di un'immagine. */
  background-image:
    radial-gradient(1px 1px at 20% 15%, rgba(242, 243, 247, 0.5), transparent),
    radial-gradient(1px 1px at 65% 8%, rgba(242, 243, 247, 0.35), transparent),
    radial-gradient(1.5px 1.5px at 85% 22%, rgba(242, 243, 247, 0.4), transparent),
    radial-gradient(1px 1px at 40% 30%, rgba(242, 243, 247, 0.3), transparent),
    radial-gradient(1px 1px at 92% 45%, rgba(242, 243, 247, 0.25), transparent),
    radial-gradient(1.5px 1.5px at 10% 55%, rgba(242, 243, 247, 0.3), transparent);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--ion-color-primary-tint);
}

.wrap {
  max-width: var(--ns-max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--ns-glass-bg);
  border-bottom: 1px solid var(--ns-glass-border);
  backdrop-filter: blur(var(--ns-glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--ns-glass-blur)) saturate(180%);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--ns-text);
  text-decoration: none;
}

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

.site-nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--ns-text-muted);
  text-decoration: none;
  font-size: 14px;
}

.site-nav a:hover {
  color: var(--ns-text);
}

.nav-toggle-checkbox {
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 26px;
  height: 26px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--ns-text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

@media (max-width: 760px) {
  .site-nav {
    position: fixed;
    top: 65px;
    left: 0;
    right: 0;
    z-index: 9;
    flex-direction: column;
    gap: 0;
    background: var(--ns-surface);
    border-bottom: 1px solid var(--ns-border);
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }

  .site-nav a {
    padding: 14px 0;
    font-size: 16px;
    border-top: 1px solid var(--ns-border);
  }

  .site-nav a:first-child {
    border-top: none;
  }

  .nav-toggle-checkbox:checked ~ .site-nav {
    max-height: 320px;
    padding: 8px 20px 16px;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-toggle-checkbox:checked ~ .header-actions .nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-toggle-checkbox:checked ~ .header-actions .nav-toggle span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle-checkbox:checked ~ .header-actions .nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--ion-color-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--ion-color-primary-tint);
}

.btn-ghost {
  background: var(--ns-glass-bg);
  border: 1px solid var(--ns-glass-border);
  color: var(--ns-text);
}

.btn-gradient {
  background: var(--ns-gradient);
  color: #ffffff;
}

.btn-gradient:hover {
  filter: brightness(1.08);
}

.btn-store {
  background: #000000;
  color: #ffffff;
  padding: 10px 20px;
  gap: 10px;
}

.icon-apple {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.icon-play {
  width: 18px;
  height: 18px;
}

.btn-store-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.btn-store-text span {
  font-size: 10px;
}

.btn-store-text strong {
  font-size: 15px;
  font-weight: 600;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: 72px 0 96px;
  overflow: hidden;
}

.hero-media {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 62%;
  z-index: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 22%);
  mask-image: linear-gradient(90deg, transparent, #000 22%);
}

.hero-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 14, 28, 0.15) 0%, rgba(10, 14, 28, 0.55) 55%, var(--ns-bg) 96%);
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-wrap {
  position: relative;
  z-index: 1;
}

.hero-copy {
  max-width: 520px;
}

.grad-text {
  background: var(--ns-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--ns-glass-bg);
  border: 1px solid var(--ns-glass-border);
  color: var(--ns-text-muted);
  font-size: 13px;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  margin: 0 0 16px;
  line-height: 1.1;
}

.hero p.subtitle {
  color: var(--ns-text-muted);
  font-size: clamp(16px, 2vw, 18px);
  max-width: 520px;
  margin: 0 0 32px;
}

.hero-ctas {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 860px) {
  .hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 0;
  }

  .hero-media {
    inset: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .hero-media img {
    object-position: bottom 0px right -320px
  }

  .hero-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 14, 28, 0.15) 0%, rgba(10, 14, 28, 0.55) 55%, var(--ns-bg) 96%);
  }

  .hero-wrap {
    width: 100%;
  }

  .hero-copy {
    max-width: none;
    text-align: center;
  }

  .hero-ctas {
    justify-content: center;
  }
}

/* ---------- Sections ---------- */

section {
  padding: 56px 0;
}

.section-title {
  font-size: clamp(24px, 4vw, 32px);
  margin: 0 0 12px;
  text-align: center;
}

.section-subtitle {
  color: var(--ns-text-muted);
  text-align: center;
  max-width: 560px;
  margin: 0 auto 40px;
}

/* ---------- Glass card ---------- */

.glass-card {
  background: var(--ns-glass-bg);
  border: 1px solid var(--ns-glass-border);
  border-radius: var(--ns-radius);
  backdrop-filter: blur(var(--ns-glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--ns-glass-blur)) saturate(180%);
  padding: 24px;
}

/* ---------- Feature grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(91, 95, 233, 0.18);
  color: var(--ion-color-primary-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.icon svg {
  width: 22px;
  height: 22px;
}

.icon-orange {
  background: rgba(251, 146, 60, 0.18);
  color: var(--ns-accent-orange);
}

.icon-pink {
  background: rgba(244, 114, 182, 0.18);
  color: var(--ns-accent-pink);
}

.icon-purple {
  color: #a78bfa;
}

.icon-teal {
  color: var(--ns-accent-teal);
}

.icon-blue {
  color: var(--ns-accent-blue);
}

.feature-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.feature-card p {
  margin: 0;
  color: var(--ns-text-muted);
  font-size: 14px;
}

/* ---------- Feature rows (con screenshot) ---------- */

.feature-row {
  display: flex;
  align-items: center;
  gap: 40px;
  margin-bottom: 64px;
}

.feature-row:last-child {
  margin-bottom: 0;
}

.feature-row.reverse {
  flex-direction: row-reverse;
}

.feature-media,
.feature-copy {
  flex: 1 1 0;
  min-width: 0;
}

.feature-media img {
  width: 100%;
  border-radius: var(--ns-radius);
  border: 1px solid var(--ns-glass-border);
}

.feature-copy h3 {
  font-size: 22px;
  margin: 0 0 12px;
}

.feature-copy p {
  color: var(--ns-text-muted);
  font-size: 15px;
  margin: 0 0 8px;
}

.feature-copy p:last-child {
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .feature-row,
  .feature-row.reverse {
    flex-direction: column;
  }
}

/* ---------- Stats bar (card fluttuante sotto l'hero) ---------- */

.stats-bar-section {
  padding-top: 0;
  padding-bottom: 40px;
}

.stats-bar {
  margin-top: -48px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.stats-bar-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stats-bar-main .icon {
  margin-bottom: 0;
}

.stats-bar-label {
  margin: 0;
  color: var(--ns-text-muted);
  font-size: 13px;
}

.stats-bar-title {
  margin: 2px 0 0;
  font-size: 17px;
  font-weight: 700;
}

.stats-bar-title span {
  font-weight: 400;
  color: var(--ns-text-muted);
  font-size: 14px;
  margin-left: 6px;
}

.stats-bar-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 90px;
}

.stat svg {
  width: 18px;
  height: 18px;
}

.stat-label {
  color: var(--ns-text-muted);
  font-size: 12px;
}

.stat-value {
  font-size: 14px;
  font-weight: 600;
}

.status-excellent {
  color: var(--ns-score-excellent);
}

.status-good {
  color: #86efac;
}

.status-fair {
  color: var(--ns-score-fair);
}

.status-critical {
  color: #fb923c;
}

@media (max-width: 860px) {
  .stats-bar {
    margin-top: -32px;
  }
}

/* ---------- Feature detail (eyebrow + checklist) ---------- */

.feature-eyebrow {
  display: block;
  color: var(--ion-color-primary-tint);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.check-list {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
}

.check-list li {
  position: relative;
  padding: 8px 0 8px 28px;
  color: var(--ns-text-muted);
  font-size: 14px;
  border-top: 1px solid var(--ns-border);
}

.check-list li:first-child {
  border-top: none;
}

.check-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.18);
  color: var(--ns-score-excellent);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- CTA band ---------- */

.cta-band-section {
  padding-top: 0;
}

.cta-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.cta-band-copy {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cta-band-copy .icon {
  margin-bottom: 0;
}

.cta-band-copy h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
}

@media (max-width: 720px) {
  .cta-band,
  .cta-band-copy {
    flex-direction: column;
    text-align: center;
  }
}

/* ---------- Beta badge ---------- */

.beta-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--ion-color-primary-tint);
  background: rgba(91, 95, 233, 0.16);
  vertical-align: middle;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--ns-border);
  padding: 32px 0 calc(32px + env(safe-area-inset-bottom));
  color: var(--ns-text-muted);
  font-size: 13px;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--ns-text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--ns-text);
}

.footer-attribution {
  width: 100%;
  padding-top: 16px;
  border-top: 1px solid var(--ns-border);
  font-size: 12px;
}

/* ---------- Legal pages ---------- */

.legal main {
  padding: 48px 0 80px;
}

.legal .wrap {
  max-width: 760px;
}

.legal h1 {
  font-size: clamp(28px, 5vw, 38px);
  margin-bottom: 4px;
}

.legal .updated {
  color: var(--ns-text-muted);
  font-size: 13px;
  margin-bottom: 40px;
}

.legal h2 {
  font-size: 20px;
  margin-top: 40px;
  margin-bottom: 12px;
  color: var(--ns-text);
}

.legal p,
.legal li {
  color: var(--ns-text-muted);
  font-size: 15px;
}

.legal ul {
  padding-left: 20px;
}

.legal strong {
  color: var(--ns-text);
}

.legal table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.legal th,
.legal td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--ns-border);
  color: var(--ns-text-muted);
}

.legal th {
  color: var(--ns-text);
}

@media (max-width: 640px) {
  .site-footer .wrap {
    flex-direction: column;
    align-items: flex-start;
  }
}
