/* Shared design system for the Mark marketing/support/privacy site.
   Colors match the real, shipped app exactly (src/styles/app.css's default
   "evergreen" theme + manifest.webmanifest's theme_color/background_color) --
   this site is a continuation of the product's own brand, not a separate
   palette invented for marketing. */

@font-face {
  font-family: "Codex Mono";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("./fonts/codex-mono.woff2") format("woff2");
}
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("./fonts/newsreader-latin.woff2") format("woff2");
}

:root {
  --bg: #fbfaf7;
  --bg-elevated: #ffffff;
  --bg-sunken: #f3f1ea;
  --fg: #23201b;
  --muted: #6b6658;
  --border: #e5e1d8;
  --accent: #1f6f8b;
  --accent-2: #a8541f;
  --accent-soft: #1f6f8b1a;
  --accent-2-soft: #a8541f1a;
  --shadow: 0 1px 2px #23201b0d, 0 8px 24px -8px #23201b1f;
  --shadow-lg: 0 4px 12px #23201b12, 0 24px 64px -16px #23201b26;

  --font-display: "Newsreader", ui-serif, Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "Codex Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --space-1: .5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6.5rem;

  --radius: 14px;
  --radius-lg: 22px;
  --container: 72rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1a17;
    --bg-elevated: #232019;
    --bg-sunken: #15140f;
    --fg: #ece7dd;
    --muted: #97907f;
    --border: #35322c;
    --accent: #6fc3da;
    --accent-2: #e0a072;
    --accent-soft: #6fc3da26;
    --accent-2-soft: #e0a07226;
    --shadow: 0 1px 2px #00000033, 0 8px 24px -8px #00000059;
    --shadow-lg: 0 4px 16px #00000040, 0 32px 80px -20px #00000073;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1a17;
  --bg-elevated: #232019;
  --bg-sunken: #15140f;
  --fg: #ece7dd;
  --muted: #97907f;
  --border: #35322c;
  --accent: #6fc3da;
  --accent-2: #e0a072;
  --accent-soft: #6fc3da26;
  --accent-2-soft: #e0a07226;
  --shadow: 0 1px 2px #00000033, 0 8px 24px -8px #00000059;
  --shadow-lg: 0 4px 16px #00000040, 0 32px 80px -20px #00000073;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
::selection { background: var(--accent-soft); color: var(--fg); }

.wrap { max-width: var(--container); margin: 0 auto; padding: 0 var(--space-3); }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.05rem; color: var(--fg); text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 26%; box-shadow: 0 1px 3px #0002; }
.site-nav { display: flex; align-items: center; gap: var(--space-3); }
.site-nav a:not(.btn) { color: var(--muted); font-size: .92rem; font-weight: 600; text-decoration: none; }
.site-nav a:not(.btn):hover { color: var(--fg); }
.nav-links { display: flex; gap: var(--space-3); }
@media (max-width: 640px) {
  .nav-links { display: none; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1.2rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: .92rem;
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--accent-2))); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { box-shadow: var(--shadow-lg); }
.btn-ghost { background: var(--bg-elevated); color: var(--fg); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); }
/* Official Apple App Store / Mac App Store badge artwork (from Apple's own
   badge service) -- a light/dark pair per badge, toggled by theme so the
   badge itself (not just a background) has real contrast against the page. */
.badge-link { display: inline-flex; border-radius: 10px; transition: transform .15s ease; }
.badge-link:hover { transform: translateY(-1px); }
.badge-link img { height: 44px; width: auto; display: block; }
.badge-link .badge-black { display: block; }
.badge-link .badge-white { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge-link .badge-black { display: none; }
  :root:not([data-theme="light"]) .badge-link .badge-white { display: block; }
}
:root[data-theme="dark"] .badge-link .badge-black { display: none; }
:root[data-theme="dark"] .badge-link .badge-white { display: block; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  overflow: clip;
  padding: var(--space-6) 0 var(--space-5);
}
.hero::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 130%;
  background:
    radial-gradient(ellipse 60% 50% at 15% 10%, var(--accent-soft), transparent 60%),
    radial-gradient(ellipse 50% 45% at 85% 25%, var(--accent-2-soft), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
.hero .wrap { position: relative; z-index: 1; }
.hero-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-5); align-items: center; text-align: center; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: .35rem .85rem;
  margin: 0 auto var(--space-2);
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 5.5vw, 4rem);
  line-height: 1.08;
  letter-spacing: -.01em;
  margin: 0 auto var(--space-2);
  max-width: 42rem;
}
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .lede { font-size: 1.2rem; color: var(--muted); max-width: 38rem; margin: 0 auto var(--space-3); }
.hero-ctas { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center; margin-bottom: var(--space-2); }
.hero-note { color: var(--muted); font-size: .85rem; }

