:root {
  --bg: #faf7f2;
  --bg-alt: #ffffff;
  --ink: #2b2420;
  --ink-soft: #5c534b;
  --accent: #a45c3c;
  --accent-dark: #7c4128;
  --line: #e7ded2;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(43, 36, 32, 0.08);
  --max: 1080px;
}

/* KnitMath uses the same component system as QuiltMath, but its own accent (matching the
   app's own in-app palette) so the two products read as siblings, not one reskinned as
   the other. Everything else — bg/ink/line/radius — stays shared studio identity. */
body.knitmath {
  --accent: #7a5c3e;
  --accent-dark: #5b4530;
}

/* FrameBench uses its own deep-forest identity color, matching its in-app brand. */
body.framebench {
  --accent: #3d7a68;
  --accent-dark: #0b4638;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

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

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

/* Back-to-hub bar (product pages only) */
.back-bar {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.back-bar .wrap {
  padding: 10px 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-soft);
  text-decoration: none;
}

.back-link:hover { color: var(--accent-dark); }

/* Header */
header.site {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg-alt);
}

header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.brand-text .studio {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--ink-soft);
  display: block;
}

.brand-text .app {
  font-size: 19px;
  font-weight: 700;
  display: block;
  line-height: 1.2;
}

nav.site a {
  margin-left: 22px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 600;
}

nav.site a:hover { color: var(--accent-dark); }

/* Hero */
.hero {
  padding: 64px 0 48px;
}

.hero .wrap {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}

.hero .wrap > * {
  min-width: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff3e6;
  border: 1px solid #f0d5b8;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

h1 {
  font-size: 40px;
  line-height: 1.15;
  margin: 0 0 16px;
  letter-spacing: -0.5px;
}

.hero p.lead {
  font-size: 18px;
  color: var(--ink-soft);
  margin: 0 0 28px;
  max-width: 46ch;
}

.cta-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--accent-dark);
  color: #fff;
  box-shadow: 0 6px 16px rgba(124, 65, 40, 0.28);
}

.btn-secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.hero.hub .wrap {
  grid-template-columns: 1fr;
}

.hero.hub .hero-copy {
  max-width: 640px;
}

.hero-shot {
  display: flex;
  justify-content: center;
}

.hero-shot picture {
  width: 100%;
  max-width: 260px;
  display: block;
}

.hero-shot img {
  width: 100%;
  max-width: 260px;
  height: auto;
  border-radius: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

/* Sections */
section {
  padding: 56px 0;
}

section.alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

h2 {
  font-size: 28px;
  margin: 0 0 8px;
  letter-spacing: -0.3px;
}

.section-lead {
  color: var(--ink-soft);
  margin: 0 0 32px;
  max-width: 60ch;
}

.section-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.section-heading-row .section-lead { margin-bottom: 0; }

.text-link {
  flex-shrink: 0;
  font-weight: 700;
  text-decoration: none;
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 8px;
}

.about-card {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

section.alt .about-card { background: var(--bg); }

.about-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.about-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14.5px;
}

/* Product cards (studio hub) */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
  margin-top: 8px;
}

.product-card {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 5px 16px rgba(43, 36, 32, 0.05);
}

section.alt .product-card { background: var(--bg); }

.product-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 228px;
  margin: 0 0 20px;
  padding: 12px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.product-preview img { display: block; width: auto; max-width: 100%; height: 100%; object-fit: contain; border-radius: 5px; }
.product-preview:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.product-card h3 {
  margin: 0 0 10px;
  font-size: 22px;
  letter-spacing: -0.2px;
}

.product-card p {
  margin: 0 0 20px;
  color: var(--ink-soft);
}

/* Studio journal */
.journal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.journal-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-alt);
  box-shadow: 0 5px 16px rgba(43, 36, 32, 0.05);
}

.journal-card > img,
.journal-card picture,
.journal-card picture img {
  display: block;
  width: 100%;
}

.journal-card picture {
  height: 230px;
  overflow: hidden;
  background: #e5ece8;
}

.journal-card > img,
.journal-card picture img {
  height: 230px;
  object-fit: cover;
  object-position: top center;
  background: #f4efe6;
}

.journal-card picture.journal-shot-crop img {
  transform: scale(1.14);
  transform-origin: center 18%;
}

