/* ============================================================
   Draftline — draftline.ink
   Tokens + shared components, ported from the Draftline design
   system (dark is the product default).
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@400;500&family=Merriweather:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700&display=swap');

/* ---------- Color tokens ---------- */
:root {
  --bg-chrome: #1A1B1E;
  --bg-editor: #1E1F22;
  --bg-panel: #27292D;
  --bg-toolbar: #2F3033;
  --bg-surface-alt: #222427;
  --bg-hover: rgba(255,255,255,0.055);
  --bg-active: rgba(255,255,255,0.09);
  --bg-input: #1E1F22;
  --bg-selection: rgba(14,96,142,0.22);
  --bg-page: #34363B;
  --border: #323438;
  --border-subtle: #2A2C2F;
  --border-strong: #46484C;
  --border-focus: #0e608e;
  --text-primary: #DFE1E5;
  --text-secondary: #868C96;
  --text-muted: #4E5258;
  --text-faint: #35383C;
  --text-chapter: #C4C8CF;
  --text-section: #5A6070;
  --icon-color: #AFB3BA;
  --accent: #0e608e;
  --accent-dim: rgba(14,96,142,0.20);
  --accent-subtle: rgba(14,96,142,0.10);
  --app-accent: #0e608e;
  --app-accent-dim: rgba(14,96,142,0.20);
  --app-accent-subtle: rgba(14,96,142,0.10);
  --app-accent-text: #5aafe0;
  --topbar-bg: #2D2F32;
  --topbar-border: #3A3C3F;
  --topbar-accent: #0e608e;
  --close-hover: #C42B1C;
  --scrollbar-thumb: #3A3D41;
  --scrollbar-hover: #0e608e;
  --section-front: #6699FF;
  --section-body: #57A874;
  --section-back: #A07ACA;
  --status-success: #57A874;
  --status-warning: #E5C07B;
  --status-error: #E06C75;
  --status-issue: #f59e0b;
  --status-complete: #4ade80;
  /* Typography */
  --font-ui: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --font-editor: 'Merriweather', 'Georgia', serif;
  --font-mono: 'IBM Plex Mono', 'Fira Code', 'Consolas', monospace;
  /* Elevation */
  --shadow-page: 0 0 0 1px rgba(255,255,255,0.04), 0 4px 16px rgba(0,0,0,0.6), 0 1px 3px rgba(0,0,0,0.4);
  --shadow-dialog: 0 0 0 1px rgba(255,255,255,0.06), 0 16px 48px rgba(0,0,0,0.7), 0 4px 12px rgba(0,0,0,0.4);
  --shadow-card: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-dropdown: 0 0 0 1px rgba(255,255,255,0.05), 0 4px 8px rgba(0,0,0,0.4), 0 16px 48px rgba(0,0,0,0.55);
  --ease-pop: cubic-bezier(0.16,1,0.3,1);
}

/* Light theme (used by the theme-sim cards on the homepage) */
[data-sim-theme='light'] {
  --bg-chrome: #E0E2E8; --bg-editor: #E8EAEF; --bg-panel: #EFEFEF; --bg-toolbar: #F0F0F0;
  --bg-surface-alt: #E4E6EC; --bg-hover: rgba(0,0,0,0.05); --bg-active: rgba(0,0,0,0.09);
  --bg-input: #FFFFFF; --bg-page: #FFFFFF; --border: rgba(0,0,0,0.1); --border-subtle: rgba(0,0,0,0.04);
  --border-strong: rgba(0,0,0,0.18); --text-primary: #1A1D23; --text-secondary: #767C87;
  --text-muted: #A8ADB5; --text-faint: #CDD0D6; --text-chapter: #3A3E46; --text-section: #9096A0;
  --icon-color: #7C8390; --topbar-bg: #E6E8EC; --topbar-border: #CDD0D5;
  --shadow-page: 0 0 0 1px rgba(0,0,0,0.05), 0 4px 16px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.05);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg-editor); overflow-x: clip; }
