:root {
  /* The site is dark only, like the app. */
  --bg: #060b18;
  --surface: #0e1527;
  --text: #f2f4f8;
  --muted: #9aa3b5;
  --border: #1e2840;
  --accent: #ffca7a;
  --accent-2: #64b8ff;
  /* Sky behind the top of each page, see body::before. --horizon is set from today's season by the page script. */
  --horizon: #364b64;
  --sky-top: #0c1829;
  --sky-glow: color-mix(in srgb, var(--horizon) 26%, #0c1829);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 16px 32px;
  flex: 1;
}

a { color: var(--accent-2); }


/* Floating section menu */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
main [id] { scroll-margin-top: 84px; }

.topnav {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 24px);
  max-width: 800px;
  margin: 12px auto 0;
  padding: 6px 8px 6px 12px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.12);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.topnav a { color: var(--text); text-decoration: none; white-space: nowrap; }
.topnav-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; flex: none; }
.topnav-brand img { width: 28px; height: 28px; border-radius: 7px; }
.topnav-links { display: flex; gap: 2px; margin-left: auto; flex: none; }
.topnav-links a { font-size: 0.92rem; color: var(--muted); padding: 6px 12px; border-radius: 999px; }
.topnav-links a:hover { color: var(--text); background: var(--border); }
.topnav-links a[aria-current="page"] { color: var(--text); background: var(--border); }

.topnav .nav-button {
  flex: none;
  font-size: 0.92rem;
  font-weight: 600;
  background: var(--accent);
  color: #060b18;
  padding: 6px 14px;
  border-radius: 999px;
}
.topnav .nav-button:hover { filter: brightness(1.06); }

/* The app name shrinks on narrow screens so it always fits:
   first a smaller font, then "Life Calendar" moves to a second line. */
.topnav-brand { flex: 0 1 auto; min-width: 0; }
.topnav-brand .brand-name {
  min-width: 0;
  font-size: clamp(0.85rem, 3.4vw, 1rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-toggle { display: none; }
.menu-langs { display: none; }

/* Language picker: globe button with the current language, opening a list of all languages */
.lang-picker { position: relative; flex: none; }
.lang-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 10px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}
.lang-button:hover, .lang-button[aria-expanded="true"] { color: var(--text); background: var(--border); }
.lang-button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.lang-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 180px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.35);
}
.lang-menu a {
  display: block;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--text);
  font-size: 0.95rem;
}
.lang-menu a:hover, .lang-menu a:focus-visible { background: var(--border); outline: none; }
.lang-menu a[aria-current] { font-weight: 600; }
.lang-menu a[aria-current]::after { content: "✓"; float: right; color: var(--accent); margin-left: 12px; }

/* Medium widths: a compact top bar, so all links still fit next to the app name:
   the name on two lines, the globe without the language code, tighter links */
