/* Dark is the default look. Light follows the reader's system setting, and
   the nav toggle overrides both. Long-form text is harder to read as
   light-on-dark for a lot of people, which matters most on the blog.

   Three layers, and the order below is what makes them compose:
     1. :root                              dark, the baseline
     2. @media light + :not([data-theme])  the OS preference, only while the
                                           reader has not chosen for themselves
     3. :root[data-theme="..."]            the toggle, always wins

   Layer 2 is guarded by :not([data-theme]) rather than relying on source
   order, because a bare :root inside a media query and :root[data-theme]
   differ in specificity — without the guard, a reader on a light OS could
   not switch the page to dark. */
:root {
  color-scheme: dark;
  --bg: #0b0b0f;
  --card: #17171c;
  --border: #26262c;
  --text: #f2f2f5;
  --body: #c9c9d1;
  --muted: #9a9aa3;
  --accent: #ff9f0a;      /* fills and icons */
  --accent2: #ffd60a;
  --link: #ff9f0a;        /* text, so it needs contrast against --bg */
  --shot-shadow: rgba(0, 0, 0, 0.55);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #ffffff;
    --card: #f4f4f7;
    --border: #e3e3e9;
    --text: #14141a;
    --body: #3d3d47;
    --muted: #6b6b76;
    --accent: #ff9f0a;
    --accent2: #ffd60a;
    /* Not the brand orange: #ff9f0a on white is about 2:1, which fails
       for text. This is the same hue darkened until it passes. */
    --link: #a85c00;
    --shot-shadow: rgba(20, 20, 26, 0.18);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --card: #f4f4f7;
  --border: #e3e3e9;
  --text: #14141a;
  --body: #3d3d47;
  --muted: #6b6b76;
  --accent: #ff9f0a;
  --accent2: #ffd60a;
  --link: #a85c00;
  --shot-shadow: rgba(20, 20, 26, 0.18);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0b0f;
  --card: #17171c;
  --border: #26262c;
  --text: #f2f2f5;
  --body: #c9c9d1;
  --muted: #9a9aa3;
  --accent: #ff9f0a;
  --accent2: #ffd60a;
  --link: #ff9f0a;
  --shot-shadow: rgba(0, 0, 0, 0.55);
}

/* Theme toggle. Shows the mode you would switch TO: a sun while the page is
   dark, a moon while it is light. */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; flex: none;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  color: var(--muted); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover { color: var(--text); border-color: var(--muted); }
.theme-toggle svg { width: 17px; height: 17px; display: block; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme]) .theme-toggle .icon-moon { display: none; }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 960px; margin: 0 auto; padding: 0 24px; }

/* Solid first. If the clip below fails - iOS Safari drops it on inline
   elements that wrap across lines, which this headline does - the words stay
   readable in the accent colour instead of turning into gradient blocks with
   invisible text inside them. */
.gradient-text { color: var(--accent); }

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .gradient-text {
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    /* Safari needs this one, not just `color` */
    -webkit-text-fill-color: transparent;
    /* Paint the gradient per line box rather than once across the whole
       wrapped inline, which is what breaks the clip in the first place. */
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }
}

/* Nav */
nav {
  display: flex; align-items: center; gap: 28px;
  padding: 20px 0;
}
nav .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; margin-right: auto; }
nav .brand img { width: 28px; height: 28px; border-radius: 7px; }
nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
nav a:hover { color: var(--text); }

/* Hero */
.hero { text-align: center; padding: 72px 0 40px; }
.hero img.appicon { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 12px 40px rgba(255, 159, 10, 0.25); }
.hero h1 { font-size: 52px; font-weight: 800; letter-spacing: -0.02em; margin: 24px 0 12px; }
.hero p.tagline { font-size: 21px; color: var(--muted); max-width: 560px; margin: 0 auto 32px; }
.store-badge {
  display: inline-block; background: var(--text); color: var(--bg);
  font-weight: 600; font-size: 16px; padding: 14px 28px; border-radius: 14px; text-decoration: none;
}
.store-badge.soon { background: var(--card); color: var(--muted); cursor: default; }

/* Screenshots */
/* align-items: flex-start matters — a flex row stretches its items to the
   tallest one by default, which forced the screenshots to a height that
   ignored their aspect ratio and squashed the ring into an oval. */
.shots {
  display: flex; justify-content: center; align-items: flex-start;
  gap: 24px; padding: 48px 0 24px;
  /* One line, always. Wrapping put a lone fourth phone on its own row on
     anything narrower than a laptop, which read as a mistake rather than a
     layout. The images shrink to fit instead, and once they hit the floor
     below the row scrolls sideways rather than shrinking them past legible. */
  flex-wrap: nowrap;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  /* The scroll container, not the page: the body must never scroll sideways. */
  scrollbar-width: none;
}
.shots::-webkit-scrollbar { display: none; }
.shots img {
  flex: 0 1 240px; min-width: 132px; scroll-snap-align: center;
  height: auto; aspect-ratio: 720 / 1564;
  border-radius: 28px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px var(--shot-shadow);
}

/* Features */
.features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px; padding: 48px 0 64px;
}
.feature { background: var(--card); border-radius: 18px; padding: 24px; }
.feature .emoji { font-size: 28px; }
.feature h3 { font-size: 17px; margin: 10px 0 6px; }
.feature p { font-size: 15px; color: var(--muted); }