body { font-family: var(--font-ui); color: var(--text-primary); -webkit-font-smoothing: antialiased; }
a { color: var(--app-accent-text); text-decoration: none; }
a:hover { color: var(--text-primary); }
::selection { background: var(--bg-selection); }
img { max-width: 100%; }

.wrap { max-width: 1120px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.accent-strip { height: 2px; background: var(--app-accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 30px; padding: 0 16px; border-radius: 4px;
  font-size: 12.5px; font-weight: 500; font-family: var(--font-ui);
  cursor: pointer; white-space: nowrap;
  transition: border-color 0.1s, color 0.1s, background 0.1s, opacity 0.12s;
  border: 1px solid var(--border); background: var(--bg-surface-alt); color: var(--text-secondary);
}
.btn:hover { border-color: var(--border-strong); color: var(--text-primary); }
.btn--primary { border-color: var(--app-accent); background: var(--app-accent); color: #fff; }
.btn--primary:hover { border-color: var(--app-accent); color: #fff; opacity: 0.88; }
.btn--sm { height: 25px; }
.btn--lg { height: 40px; padding: 0 24px; font-size: 14px; }
.btn--xl { height: 48px; padding: 0 28px; font-size: 15px; gap: 10px; }
.btn--current { opacity: 0.6; pointer-events: none; }
.btn:disabled, .btn--disabled { opacity: 0.45; cursor: default; pointer-events: none; }

/* ---------- Download page ---------- */
.dl-hero-btn { display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 92px; justify-content: center; }
.dl-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 6px 14px; flex-wrap: wrap; justify-content: center; }
.dl-meta code { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-secondary); }
.dl-alts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.dl-card { text-align: left; }
.dl-card--active { border-color: var(--app-accent); box-shadow: 0 0 0 1px var(--app-accent-dim), var(--shadow-card); }
.dl-card--soon { opacity: 0.7; }
.dl-card-head { display: flex; align-items: center; gap: 10px; }
.dl-card-head .card-icon { width: 22px; height: 22px; }
.dl-card-actions { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.dl-card-actions .btn { width: 100%; }
.dl-card-note { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }
.dl-tag { font-size: 9px; font-weight: 700; letter-spacing: 0.5px; padding: 1.5px 6px; border-radius: 8px; background: var(--app-accent-dim); color: var(--app-accent-text); text-transform: uppercase; }
.dl-tag--soon { background: rgba(229,192,123,0.14); color: var(--status-warning); }
.dl-notes { background: var(--bg-surface-alt); border: 1px solid var(--border); border-radius: 6px; padding: 16px 18px; font-size: 12.5px; color: var(--text-secondary); line-height: 1.6; }
.dl-notes code { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-primary); background: var(--bg-toolbar); padding: 1px 5px; border-radius: 3px; }
.dl-notes table { border-collapse: collapse; width: 100%; margin-top: 8px; }
.dl-notes td { padding: 5px 8px 5px 0; vertical-align: top; border-top: 1px solid var(--border); }
.dl-notes td:first-child { color: var(--text-primary); font-weight: 600; white-space: nowrap; width: 90px; }
.dl-spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; border-radius: 50%; animation: dl-spin 0.8s linear infinite; }
@keyframes dl-spin { to { transform: rotate(360deg); } }

/* ---------- Section label ---------- */
.section-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-section); font-family: var(--font-ui);
}
.section-label .dot { width: 4px; height: 4px; border-radius: 50%; flex-shrink: 0; }
.dot--front { background: var(--section-front); }
.dot--body { background: var(--section-body); }
.dot--back { background: var(--section-back); }

/* ---------- Kbd ---------- */
.kbd {
  display: inline-flex; align-items: center; height: 20px; padding: 0 6px;
  background: var(--bg-toolbar); border: 1px solid var(--border-strong); border-radius: 3px;
  font-family: var(--font-ui); font-size: 11px; color: var(--text-secondary);
  box-shadow: 0 1px 0 var(--border-strong); white-space: nowrap;
}

