/* Ghost PDF. Every rule is scoped to .gp / .gp-content so nothing leaks into the rest of the site.
   Colours come from the site's theme variables (style.css, tool-dark.css). No overflow: hidden on cards:
   the page scrolls the window to show results (see shared/ui.js scrollToElement). */

.gp { max-width: 1100px; margin: 0 auto; padding: 0 16px; color: var(--text-primary, #E6EDF3); }
.gp-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.gp [hidden] { display: none !important; }

.gp-hero { margin: 18px 0 8px; }
.gp-hero h1 { font-size: 2rem; margin: 0 0 8px; color: var(--text-heading, #F8FAFC); }
.gp-hero p { margin: 0; max-width: 780px; color: var(--text-muted, #9AA4AE); line-height: 1.6; }

.gp-card { background: linear-gradient(135deg, #161B22, #111827); border: 1px solid var(--border, #2A2F36); border-radius: 16px; padding: 24px; margin: 18px 0; box-shadow: 0 16px 42px rgba(0, 0, 0, 0.45); }
.gp-card h2 { font-size: 1.35rem; margin: 0 0 6px; color: var(--text-heading, #F8FAFC); }
.gp-muted { color: var(--text-muted, #9AA4AE); font-size: 0.92rem; }
.gp-center { text-align: center; }
.gp-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0; }

/* Buttons. !important keeps tool-dark.css (which styles every button on tool pages) from overriding them. */
.gp .gp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 22px !important; border-radius: 12px !important; border: 1px solid transparent !important; background: linear-gradient(135deg, #D32F2F, #B71C1C) !important; color: #fff !important; font: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 10px 24px rgba(211, 47, 47, 0.25); }
.gp .gp-btn:hover { filter: brightness(1.07); }
.gp .gp-btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
.gp .gp-btn-secondary { background: #1F2937 !important; border-color: var(--border, #2A2F36) !important; box-shadow: none; color: var(--text-primary, #E6EDF3) !important; }
.gp .gp-link { background: none !important; border: 0 !important; box-shadow: none !important; padding: 2px 0 !important; color: #f87171 !important; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.gp .gp-btn:focus-visible, .gp .gp-link:focus-visible, .gp-drop:focus-visible, .gp .gp-tab:focus-visible { outline: 2px solid #f87171; outline-offset: 2px; }
.gp-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 18px; }

/* Drop zones */
.gp-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 26px 18px; border: 2px dashed rgba(211, 47, 47, 0.4); border-radius: 14px; background: #111827; color: var(--text-muted, #9AA4AE); cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.gp-drop strong { color: var(--text-primary, #E6EDF3); }
.gp-drop:hover, .gp-drop.is-dragover { border-color: #D32F2F; background: #1F2937; }
.gp-drop-big { padding: 46px 20px; font-size: 1.05rem; }
.gp-drop-small { padding: 16px; }

.gp-alert { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: rgba(198, 40, 40, 0.14); border: 1px solid rgba(198, 40, 40, 0.5); color: #fca5a5; }
.gp-note { margin: 16px 0 0; padding: 12px 14px; border-radius: 12px; background: rgba(249, 168, 37, 0.08); border: 1px solid rgba(249, 168, 37, 0.35); color: #fde68a; font-size: 0.92rem; line-height: 1.55; }
.gp-status { min-height: 1.3em; margin: 10px 0 0; color: var(--text-muted, #9AA4AE); }
.gp-privacy { margin: 14px 0 0; text-align: center; color: var(--text-muted, #9AA4AE); font-size: 0.9rem; }
.gp-privacy::before { content: "🔒 "; }

/* Start */
.gp-paths { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.gp-path { padding: 20px; border: 1px solid var(--border, #2A2F36); border-radius: 14px; background: rgba(17, 24, 39, 0.6); }
.gp-path h3 { margin: 6px 0; color: var(--text-heading, #F8FAFC); }
.gp-path p { color: var(--text-muted, #9AA4AE); margin: 0 0 14px; line-height: 1.5; }
.gp-path-icon { font-size: 1.6rem; }

/* Steps */
.gp-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; list-style: none; margin: 0 0 22px; padding: 0; }
.gp-steps li { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border, #2A2F36); background: #111827; color: var(--text-muted, #9AA4AE); font-size: 0.92rem; }
.gp-step-num { display: inline-flex; flex: none; width: 24px; height: 24px; border-radius: 50%; align-items: center; justify-content: center; background: #2A2F36; color: #fff; font-size: 0.78rem; font-weight: 800; }
.gp-steps li.is-current { border-color: #D32F2F; background: #1F2937; color: #fff; }
.gp-steps li.is-current .gp-step-num { background: #D32F2F; }
.gp-steps li.is-done { border-color: rgba(46, 125, 50, 0.5); color: #bbf7d0; }
.gp-steps li.is-done .gp-step-num { background: #2E7D32; font-size: 0; }
.gp-steps li.is-done .gp-step-num::after { content: "✓"; font-size: 0.8rem; }

/* Files and pages */
.gp-file { display: flex; align-items: center; gap: 14px; padding: 12px; margin-top: 12px; border: 1px solid var(--border, #2A2F36); border-radius: 12px; background: #111827; cursor: pointer; }
.gp-file > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.gp-thumb { width: 60px; height: auto; flex: none; background: #fff; border-radius: 3px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45); }
#gpCoverThumb { width: 90px; }
.gp-page { display: block; width: 100%; max-width: 220px; height: auto; background: #fff; border-radius: 4px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5); }

/* Hidden PDF cards */
.gp-hidden-list { display: grid; gap: 14px; margin-top: 14px; }
.gp-hidden-card { position: relative; margin: 0; padding: 16px; border: 1px solid var(--border, #2A2F36); border-radius: 14px; background: rgba(17, 24, 39, 0.6); min-width: 0; }
.gp-hidden-card legend { padding: 0 6px; font-weight: 700; color: var(--text-heading, #F8FAFC); }
.gp-hidden-card .gp-remove { position: absolute; top: 4px; right: 14px; }
.gp-hidden-card [data-role="drop"], .gp-hidden-card [data-role="note-write"], .gp-hidden-card [data-role="file-info"] { margin-top: 12px; }

/* Upload a PDF / Write a note */
.gp-mode { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 26px; padding: 4px; border-radius: 12px; border: 1px solid var(--border, #2A2F36); background: #0F1419; }
.gp .gp-mode-btn { padding: 8px 14px !important; border-radius: 9px !important; border: 0 !important; background: transparent !important; box-shadow: none !important; color: var(--text-muted, #9AA4AE) !important; font: inherit; font-weight: 600; cursor: pointer; }
.gp .gp-mode-btn[aria-pressed="true"] { background: linear-gradient(135deg, #D32F2F, #B71C1C) !important; color: #fff !important; }
.gp .gp-note-start { width: 100%; font: inherit; color: var(--text-muted, #9AA4AE) !important; background: #111827 !important; border: 2px dashed rgba(211, 47, 47, 0.4) !important; border-radius: 14px !important; box-shadow: none !important; }
.gp .gp-note-start:hover { background: #1F2937 !important; border-color: #D32F2F !important; }

/* Note editor dialog */
.gp-composer { width: min(960px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 1px solid var(--border, #2A2F36); border-radius: 16px; background: #111827; color: var(--text-primary, #E6EDF3); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6); }
.gp-composer[open] { display: flex; flex-direction: column; }
.gp-composer::backdrop { background: rgba(15, 20, 25, 0.8); backdrop-filter: blur(4px); }
.gp-composer-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 16px 18px 10px; }
.gp-composer-head h2 { margin: 0; font-size: 1.25rem; color: var(--text-heading, #F8FAFC); }
.gp-composer-fields { display: flex; flex-wrap: wrap; gap: 10px; }
.gp-composer-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: var(--text-muted, #9AA4AE); }
.gp-composer-fields input, .gp-composer-fields select { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border, #2A2F36); background: #0F1419; color: var(--text-primary, #E6EDF3); font: inherit; min-width: 0; }
.gp-composer-fields input { width: 260px; max-width: 60vw; }
.gp-toolbar, .gp-image-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 18px; border-top: 1px solid var(--border, #2A2F36); background: #0F1419; }
.gp-image-bar { border-top: 0; color: var(--text-muted, #9AA4AE); font-size: 0.88rem; }
.gp-image-bar[hidden] { display: none; }
.gp-composer button[data-cmd], .gp-composer button[data-size] { min-width: 38px; height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text-primary, #E6EDF3); font: inherit; font-weight: 700; cursor: pointer; box-shadow: none; }
.gp-composer button[data-cmd]:hover, .gp-composer button[data-size]:hover { background: #1F2937; }
.gp-composer button[aria-pressed="true"] { background: rgba(211, 47, 47, 0.25); border-color: rgba(211, 47, 47, 0.6); }
.gp-composer button[data-cmd]:disabled { opacity: 0.4; cursor: default; }
.gp-composer button:focus-visible { outline: 2px solid #f87171; outline-offset: 1px; }
.gp-toolbar-sep { width: 1px; height: 22px; margin: 0 4px; background: var(--border, #2A2F36); }
.gp-composer-body { flex: 1; min-height: 0; overflow: auto; padding: 18px; background: #3a3f47; }
/* The editor looks like the page the note becomes: same fonts, proportions and image sizes as core/compose. */
.gp-note-editor { position: relative; box-sizing: border-box; width: 100%; max-width: 760px; min-height: 420px; margin: 0 auto; padding: 48px 56px; background: #fff; color: #111827; border-radius: 4px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45); font: 400 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif; outline: none; overflow-wrap: anywhere; }
.gp-note-editor:focus-visible { box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.6), 0 8px 22px rgba(0, 0, 0, 0.45); }
.gp-note-editor.is-empty::before { content: attr(data-placeholder); position: absolute; color: #9ca3af; pointer-events: none; }
.gp-note-editor p, .gp-note-editor h1, .gp-note-editor h2, .gp-note-editor li { unicode-bidi: plaintext; text-align: start; }
.gp-note-editor p { margin: 0 0 10px; }
.gp-note-editor h1 { font-size: 29px; line-height: 1.3; margin: 16px 0 12px; color: #111827; }
.gp-note-editor h2 { font-size: 22px; line-height: 1.35; margin: 14px 0 8px; color: #111827; }
.gp-note-editor ul, .gp-note-editor ol { margin: 0 0 10px; padding-inline-start: 26px; }
.gp-note-editor li { margin-bottom: 4px; }
.gp-note-editor img { display: block; max-width: 100%; height: auto; margin: 10px auto; border-radius: 2px; cursor: pointer; }
.gp-note-editor img[data-size="small"] { width: 33.3%; }
.gp-note-editor img[data-size="medium"] { width: 60%; }
.gp-note-editor img[data-size="full"] { width: 100%; }
.gp-note-editor img.is-selected { outline: 3px solid #D32F2F; outline-offset: 2px; }
.gp-note-preview { display: grid; gap: 18px; justify-items: center; }
.gp-note-preview figure { margin: 0; width: 100%; max-width: 760px; }
.gp-note-preview canvas { display: block; width: 100%; height: auto; background: #fff; border-radius: 4px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45); }
.gp-note-preview figcaption { margin-top: 6px; text-align: center; color: #e5e7eb; font-size: 0.85rem; }
.gp-composer-hint { margin: 8px 18px 0; font-size: 0.85rem; }
.gp-composer .gp-alert, .gp-composer .gp-status { margin-left: 18px; margin-right: 18px; }
.gp-composer-actions { margin: 10px 0 0; padding: 12px 18px 16px; border-top: 1px solid var(--border, #2A2F36); }
.gp-composer-spacer { flex: 1; }
.gp-composer .gp-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 22px; border-radius: 12px; border: 1px solid transparent; background: linear-gradient(135deg, #D32F2F, #B71C1C); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.gp-composer .gp-btn-secondary { background: #1F2937; border-color: var(--border, #2A2F36); color: var(--text-primary, #E6EDF3); }
.gp-composer .gp-btn:disabled { opacity: 0.5; cursor: not-allowed; }
@media (max-width: 760px) {
  .gp-composer { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; margin: 0; }
  .gp-composer-fields input { width: 100%; max-width: none; }
  .gp-composer-fields, .gp-composer-fields label { width: 100%; }
  .gp-composer-body { padding: 10px; }
  .gp-note-editor { padding: 24px 20px; min-height: 300px; }
  .gp-composer-actions { flex-wrap: wrap; }
  .gp-composer-actions .gp-btn { flex: 1 1 40%; }
  .gp-composer-spacer { display: none; }
}
.gp-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.gp-fields label { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; color: var(--text-muted, #9AA4AE); }
.gp input[type="password"], .gp input[type="text"] { width: 100%; box-sizing: border-box; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border, #2A2F36); background: #0F1419; color: var(--text-primary, #E6EDF3); font: inherit; }
.gp input[type="password"]:focus, .gp input[type="text"]:focus { outline: 2px solid #f87171; outline-offset: 1px; }
.gp-meter { height: 6px; margin-top: 10px; border-radius: 3px; background: #1F2937; overflow: hidden; }
.gp-meter span { display: block; height: 100%; width: 0; background: #ef4444; transition: width 0.2s; }
.gp-meter span[data-score="2"] { background: #f59e0b; }
.gp-meter span[data-score="3"] { background: #84cc16; }
.gp-meter span[data-score="4"] { background: #22c55e; }
.gp-check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 0; color: var(--text-primary, #E6EDF3); cursor: pointer; }
.gp-check input { width: 18px; height: 18px; margin-top: 2px; accent-color: #D32F2F; flex: none; }
.gp-check small { display: block; color: var(--text-muted, #9AA4AE); font-size: 0.85rem; margin-top: 2px; }
.gp-check-inline { margin: 0; font-size: 0.88rem; }

/* Review */
.gp-layers { display: grid; grid-template-columns: minmax(140px, 220px) 48px 1fr; align-items: center; gap: 14px; margin-top: 14px; }
.gp-layers figure { margin: 0; }
.gp-layers figcaption, .gp-caption { margin: 0 0 8px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted, #9AA4AE); }
.gp-layers-lock { font-size: 1.6rem; text-align: center; }
.gp-review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.gp-review-list li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(211, 47, 47, 0.35); background: rgba(211, 47, 47, 0.08); overflow-wrap: anywhere; }
.gp-review-list span { color: var(--text-muted, #9AA4AE); font-size: 0.9rem; }

/* Done */
.gp-done { display: flex; align-items: center; gap: 14px; }
.gp-done-icon { display: inline-flex; flex: none; width: 44px; height: 44px; border-radius: 50%; align-items: center; justify-content: center; background: #2E7D32; color: #fff; font-weight: 800; font-size: 1.3rem; }
.gp-done h2:focus { outline: none; }

/* Viewer */
.gp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(211, 47, 47, 0.45); background: #0F1419; }
.gp-bar.is-unlocked { border-color: rgba(46, 125, 50, 0.6); }
.gp-tag { padding: 4px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; background: rgba(211, 47, 47, 0.15); border: 1px solid rgba(211, 47, 47, 0.45); color: #fca5a5; }
.gp-bar.is-unlocked .gp-tag { background: rgba(46, 125, 50, 0.18); border-color: rgba(46, 125, 50, 0.55); color: #86efac; }
.gp-bar-text { flex: 1 1 200px; overflow-wrap: anywhere; }
.gp-unlock { display: flex; gap: 8px; flex: 1 1 320px; }
.gp-unlock input { flex: 1; min-width: 0; }
.gp-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding: 4px; border-radius: 12px; border: 1px solid var(--border, #2A2F36); background: #0F1419; }
.gp .gp-tab { padding: 8px 14px !important; border-radius: 9px !important; border: 0 !important; background: transparent !important; box-shadow: none !important; color: var(--text-muted, #9AA4AE) !important; font: inherit; font-weight: 600; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp .gp-tab[aria-selected="true"] { background: linear-gradient(135deg, #D32F2F, #B71C1C) !important; color: #fff !important; }
.gp-stage { display: flex; justify-content: center; margin-top: 14px; padding: 18px; border-radius: 14px; background: #3a3f47; }
.gp-page-large { max-width: 760px; }
.gp-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 12px; }
.gp-pager .gp-btn { min-width: 48px; padding: 6px 14px !important; font-size: 1.3rem; }

/* Content sections */
.gp-content { max-width: 1100px; margin: 40px auto; padding: 0 16px; color: var(--text-muted, #9AA4AE); }
.gp-content section { margin: 0 0 40px; }
.gp-content h2 { font-size: 1.5rem; color: var(--text-heading, #F8FAFC); padding-bottom: 10px; border-bottom: 1px solid var(--border, #2A2F36); }
.gp-content h3 { font-size: 1.05rem; color: var(--text-heading, #F8FAFC); margin: 0 0 6px; }
.gp-content p, .gp-content li { line-height: 1.7; }
.gp-how { counter-reset: gp-step; list-style: none; padding: 0; display: grid; gap: 14px; }
.gp-how li { counter-increment: gp-step; position: relative; padding-left: 52px; }
.gp-how li::before { content: counter(gp-step); position: absolute; left: 0; top: 0; width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #D32F2F, #B71C1C); color: #fff; font-weight: 800; }
.gp-how p { margin: 0; }
.gp-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.gp-features > div, .gp-faq { padding: 18px; border-radius: 12px; border: 1px solid var(--border, #2A2F36); background: #111827; }
.gp-features p, .gp-faq p { margin: 0; }
.gp-faq { margin-bottom: 12px; }
.gp-related { display: flex; flex-wrap: wrap; gap: 12px; }
.gp-related a { padding: 14px 20px; border-radius: 12px; border: 1px solid var(--border, #2A2F36); background: #111827; color: var(--text-heading, #F8FAFC); font-weight: 600; text-decoration: none; }
.gp-related a:hover { border-color: #D32F2F; }

@media (max-width: 760px) {
  .gp-hero h1 { font-size: 1.55rem; }
  .gp-card { padding: 16px; }
  .gp-paths, .gp-fields { grid-template-columns: 1fr; }
  .gp-steps { grid-template-columns: 1fr 1fr; }
  .gp-layers { grid-template-columns: 1fr; }
  .gp-layers figure { max-width: 220px; }
  .gp-layers-lock { display: none; }
  .gp-actions .gp-btn { flex: 1 1 100%; }
  .gp-stage { padding: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .gp-drop, .gp-meter span { transition: none; }
}

/* The site's tool-page styles colour every paragraph and button; inside the note editor the page must stay
   black on white and the toolbar plain, as in the PDF the note becomes. */
.gp .gp-note-editor, .gp .gp-note-editor p, .gp .gp-note-editor li, .gp .gp-note-editor h1, .gp .gp-note-editor h2,
.gp .gp-note-editor b, .gp .gp-note-editor i, .gp .gp-note-editor u, .gp .gp-note-editor span { color: #111827 !important; background: transparent !important; }
.gp .gp-note-editor { background: #fff !important; }
.gp .gp-composer button[data-cmd], .gp .gp-composer button[data-size] { background: transparent !important; border: 1px solid transparent !important; box-shadow: none !important; color: var(--text-primary, #E6EDF3) !important; padding: 0 10px !important; border-radius: 8px !important; transform: none !important; }
.gp .gp-composer button[data-cmd]:hover, .gp .gp-composer button[data-size]:hover { background: #1F2937 !important; }
.gp .gp-composer button[data-cmd][aria-pressed="true"], .gp .gp-composer button[data-size][aria-pressed="true"] { background: rgba(211, 47, 47, 0.25) !important; border-color: rgba(211, 47, 47, 0.6) !important; }
.gp-file .gp-link { align-self: flex-start; }