.hero-shot {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  max-width: 62rem;
  margin: var(--space-4) auto 0;
}
.hero-shot img { width: 100%; height: auto; }

/* ---------- sections ---------- */
section { padding: var(--space-6) 0; }
.section-head { max-width: 40rem; margin: 0 auto var(--space-5); text-align: center; }
.section-head .eyebrow { margin: 0 auto var(--space-2); }
.section-head h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.8rem, 3.5vw, 2.5rem); margin: 0 0 .6rem; letter-spacing: -.01em; }
.section-head p { color: var(--muted); font-size: 1.08rem; margin: 0; }

.alt { background: var(--bg-sunken); }

/* feature grid */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr)); gap: var(--space-3); }
.feature-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  box-shadow: var(--shadow);
}
.feature-card .icon {
  width: 2.75rem; height: 2.75rem;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-2-soft));
  color: var(--accent);
  margin-bottom: var(--space-2);
}
.feature-card .icon svg { width: 1.4rem; height: 1.4rem; }
.feature-card h3 { font-size: 1.05rem; margin: 0 0 .4rem; }
.feature-card p { color: var(--muted); font-size: .93rem; margin: 0; line-height: 1.55; }

/* showcase (feature + screenshot pairs) */
.showcase { display: grid; grid-template-columns: 1fr; gap: var(--space-4); align-items: center; margin-top: var(--space-5); }
.showcase:first-of-type { margin-top: 0; }
@media (min-width: 900px) {
  .showcase { grid-template-columns: 1fr 1.1fr; gap: var(--space-5); }
  .showcase.reverse > .showcase-text { order: 2; }
}
.showcase-text .eyebrow { margin: 0 0 var(--space-2); }
.showcase-text h3 { font-family: var(--font-display); font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 600; margin: 0 0 .75rem; letter-spacing: -.01em; }
.showcase-text p { color: var(--muted); font-size: 1.05rem; margin: 0 0 var(--space-2); }
.showcase-text ul { margin: 0; padding-left: 1.1rem; color: var(--muted); }
.showcase-text li { margin-bottom: .4rem; }
.showcase-text li::marker { color: var(--accent); }
.showcase-shot {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--bg-sunken);
}

/* ---------- try-it demos: real Mark --export output, iframed as-is ---------- */
.demo-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-4); align-items: start; max-width: 56rem; margin: 0 auto; }
.demo-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3); box-shadow: var(--shadow); }
.demo-card-head h4 { margin: 0 0 .35rem; font-size: 1.05rem; }
.demo-card-head p { margin: 0 0 var(--space-2); color: var(--muted); font-size: .9rem; line-height: 1.5; }
.demo-card-head code { font-size: .85em; }
.demo-frame-wrap { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; height: 26rem; }
.demo-frame-wrap-short { height: 15rem; }
.demo-frame { display: block; width: 100%; height: 100%; border: 0; color-scheme: light dark; }
.demo-disclaimer { text-align: center; color: var(--muted); font-size: .88rem; margin: var(--space-3) 0 0; }
.demo-disclaimer code { font-size: .9em; }

.tour-frame-wrap { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-elevated); display: flex; align-items: center; justify-content: center; min-height: 20rem; }
.tour-load-btn {
  display: flex; flex-direction: column; align-items: center; gap: .6rem;
  background: none; border: 2px dashed var(--border); border-radius: var(--radius);
  padding: var(--space-4) var(--space-5); margin: var(--space-3);
  color: var(--fg); font: inherit; font-weight: 700; cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.tour-load-btn:hover { border-color: var(--accent); color: var(--accent); }
.tour-load-btn svg { width: 2.5rem; height: 2.5rem; color: var(--accent); }
.tour-load-btn small { font-weight: 500; color: var(--muted); }
.tour-frame-wrap.is-loaded { min-height: 0; display: block; }
.tour-frame { display: block; width: 100%; height: 46rem; border: 0; color-scheme: light dark; }

/* theme / icon grid */
.theme-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--space-2); max-width: 40rem; margin: 0 auto; }
@media (max-width: 640px) { .theme-grid { grid-template-columns: repeat(3, 1fr); } }
.theme-tile { text-align: center; }
.theme-tile img { width: 100%; aspect-ratio: 1; border-radius: 22%; box-shadow: var(--shadow); margin-bottom: .5rem; }
.theme-tile span { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: capitalize; }

/* platform gallery */
.platform-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--space-3); align-items: end; }
.platform-gallery figure { margin: 0; }
.platform-gallery img { border-radius: 20px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.platform-gallery figcaption { text-align: center; margin-top: var(--space-1); color: var(--muted); font-size: .85rem; }

/* trust / privacy band */
.trust-band {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-2-soft));
  padding: var(--space-4);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}
