/*
 * Shared styles for app-scoped pages (rosevine.net/apps/<slug>/...).
 * Each page sets its brand as CSS variables on :root (AppLayout.tsx), so one
 * stylesheet serves every app. Bump APPS_STYLESHEET_VERSION when this changes.
 */

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

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

body.app-page {
  margin: 0;
  background: #fff;
  color: var(--app-ink);
  font-family: var(--app-body-font);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.app-page h1, .app-page h2, .app-page h3 {
  font-family: var(--app-heading-font);
  font-weight: 700;
  color: var(--app-ink);
  margin: 0;
}

.app-page a { color: inherit; }
.app-page img { max-width: 100%; height: auto; }

.app-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--app-button-bg);
  color: var(--app-button-color);
  padding: 0.5rem 1rem;
  z-index: 10;
}
.app-skip:focus { left: 1rem; top: 1rem; }

.app-container { max-width: 1140px; margin: 0 auto; padding: 0 20px; }

/* ── Header: logo left, uppercase nav right ─────────────────────────── */
.app-header { background: #fff; border-bottom: 1px solid rgba(0, 0, 0, 0.06); }
.app-header-inner {
  max-width: 1366px;
  margin: 0 auto;
  padding: 10px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.app-logo { display: block; line-height: 0; }
.app-logo img { width: 157px; height: auto; }

.app-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; }
.app-nav a,
.app-menu nav a {
  text-decoration: none;
  text-transform: uppercase;
  color: var(--app-muted);
  font-size: 20px;
  line-height: 1;
  padding: 10px 15px;
  transition: color 0.15s ease;
}
.app-nav a:hover, .app-nav a:focus-visible,
.app-menu nav a:hover, .app-menu nav a:focus-visible { color: var(--app-primary); }

.app-menu { display: none; position: relative; }
.app-menu summary {
  list-style: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 8px;
}
.app-menu summary::-webkit-details-marker { display: none; }
.app-menu summary span { display: block; height: 4px; background: var(--app-ink); border-radius: 1px; }
.app-menu[open] nav {
  position: absolute;
  right: 0;
  top: 52px;
  z-index: 5;
  min-width: 220px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border-radius: 7px;
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
}
.app-menu[open] nav a { padding: 14px 20px; font-size: 18px; }

/* ── Hero: the brand color block with a rounded corner ──────────────── */
.app-hero {
  background: var(--app-primary);
  border-bottom-right-radius: 120px;
}
.app-hero .app-container { padding-top: 72px; padding-bottom: 72px; max-width: 1140px; }
.app-eyebrow {
  margin: 0 0 0.75rem;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.app-hero h1 { font-size: clamp(2.5rem, 6vw, 62px); line-height: 1.05; }
.app-accent { color: var(--app-on-primary-accent); }
.app-lead { margin: 1rem 0 0; max-width: 40rem; font-size: 20px; line-height: 1.6; }
.app-meta {
  display: inline-block;
  margin: 1.5rem 0 0;
  padding: 6px 14px;
  border-radius: 7px;
  background: var(--app-button-bg);
  color: var(--app-button-color);
  font-size: 15px;
}

/* ── Document: sticky contents beside numbered sections ─────────────── */
.app-doc { padding: 64px 0 96px; }
.app-doc-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}
.app-toc {
  position: sticky;
  top: 24px;
  background: var(--app-tint);
  border-radius: 10px;
  padding: 24px 24px 20px;
  font-size: 15px;
  line-height: 1.4;
}
.app-toc-title {
  margin: 0 0 0.75rem;
  font-family: var(--app-heading-font);
  font-weight: 700;
  font-size: 18px;
}
.app-toc ol { margin: 0; padding-left: 1.25rem; }
.app-toc li { margin: 0 0 0.5rem; }
.app-toc li::marker { color: var(--app-primary); font-weight: 700; }
.app-toc a { text-decoration: none; }
.app-toc a:hover, .app-toc a:focus-visible { color: var(--app-primary); text-decoration: underline; }

.app-doc-section { scroll-margin-top: 24px; padding-bottom: 2rem; }
.app-doc-section + .app-doc-section { border-top: 1px solid rgba(0, 0, 0, 0.08); padding-top: 2rem; }
.app-doc-section h2 {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: clamp(1.5rem, 3vw, 28px);
  line-height: 1.2;
  margin-bottom: 1rem;
}
.app-num {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--app-primary);
  color: var(--app-ink);
  font-size: 18px;
}
.app-doc-section p, .app-doc-section ul, .app-doc-section address { margin: 0 0 1rem; }
.app-doc-section ul { padding-left: 1.4rem; }
.app-doc-section li { margin-bottom: 0.4rem; }
.app-doc-section li::marker { color: var(--app-primary); }
.app-doc-section a {
  color: var(--app-ink);
  text-decoration-color: var(--app-primary);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.app-doc-section a:hover, .app-doc-section a:focus-visible { color: var(--app-primary); }
.app-doc-section strong { font-weight: 700; }

.app-callout {
  background: var(--app-tint);
  border-left: 5px solid var(--app-primary);
  border-radius: 10px;
  padding: 18px 22px;
  margin: 0 0 1rem;
}
.app-callout p:last-child { margin-bottom: 0; }

/* ── Hub cards: alternating brand colors, like the app's feature grid ─ */
.app-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; max-width: 900px; margin: 0 auto; }
.app-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 36px 28px;
  border-radius: 10px;
  background: var(--app-tint);
  text-decoration: none;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
