/* Learn Giacomo AI + — mesma paleta editorial do tspmmiii.com (tinta, creme, dourado). */
@font-face {
  font-family: "Outfit";
  src: url("/assets/fonts/outfit-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #0e1a13;
  --ink-2: #1b3325;
  --paper: #f5f1e8;
  --card: #fffdf8;
  --cream: #f3ead8;
  --line: rgba(14, 26, 19, 0.12);
  --muted: #59615c;
  --gold: #c8a24b;
  --gold-text: #80631f;
  --red: #b4432e;
  --green: #2e7d4e;
  --display: "Outfit", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --reading: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --radius: 18px;
  --shadow: 0 24px 60px -40px rgba(14, 26, 19, 0.45);
}

* { box-sizing: border-box; }
/* Os estados usam display próprio; hidden precisa vencê-los. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.55;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
.wrap { width: min(100% - 32px, 1180px); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 10; padding: 10px 14px; background: var(--gold); color: var(--ink); border-radius: 8px; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* Cabeçalho */
.plus-header { position: sticky; top: 0; z-index: 5; background: rgba(14, 26, 19, 0.96); color: #f6f1e4; backdrop-filter: blur(8px); }
.header-row { display: flex; align-items: center; gap: 18px; min-height: 60px; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand strong { font-size: 1.05rem; font-weight: 900; letter-spacing: 0.02em; }
.brand strong span { color: var(--gold); }
.brand small { color: var(--gold); font-size: 0.66rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.header-nav { display: none; margin-left: auto; gap: 22px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.header-nav a { text-decoration: none; opacity: 0.86; }
.header-nav a:hover { opacity: 1; color: var(--gold); }
.connection { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; padding: 6px 10px; border: 1px solid rgba(246, 241, 228, 0.18); border-radius: 999px; font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.connection .dot { width: 8px; height: 8px; border-radius: 50%; background: #c9c3b3; }
.connection[data-state="ok"] .dot { background: #5bc184; box-shadow: 0 0 0 4px rgba(91, 193, 132, 0.18); }
.connection[data-state="warn"] .dot { background: var(--gold); }
.connection[data-state="off"] .dot { background: #e0745e; }

/* Hero */
.hero { position: relative; overflow: hidden; padding-block: 56px 48px; background: radial-gradient(circle at 85% 10%, rgba(200, 162, 75, 0.22), transparent 34%), var(--ink); color: #f6f1e4; }
.hero::after { content: "+"; position: absolute; right: -0.05em; bottom: -0.35em; color: transparent; font-size: clamp(14rem, 32vw, 26rem); font-weight: 900; line-height: 1; -webkit-text-stroke: 1px rgba(200, 162, 75, 0.18); pointer-events: none; }
.hero-grid { position: relative; z-index: 1; display: grid; gap: 32px; }
.kicker { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; color: var(--gold); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; }
.kicker > span { width: 34px; height: 2px; background: currentColor; }
.hero h1 { max-width: 15ch; font-size: clamp(2.4rem, 6.4vw, 4.6rem); font-weight: 900; line-height: 0.98; letter-spacing: -0.045em; }
.hero h1 em { color: var(--gold); font-style: italic; }
.lead { max-width: 60ch; margin-top: 20px; color: rgba(246, 241, 228, 0.82); font-size: 1.05rem; }
.hero-points { display: grid; gap: 12px; align-self: end; margin: 0; padding: 0; list-style: none; }
.hero-points li { padding: 14px 16px; border: 1px solid rgba(200, 162, 75, 0.28); border-radius: 14px; background: rgba(246, 241, 228, 0.04); color: rgba(246, 241, 228, 0.78); font-size: 0.9rem; }
.hero-points strong { display: block; color: #f6f1e4; }

/* Seções */
.section-head { margin-bottom: 20px; }
.section-head .kicker { color: var(--red); }
.section-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); font-weight: 900; line-height: 1.05; letter-spacing: -0.035em; }
.themes { padding-block: 48px 28px; }
.placeholder { color: var(--muted); font-size: 0.92rem; }

/* Temas com imagem de domínio público: mostra só a gravura da capa, sem o painel de título. */
.theme-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.theme-card { position: relative; display: flex; flex-direction: column; overflow: hidden; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); text-align: left; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s; }
.theme-card:hover { transform: translateY(-2px); }
.theme-card[aria-checked="true"] { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), var(--shadow); }
.theme-media { position: relative; aspect-ratio: 640 / 400; overflow: hidden; background: #e5d9c1; }
.theme-media img { width: 100%; height: auto; margin-top: -14%; }
.theme-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(14, 26, 19, 0.55)); }
.theme-check { position: absolute; top: 10px; right: 10px; z-index: 1; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: var(--ink); font-size: 0.8rem; font-weight: 900; opacity: 0; transform: scale(0.8); transition: 0.2s; }
.theme-card[aria-checked="true"] .theme-check { opacity: 1; transform: scale(1); }
.theme-credit { position: absolute; right: 10px; bottom: 8px; left: 10px; z-index: 1; overflow: hidden; color: rgba(255, 255, 255, 0.82); font-size: 0.58rem; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.theme-body { padding: 14px 16px 16px; }
.theme-body strong { display: block; font-size: 1.05rem; font-weight: 800; letter-spacing: -0.01em; }
.theme-body span { display: block; margin-top: 4px; color: var(--muted); font-size: 0.82rem; line-height: 1.35; }

/* Pergunta e resposta */
.work-grid { display: grid; gap: 28px; padding-block: 20px 64px; }
.ask, .answer { padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.field-label { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; color: var(--ink-2); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.theme-chip { padding: 3px 9px; border-radius: 999px; background: var(--ink); color: var(--gold); font-size: 0.64rem; letter-spacing: 0.1em; }
textarea { width: 100%; min-height: 150px; padding: 14px 16px; border: 1px solid rgba(14, 26, 19, 0.2); border-radius: 14px; background: #fff; font-size: 1rem; line-height: 1.5; resize: vertical; }
textarea:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(200, 162, 75, 0.25); }
.hint-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; color: var(--muted); font-size: 0.76rem; }
.field-error { margin-top: 8px; color: var(--red); font-size: 0.84rem; font-weight: 600; }
.depth { display: grid; gap: 8px; margin: 22px 0 0; padding: 0; border: 0; }
.depth label { position: relative; cursor: pointer; }
.depth input { position: absolute; opacity: 0; }
.depth span { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; transition: 0.15s; }
.depth strong { display: block; font-size: 0.92rem; }
.depth small { color: var(--muted); font-size: 0.76rem; }
.depth input:checked + span { border-color: var(--ink); background: var(--ink); color: #f6f1e4; }
.depth input:checked + span small { color: var(--gold); }
.depth input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.options { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 18px; font-size: 0.86rem; }
.options label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.options input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--ink); }
.language { margin-left: auto; }
.language span { color: var(--muted); font-size: 0.78rem; }
select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border: 1px solid var(--ink); border-radius: 999px; background: transparent; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; transition: 0.15s; }
.btn.primary { background: var(--ink); color: var(--gold); }
.btn.primary:hover { background: var(--ink-2); }
.btn.ghost { border-color: var(--line); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 0.68rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.kbd-hint { margin-top: 8px; color: var(--muted); font-size: 0.72rem; text-align: right; }
.presets, .history { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.preset-list { display: grid; gap: 8px; }
.preset { padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--cream); font-size: 0.88rem; text-align: left; cursor: pointer; }
.preset:hover { border-color: var(--gold); }
.history-head { display: flex; align-items: center; justify-content: space-between; }
.link-btn { padding: 0; border: 0; background: none; color: var(--gold-text); font-size: 0.78rem; font-weight: 700; text-decoration: underline; cursor: pointer; }
.note { color: var(--muted); font-size: 0.76rem; }
.history-list { display: grid; gap: 8px; margin-top: 10px; }
.history-item { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left; cursor: pointer; }
.history-item strong { display: block; overflow: hidden; font-size: 0.86rem; text-overflow: ellipsis; white-space: nowrap; }
.history-item small { color: var(--muted); font-size: 0.72rem; }

.answer { align-self: start; }
.answer-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.answer-actions { display: flex; gap: 8px; }
.state { display: grid; justify-items: start; gap: 10px; padding: 28px 4px; }
.state h3 { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }
.state p { max-width: 48ch; color: var(--muted); }
.state .mark { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: var(--ink); color: var(--gold); font-size: 1.6rem; font-weight: 900; }
.state.error .mark { background: var(--red); color: #fff; }
.spinner { width: 34px; height: 34px; border: 3px solid rgba(14, 26, 19, 0.15); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 12px; }
.tag { padding: 4px 10px; border-radius: 999px; background: var(--ink); color: var(--gold); font-size: 0.66rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.ghost-tag { border: 1px solid var(--line); background: transparent; color: var(--ink-2); }
.meta-time { color: var(--muted); font-size: 0.74rem; }
.result-question { font-size: clamp(1.25rem, 2.6vw, 1.6rem); font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; }
.takeaway { margin-top: 18px; padding: 16px 18px; border-left: 4px solid var(--gold); border-radius: 0 12px 12px 0; background: var(--cream); }
.takeaway h4 { margin-bottom: 4px; color: var(--gold-text); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.markdown { margin-top: 20px; font-family: var(--reading); font-size: 1.06rem; line-height: 1.7; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { margin: 1.5em 0 0.5em; font-family: var(--display); font-weight: 800; line-height: 1.2; letter-spacing: -0.015em; }
.markdown h3 { font-size: 1.15rem; }
.markdown p, .markdown ul, .markdown ol, .markdown blockquote, .markdown table { margin: 0 0 1em; }
.markdown ul, .markdown ol { padding-left: 1.3em; }
.markdown li { margin-bottom: 0.35em; }
.markdown blockquote { padding: 0.4em 1em; border-left: 3px solid var(--gold); color: var(--ink-2); }
.markdown a { color: var(--gold-text); }
.markdown table { width: 100%; border-collapse: collapse; font-family: var(--display); font-size: 0.88rem; }
.markdown th, .markdown td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; }
.markdown code { padding: 1px 5px; border-radius: 5px; background: var(--cream); font-size: 0.9em; }
.result-notice { margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: #f1ece0; color: var(--muted); font-size: 0.8rem; }
.readings { margin-top: 26px; padding: 20px; border-radius: 16px; background: var(--ink); color: #f6f1e4; }
.readings h4 { margin-bottom: 14px; color: var(--gold); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.reading-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.reading { display: grid; grid-template-columns: 54px 1fr; align-items: center; gap: 10px; padding: 8px; border: 1px solid rgba(200, 162, 75, 0.25); border-radius: 12px; text-decoration: none; transition: 0.15s; }
.reading:hover { border-color: var(--gold); background: rgba(246, 241, 228, 0.05); }
.reading img { width: 54px; height: auto; aspect-ratio: 640 / 880; border-radius: 6px; object-fit: cover; background: #2a3a30; }
.reading span { font-size: 0.82rem; font-weight: 700; line-height: 1.3; }
.catalog-link { display: inline-block; margin-top: 14px; color: var(--gold); font-size: 0.8rem; font-weight: 800; text-decoration: none; }
.provider { margin-top: 14px; color: var(--muted); font-size: 0.72rem; }

.plus-footer { padding-block: 28px; background: var(--ink); color: rgba(246, 241, 228, 0.72); font-size: 0.8rem; }
.footer-row { display: grid; gap: 8px; }
.plus-footer strong { color: var(--gold); }
.noscript { padding: 16px; background: var(--red); color: #fff; text-align: center; }

@media (min-width: 720px) {
  .header-nav { display: flex; }
  .connection { margin-left: 0; }
  .theme-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .depth { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .reading-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .reading { grid-template-columns: 1fr; align-items: start; }
  .reading img { width: 100%; }
}

@media (min-width: 1040px) {
  .hero { padding-block: 76px 64px; }
  .hero-grid { grid-template-columns: 1.4fr 0.9fr; gap: 56px; }
  .theme-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .work-grid { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr); align-items: start; }
  .ask { position: sticky; top: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  .plus-header, .hero, .themes, .ask, .answer-actions, .plus-footer, .readings, .section-head { display: none !important; }
  body, .answer { background: #fff; box-shadow: none; border: 0; }
  .work-grid { display: block; padding: 0; }
}