/* ---------- Badge ---------- */
.badge {
  display: inline-block; font-size: 10.5px; font-weight: 600; padding: 2px 7px;
  border-radius: 10px; letter-spacing: 0.02em; font-family: var(--font-ui);
}
.badge--warn { background: rgba(229,192,123,0.14); color: #E5C07B; }

/* ---------- Progress bar ---------- */
.progress { font-family: var(--font-ui); }
.progress-track { height: 6px; background: var(--bg-surface-alt); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--app-accent); border-radius: 3px; transition: width 0.3s ease; }
.progress-fill--complete { background: #4ade80; }
.progress-labels { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11px; color: var(--text-muted); }

/* ---------- Dashboard section / big number / stat row ---------- */
.dash-section { background: var(--bg-surface-alt); border: 1px solid var(--border); border-radius: 6px; padding: 12px; font-family: var(--font-ui); }
.dash-section-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-section); margin-bottom: 8px; }
.big-number { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.big-number .value { font-size: 28px; font-weight: 700; color: var(--text-primary); letter-spacing: -1px; line-height: 1; }
.big-number .label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-row { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.stat-row span:first-child { color: var(--text-secondary); }
.stat-row span:last-child { color: var(--text-primary); font-weight: 600; }

/* ---------- Tools tab ---------- */
.tools-tab {
  flex: 1; height: 100%; background: transparent; border: none;
  border-bottom: 2px solid transparent; color: var(--text-section);
  font-size: 11px; font-weight: 600; font-family: var(--font-ui);
  letter-spacing: 0.3px; cursor: pointer; text-transform: uppercase;
  transition: color 0.1s, border-color 0.1s;
}
.tools-tab:hover { color: var(--text-primary); }
.tools-tab--active, .tools-tab--active:hover { border-bottom-color: var(--app-accent); color: var(--app-accent-text); }

/* ---------- Tool card ---------- */
.tool-card {
  background: var(--bg-surface-alt); border: 1px solid var(--border); border-radius: 5px;
  padding: 11px 12px 12px; box-shadow: var(--shadow-card);
  transition: border-color 0.15s; font-family: var(--font-ui);
}
.tool-card:hover { border-color: var(--border-strong); }
.tool-card-title { font-size: 12px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; letter-spacing: 0.1px; }
.tool-card-desc { font-size: 11px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 9px; }
.tool-card-btn {
  width: 100%; height: 25px; background: transparent; border: 1px solid var(--border);
  border-radius: 3px; color: var(--text-secondary); font-size: 11px; font-family: var(--font-ui);
  cursor: pointer; transition: border-color 0.1s, color 0.1s, background 0.1s; font-weight: 500; margin-top: 4px;
}
.tool-card-btn:hover { background: var(--app-accent-subtle); border-color: var(--app-accent); color: var(--app-accent-text); }

/* ---------- Chapter item ---------- */
.chapter-item {
  display: flex; align-items: center; padding: 0 8px 0 22px; cursor: pointer; gap: 7px;
  height: 28px; color: var(--text-chapter); font-size: 12.5px; font-family: var(--font-ui);
  transition: background 0.08s; border-left: 2px solid transparent;
}
.chapter-item:hover { background: var(--bg-hover); }
.chapter-item--selected { color: var(--text-primary); border-left-color: var(--icon-color); background: var(--bg-active); }
.chapter-item--selected .chapter-item-title { font-weight: 500; }
.chapter-item--subtitled { height: auto; padding-top: 5px; padding-bottom: 5px; }
.chapter-item-icon { color: var(--icon-color); opacity: 0.7; flex-shrink: 0; line-height: 0; }
.chapter-item--selected .chapter-item-icon { opacity: 1; }
.chapter-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.chapter-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-item-subtitle { font-size: 10px; color: var(--text-muted); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Menu ---------- */
.menu {
  min-width: 248px; background: var(--bg-panel); border: 1px solid var(--border-strong);
  border-radius: 8px; box-shadow: var(--shadow-dropdown); padding: 5px;
}
.menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 30px; padding: 0 10px;
  background: transparent; border: none; border-radius: 4px; cursor: pointer;
  font-family: var(--font-ui); font-size: 13px; color: var(--text-primary); text-align: left;
  transition: background 0.08s;
}
.menu-item:hover:not(:disabled) { background: var(--bg-hover); }
.menu-item:disabled { opacity: 0.38; cursor: default; }
.menu-item-icon { color: var(--icon-color); flex-shrink: 0; display: flex; }
.menu-item-label { flex: 1; }
.menu-item-shortcut { font-size: 10.5px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.menu-sep { height: 1px; background: var(--border); margin: 3px 4px; }
.menu-note { padding: 7px 10px 5px; font-size: 12.5px; color: var(--text-muted); font-family: var(--font-ui); }

/* ---------- Site nav ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg-chrome) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-nav-inner { max-width: 1120px; margin: 0 auto; padding: 0 24px; height: 56px; display: flex; align-items: center; gap: 16px; }
.nav-logo { display: flex; align-items: center; flex-shrink: 0; }
.logo-mask {
  display: inline-block; width: 104px; height: 46px; background: var(--text-primary); opacity: 0.85;
  mask: url('../assets/logo.svg') center / contain no-repeat;
  -webkit-mask: url('../assets/logo.svg') center / contain no-repeat;
}
.nav-links { display: flex; align-items: center; gap: 4px; flex: 1; margin-left: 12px; }
.nav-link { color: var(--text-secondary); font-size: 13px; padding: 6px 10px; border-radius: 3px; transition: background 0.1s, color 0.1s; }
.nav-link:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-link--active, .nav-link--active:hover { color: var(--text-primary); background: var(--bg-active); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-gh { display: flex; align-items: center; gap: 7px; color: var(--text-secondary); font-size: 13px; padding: 6px 10px; border-radius: 3px; transition: background 0.1s, color 0.1s; }
.nav-gh:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-burger {
  display: none; width: 36px; height: 36px; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border); border-radius: 4px;
  color: var(--icon-color); cursor: pointer; transition: background 0.1s, color 0.1s;
}
.nav-burger:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-mobile { display: none; border-top: 1px solid var(--border); background: var(--bg-chrome); flex-direction: column; padding: 8px 16px 14px; gap: 2px; }
.nav-mobile a { color: var(--text-secondary); font-size: 14px; padding: 10px 8px; border-radius: 4px; transition: background 0.1s, color 0.1s; }
.nav-mobile a:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-mobile a.nav-link--active { color: var(--text-primary); background: var(--bg-active); }
@media (max-width: 840px) {
  .nav-desktop { display: none !important; }
  .nav-burger { display: inline-flex; }
  .nav-mobile.open { display: flex; }
}

/* ---------- Footer (mobile layout fixed) ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-chrome); }
.site-footer-inner {
  max-width: 1120px; margin: 0 auto; padding: 28px 24px;
  display: flex; align-items: center; gap: 16px 24px; flex-wrap: wrap;
}
.footer-logo {
  display: inline-block; width: 82px; height: 36px; background: var(--text-secondary); opacity: 0.85;
  mask: url('../assets/logo.svg') center / contain no-repeat;
  -webkit-mask: url('../assets/logo.svg') center / contain no-repeat;
  flex-shrink: 0;
}
.footer-links { display: flex; gap: 18px; font-size: 12.5px; flex-wrap: wrap; }
.footer-links a { color: var(--text-secondary); }
.footer-links a:hover { color: var(--text-primary); }
.footer-meta { margin-left: auto; font-size: 12px; color: var(--text-muted); }
@media (max-width: 720px) {
  .site-footer-inner { flex-direction: column; align-items: flex-start; gap: 14px; }
  .footer-meta { margin-left: 0; }
}

/* ---------- Scroll reveal (shared across all pages) ---------- */
.rv { opacity: 0; transform: translateY(28px); transition: opacity .7s ease, transform .7s var(--ease-pop); }
.rv-l { transform: translateX(-36px); }
.rv-r { transform: translateX(36px); }
.rv.rv-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; transform: none; transition: none; } }

/* ---------- Shared page patterns ---------- */
.hero { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 22px; }
.hero h1 { margin: 0; line-height: 1.14; font-weight: 650; letter-spacing: -0.5px; text-wrap: balance; }
.hero-sub { margin: 0; line-height: 1.65; color: var(--text-secondary); text-wrap: pretty; }
.section-head { display: flex; flex-direction: column; gap: 10px; }
.section-head h2 { margin: 0; font-weight: 650; letter-spacing: -0.3px; }
.section-head p { margin: 0; line-height: 1.6; color: var(--text-secondary); text-wrap: pretty; }
.cta-band { border-top: 1px solid var(--border); }
.cta-inner { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; }
.cta-asterism { font-family: var(--font-editor); font-style: italic; font-size: 15px; color: var(--text-muted); }
.cta-actions { display: flex; gap: 12px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }
.back-link { display: flex; align-items: center; font-size: 13.5px; padding: 0 10px; white-space: nowrap; }
.check-list { display: flex; flex-direction: column; gap: 9px; }
.check-item { display: flex; gap: 10px; align-items: baseline; font-size: 13.5px; color: var(--text-secondary); }
.check-item .tick { color: var(--status-success); font-weight: 700; }
.check-item .cross { color: var(--status-error); font-weight: 700; }
.check-item strong { color: var(--text-primary); font-weight: 600; }
.card {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 6px;
  padding: 22px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-card); transition: border-color 0.15s;
}
.card:hover { border-color: var(--border-strong); }
.card-title { font-size: 14.5px; font-weight: 600; color: var(--text-primary); }
.card-body { font-size: 13px; line-height: 1.6; color: var(--text-secondary); text-wrap: pretty; }
.card-icon { color: var(--icon-color); display: inline-flex; width: 22px; height: 22px; }

