/* ==========================================================================
   Almanac – Ancient Cycles · website
   One stylesheet for every page. Light by default; dark follows the system.
   Matches danyals-code.github.io, with the app's parchment and terracotta.
   ========================================================================== */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --bg-2: #f5f5f7;
  --fg: #1d1d1f;
  --fg-2: #6e6e73;
  --fg-3: #86868b;
  --line: #d2d2d7;
  --line-soft: rgb(0 0 0 / 0.08);
  --link: #0066cc;
  --btn: #0071e3;
  --btn-hover: #0066cc;
  --accent: #b4460a;
  --parchment: #f3ecdc;
  --parchment-fg: #2b2118;
  --parchment-fg-2: #6b5a48;
  --nav-bg: rgb(255 255 255 / 0.8);
  --shadow-soft: 0 4px 24px rgb(0 0 0 / 0.06), 0 1px 2px rgb(0 0 0 / 0.04);
  --shadow-lift: 0 18px 50px -12px rgb(0 0 0 / 0.25);

  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "New York", ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;

  --w-text: 692px;
  --w-main: 980px;
  --gutter: 22px;
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-2: #161617;
    --fg: #f5f5f7;
    --fg-2: #a1a1a6;
    --fg-3: #86868b;
    --line: #424245;
    --line-soft: rgb(255 255 255 / 0.1);
    --link: #2997ff;
    --btn: #0071e3;
    --btn-hover: #0077ed;
    --accent: #ff8a4c;
    --parchment: #1d1a15;
    --parchment-fg: #f3ecdc;
    --parchment-fg-2: #b9ab97;
    --nav-bg: rgb(22 22 23 / 0.8);
    --shadow-soft: 0 4px 24px rgb(0 0 0 / 0.5);
    --shadow-lift: 0 18px 50px -12px rgb(0 0 0 / 0.8);
  }
}

/* Base ------------------------------------------------------------------ */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  padding: 8px 14px;
  background: var(--bg);
  border-radius: 8px;
  z-index: 100;
}
.skip-link:focus { left: 8px; }

/* Navigation ------------------------------------------------------------ */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line-soft);
}

.nav__inner {
  max-width: var(--w-main);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  font-weight: 600;
  font-size: 17px;
}
.nav__brand:hover { text-decoration: none; }
.nav__brand img { border-radius: 7px; }

.nav__links {
  display: flex;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
}
.nav__links a { color: var(--fg-2); }
.nav__links a:hover,
.nav__links a[aria-current="page"] { color: var(--fg); text-decoration: none; }

/* Shared pieces ---------------------------------------------------------- */

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-title {
  margin: 0 auto 40px;
  max-width: 760px;
  text-align: center;
  font-size: clamp(28px, 4.4vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  font-weight: 700;
}

.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 980px;
  background: var(--btn);
  color: #fff;
  font-size: 17px;
  font-weight: 500;
}
.btn:hover { background: var(--btn-hover); text-decoration: none; }
.btn--quiet,
.btn--quiet:hover {
  background: var(--bg-2);
  color: var(--fg-2);
  cursor: default;
}

.link-more { font-size: 17px; }
.link-more::after { content: " ›"; }

/* Home: hero ------------------------------------------------------------- */

.hero {
  max-width: var(--w-main);
  margin: 0 auto;
  padding: 72px var(--gutter) 48px;
  text-align: center;
}

.hero__icon {
  margin: 0 auto 24px;
  width: 128px;
  height: 128px;
  border-radius: 28px;
  box-shadow: var(--shadow-lift);
}