.journal-card:first-child > img {
  object-fit: contain;
  padding: 38px;
}

.journal-card-copy { padding: 20px; }

.journal-card time,
.update-entry time {
  display: block;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  margin-bottom: 8px;
}

.journal-card h3,
.update-entry h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.journal-card p,
.update-entry p {
  margin: 0 0 14px;
  color: var(--ink-soft);
}

.journal-card a { font-weight: 700; text-decoration: none; }

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.social-link::before {
  content: "";
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M22 12a10 10 0 1 0-11.56 9.88v-6.99H7.9V12h2.54V9.8c0-2.5 1.49-3.89 3.78-3.89 1.1 0 2.24.2 2.24.2v2.46H15.2c-1.24 0-1.63.77-1.63 1.56V12h2.77l-.44 2.89h-2.33v6.99A10 10 0 0 0 22 12Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M22 12a10 10 0 1 0-11.56 9.88v-6.99H7.9V12h2.54V9.8c0-2.5 1.49-3.89 3.78-3.89 1.1 0 2.24.2 2.24.2v2.46H15.2c-1.24 0-1.63.77-1.63 1.56V12h2.77l-.44 2.89h-2.33v6.99A10 10 0 0 0 22 12Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.updates-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}

.updates-intro { margin-bottom: 34px; }

.update-entry {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

.update-entry img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  object-position: center 12%;
  border: 0;
  border-radius: 0;
  background: #e5ece8;
}

.update-entry picture {
  display: block;
  height: 280px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #e5ece8;
  box-shadow: 0 5px 16px rgba(43, 36, 32, 0.05);
}

.journal-card picture.layout-designer-shot img,
.update-entry picture.layout-designer-shot img {
  object-position: center 58%;
}

.update-entry.logo-entry img {
  height: 280px;
  object-fit: cover;
  object-position: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ead9b6;
  box-shadow: 0 5px 16px rgba(43, 36, 32, 0.05);
}

.article-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 56px 24px 84px;
}

.article-page header.article-header {
  margin-bottom: 34px;
}

.article-page header.article-header h1 {
  max-width: 18ch;
  margin-bottom: 14px;
}

.article-page .article-meta {
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 13px;
}

.article-page .article-lead {
  font-size: 20px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.article-media {
  margin: 30px 0 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
}

.article-media img {
  display: block;
  width: 100%;
  height: auto;
}

.article-media.layout-designer-article {
  width: min(100%, 520px);
  aspect-ratio: 4 / 5;
}

.article-media.layout-designer-article img {
  height: 100%;
  object-fit: cover;
  object-position: center 58%;
}

.article-media:not(.cover) {
  width: min(100%, 372px);
  margin-left: auto;
  margin-right: auto;
}

.article-media.cover img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.article-page h2 { margin-top: 36px; }
.article-page li { margin-bottom: 8px; }
.article-back { margin-top: 44px; }

/* Features */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.feature {
  display: flex;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-alt);
}

.feature .icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #f4e9dd;
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.feature h3 {
  margin: 0 0 4px;
  font-size: 15.5px;
}

.feature p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.feature.premium {
  border-color: #e9cfa8;
  background: #fffaf3;
}

.premium-heading {
  margin: 32px 0 18px;
  font-size: 16px;
  color: var(--accent-dark);
}

.faq-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 28px;
  align-items: start;
}

.faq-shot {
  display: block;
  position: sticky;
  top: 24px;
  width: 100%;
  max-width: 280px;
}