/* ---------- Titlebar chrome (theme-sim mockups) ---------- */
.titlebar {
  display: flex; align-items: center; height: 44px; min-height: 44px;
  background: color-mix(in srgb, var(--topbar-bg) 50%, transparent);
  border-bottom: 1px solid var(--topbar-border);
  border-top: 2px solid var(--accent);
  position: relative; z-index: 20; user-select: none;
}
.tb-logo-wrap { display: flex; align-items: center; padding: 0 16px 0 18px; position: relative; z-index: 22; }
.tb-logo {
  width: 100px; height: 44px; background-color: var(--text-primary); opacity: 0.85; flex-shrink: 0;
  mask: url('../assets/logo.svg') left center / contain no-repeat;
  -webkit-mask: url('../assets/logo.svg') left center / contain no-repeat;
}
.tb-divider { width: 1px; height: 18px; background: var(--border); opacity: 0.8; position: relative; z-index: 22; }
.tb-switcher { position: relative; isolation: isolate; margin-left: 8px; z-index: 22; }
.tb-glow {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 280px; height: 80px; pointer-events: none; z-index: -1;
}
.tb-project {
  display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px 0 6px;
  background: transparent; border: none; border-radius: 5px; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-primary); max-width: 240px;
}
.tb-project.open, .tb-project:hover { background: var(--bg-hover); }
.tb-avatar {
  width: 20px; height: 20px; border-radius: 4px; color: #1A1B1E; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; line-height: 1; flex-shrink: 0;
}
.tb-project-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-chevron { color: var(--text-muted); transition: transform .15s; }
.tb-project.open .tb-chevron { transform: rotate(180deg); }
.tb-menu {
  position: absolute; top: 34px; left: 0; z-index: 9999; display: none;
}
.tb-menu.open { display: block; animation: dl-menu-pop 0.12s var(--ease-pop); }
@keyframes dl-menu-pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.tb-spacer { flex: 1; }
.tb-right { display: flex; align-items: center; position: relative; z-index: 22; }
.tb-theme-toggle {
  width: 34px; height: 42px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--icon-color); cursor: pointer;
}
.tb-author {
  display: flex; align-items: center; gap: 5px; height: 42px; padding: 0 12px;
  background: transparent; border: none; color: var(--text-secondary); font-size: 12px;
  font-family: inherit; cursor: pointer; white-space: nowrap;
}
.tb-author-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text-faint); }
.tb-winbtn {
  width: 44px; height: 42px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--icon-color); cursor: pointer;
}
.tb-winbtn:hover { background: var(--bg-hover); }
.tb-winbtn--close:hover { background: var(--close-hover); color: #fff; }

/* Theme-sim crossfade (same curve as the app's auto-theme switch) */
.sim-crossfade, .sim-crossfade *, .sim-crossfade *::before, .sim-crossfade *::after {
  transition: background-color .8s ease-out, background .8s ease-out, border-color .6s ease-out,
              color .5s ease-out, fill .5s ease-out, stroke .5s ease-out, box-shadow .8s ease-out;
}

/* Titlebar sky animation (ported keyframes) */
@keyframes dl-starsLife { 0%{opacity:0} 15%{opacity:.65} 75%{opacity:.65} 100%{opacity:0} }
@keyframes dl-twinkle { 0%{opacity:.3;transform:scale(.8)} 100%{opacity:1;transform:scale(1.2)} }
@keyframes dl-celestialLife { 0%{opacity:0;transform:translateY(20px) scale(.7)} 15%{opacity:.95;transform:translateY(-50%) scale(1)} 75%{opacity:.95;transform:translateY(-50%) scale(1)} 100%{opacity:0;transform:translateY(-60%) scale(.9)} }
@keyframes dl-moonGlow { 0%{opacity:.8;transform:scale(1)} 100%{opacity:1;transform:scale(1.1)} }
@keyframes dl-sunGlow { 0%{opacity:.9;transform:scale(1)} 100%{opacity:1;transform:scale(1.15)} }
@keyframes dl-sunSpin { from{transform:rotate(0)} to{transform:rotate(360deg)} }
@keyframes dl-cloudLife { 0%{opacity:0;transform:translateX(-15px) translateY(10px)} 15%{opacity:.9;transform:translateX(0) translateY(0)} 75%{opacity:.9;transform:translateX(8px) translateY(0)} 100%{opacity:0;transform:translateX(15px) translateY(-5px)} }

/* ---------- Mega menu (Features dropdown) ---------- */
.nav-mega { position: relative; }
.nav-mega-btn {
  display: flex; align-items: center; gap: 6px;
  background: transparent; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 13px; font-family: var(--font-ui);
  padding: 6px 10px; border-radius: 3px; transition: background 0.1s, color 0.1s;
}
.nav-mega-btn:hover, .nav-mega.open .nav-mega-btn { color: var(--text-primary); background: var(--bg-hover); }
.nav-mega-btn.nav-link--active { color: var(--text-primary); background: var(--bg-active); }
.nav-mega-btn .mega-chev { color: var(--text-muted); transition: transform 0.15s; }
.nav-mega.open .nav-mega-btn .mega-chev { transform: rotate(180deg); }
.mega-panel {
  position: absolute; top: calc(100% + 12px); left: -14px; z-index: 60;
  width: min(720px, calc(100vw - 48px));
  background: var(--bg-panel); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: var(--shadow-dropdown); padding: 16px 16px 0;
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity 0.14s ease, transform 0.14s var(--ease-pop), visibility 0.14s;
}
.nav-mega.open .mega-panel { opacity: 1; visibility: visible; transform: none; }
.mega-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 14px; }
.mega-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mega-col > .section-label { padding: 4px 10px 7px; }
.mega-item {
  display: flex; gap: 10px; padding: 8px 10px; border-radius: 6px; align-items: flex-start;
  color: inherit; transition: background 0.1s;
}
.mega-item:hover { background: var(--bg-hover); color: inherit; }
.mega-item-icon { color: var(--icon-color); flex-shrink: 0; margin-top: 2px; display: flex; }
.mega-item-title { font-size: 13px; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 7px; }
.mega-item-desc { font-size: 11.5px; color: var(--text-secondary); line-height: 1.45; margin-top: 2px; text-wrap: pretty; }
.mega-badge {
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px; padding: 1.5px 6px;
  border-radius: 8px; background: var(--app-accent-dim); color: var(--app-accent-text);
}
.mega-foot {
  display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap;
  margin: 12px -16px 0; padding: 11px 18px; border-top: 1px solid var(--border);
  background: var(--bg-surface-alt); border-radius: 0 0 10px 10px;
  font-size: 12px; color: var(--text-secondary);
}
.mega-foot a { font-size: 12.5px; white-space: nowrap; }
.mega-foot a:first-of-type { margin-left: auto; }

