/* Safely — light theme, V2 base.
   Tokens lifted from the Safely design system:
   - rgb(1,120,255)  primary blue
   - #1a1a1d         text
   - #6e6e73         muted
   - #a0a0a6         faint
   - #ededed         border
   - #f4f4f5         soft surface
*/

* { box-sizing: border-box; }
html {
  scrollbar-gutter: stable;
  overflow-y: scroll; /* legacy fallback so scrollbar width never shifts content */
}
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", "SF Pro Text",
               "Helvetica Neue", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: #fff;
  color: #1a1a1d;
  font-size: 17px;
  line-height: 24px;
  letter-spacing: -0.01em;
}
a { color: inherit; }

/* ── Page shell ─────────────────────────────────────────────── */
.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ── Top nav — pinned width across all pages ────────────────── */
.site-nav {
  max-width: 680px;
  margin: 0 auto;
  padding: 56px 28px 0;
}

/* ── Site footer — pinned width across all pages ────────────── */
.site-footer {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 28px 96px;
}
.footer {
  margin-top: 96px;
  padding-top: 28px;
  border-top: 1px solid #ededed;
  font-size: 13px;
  line-height: 20px;
  color: #a0a0a6;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px 32px;
  text-align: center;
}
.footer .footer-col-label {
  color: #a0a0a6;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  margin-bottom: 6px;
}
.footer a { text-decoration: none; color: #6e6e73; }
.footer a:hover { color: #1a1a1d; }
.footer a.disabled { color: #a0a0a6; cursor: not-allowed; }
.footer-row { display: block; margin-bottom: 4px; }
.footer .footer-legal {
  grid-column: 1 / -1;
  padding-top: 16px;
  border-top: 1px solid #f4f4f5;
  margin-top: 8px;
  color: #a0a0a6;
}
.nav {
  display: flex;
  gap: 24px;
  align-items: center;
  margin-bottom: 64px;
  font-size: 14px;
  line-height: 20px;
  flex-wrap: wrap;
}
.nav .nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  margin-right: auto;
  font-weight: 600;
  color: #1a1a1d;
}
.nav .nav-brand img { display: block; border-radius: 8px; }
.nav a {
  text-decoration: none;
  color: #6e6e73;
  font-weight: 400;
}
.nav a:hover { color: #1a1a1d; }
.nav a.active { color: #1a1a1d; font-weight: 400; }
.nav a.disabled { color: #a0a0a6; cursor: not-allowed; }
.nav .nav-brand { font-weight: 600; }

/* ── Blog list (Tonsky-style) ───────────────────────────────── */
.blog-section { margin-bottom: 32px; }
.blog-year {
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
  color: #1a1a1d;
}
.blog-list { list-style: none; padding: 0; margin: 0; }
.blog-item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 3px 0;
  line-height: 24px;
}
.blog-item a {
  text-decoration: none;
  color: #1a1a1d;
  border-bottom: 1px solid rgba(1,120,255,0.3);
}
.blog-item a:hover { border-bottom-color: rgb(1,120,255); }
.blog-date {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: #a0a0a6;
  flex-shrink: 0;
  margin-left: 8px;
}
.blog-author,
.blog-meta {
  font-size: 13px;
  color: #a0a0a6;
  flex-shrink: 0;
}
.blog-star { color: rgb(1,120,255); font-size: 13px; }

/* ── Page title (Changelog, About) ──────────────────────────── */
.page-title {
  font-size: 40px;
  line-height: 44px;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0 0 40px;
  color: #1a1a1d;
}

/* ── Article page ───────────────────────────────────────────── */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; line-height: 20px;
  text-decoration: none;
  color: #6e6e73;
  margin-bottom: 48px;
}
.back-link:hover { color: #1a1a1d; }

.article-title {
  font-size: 36px; line-height: 44px;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0 0 12px;
  color: #1a1a1d;
}

.article-meta {
  font-size: 13px; line-height: 20px;
  color: #a0a0a6;
  font-variant-numeric: tabular-nums;
  margin: 0 0 40px;
  display: flex; gap: 10px; align-items: center;
}
.article-meta .star { color: rgb(1,120,255); }

.article-body {
  font-size: 17px; line-height: 28px;
  color: #1a1a1d;
}
.article-body p { margin: 0 0 22px; }
.article-body ul, .article-body ol { margin: 0 0 22px; padding-left: 24px; }
.article-body li { margin-bottom: 6px; }
.article-body li:last-child { margin-bottom: 0; }
.article-body hr {
  border: 0;
  border-top: 1px solid #ededed;
  margin: 32px 0;
}
.article-body h2 {
  font-size: 22px; line-height: 30px;
  letter-spacing: -0.015em;
  margin: 48px 0 14px;
  font-weight: 600;
}
.article-body a {
  color: rgb(1,120,255); text-decoration: none;
  border-bottom: 1px solid rgba(1,120,255,0.3);
}
.article-body a:hover { border-bottom-color: rgb(1,120,255); }
.article-body strong { font-weight: 600; color: #1a1a1d; }
.article-body code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 14px;
  background: #f4f4f5;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #ededed;
}
.article-body blockquote {
  margin: 28px 0;
  padding: 4px 0 4px 18px;
  border-left: 2px solid rgb(1,120,255);
  color: #6e6e73;
}

/* Article figures (images, screenshots, diagrams) */
.article-body figure { margin: 32px 0; }
.article-body figure img,
.article-body figure .img-placeholder {
  display: block;
  width: 100%;
  border-radius: 8px;
  background: #f4f4f5;
  border: 1px solid #ededed;
}
.article-body figure .img-placeholder {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #a0a0a6;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.article-body figcaption {
  font-size: 13px;
  line-height: 20px;
  color: #a0a0a6;
  margin-top: 10px;
  text-align: center;
  letter-spacing: -0.005em;
}
.article-body figure.wide {
  margin-left: -40px;
  margin-right: -40px;
}
@media (max-width: 760px) {
  .article-body figure.wide { margin-left: 0; margin-right: 0; }
}

.next-prev {
  display: flex; gap: 24px;
  margin-top: 56px; padding-top: 24px;
  border-top: 1px solid #ededed;
}
.next-prev a {
  flex: 1; text-decoration: none;
  color: #1a1a1d;
  font-size: 14px; line-height: 20px;
}
.next-prev a:hover .np-title { color: rgb(1,120,255); }
.np-label {
  font-size: 12px; color: #a0a0a6;
  margin-bottom: 4px; display: block;
}
.np-title { font-size: 15px; font-weight: 600; }
.next-prev .next { text-align: right; }

/* ── D2 · Phone-first (Home) ────────────────────────────────── */
.phone-frame {
  background: #0c0c0d;
  border-radius: 42px;
  padding: 8px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.06),
    0 40px 60px -25px rgba(0,0,0,0.22),
    0 18px 28px -14px rgba(0,0,0,0.14),
    0 6px 12px -6px rgba(0,0,0,0.10);
  position: relative;
  overflow: hidden;
  aspect-ratio: 390 / 844;
}
.phone-frame img {
  width: 100%; height: 100%;
  display: block;
  border-radius: 34px;
  object-fit: cover;
  object-position: top center;
}

.v-d2 .page { max-width: 800px; text-align: center; }
.v-d2 .hero { margin-bottom: 96px; }
.v-d2 .v-d2-title {
  font-size: 64px; line-height: 64px;
  letter-spacing: -0.035em; font-weight: 700;
  margin: 0 auto 24px; max-width: 14ch;
  color: #1a1a1d; text-wrap: balance;
}
.v-d2 .v-d2-sub {
  font-size: 19px; line-height: 28px;
  color: #6e6e73; max-width: 38em;
  margin: 0 auto 36px;
}
.v-d2 .hero-phone { display: flex; justify-content: center; }
.v-d2 .hero-phone .phone-frame { width: 320px; }
.v-d2 .v-d2-stage {
  position: relative;
  padding: 24px 0 0;
}
.v-d2 .v-d2-stage::before {
  content: ""; position: absolute;
  left: 50%; top: 0; transform: translateX(-50%);
  width: 580px; height: 580px;
  background: radial-gradient(closest-side, rgba(0,0,0,0.08), transparent 70%);
  pointer-events: none; z-index: 0;
}
.v-d2 .v-d2-stage .phone-frame { position: relative; z-index: 1; }

/* Beta note under the phone — sized like the hero sub (user override) */
.hero-beta-note {
  margin: 40px auto 0;
  text-align: center;
  font-size: 19px;
  line-height: 28px;
  color: #6e6e73;
}

/* ── Mobile (≤600px) ────────────────────────────────────────── */
@media (max-width: 600px) {
  body { font-size: 16px; line-height: 24px; }

  .page { padding: 0 20px; }
  .site-nav { padding: 32px 20px 0; }
  .site-footer { padding: 0 20px 64px; }
  .footer { grid-template-columns: 1fr 1fr; margin-top: 64px; }

  .nav { margin-bottom: 40px; gap: 16px; }

  /* Page titles */
  .page-title { font-size: 32px; line-height: 36px; margin-bottom: 28px; }

  /* Blog list */
  .blog-year { font-size: 20px; line-height: 28px; margin-bottom: 10px; }
  .blog-item { flex-wrap: wrap; gap: 6px; padding: 6px 0; }
  .blog-date { margin-left: 0; }

  /* Article */
  .article-title { font-size: 28px; line-height: 34px; margin-bottom: 10px; }
  .article-meta { margin-bottom: 28px; }
  .article-body { font-size: 16px; line-height: 26px; }
  .article-body h2 { font-size: 19px; line-height: 26px; margin: 36px 0 12px; }
  .back-link { margin-bottom: 32px; }
  .article-body figure.wide { margin-left: 0; margin-right: 0; }

  /* Next/prev — stack */
  .next-prev { flex-direction: column; gap: 16px; }
  .next-prev .next { text-align: left; }

  /* Home (D2) */
  .v-d2 .hero { margin-bottom: 56px; }
  .v-d2 .v-d2-title {
    font-size: 32px; line-height: 36px;
    margin-bottom: 18px;
    max-width: none;
  }
  .v-d2 .v-d2-sub { font-size: 17px; line-height: 26px; margin-bottom: 28px; }
  .v-d2 .hero-phone .phone-frame { width: 80%; max-width: 280px; }
  .v-d2 .v-d2-stage::before {
    width: 90vw; height: 90vw;
    max-width: 420px; max-height: 420px;
  }
  .hero-beta-note { margin-top: 28px; font-size: 17px; line-height: 26px; }
}