/* Content pages & posts */
.content { max-width: 680px; margin: 0 auto; padding: 48px 24px 80px; }
.content h1 { font-size: 34px; letter-spacing: -0.02em; margin-bottom: 8px; }
.content h2 { font-size: 22px; margin: 36px 0 10px; }
.content p, .content li { color: var(--body); font-size: 16px; margin-bottom: 14px; }
.content ul { padding-left: 22px; }
.content a { color: var(--link); }
.post-meta { color: var(--muted); font-size: 14px; margin-bottom: 28px; }

/* Blog index */
.post-list { list-style: none; }
.post-list li { background: var(--card); border-radius: 16px; padding: 22px 24px; margin-bottom: 14px; }
.post-list a { color: var(--text); text-decoration: none; font-size: 19px; font-weight: 600; }
.post-item > a { color: var(--text); }
.post-list a:hover { color: var(--accent); }
.post-list .date { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; }

footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 48px; text-align: center;
  color: var(--muted); font-size: 14px;
}
footer a { color: var(--muted); margin: 0 10px; }

/* ---- Responsive ------------------------------------------------------ */

/* Nothing may exceed its container. Media and long strings are the usual
   culprits for a page that scrolls sideways on a phone. */
img, svg, video, table { max-width: 100%; }
.content p, .content li, .content h1, .content h2, .content h3 { overflow-wrap: break-word; }

@media (max-width: 720px) {
  .wrap { padding: 0 20px; }
  .hero { padding: 48px 0 32px; }
  .hero h1 { font-size: 38px; }
  .hero p.tagline { font-size: 18px; }
  .hero img.appicon { width: 80px; height: 80px; }

  /* Two shots side by side rather than one enormous one per row.
     40vw keeps the pair plus the gap inside the padded container. */
  .shots { gap: 14px; padding: 32px 0 16px; }
  .shots img { width: 40vw; max-width: 200px; border-radius: 20px; }

  .features { padding: 32px 0 48px; gap: 14px; }
  .feature { padding: 20px; }

  .content { padding: 32px 20px 64px; }
  .content h1 { font-size: 28px; }
  .content h2 { font-size: 20px; }
  .content .lede { font-size: 17px; }
  .cta { padding: 20px; }

  /* A two-column table can still push past a narrow screen, so let it
     scroll inside its own box instead of taking the page with it. */
  .content table { display: block; overflow-x: auto; white-space: nowrap; }
  .content th, .content td { padding: 9px 10px; }

  nav { gap: 18px; padding: 16px 0; }
  nav a { font-size: 14px; }
}

@media (max-width: 400px) {
  .hero h1 { font-size: 32px; }
  .shots img { width: 42vw; }
  .content h1 { font-size: 25px; }
}

/* Article furniture: figures, pull-quotes, callouts, and the app nudge */
.content figure { margin: 28px 0; }
.content figure img, .content figure svg { width: 100%; height: auto; border-radius: 14px; display: block; }
.content figcaption { color: var(--muted); font-size: 13px; margin-top: 10px; text-align: center; }

.content .lede { font-size: 19px; color: var(--body); margin-bottom: 22px; }

.content blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 18px; margin: 26px 0; color: var(--body); font-size: 18px;
}

.content .note {
  background: var(--card); border-radius: 14px; padding: 18px 20px; margin: 26px 0;
}
.content .note p:last-child { margin-bottom: 0; }

.content h2 { scroll-margin-top: 20px; }
.content h3 { font-size: 18px; margin: 26px 0 8px; }
.content strong { color: var(--text); }

/* Screenshot sitting inside an article */
.content .shot-inline { max-width: 260px; margin: 28px auto; }
.content .shot-inline img { border-radius: 22px; border: 1px solid var(--border); }

/* End of article: the one place we ask for something */
.cta {
  margin: 44px 0 8px; padding: 26px; border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,159,10,0.14), rgba(255,214,10,0.06));
  border: 1px solid rgba(255,159,10,0.28);
}
.cta h3 { margin: 0 0 8px; font-size: 19px; color: var(--text); }
.cta p { margin-bottom: 14px; }
.cta a {
  display: inline-block; background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: #14141a; font-weight: 700; text-decoration: none;
  padding: 11px 20px; border-radius: 12px;
}

.post-meta { color: var(--muted); font-size: 14px; }
.post-list .date { color: var(--muted); font-size: 14px; margin-left: 10px; }
.read-next { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--border); }
.read-next h3 { font-size: 16px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }

.post-list { list-style: none; padding: 0; }
.post-item { padding: 20px 0; border-bottom: 1px solid var(--border); }
.post-item > a { font-size: 19px; font-weight: 600; text-decoration: none; }
.post-item > a:hover { text-decoration: underline; }
.post-excerpt { color: var(--muted); font-size: 15px; margin-top: 6px; }
.content table { width: 100%; border-collapse: collapse; margin: 22px 0; font-size: 15px; }
.content th, .content td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--body); }
.content th { color: var(--muted); font-weight: 600; font-size: 13px; }
.content td:last-child, .content th:last-child { text-align: right; }


@media (prefers-color-scheme: light) {
  /* Orange to yellow on white is close to invisible, so the headline uses a
     deeper ramp. Same hues, enough contrast to read. */
  .gradient-text { color: #e07800; }
  @supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .gradient-text { background: linear-gradient(90deg, #e07800, #b88600); color: transparent; -webkit-text-fill-color: transparent; }
  }
  .store-badge.soon { background: var(--card); color: var(--muted); }
  .cta { background: linear-gradient(135deg, rgba(255,159,10,0.16), rgba(255,214,10,0.07)); }
}
