/* ============================================================
   Synapps Author — design system (paleta da marca)
   ============================================================ */
:root {
  --paper: #f6f5fc;
  --paper-2: #ecebf9;
  --card: #ffffff;
  --ink: #0c0b1a;
  --ink-2: #45415e;
  --ink-3: #7b7794;
  --line: #e2dff3;
  --brand: #4c1fd6;
  --brand-2: #6d3bf5;
  --accent: #22aaf5;
  --ok: #17845c;
  --danger: #c02a3d;
  --radius: 16px;
  --radius-s: 10px;
  --shadow-s: 0 1px 2px rgba(12, 11, 26, .06), 0 4px 14px rgba(12, 11, 26, .05);
  --shadow-m: 0 10px 30px rgba(12, 11, 26, .10);
  --shadow-l: 0 30px 70px rgba(12, 11, 26, .16);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -.02em; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.hidden { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px; border: 1px solid transparent;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 15px;
  cursor: pointer; text-decoration: none; transition: transform .15s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-m); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #fff; }
.btn-soft { background: var(--paper-2); color: var(--ink); border-color: var(--line); }
.btn-sm { padding: 8px 14px; font-size: 13.5px; }
.btn-block { width: 100%; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.brand .tag {
  font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--brand); background: rgba(76, 31, 214, .08); border: 1px solid rgba(76, 31, 214, .16);
  padding: 4px 9px; border-radius: 999px;
}

/* logo — recorta a moldura branca do arquivo original */
.logo {
  --lh: 34px;
  display: block; position: relative; overflow: hidden; flex: none;
  height: var(--lh); width: calc(var(--lh) * 2.73);
}
.logo img {
  position: absolute; max-width: none; width: auto;
  height: calc(var(--lh) / .55);
  top: calc(var(--lh) / .55 * -.197);
  left: calc(var(--lh) / .55 * 1.777 * -.078);
}
.logo.on-dark img { filter: brightness(0) invert(1); }
.nav { display: flex; gap: 26px; margin-left: auto; font-size: 15px; color: var(--ink-2); }
.nav a { text-decoration: none; }
.nav a:hover { color: var(--brand); }

/* ---------- hero ---------- */
.hero { padding: 84px 0 72px; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -30% 40% 40% -20%;
  background: radial-gradient(closest-side, rgba(109, 59, 245, .18), transparent);
  pointer-events: none;
}
.hero .wrap { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; position: relative; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--brand);
  background: rgba(76, 31, 214, .08); border: 1px solid rgba(76, 31, 214, .16);
  padding: 6px 14px; border-radius: 999px;
}
.hero h1 { font-size: clamp(38px, 5.2vw, 62px); margin: 20px 0 18px; }
.hero h1 em { font-style: italic; color: var(--brand); }
.hero p.lead { font-size: 18.5px; color: var(--ink-2); max-width: 52ch; margin: 0 0 30px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-note { margin-top: 18px; font-size: 14px; color: var(--ink-3); }
.hero-art { position: relative; }
.hero-art img { border-radius: 20px; box-shadow: var(--shadow-l); }
.hero-badge {
  position: absolute; bottom: -22px; left: -18px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 18px; box-shadow: var(--shadow-m); font-size: 14px; font-weight: 600;
}
.hero-badge span { display: block; font-size: 12px; font-weight: 500; color: var(--ink-3); }

/* ---------- sections ---------- */
section.band { padding: 78px 0; }
.band-alt { background: var(--paper-2); border-block: 1px solid var(--line); }
.sec-head { max-width: 640px; margin-bottom: 44px; }
.sec-head h2 { font-size: clamp(28px, 3.4vw, 40px); margin-bottom: 12px; }
.sec-head p { color: var(--ink-2); font-size: 17px; margin: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow-s);
}
.card .ico { font-size: 26px; margin-bottom: 14px; }
.card h3 { font-size: 20px; margin-bottom: 8px; }
.card p { margin: 0; color: var(--ink-2); font-size: 15.5px; }
.step-n {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--ink); color: #fff; font-family: var(--serif); font-size: 17px; margin-bottom: 14px;
}
.quotes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.quote { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.quote p { font-family: var(--serif); font-size: 17px; font-style: italic; margin: 0 0 16px; }
.quote .who { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(140deg, var(--brand), var(--accent)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.cta-band { text-align: center; padding: 88px 0; background: linear-gradient(150deg, #0c0b1a 0%, #1b1147 55%, #4c1fd6 100%); color: #fff; }
.cta-band h2 { font-size: clamp(30px, 4vw, 46px); margin-bottom: 14px; }
.cta-band p { color: #cfc9f2; font-size: 18px; max-width: 55ch; margin: 0 auto 28px; }
.site-footer { padding: 40px 0; font-size: 14px; color: var(--ink-3); border-top: 1px solid var(--line); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- form / studio ---------- */
.studio { padding: 52px 0 90px; }
.studio-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 34px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-s); padding: 30px; }
.panel + .panel { margin-top: 22px; }
.panel h2 { font-size: 26px; margin-bottom: 6px; }
.panel .sub { color: var(--ink-3); font-size: 15px; margin: 0 0 24px; }
.field { margin-bottom: 20px; }
.field label { display: block; font-weight: 600; font-size: 14.5px; margin-bottom: 7px; }
.field .hint { font-weight: 400; color: var(--ink-3); font-size: 13px; }
.input, .select, .textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--paper); transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(109, 59, 245, .16); background: #fff;
}
.textarea { min-height: 130px; resize: vertical; line-height: 1.55; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper);
  cursor: pointer; font-size: 14px; transition: all .15s;
}
.chip:hover { border-color: var(--brand-2); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.range-row { display: flex; align-items: center; gap: 14px; }
.range-row input[type=range] { flex: 1; accent-color: var(--brand); }
.range-val { font-family: var(--serif); font-size: 22px; min-width: 92px; text-align: right; }
.aside-card { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.aside-card h3 { font-size: 18px; margin-bottom: 10px; }
.aside-card ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 14.5px; }
.aside-card li { margin-bottom: 8px; }

/* ---------- progress overlay ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 90; background: rgba(12, 11, 26, .55);
  backdrop-filter: blur(6px); display: grid; place-items: center; padding: 24px;
}
.overlay-box { background: #fff; border-radius: 20px; padding: 34px; width: min(560px, 100%); box-shadow: var(--shadow-l); }
.overlay-box h3 { font-size: 24px; margin-bottom: 8px; }
.overlay-box .sub { color: var(--ink-3); margin: 0 0 22px; font-size: 15px; }
.bar { height: 8px; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .4s ease; }
.log { margin-top: 18px; max-height: 190px; overflow: auto; font-size: 14px; color: var(--ink-2); }
.log div { padding: 5px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 8px; }
.log div:last-child { border: 0; }
.spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--brand); animation: sp .7s linear infinite; flex: none; margin-top: 3px; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- editor ---------- */
.editor { display: grid; grid-template-columns: 268px 1fr 300px; height: calc(100vh - 128px); }
.ed-side, .ed-design { overflow-y: auto; background: #fff; }
.ed-side { border-right: 1px solid var(--line); }
.ed-design { border-left: 1px solid var(--line); }
.ed-main { overflow-y: auto; background: var(--paper-2); padding: 34px 20px 90px; }
.side-head {
  padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.side-head h4 { font-family: var(--sans); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.toc-item {
  padding: 11px 18px; border-bottom: 1px solid var(--paper-2); cursor: pointer; font-size: 14.5px;
  display: flex; gap: 10px; align-items: flex-start; transition: background .15s;
}
.toc-item:hover { background: var(--paper); }
.toc-item.active { background: var(--paper-2); box-shadow: inset 3px 0 0 var(--brand); font-weight: 600; }
.toc-item .n { color: var(--ink-3); font-family: var(--serif); font-size: 13px; min-width: 18px; }
.toc-item .t { flex: 1; }
.toc-item .st { font-size: 11px; color: var(--ink-3); }
.ed-topbar {
  display: flex; align-items: center; gap: 10px; padding: 0 20px; height: 60px;
  border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 68px; z-index: 20;
}
.ed-title { font-family: var(--serif); font-size: 18px; margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved { font-size: 12.5px; color: var(--ok); }

/* page canvas */
.page {
  width: var(--page-w, 720px); margin: 0 auto 26px; background: #fff; box-shadow: var(--shadow-m);
  padding: var(--page-pad, 64px 72px); min-height: 300px; border-radius: 3px;
  font-family: var(--book-body, Georgia, serif); font-size: var(--book-size, 17px);
  line-height: var(--book-lh, 1.75); color: var(--book-ink, #0c0b1a);
}
.page h1, .page h2, .page h3 { font-family: var(--book-head, "Fraunces", Georgia, serif); color: var(--book-accent, #4c1fd6); }
.page .ch-num { font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--book-accent, #4c1fd6); margin-bottom: 10px; font-family: var(--sans); }
.page h2.ch-title { font-size: 32px; margin-bottom: 8px; color: var(--book-ink, #0c0b1a); }
.page .rule { width: 60px; height: 3px; background: var(--book-accent, #4c1fd6); margin: 18px 0 28px; border-radius: 2px; }
.page [contenteditable] { outline: none; }
.page [contenteditable]:focus { box-shadow: 0 0 0 2px rgba(109, 59, 245, .20); border-radius: 6px; }
.page p { margin: 0 0 1.05em; text-align: var(--book-align, justify); hyphens: auto; }
.page h3 { font-size: 21px; margin: 1.6em 0 .6em; }
.page blockquote { margin: 1.4em 0; padding-left: 18px; border-left: 3px solid var(--book-accent, #4c1fd6); font-style: italic; color: #55504a; }
.page ul, .page ol { margin: 0 0 1.05em; padding-left: 24px; }
.page li { margin-bottom: .4em; }

/* cover */
.cover-page {
  width: var(--page-w, 720px); margin: 0 auto 26px; aspect-ratio: 2/3; position: relative; overflow: hidden;
  box-shadow: var(--shadow-l); border-radius: 3px; display: flex; flex-direction: column;
  justify-content: space-between; padding: 12% 10%; text-align: center; color: #fff;
  background: var(--cover-bg, linear-gradient(160deg, #0c0b1a, #4c1fd6));
  background-size: cover; background-position: center;
}
.cover-page::after {
  content: ""; position: absolute; inset: 0; background: var(--cover-veil, linear-gradient(180deg, rgba(0,0,0,.42), rgba(0,0,0,.66)));
  z-index: 0;
}
.cover-page > * { position: relative; z-index: 1; }
.cover-title { font-family: var(--cover-font, "Fraunces", serif); font-size: clamp(30px, 5.4vw, 54px); line-height: 1.08; text-shadow: 0 2px 20px rgba(0,0,0,.35); }
.cover-sub { font-family: var(--sans); font-size: 16px; letter-spacing: .04em; opacity: .92; margin-top: 14px; }
.cover-author { font-family: var(--sans); font-size: 15px; letter-spacing: .22em; text-transform: uppercase; }
.cover-top { font-family: var(--sans); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; opacity: .8; }

/* design panel */
.d-group { padding: 18px; border-bottom: 1px solid var(--line); }
.d-group h5 { font-family: var(--sans); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 14px; font-weight: 700; }
.d-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; font-size: 14px; }
.d-row:last-child { margin-bottom: 0; }
.d-row select, .d-row input[type=number] { flex: none; width: 130px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font-size: 13.5px; }
.d-row input[type=range] { width: 130px; accent-color: var(--brand); }
.d-row input[type=color] { width: 42px; height: 30px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.themes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.theme-sw { border: 1px solid var(--line); border-radius: 10px; padding: 8px; cursor: pointer; text-align: left; background: #fff; font-size: 12.5px; }
.theme-sw.active { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(76,31,214,.18); }
.theme-sw i { display: block; height: 26px; border-radius: 6px; margin-bottom: 6px; }
.stack { display: grid; gap: 9px; }

/* toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(120%);
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px; z-index: 120;
  box-shadow: var(--shadow-m); font-size: 14.5px; transition: transform .3s cubic-bezier(.2,.9,.3,1.2);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* library */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; }
.lib-card { cursor: pointer; }
.lib-card .mini {
  aspect-ratio: 2/3; border-radius: 10px; box-shadow: var(--shadow-m); background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; color: #fff;
  font-family: var(--serif); font-size: 16px; line-height: 1.2; text-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.lib-card .meta { margin-top: 10px; font-size: 13px; color: var(--ink-3); }
.lib-card .meta b { display: block; color: var(--ink); font-size: 14.5px; font-weight: 600; }

/* ---------- print ---------- */
@media print {
  @page { size: A5; margin: 16mm 15mm; }
  .site-header, .ed-side, .ed-design, .ed-topbar, .toast, .overlay, .no-print { display: none !important; }
  .editor { display: block; height: auto; }
  .ed-main { overflow: visible; background: #fff; padding: 0; }
  .page {
    width: auto; box-shadow: none; padding: 0; margin: 0; page-break-after: always; border-radius: 0;
    font-size: 11.5pt; line-height: 1.6;
  }
  .cover-page { width: auto; height: 96vh; aspect-ratio: auto; page-break-after: always; box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .page h2.ch-title { font-size: 22pt; }
  body { background: #fff; }
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .editor { grid-template-columns: 1fr; height: auto; }
  .ed-side, .ed-design { max-height: 320px; border: 0; border-bottom: 1px solid var(--line); }
  .page, .cover-page { width: 100%; }
}
@media (max-width: 900px) {
  .hero .wrap, .studio-grid { grid-template-columns: 1fr; }
  .grid-3, .grid-4, .quotes { grid-template-columns: 1fr 1fr; }
  .nav { display: none; }
}
@media (max-width: 620px) {
  .grid-3, .grid-4, .quotes, .row-2, .row-3 { grid-template-columns: 1fr; }
  .hero { padding: 54px 0 44px; }
  .page { padding: 34px 26px; }
}