@media (min-width: 800px) { .trust-band { grid-template-columns: repeat(3, 1fr); } }
.trust-item { display: flex; gap: .85rem; align-items: flex-start; }
.trust-item .icon { flex-shrink: 0; width: 2.25rem; height: 2.25rem; display: grid; place-items: center; border-radius: 10px; background: var(--bg-elevated); color: var(--accent); box-shadow: var(--shadow); }
.trust-item .icon svg { width: 1.15rem; height: 1.15rem; }
.trust-item h4 { margin: 0 0 .25rem; font-size: .98rem; }
.trust-item p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }

/* code sample */
.code-sample {
  background: #15140f;
  color: #ece7dd;
  border-radius: var(--radius);
  padding: var(--space-3);
  font-family: var(--font-mono);
  font-size: .95rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-x: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid #35322c;
}
.code-sample .tok-heading { color: #e0a072; font-weight: 700; }
.code-sample .tok-task { color: #6fc3da; font-weight: 700; }
.code-sample .tok-fence { color: #97907f; }
.code-sample .tok-keyword { color: #e0a072; }
.code-sample .tok-operator { color: #97907f; }
.code-sample .tok-function { color: #6fc3da; }
.code-sample .wikilink-marker { color: #97907f; opacity: .6; }
.code-sample .wikilink-content { color: #9fd88c; }
.code-sample .caret { display: inline-block; width: .5em; height: 1em; background: #6fc3da; vertical-align: text-bottom; margin-left: 1px; }
@media (prefers-reduced-motion: no-preference) {
  .code-sample .caret { animation: caret-blink 1s step-end infinite; }
}
@keyframes caret-blink { 50% { opacity: 0; } }

/* theme tiles */
.theme-tile img { transition: transform .2s ease, box-shadow .2s ease; }
.theme-tile:hover img { transform: translateY(-4px) scale(1.06); box-shadow: 0 12px 28px -8px rgba(0,0,0,0.35), var(--shadow); }

/* final CTA */
.cta-band {
  text-align: center;
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-3);
  background: linear-gradient(160deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2)));
  color: #fff;
  box-shadow: var(--shadow-lg);
}
.cta-band h2 { font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 .75rem; font-weight: 600; }
.cta-band p { opacity: .92; font-size: 1.1rem; margin: 0 0 var(--space-3); }
.cta-band .hero-ctas { margin-bottom: 0; }
/* the CTA band's gradient background is always dark enough for white text,
   in both themes -- always show the white badge here, no toggle needed */
.cta-band .badge-link .badge-black { display: none; }
.cta-band .badge-link .badge-white { display: block; }
.cta-band .btn-ghost { background: transparent; color: #fff; border-color: #ffffff55; }
.cta-band .btn-ghost:hover { border-color: #fff; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: var(--space-4) 0 var(--space-5); color: var(--muted); }
.footer-grid { display: flex; flex-wrap: wrap; gap: var(--space-4); justify-content: space-between; }
.footer-brand { display: flex; align-items: center; gap: .6rem; color: var(--fg); font-weight: 700; text-decoration: none; }
.footer-brand img { width: 26px; height: 26px; border-radius: 26%; }
.footer-cols { display: flex; gap: var(--space-5); flex-wrap: wrap; }
.footer-col h5 { margin: 0 0 .75rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.footer-col a { display: block; color: var(--fg); text-decoration: none; font-size: .92rem; margin-bottom: .55rem; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--border); font-size: .82rem; display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; justify-content: space-between; }

/* ---------- simple content pages (support/privacy) ---------- */
.doc-page { max-width: 42rem; margin: 0 auto; padding: var(--space-5) 0 var(--space-6); }
.doc-page h1 { font-family: var(--font-display); font-size: clamp(2rem, 4vw, 2.6rem); font-weight: 600; margin: 0 0 .35rem; letter-spacing: -.01em; }
.doc-page .subtitle, .doc-page .updated { color: var(--muted); font-size: .98rem; margin: 0 0 var(--space-3); }
.doc-page h2 { font-size: 1.15rem; margin: var(--space-4) 0 var(--space-2); }
.doc-page p, .doc-page li { color: var(--fg); }
.doc-page ul { padding-left: 1.25rem; }
.doc-page li + li { margin-top: .5rem; }
.doc-page .summary {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  margin: var(--space-2) 0 var(--space-4);
  box-shadow: var(--shadow);
}
.doc-page .summary p:first-child { margin-top: 0; }
.doc-page .summary p:last-child { margin-bottom: 0; }
.doc-page dt { font-weight: 700; margin-top: var(--space-3); }
.doc-page dt:first-child { margin-top: 0; }
.doc-page dd { margin: .35rem 0 0; color: var(--muted); }

@media (max-width: 640px) {
  section { padding: var(--space-5) 0; }
  .hero { padding: var(--space-4) 0 var(--space-4); }
}
