/* ==========================================================================
   Tact — justtact.com
   One stylesheet for the whole site (main pages + blog).
   Breakpoints:
     phone   < 810px
     tablet  810px – 1199px
     desktop ≥ 1200px
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #fff;
  --text: #171a1c;
  --navy: #313a72;          /* headlines, icons, logo */
  --link: #08f;
  --pill-from: rgb(77, 172, 255);
  --pill-to: rgb(0, 136, 255);

  --font-text: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;

  --measure: 500px;         /* article text column */
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171a1c;
    --text: #fff;
    --navy: #4a57ab;
    --link: #0f8fff;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p, figure, blockquote, ul, ol { margin: 0; }

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

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Header (logo + page title) ---------- */
.site-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 96px;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  text-decoration: none;
}
.logo:hover { text-decoration: none; }
.logo svg { width: 48px; height: 48px; }
.logo span {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  line-height: 16px;
  letter-spacing: 0.02em;
  color: var(--text);
}

.page-title {
  margin-top: 48px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 48px;
  line-height: 1;
  color: var(--navy);
  text-align: center;
}
.page-title a { color: inherit; }
.page-title a:hover { text-decoration: none; }

/* ---------- Home ----------
   Layout, top to bottom:
   1. .hero is fixed to the top of the window, behind everything else.
      site.js sets --scroll-progress (0 at the top of the page, 1 at the
      bottom) and the hero shrinks and lifts with it.
   2. .hero-spacer pushes the page content down so the hero shows first.
   3. The screenshots, features and footer scroll up over the hero.
      The features and footer have a solid background that hides it.
   ------------------------------------------------------------------ */
.home {
  --scroll-progress: 0;
  --hero-width: 500px;
  --hero-gap: 80px;
  --hero-lift: -40px;       /* how far the hero moves up at the bottom of the page */
  --hero-shrink: 0.2;       /* how much it shrinks: 1 → 0.8 */
}

.hero {
  position: fixed;
  top: 0;
  left: calc(50% - min(var(--hero-width), 100%) / 2);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--hero-gap);
  width: 100%;
  max-width: var(--hero-width);
  height: 70vh;
  min-height: 400px;
  max-height: 70vh;
  text-align: center;
  transform:
    translateY(calc(var(--scroll-progress) * var(--hero-lift)))
    scale(calc(1 - var(--scroll-progress) * var(--hero-shrink)));
}

.hero-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 100%;
}

.pill {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 6px 12px 6px 14px;
  border-radius: 100px;
  background: linear-gradient(155deg, var(--pill-from) 23%, var(--pill-to) 85%);
  color: #fff;
  font-size: 12px;
  line-height: 14px;
  font-weight: 300;
  white-space: nowrap;
}
.pill:hover { text-decoration: none; }
.pill b { font-weight: 600; opacity: 0.6; }
.pill span { opacity: 0.6; }

.hero-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 48px;
  line-height: 1;
  color: var(--navy);
  white-space: nowrap;
}
.hero h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 40px;
  line-height: 1.2;
  color: var(--navy);
  opacity: 0.6;
}

.app-store {
  display: inline-block;
  line-height: 0;
}
.app-store svg { width: 148px; height: 48px; }

.home-main {
  position: relative;
  overflow: hidden;
}
.hero-spacer { height: 75vh; }

/* ---------- Home: screenshots + light/dark switch ---------- */
.device {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  /* Paint the bottom of this block with the page colour, so the hero
     doesn't show through below the screenshot. */
  box-shadow: inset 0 -400px 0 0 var(--bg);
}