@media (max-width: 899px) {
  .topnav-brand .brand-name { font-size: 0.9rem; line-height: 1.15; }
  .topnav-brand .brand-sep { display: none; }
  .topnav-brand .brand-sub {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topnav-links a { padding: 6px 9px; font-size: 0.88rem; }
  .lang-button { width: 34px; padding: 0; justify-content: center; }
  .lang-button span { display: none; }
  .topnav .nav-button { padding: 6px 12px; font-size: 0.88rem; }
}

/* Phones: page links and languages move into a menu; Download stays visible.
   The compact bar needs up to 629px (Spanish is the longest); check this when adding a language. */
@media (max-width: 639px) {
  .topnav { padding-right: 6px; }
  .menu-toggle {
    display: grid;
    flex: none;
    align-content: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 0 11px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
  }
  .menu-toggle span { display: block; height: 2px; border-radius: 2px; background: var(--text); transition: transform 0.2s, opacity 0.2s; }
  .topnav.open .menu-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .topnav.open .menu-toggle span:nth-child(2) { opacity: 0; }
  .topnav.open .menu-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .topnav-links {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.35);
  }
  .topnav.open .topnav-links { display: flex; }
  /* Languages live in the menu here instead of the globe button */
  .lang-picker { display: none; }
  .topnav .nav-button { margin-left: auto; }
  .menu-langs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    padding: 12px 6px 4px;
    border-top: 1px solid var(--border);
  }
  .topnav-links .menu-langs a { font-size: 0.92rem; padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; }
  .topnav-links .menu-langs a[aria-current] { background: var(--accent); border-color: var(--accent); color: #060b18; font-weight: 600; }
  .topnav-links a { font-size: 1rem; color: var(--text); padding: 12px 14px; border-radius: 12px; }
}
/* Landing page */
.hero { text-align: center; padding-top: 24px; }
.hero .icon { width: 112px; height: 112px; border-radius: 26px; box-shadow: 0 8px 28px rgb(0 0 0 / 0.18); }
.hero h1 { font-size: clamp(2.2rem, 7vw, 3rem); line-height: 1.1; margin: 24px 0 14px; letter-spacing: -0.01em; }
.hero h1 .eyebrow { display: block; font-size: 1rem; font-weight: 600; letter-spacing: 0; color: var(--accent); margin-bottom: 8px; }
.hero .lead { font-size: 1.2rem; font-weight: 600; margin: 0 0 12px; }
.hero .tagline { color: var(--muted); font-size: 1.15rem; margin: 0 auto 28px; max-width: 32em; }
.hero .note { color: var(--muted); font-size: 0.9rem; margin: 12px 0 0; }

/* Official Google Play badge (the PNG has Google's required clear space built in) */
.play-badge { display: inline-block; }
.play-badge img { display: block; width: 239px; height: auto; }


main > section + section,
main > .hero-wrap + section { margin-top: 64px; }
/* Desktop rhythm: the five story rows sit closer together, and topic changes get more room.
   Phones keep the even 64px (text and screenshot are stacked there). */
@media (min-width: 700px) {
  main > .feature + .feature { margin-top: 40px; }
  main > .hero-wrap + .feature,
  main > .feature + .teaser,
  main > .private + .closing,
  main > .closing + .more-apps { margin-top: 96px; }
}

/* Spread heading lines evenly, so no single word ends up alone on the last line */
h1, h2, .closing-line { text-wrap: balance; }

main h2 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 8px; }
main section > p, .feature-text p { color: var(--muted); margin: 0; }
.feature-text p + p, main section > p + p { margin-top: 12px; }

figure { margin: 0; }
figure img { display: block; width: 100%; height: auto; }

.phone { max-width: 240px; margin: 48px auto 0; }
.phone img {
  border-radius: 32px;
  border: 6px solid #1a2236;
  box-shadow: 0 18px 48px rgb(0 0 0 / 0.25);
}

.shot { margin: 20px auto 0; }
.shot.widget { max-width: 420px; }
.shot img { border-radius: 18px; box-shadow: 0 10px 32px rgb(0 0 0 / 0.18); }

.features {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 12px;
}

.features strong { display: block; }
.features span { color: var(--muted); }

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

/* More apps */
.apps {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 12px;
}
.apps li {
  position: relative;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
}
.apps li:hover { border-color: var(--accent-2); }
.apps img { flex: none; width: 56px; height: 56px; border-radius: 13px; }
.apps .app-name { display: block; color: var(--text); font-weight: 600; text-decoration: none; }
/* The whole card is the link: the app's website if it has real content, otherwise Google Play. */
.apps .app-name::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.apps span { display: block; color: var(--muted); font-size: 0.95rem; line-height: 1.45; }

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

/* Legal pages */
.legal h1 { font-size: 1.9rem; margin: 32px 0 16px; }
.legal .back { margin: 28px 0 0; font-size: 0.95rem; }
.legal .back + h1 { margin-top: 12px; }
.legal .updated { color: var(--muted); font-size: 0.95rem; margin: -8px 0 20px; }
.legal .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.legal h2 { font-size: 1.25rem; margin: 32px 0 2px; }
.muted { color: var(--muted); margin: 0 0 12px; }