.hero__title {
  margin: 0;
  font-size: clamp(48px, 9vw, 80px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.hero__headline {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-size: clamp(24px, 3.6vw, 34px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.hero__lede {
  max-width: 640px;
  margin: 20px auto 0;
  color: var(--fg-2);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.45;
}

.hero__actions {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  align-items: center;
  justify-content: center;
}

/* Home: screenshots ------------------------------------------------------ */

.gallery {
  padding: 24px 0 72px;
}

.gallery__track {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 12px max(var(--gutter), calc((100vw - var(--w-main)) / 2 + var(--gutter))) 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--gutter);
  scrollbar-width: none;
}
.gallery__track::-webkit-scrollbar { display: none; }

.gallery__item {
  flex: 0 0 auto;
  width: min(62vw, 240px);
  scroll-snap-align: start;
}

.gallery figure { margin: 0; }

.gallery img {
  width: 100%;
  border-radius: 12% / 5.5%;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-lift);
  background: var(--parchment);
}

.gallery figcaption {
  margin-top: 16px;
  color: var(--fg-2);
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
}

/* Home: stats ------------------------------------------------------------ */

.stats {
  max-width: var(--w-main);
  margin: 0 auto;
  padding: 0 var(--gutter) 88px;
}

.stats__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin: 0;
  padding: 32px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.stats__grid dt {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.stats__grid dd {
  margin: 4px 0 0;
  color: var(--fg-2);
  font-size: 14px;
}

/* Home: features --------------------------------------------------------- */

.features {
  max-width: var(--w-main);
  margin: 0 auto;
  padding: 0 var(--gutter) 96px;
}

.features__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.tile {
  padding: 28px;
  border-radius: var(--radius);
  background: var(--bg-2);
}
.tile h3 {
  margin: 0 0 10px;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.tile p {
  margin: 0;
  color: var(--fg-2);
  font-size: 15px;
  line-height: 1.5;
}

/* Home: privacy band ----------------------------------------------------- */

.privacy-band {
  background: var(--parchment);
  color: var(--parchment-fg);
}
.privacy-band__inner {
  max-width: var(--w-text);
  margin: 0 auto;
  padding: 88px var(--gutter);
  text-align: center;
}
.privacy-band .section-title { margin-bottom: 16px; }
.privacy-band p {
  margin: 0 0 20px;
  color: var(--parchment-fg-2);
  font-size: 19px;
  line-height: 1.5;
}

/* Text pages (privacy, support) ----------------------------------------- */

.prose {
  max-width: var(--w-text);
  margin: 0 auto;
  padding: 64px var(--gutter) 96px;
}

.prose h1 {
  margin: 0;
  font-size: clamp(36px, 6vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.prose .meta {
  margin: 10px 0 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
  color: var(--fg-2);
  font-size: 15px;
}

.prose h2 {
  margin: 48px 0 12px;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.012em;
}

.prose h3 {
  margin: 32px 0 6px;
  font-size: 19px;
  line-height: 1.3;
}
.prose h3 + p { margin-top: 0; }

.prose p, .prose li { color: var(--fg); }
.prose p { margin: 0 0 16px; }
.prose ul { padding-left: 1.2em; margin: 0 0 16px; }
.prose li { margin: 4px 0; }
.prose strong { font-weight: 600; }

.prose pre {
  margin: 0 0 16px;
  padding: 20px;
  overflow-x: auto;
  border-radius: 12px;
  background: var(--bg-2);
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0;
}
.prose code {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  letter-spacing: 0;
}

.prose .callout {
  padding: 20px 24px;
  border-radius: var(--radius);
  background: var(--bg-2);
}

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

.footer {
  border-top: 1px solid var(--line-soft);
  background: var(--bg-2);
  color: var(--fg-3);
  font-size: 13px;
}
.footer__inner {
  max-width: var(--w-main);
  margin: 0 auto;
  padding: 24px var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
}
.footer p { margin: 0; }
.footer a { color: var(--fg-2); }
.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Small screens --------------------------------------------------------- */

@media (max-width: 860px) {
  .features__grid { grid-template-columns: repeat(2, 1fr); }
  .stats__grid { grid-template-columns: repeat(2, 1fr); row-gap: 28px; }
}

@media (max-width: 560px) {
  :root { --gutter: 16px; }
  .nav__links { gap: 16px; }
  .hero { padding-top: 48px; }
  .hero__icon { width: 104px; height: 104px; border-radius: 23px; }
  .features__grid { grid-template-columns: 1fr; }
  .tile { padding: 24px; }
  .stats__grid dt { font-size: 24px; }
  .prose { padding-top: 40px; }
  .footer__inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 360px) {
  .nav__brand span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