.device-frame {
  position: relative;
  width: 94%;
}
.device-frame img {
  width: 100%;
  height: auto;
}
.device-frame img.dark {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.device[data-mode="dark"] .device-frame img.dark { opacity: 1; }
.device[data-mode="dark"] .device-frame img.light { opacity: 0; }

/* One device per breakpoint */
.device-frame[data-device="ipad"],
.device-frame[data-device="iphone"] { display: none; }

/* Switch: a faint track, a sliding knob, sun and moon icons on top */
.mode-switch {
  --switch-ease: 0.64s cubic-bezier(0.25, 1, 0.5, 1);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  width: 56px;
  height: 28px;
  padding: 0 6px;
  border: 0;
  border-radius: 100px;
  background: color-mix(in srgb, var(--text) 8%, var(--bg));
  color: var(--navy);
  cursor: pointer;
}
.mode-switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 100px;
  background: var(--bg);
  transition: transform var(--switch-ease);
}
.mode-switch[aria-checked="true"]::before { transform: translateX(28px); }
.mode-switch svg { position: relative; width: 16px; height: 16px; }
.mode-switch:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }

/* ---------- Home: features ---------- */
.features-section {
  position: relative;
  z-index: 10;
  padding: 120px 0;
  background: var(--bg);
}
.features {
  display: flex;
  flex-direction: column;
  gap: 40px;
  max-width: 520px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}
.feature {
  display: grid;
  grid-template-columns: 24px 1fr;
  column-gap: 20px;
  row-gap: 2px;
  line-height: 1.4;
}
.feature svg { grid-row: span 2; width: 24px; height: 24px; color: var(--navy); }
.feature h3 { font-size: 16px; font-weight: 700; line-height: 1.4; }
.feature p { opacity: 0.72; }

/* Features grow from 90% to full size when they scroll into view, and
   shrink back when they leave. The easing curve is a spring
   (stiffness 500, damping 60), so it settles without bouncing. */
.js .scale-in {
  transform: scale(0.9);
  transition: transform 0.6s linear(0, 0.179, 0.415, 0.595, 0.721, 0.808, 0.868, 0.909, 0.938, 0.957, 0.971, 0.98, 0.986, 0.99, 0.993, 0.995, 1);
}
.js .scale-in.is-visible { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .hero { transform: none; }
  .js .scale-in { transform: none; transition: none; }
  .mode-switch::before { transition: none; }
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 80px;
  padding: 0 20px 96px;
  background: var(--bg);
  text-align: center;
  font-size: 13px;
  line-height: 1.6;
}
.footer-links {
  display: flex;
  gap: 40px;
  padding: 0;
  list-style: none;
  font-size: 14px;
  line-height: 14px;
  font-weight: 700;
}
.site-footer p { opacity: 0.4; }
.smallprint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* Platform-specific lines */
.only-tablet, .only-phone { display: none; }

/* ---------- Updates (blog index) ---------- */
.updates-links {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 95px;
  padding: 0;
  list-style: none;
  font-size: 14px;
  line-height: 17px;
  font-weight: 700;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 96px;
  width: 680px;
  max-width: 100%;
  margin: 94px auto 0;
  padding: 0 0 120px;
  list-style: none;
}
.post-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: inherit;
}
.post-card:hover { text-decoration: none; }
.post-card img {
  width: 100%;
  aspect-ratio: 2 / 1;
  object-fit: contain;
}
.post-card h3 {
  margin-top: 24px;
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
}
.post-card p {
  max-width: var(--measure);
  margin-top: 4px;
}
.post-card time {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
}
.post-card:hover h3 { color: var(--link); }

/* ---------- Article (blog post + legal) ---------- */
.post-cover {
  width: 680px;
  max-width: calc(100% - 32px);
  margin: 96px auto 0;
  aspect-ratio: 2 / 1;
  object-fit: cover;
}

.article {
  width: var(--measure);
  max-width: calc(100% - 64px);
  margin: 48px auto 0;
  padding-bottom: 120px;
}
.article-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 40px;
  line-height: 1.2;
  color: var(--navy);
}
.article-meta {
  display: flex;
  gap: 36px;
  margin-top: 16px;
  font-size: 14px;
  line-height: 1;
}