.doc-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.doc-list a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  color: var(--text);
  text-decoration: none;
}
.doc-list a:hover { border-color: var(--accent-2); }
.doc-list strong { display: block; }
.doc-list span { color: var(--muted); font-size: 0.95rem; }

footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
  padding: 20px 16px 28px;
  text-align: center;
}

footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 8px; }
footer a { color: var(--muted); }
footer .lang-switch { margin-bottom: 8px; }
footer .lang-switch a { text-decoration: none; }
footer .lang-switch a[aria-current] { color: var(--text); font-weight: 600; }
footer .lang-switch a + a::before { content: "·"; color: var(--muted); margin: 0 10px; display: inline-block; }
footer .trademark { font-size: 0.8rem; margin: 10px 0 0; opacity: 0.8; }

/* Hero: text next to the phone screenshot on wider screens */
@media (min-width: 700px) {
  .hero-wrap {
    display: grid;
    grid-template-columns: 1fr 230px;
    gap: 40px;
    align-items: center;
  }
  .hero-wrap .hero { text-align: left; padding-top: 0; }
  .hero-wrap .hero .tagline { margin-left: 0; }
  .hero-wrap .phone { margin: 0; }
}

/* Feature rows: text next to a phone screenshot, alternating sides on wider screens */
.feature .phone { margin-top: 24px; }
@media (min-width: 700px) {
  .feature {
    display: grid;
    grid-template-columns: 1fr 230px;
    gap: 48px;
    align-items: center;
  }
  .feature:nth-of-type(even) { grid-template-columns: 230px 1fr; }
  .feature:nth-of-type(even) .phone { order: -1; }
  .feature .phone { margin: 0; }
}

.private {
  text-align: center;
  background:
    radial-gradient(90% 120% at 50% 0%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 70%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 36px 24px 28px;
}
.private-icon {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 50%;
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-2) 30%, transparent);
}
.private > p { max-width: 30em; margin: 0 auto; }
.private-facts {
  list-style: none;
  padding: 0;
  margin: 22px 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.private-facts li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  padding: 7px 14px 7px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.private-facts svg { color: var(--accent); flex: none; }
.private-facts li { white-space: nowrap; justify-content: center; }
/* 2 x 2 on wider screens, one column on phones; badges in a group share one width */
.private-facts { display: grid; grid-template-columns: 1fr 1fr; max-width: 440px; margin-inline: auto; }
@media (max-width: 639px) {
  .private-facts { grid-template-columns: 1fr; max-width: 250px; }
}

.closing { text-align: center; }
.closing .closing-line { color: var(--text); font-size: 1.3rem; font-weight: 600; margin: 0 auto 20px; }

/* Scroll-to-top button, shown after scrolling down */
.to-top {
  position: fixed;
  /* Sits just outside the right edge of the 720px content column on wide screens,
     and falls back to the screen corner when there is no room beside the column. */
  right: max(24px, calc((100vw - 720px) / 2 - 76px));
  bottom: 32px;
  z-index: 10;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #060b18;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.2);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.to-top.visible { opacity: 0.8; pointer-events: auto; }
.to-top:hover, .to-top:focus-visible { opacity: 1; }
@media (max-width: 479px) { .to-top { right: 16px; bottom: 16px; } }

/* Sky band behind the hero: deep sky at the top, a seasonal glow on the horizon, then the page */
body { position: relative; }
body::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1300px;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(110% 45% at 50% 40%, var(--sky-glow) 0%, transparent 100%),
    var(--sky-top);
  /* The whole sky fades out gradually, so there is no visible edge where it ends */
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgb(0 0 0 / 0.85) 25%, rgb(0 0 0 / 0.5) 50%, rgb(0 0 0 / 0.2) 72%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, rgb(0 0 0 / 0.85) 25%, rgb(0 0 0 / 0.5) 50%, rgb(0 0 0 / 0.2) 72%, transparent 100%);
}