.faq-shot img {
  display: block;
  width: 100%;
  max-height: 560px;
  height: auto;
  object-fit: contain;
  object-position: top center;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* Changelog */
.changelog {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.changelog-item {
  display: flex;
  gap: 20px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.changelog-item:first-child { border-top: none; }

.changelog-version {
  flex-shrink: 0;
  width: 64px;
  font-weight: 700;
  color: var(--accent-dark);
}

.changelog-item h3 {
  margin: 0 0 4px;
  font-size: 15.5px;
}

.changelog-date {
  font-weight: 400;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-left: 6px;
}

.coming-up-cta {
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13.5px;
}

.coming-up-cta a {
  color: var(--accent-dark);
  font-weight: 700;
}

.changelog-item p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14.5px;
}

/* Screenshots */
.screenshot-group-title {
  margin: 26px 0 6px;
  font-size: 18px;
}

.premium-screenshot-title,
.extra-screenshot-title {
  color: var(--accent);
  margin-top: 34px;
}

.screenshot-group-copy {
  max-width: 720px;
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 14.5px;
}

.shot-scroll {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding: 8px 4px 20px;
  scroll-snap-type: x mandatory;
}

.shot-scroll picture {
  scroll-snap-align: start;
  width: 200px;
  flex-shrink: 0;
  display: block;
}

.shot-scroll img {
  width: 200px;
  height: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* Status / testing */
.status-box {
  border: 1px solid var(--line);
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 26px 28px;
}

.status-box h3 {
  margin-top: 0;
  font-size: 17px;
}

.status-steps {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.status-steps li {
  counter-increment: step;
  display: flex;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.status-steps li:first-child { border-top: none; }

.status-steps li::before {
  content: counter(step);
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-steps li > div { min-width: 0; }
.status-steps a {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.note {
  margin-top: 18px;
  font-size: 13.5px;
  color: var(--ink-soft);
  background: #f4efe6;
  border-radius: 10px;
  padding: 12px 14px;
}

/* Contact */
.contact-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 28px;
}

.contact-box h3 { margin: 0 0 6px; font-size: 18px; }
.contact-box p { margin: 0; color: var(--ink-soft); }

/* Footer */
footer.site {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  background: var(--bg-alt);
}

footer.site .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13.5px;
  color: var(--ink-soft);
}

footer.site a { color: var(--ink-soft); }

/* Privacy page */
.policy {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}

.policy h1 { font-size: 30px; }
.policy .effective { color: var(--ink-soft); margin-bottom: 32px; }
.policy h2 { font-size: 20px; margin-top: 36px; }
.policy p { color: var(--ink-soft); }
.policy hr { border: none; border-top: 1px solid var(--line); margin: 32px 0; }

/* Responsive */
@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-shot { order: -1; }
  .about-grid { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .journal-grid { grid-template-columns: 1fr; }
  .journal-grid { gap: 12px; }
  .journal-card { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: start; padding: 14px; gap: 14px; }
  .journal-card picture,
  .journal-card > img,
  .journal-card picture img { width: 88px; height: 112px; border-radius: 8px; }
  .journal-card:first-child > img { padding: 8px; }
  .journal-card-copy { padding: 0; min-width: 0; }
  .journal-card h3 { font-size: 17px; line-height: 1.3; }
  .journal-card p { font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin-bottom: 8px; }
  .journal-card a { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; }
  .section-heading-row { align-items: flex-start; flex-direction: column; }
  .update-entry { grid-template-columns: 88px minmax(0, 1fr); gap: 14px; padding: 20px 0; align-items: start; }
  .update-entry > div { min-width: 0; }
  .update-entry > div:only-child { grid-column: 1 / -1; }
  .update-entry picture,
  .update-entry img,
  .update-entry.logo-entry img { width: 88px; height: 112px; border-radius: 8px; }
  .update-entry h2 { font-size: 17px; line-height: 1.3; }
  .update-entry p { font-size: 14px; line-height: 1.5; margin-bottom: 8px; }
  .faq-layout { grid-template-columns: 1fr; }
  .faq-shot { position: static; max-width: 260px; }
  h1 { font-size: 32px; }
  nav.site { display: none; }
}

@media (max-width: 520px) {
  .product-preview { height: 180px; margin-bottom: 16px; }
  .btn { max-width: 100%; overflow-wrap: anywhere; }
  .update-entry { grid-template-columns: 64px minmax(0, 1fr); gap: 12px; }
  .update-entry picture,
  .update-entry img,
  .update-entry.logo-entry img { width: 64px; height: 88px; }
  .shot-scroll picture,
  .shot-scroll img { width: min(76vw, 260px); }
  .faq-shot { max-width: min(76vw, 260px); }
}


/* Current iOS gallery links preserve the screenshot rail layout. */
.shot-scroll > a { display: block; flex: 0 0 auto; scroll-snap-align: start; }
.shot-scroll > a img { display: block; }
.ipad-preview { max-width: 680px; margin: 24px auto; }
.ipad-preview img { display: block; width: 100%; height: auto; border-radius: 16px; }