/* Checkerboard across the two columns. */
.app-card:nth-child(4n + 1), .app-card:nth-child(4n + 4) { background: var(--app-secondary); }
.app-card:hover, .app-card:focus-visible { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1); }
.app-card h2 { font-size: 23px; }
.app-card p { margin: 0; font-size: 17px; flex: 1; }
.app-card-more { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }

/* ── Footer: contact band, gradient nav strip, copyright bar ────────── */
.app-footer-contact {
  background: var(--app-footer);
  padding: 56px 20px;
  text-align: center;
}
.app-footer-contact a {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-size: 18px;
  overflow-wrap: anywhere;
}
.app-footer-contact a:hover { text-decoration: underline; }
.app-footer-nav {
  background: linear-gradient(90deg, var(--app-primary) 0%, var(--app-secondary) 100%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  padding: 10px 20px;
}
.app-footer-nav a {
  text-decoration: none;
  text-transform: uppercase;
  font-size: 15px;
  line-height: 1;
  padding: 4px 12px;
}
.app-footer-nav a + a { border-left: 1px solid var(--app-ink); }
.app-footer-nav a:hover, .app-footer-nav a:focus-visible { text-decoration: underline; }
.app-footer-legal {
  max-width: 1366px;
  margin: 0 auto;
  padding: 14px 60px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  font-size: 13px;
}
.app-footer-legal p { margin: 0; }
.app-footer-docs { display: flex; gap: 1.25rem; }
.app-footer-docs a { text-decoration: none; }
.app-footer-docs a:hover, .app-footer-docs a:focus-visible { color: var(--app-primary); text-decoration: underline; }

/* ── Small screens ──────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .app-doc-grid { grid-template-columns: 1fr; gap: 32px; }
  .app-toc { position: static; }
}

@media (max-width: 860px) {
  .app-cards { grid-template-columns: 1fr; }
  .app-card:nth-child(n) { background: var(--app-tint); }
  .app-card:nth-child(odd) { background: var(--app-secondary); }
  .app-nav { display: none; }
  .app-menu { display: block; }
  .app-header-inner { padding: 10px 16px; }
  .app-logo img { width: 140px; }
  .app-hero { border-bottom-right-radius: 64px; text-align: center; }
  .app-hero .app-container { padding-top: 48px; padding-bottom: 48px; }
  .app-lead { margin-left: auto; margin-right: auto; }
  .app-footer-legal { justify-content: center; text-align: center; padding: 14px 16px; }
}

@media (max-width: 480px) {
  body.app-page { font-size: 17px; }
  .app-container { padding: 0 16px; }
  .app-lead { font-size: 18px; }
  .app-doc { padding: 40px 0 64px; }
  .app-doc-section h2 { align-items: flex-start; }
  .app-num { width: 34px; height: 34px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .app-card { transition: none; }
}