/* Manuscript squiggles (grammar page) */
.sq-sp { text-decoration: underline wavy var(--status-error); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.sq-gr { text-decoration: underline wavy var(--section-front); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.sq-us { text-decoration: underline dotted var(--status-warning); text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.ms-p { margin: 0; text-indent: 1.5em; }

/* ---------- Index hero ---------- */
.hero-field {
  position: relative; overflow: hidden;
  background:
    radial-gradient(1100px 520px at 50% -8%, rgba(14,96,142,0.34), transparent 62%),
    radial-gradient(rgba(255,255,255,0.028) 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(180deg, var(--bg-chrome) 0%, var(--bg-editor) 70%);
}
.hero-field::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, var(--bg-editor) 100%);
}
.hero-field > * { position: relative; z-index: 1; }
.hero-window {
  position: relative; border-radius: 10px; overflow: hidden; background: var(--bg-chrome);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.10),
    0 2px 0 rgba(255,255,255,0.04) inset,
    0 48px 110px -30px rgba(0,0,0,0.85),
    0 20px 40px -20px rgba(0,0,0,0.7),
    0 0 90px rgba(14,96,142,0.16);
}
.hero-window img { display: block; width: 100%; height: auto; margin-top: -3px; }
.hero-glow {
  position: absolute; left: 50%; top: 0; width: 70%; height: 240px; transform: translate(-50%, -45%);
  background: radial-gradient(ellipse at center, rgba(14,96,142,0.38) 0%, transparent 70%);
  filter: blur(18px); pointer-events: none; z-index: 0;
}
.hero-title { margin: 0; font-weight: 650; letter-spacing: -0.6px; line-height: 1.1; text-wrap: balance; color: var(--text-primary); }
.hero-line { margin: 0; color: var(--text-secondary); line-height: 1.5; text-wrap: pretty; }
.hero-cta { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hero-cta a:not(.btn) { font-size: 13.5px; }

/* A — centered stack */
.hero-a { padding: 52px 24px 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; }
.hero-a .hero-title { font-size: clamp(34px, 4.4vw, 56px); max-width: 960px; }
.hero-a .hero-line { font-size: clamp(15px, 1.25vw, 18px); }
.hero-a .hero-cta { justify-content: center; margin-top: 6px; }
.hero-a .hero-shot { position: relative; width: 100%; max-width: 1280px; margin: 26px auto 0; padding-bottom: 48px; }

/* B — split, screenshot bleeding off the right */
.hero-b {
  --hero-inset: max(24px, calc((100vw - 1280px) / 2));
  padding: 36px 0 0; display: grid; grid-template-columns: calc(420px + var(--hero-inset)) 1fr; gap: 48px;
  align-items: center; min-height: calc(100vh - 56px); max-height: 980px;
}
.hero-b .hero-copy { display: flex; flex-direction: column; gap: 18px; padding-left: var(--hero-inset); padding-bottom: 40px; }
.hero-b .hero-title { font-size: clamp(30px, 2.7vw, 42px); }
.hero-b .hero-line { font-size: clamp(15px, 1.15vw, 17px); }
.hero-b .hero-cta { margin-top: 4px; }
.hero-b .hero-shot { position: relative; align-self: stretch; display: flex; align-items: center; min-width: 0; }
.hero-b .hero-window { width: 109%; max-width: none; transform: perspective(2600px) rotateY(-5deg); transform-origin: left center; }
.hero-b .hero-glow { left: 30%; top: 50%; width: 80%; height: 60%; transform: translate(-30%, -50%); }
@media (max-width: 900px) {
  .hero-b { grid-template-columns: 1fr; padding: 40px 24px 0; min-height: 0; max-height: none; --hero-inset: 0px; }
  .hero-b .hero-copy { padding-left: 0; padding-bottom: 0; }
  .hero-b .hero-window { width: 100%; transform: none; }
  .hero-b .hero-shot { padding-bottom: 40px; }
}