/* Days since / until calculator */
.calc-card {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 20px 12px;
}
/* Year progress at the top of the calculator */
.year { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.year-today { margin: 0; font-size: 0.9rem; color: var(--muted); }
.year-count { margin: 2px 0 10px; font-size: 1.15rem; }
.year-count span { color: var(--muted); }
.year-bar { height: 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.year-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }

/* Quick picks */
.calc-picks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 40px;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent-2); }
.chip:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #060b18; font-weight: 600; }

.calc-input { display: inline-flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.calc-input input {
  font: inherit;
  font-size: 1.05rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  min-height: 44px;
}
.calc-input input:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.calc-result { margin-top: 14px; min-height: 3.6em; }
.calc-days { font-size: 2rem; font-weight: 700; line-height: 1.15; margin: 0; color: var(--text); font-variant-numeric: tabular-nums; }
.calc-detail { margin: 4px 0 0; color: var(--muted); }
.calc-milestone { margin: 10px 0 0; color: var(--accent); font-weight: 600; }
.calc-app {
  margin: 14px 0 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
  color: var(--muted);
}
.calc-app a { color: var(--accent-2); font-weight: 600; white-space: nowrap; }
.calc-line { display: block; width: 100%; height: 76px; margin-top: 8px; overflow: visible; }
.calc-line .axis { stroke: var(--border); stroke-width: 2; }
.calc-line .tick { stroke: var(--muted); stroke-width: 1; opacity: 0.6; }
.calc-line .tick-label { fill: var(--muted); font-size: 12px; text-anchor: middle; }
.calc-line .span.past { fill: var(--accent-2); opacity: 0.55; }
.calc-line .span.future { fill: var(--accent-2); opacity: 0.3; }
.calc-line .mark { fill: #a98bf0; stroke: var(--surface); stroke-width: 2; }
.calc-line .now-line { stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; }
.calc-line .now-label { fill: var(--accent); font-size: 11px; font-weight: 700; text-anchor: middle; letter-spacing: 0.04em; }

/* FAQ */
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-top: 10px;
}
.faq h1 + details, .faq h2 + details { margin-top: 16px; }
.faq summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  padding: 14px 44px 14px 18px;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  position: absolute;
  right: 20px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.2s;
}
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq summary:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 14px; }
.faq details p { color: var(--muted); margin: 0; padding: 0 18px 16px; }

/* Fade-in on scroll (the class is only added by the script, and not for reduced motion) */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* Sub pages */
.page-head h1 { font-size: clamp(2rem, 6vw, 2.6rem); line-height: 1.15; margin: 24px 0 12px; }
.page-head > p { font-size: 1.1rem; }
.closing .closing-sub { color: var(--muted); max-width: 30em; margin: -8px auto 16px; }

/* Home: link card to the days calculator */
.teaser-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 24px;
  color: var(--text);
  text-decoration: none;
}
.teaser-card:hover { border-color: var(--accent-2); }
.teaser-card strong { display: block; font-size: 1.35rem; line-height: 1.25; }
.teaser-card span { display: block; color: var(--muted); margin-top: 6px; }
.teaser-card .teaser-cta { color: var(--accent-2); font-weight: 600; margin-top: 12px; }

/* 404 page */
.not-found { text-align: center; padding-top: 32px; }
.not-found-code { font-size: 4rem; font-weight: 800; line-height: 1; margin: 0; color: var(--accent); letter-spacing: -0.02em; }
.not-found > p:not(.not-found-code) { margin: 0 auto; }
.not-found-links { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.not-found-links a {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.not-found-links a:hover { border-color: var(--accent-2); }
.not-found > p.not-found-lang { margin-top: 28px; font-size: 0.95rem; }
.not-found > p.not-found-lang + p.not-found-lang { margin-top: 6px; }

/* Very narrow phones: slightly more compact buttons */
@media (max-width: 359px) {
  .topnav { gap: 6px; }
  .topnav .nav-button { padding: 6px 11px; font-size: 0.85rem; }
  .menu-toggle { width: 36px; padding: 0 9px; }
}