.prose { margin-top: 48px; }
.prose > * + * { margin-top: 16px; }
.prose h2 {
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1.2;
  font-weight: 400;
  text-align: center;
}
.prose h3 {
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
}
.prose > * + h2 { margin-top: 96px; }
.prose > * + h3 { margin-top: 40px; }
.prose h2 + * { margin-top: 32px; }
.prose img,
.prose > p:has(> img:only-child) { margin-block: 48px 40px; }
.prose > p:has(> img:only-child) img { margin: 0; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 8px; }
.prose li p + p { margin-top: 8px; }
.prose blockquote {
  padding-left: 16px;
  border-left: 3px solid var(--navy);
  font-style: italic;
}
.prose blockquote > * + * { margin-top: 16px; }
.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
}
.prose hr { border: 0; border-top: 1px solid color-mix(in srgb, var(--text) 15%, transparent); margin-block: 40px; }

/* Legal uses a slightly wider column */
.article.legal { width: 616px; margin-top: 96px; }
.article.legal .prose { margin-top: 0; }
.article.legal .prose > h2:first-child + p { text-align: center; margin-top: 26px; }

/* 404 */
.not-found { text-align: center; padding: 64px 20px 160px; }
.not-found p + p { margin-top: 16px; }

/* ==========================================================================
   Tablet 810–1199
   ========================================================================== */
@media (min-width: 810px) and (max-width: 1199.98px) {
  .site-header { padding-top: 119px; }
  .logo svg { width: 44px; height: 44px; }
  .logo span { font-size: 15px; line-height: 15px; letter-spacing: 0.03em; }

  .home { --hero-width: 400px; --hero-gap: 64px; --hero-lift: -80px; }
  .hero h1 { font-size: 42px; }
  .hero h2 { font-size: 34px; }
  .app-store svg { width: 136px; height: 44px; }

  .device-frame { width: 92%; }
  .device-frame[data-device="mac"] { display: none; }
  .device-frame[data-device="ipad"] { display: block; }

  .features-section { padding: 100px 0; }
  .features { gap: 44px; max-width: 480px; }

  .site-footer { gap: 64px; padding-bottom: 80px; }
  .footer-links { gap: 36px; }

  .only-desktop { display: none; }
  .only-tablet { display: revert; }
}

/* ==========================================================================
   Phone < 810
   ========================================================================== */
@media (max-width: 809.98px) {
  .site-header { padding-top: 48px; }
  .logo svg { width: 40px; height: 40px; }
  .logo span { font-size: 14px; line-height: 14px; letter-spacing: 0.04em; }
  .page-title { margin-top: 32px; font-size: 36px; }

  .home { --hero-width: 300px; --hero-gap: 48px; --hero-lift: -120px; }
  .hero { min-height: 320px; }
  .hero h1 { font-size: 36px; }
  .hero h2 { font-size: 26px; }
  .app-store svg { width: 124px; height: 40px; }

  .device-frame { width: 88%; }
  .device-frame[data-device="mac"] { display: none; }
  .device-frame[data-device="iphone"] { display: block; }

  .features-section { padding: 80px 40px; }
  .features { gap: 48px; max-width: none; }
  .feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-align: center;
  }
  .feature svg { width: 32px; height: 32px; margin-bottom: 14px; }

  .site-footer { gap: 48px; padding-bottom: 64px; }
  .footer-links { gap: 28px; }

  .only-desktop { display: none; }
  .only-phone { display: revert; }

  .updates-links { margin-top: 64px; }
  .post-list { gap: 72px; margin-top: 64px; padding-inline: 16px; }
  .post-card p { padding-inline: 16px; }

  .post-cover { margin-top: 48px; }
  .article { margin-top: 32px; }
  .article-title { font-size: 26px; }
  .article-meta { flex-direction: column; gap: 8px; }
  .prose { margin-top: 40px; }
  .prose h2 { font-size: 32px; }

  .article.legal { margin-top: 64px; }
}

/* Page-specific spacing */
.page-title a { display: inline-block; }
.article.legal .prose > * + h3 { margin-top: 48px; }
