/* ============================================================================
   Halcyon Debate — shared site styles
   Static site, no build step. Components under components/*.html carry their
   own layout inline; this file holds the shared design system: fonts, reset,
   buttons, inputs, cards, keyframes, and page visibility.
   Accent: #6EB5C0. UI text uses en dashes, never em dashes.
   ============================================================================ */

:root {
  --accent: #6EB5C0;
  --accent-ink: #06181d;   /* text color on an accent-filled control */
  --accent-deep: #3f7a83;  /* darker accent for mono labels on light panels */
  --ink: #141414;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: #ffffff; }
body {
  color: var(--ink);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent); color: var(--accent-ink); }

/* ── Page routing: exactly one .site-page is visible at a time ─────────────── */
.site-page { display: none; }
.site-page.active { display: block; }

/* ── Type helpers ──────────────────────────────────────────────────────────── */
.mono { font-family: 'JetBrains Mono', monospace; }
.kicker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; letter-spacing: 3px;
  color: var(--accent); margin-bottom: 20px;
}
.field-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; letter-spacing: 1.5px; color: #9a9a9a;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-accent {
  background: var(--accent); color: var(--accent-ink);
  border: none; cursor: pointer; font-family: inherit;
  font-weight: 700; font-size: 15px; padding: 14px 26px; border-radius: 7px;
}
.btn-accent:hover { filter: brightness(1.06); }
.btn-accent:disabled { opacity: 0.55; cursor: default; filter: none; }
.btn-accent.small { font-size: 13.5px; padding: 9px 18px; border-radius: 6px; }

.btn-ghost {
  background: #ffffff; color: #222;
  border: 1px solid #d4d4d4; cursor: pointer; font-family: inherit;
  font-weight: 600; font-size: 15px; padding: 14px 26px; border-radius: 7px;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost.small { font-size: 13.5px; padding: 9px 16px; border-radius: 8px; }
.btn-ghost.danger:hover { border-color: #c97a7a; color: #b04a4a; }

.link-quiet {
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: 14px; color: #555; text-align: left; padding: 0;
}
.link-quiet:hover { color: var(--accent); }
.link-accent {
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: 13.5px; font-weight: 700; color: var(--accent); padding: 0;
}
.link-back {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px; letter-spacing: 1.5px; color: #9a9a9a; padding: 0;
}
.link-back:hover { color: var(--accent); }
.site-pagination {
  max-width: 960px; margin: -62px auto 76px; padding: 0 32px;
  display: flex; justify-content: center; align-items: center; gap: 7px; flex-wrap: wrap;
}
.site-page-button {
  min-width: 36px; height: 36px; padding: 0 10px; border: 1px solid #d4dfe1; border-radius: 8px;
  background: #ffffff; color: #3d4a4c; font-family: 'JetBrains Mono', monospace; font-size: 12px;
  cursor: pointer;
}
.site-page-button:hover { border-color: var(--accent); color: var(--accent-deep); }
.site-page-button.active {
  border-color: var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.site-page-button:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 2px; }

/* ── Nav links (site.js sets .active from the route) ───────────────────────── */
.nav-link {
  background: none; border: none; cursor: pointer;
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  font-size: 14px; font-weight: 600; padding: 20px 0; line-height: 1;
  border-bottom: 2px solid transparent; color: #777777;
}
.nav-link.active { color: #141414; border-bottom-color: var(--accent); }

/* ── Inputs ────────────────────────────────────────────────────────────────── */
.field {
  font-family: inherit; font-size: 15px; color: var(--ink);
  padding: 12px 14px; border: 1px solid #dcdcdc; border-radius: 9px;
  background: #fafafa; outline: none; width: 100%;
}
.field:focus { border-color: var(--accent); background: #ffffff; }
textarea.field { resize: vertical; min-height: 220px; line-height: 1.6; }

/* ── Admin rich-text editor (ProseMirror; articles + release notes) ─────────── */
/* Bundled from website/editor/src into website/editor/pm-bundle.js; lazy-loaded by site.js.
   The editable inherits the site font (Manrope) from <body>; only sizing/spacing is set here. */
.pm-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-bottom: 8px; min-height: 30px; }
.pm-btn {
  font-family: inherit; font-size: 12.5px; font-weight: 600; color: #2f3a3c;
  background: #ffffff; border: 1px solid #d4dfe1; border-radius: 6px;
  padding: 5px 10px; cursor: pointer; line-height: 1.2;
}
.pm-btn:hover { background: #eef6f7; border-color: #cfe3e6; color: var(--accent-deep); }
.pm-btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pm-btn.pm-b { font-weight: 800; }
.pm-btn.pm-i { font-style: italic; }
.pm-btn.pm-u { text-decoration: underline; }
.pm-btn.pm-s { text-decoration: line-through; }
.pm-sep { width: 1px; align-self: stretch; background: #e2e2e2; margin: 2px 3px; }
.pm-control { display: inline-flex; align-items: center; gap: 5px; }
.pm-control-label {
  font-family: 'JetBrains Mono', monospace; font-size: 9px; letter-spacing: 0.7px; color: #7d8a8c;
}
.pm-select, .pm-number {
  min-height: 29px; border: 1px solid #d4dfe1; border-radius: 6px; background: #ffffff;
  color: #2f3a3c; font-family: inherit; font-size: 12px; font-weight: 600;
  line-height: 1.2; padding: 4px 6px; outline: none;
}
.pm-select:focus, .pm-number:focus { border-color: var(--accent); }
.pm-number { width: 64px; }

.pm-mount { border: 1px solid #dcdcdc; border-radius: 9px; background: #ffffff; }
.pm-mount:focus-within { border-color: var(--accent); }

/* Required ProseMirror base rules (we don't ship prosemirror-view's default stylesheet). */
.pm-editor {
  position: relative; word-wrap: break-word; white-space: pre-wrap; font-variant-ligatures: none;
  min-height: 240px; max-height: 520px; overflow-y: auto;
  padding: 14px 16px; line-height: 1.75; font-size: 15.5px; color: var(--ink); outline: none;
}
.pm-editor [contenteditable="false"] { white-space: normal; }
.pm-editor p { margin: 0 0 10px; }
.pm-editor h1, .pm-editor h2, .pm-editor h3 { font-weight: 800; letter-spacing: -0.01em; margin: 16px 0 8px; }
.pm-editor h1 { font-size: 27px; }
.pm-editor h2 { font-size: 22px; }
.pm-editor h3 { font-size: 18px; }
.pm-editor blockquote { border-left: 3px solid var(--accent); padding-left: 14px; margin: 14px 0; color: #555; font-style: italic; }
.pm-editor ul, .pm-editor ol { padding-left: 24px; margin: 0 0 10px; }
.pm-editor li { margin: 0 0 4px; }
.pm-editor li p { margin: 0; }
.pm-editor a { color: var(--accent-deep); text-decoration: underline; }
/* Placeholder: shown while the doc is a single empty paragraph (site.js toggles .pm-empty). */
.pm-editor.pm-empty::before { content: attr(data-placeholder); color: #b0b0b0; pointer-events: none; height: 0; float: left; }
.pm-editor .ProseMirror-selectednode { outline: 2px solid var(--accent); }

/* Editor media atoms: a figure with a hover "×" delete button (nodeView in editor.mjs). */
.pm-editor .pm-media { position: relative; display: block; width: fit-content; max-width: 100%; margin: 12px 0; border-radius: 8px; }
.pm-editor .pm-media img, .pm-editor .pm-media video { display: block; max-width: 100%; border-radius: 8px; }
.pm-editor .pm-media video { width: min(100%, 460px); aspect-ratio: 16 / 9; object-fit: contain; background: #000; }
.pm-editor .pm-media:hover, .pm-editor .pm-media.ProseMirror-selectednode { outline: 2px solid var(--accent); outline-offset: 2px; }
.pm-media-del {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  border: none; background: rgba(20,20,20,0.72); color: #fff; font-size: 15px; line-height: 1; padding: 0;
  cursor: pointer; display: none; align-items: center; justify-content: center;
}
.pm-editor .pm-media:hover .pm-media-del { display: flex; }
.pm-media-del:hover { background: #b04a4a; }

/* gapcursor (cursor beside a media atom) — from prosemirror-gapcursor's default stylesheet. */
/* Article editing uses a focused mini-window so the long form does not expand the account page. */
.article-editor-dialog {
  width: min(920px, calc(100vw - 32px)); max-height: min(90vh, 900px); padding: 0;
  border: 0; border-radius: 16px; background: #ffffff; color: var(--ink);
  box-shadow: 0 24px 70px rgba(0,0,0,0.3); overflow: hidden;
}
.article-editor-dialog::backdrop { background: rgba(15,26,28,0.55); }
.article-editor-shell { max-height: min(90vh, 900px); overflow-y: auto; padding: 22px; }
.article-editor-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
  padding-bottom: 15px; margin-bottom: 18px; border-bottom: 1px solid #ececec;
}
.article-editor-head h2 { margin: 0; font-size: 24px; line-height: 1.15; }
@media (max-width: 640px) {
  .article-editor-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .article-editor-shell { max-height: calc(100vh - 16px); padding: 16px; }
}

.ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; margin: 0; }
.ProseMirror-gapcursor:after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid #333; animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; }
@keyframes ProseMirror-cursor-blink { to { visibility: hidden; } }
.ProseMirror-focused .ProseMirror-gapcursor { display: block; }

/* Admin media-slot overlay controls on the home/product placeholders */
.slot-admin-bar { position: absolute; top: 10px; right: 10px; z-index: 5; display: flex; gap: 6px; }
.slot-admin-bar .btn-ghost { background: rgba(255,255,255,0.92); }

/* Account dashboard: a symmetrical 2-column grid of equal-height cards (1 column on phones) */
.acct-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: stretch; }
@media (max-width: 640px) { .acct-grid { grid-template-columns: 1fr; } }
.acct-card { border: 1px solid #e6e6e6; border-radius: 16px; background: #ffffff; padding: clamp(24px, 3vw, 30px); display: flex; flex-direction: column; }
.acct-label { font-size: 11px; letter-spacing: 1.5px; color: var(--accent); margin-bottom: 18px; }
.account-tool-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px;
}
.account-tool-card {
  display: flex; min-width: 0; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 16px; border: 1px solid #dfe7e8; border-radius: 12px; background: #fff;
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.account-tool-card:hover {
  border-color: var(--accent); box-shadow: 0 8px 20px rgba(6,24,29,0.08); transform: translateY(-1px);
}
.account-tool-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.account-tool-kicker { font-size: 9.5px; letter-spacing: 1.35px; color: var(--accent-deep); font-weight: 700; }
.account-tool-title { font-size: 15px; line-height: 1.25; color: #142023; font-weight: 800; }
.account-tool-copy { min-height: 34px; font-size: 12.5px; line-height: 1.4; color: #687477; }
.account-tool-open {
  margin-top: auto; padding-top: 4px; font-size: 11px; color: var(--accent-deep); font-weight: 800;
  letter-spacing: 0.35px;
}
.account-mini-dialog {
  width: min(510px, calc(100vw - 28px)); max-height: min(82vh, 720px); padding: 0;
  border: 0; border-radius: 16px; background: #fff; color: var(--ink);
  box-shadow: 0 24px 70px rgba(0,0,0,0.28); overflow: hidden;
}
.account-mini-dialog::backdrop { background: rgba(15,26,28,0.5); }
.account-mini-shell { max-height: min(82vh, 720px); overflow-y: auto; padding: 22px; }
.account-mini-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid #ececec;
}
.account-mini-head h2 { margin: 5px 0 0; font-size: 22px; line-height: 1.15; }
.account-mini-copy { font-size: 14px; line-height: 1.6; color: #565656; margin: 0; }
.account-profile-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.account-field-label { display: flex; flex-direction: column; gap: 6px; }
.account-form-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.account-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 18px; }
.account-color-field { width: 72px; min-height: 43px; padding: 5px; cursor: pointer; }
.account-code-field { width: 132px; text-align: center; letter-spacing: 5px; }
.account-toggle-row { display: flex; align-items: center; gap: 9px; margin-top: 16px; font-size: 13.5px; color: #333; cursor: pointer; }
.site-avatar-host { display: flex; align-items: center; justify-content: center; }
.site-avatar {
  width: 100%; height: 100%; border-radius: 22%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; font-family: 'JetBrains Mono', monospace;
  font-weight: 700; border: 1px solid rgba(6,24,29,0.12);
}
.site-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.site-avatar svg { width: 72%; height: 72%; display: block; }
@media (max-width: 640px) {
  .account-tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-mini-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .account-mini-shell { max-height: calc(100vh - 16px); padding: 17px; }
  .account-form-row { align-items: stretch; flex-direction: column; }
  .account-form-row .account-field-label { width: 100%; max-width: none !important; }
  .account-code-field { width: 100%; }
}
@media (max-width: 420px) {
  .account-tool-grid { grid-template-columns: 1fr; }
  .account-tool-copy { min-height: 0; }
}

/* Admin inline edit + flair: floating button, per-element outlines, and the flair toolbar */
.hc-edit-fab { position: fixed; right: 20px; bottom: 20px; z-index: 90; background: var(--accent-deep); color: #fff; border: none; border-radius: 24px; padding: 11px 20px; font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,0.18); }
.hc-edit-fab:hover { filter: brightness(1.08); }
body.hc-editing .hc-editable { outline: 1px dashed rgba(63,122,131,0.5); outline-offset: 2px; cursor: text; border-radius: 3px; }
body.hc-editing .hc-editable:hover { outline: 1px dashed var(--accent-deep); background: rgba(110,181,192,0.07); }
body.hc-editing .hc-editable:focus { outline: 2px solid var(--accent); background: rgba(110,181,192,0.10); }
.hc-flair-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 95; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; max-width: 94vw; background: #ffffff; border: 1px solid #dcdcdc; border-radius: 12px; padding: 8px 10px; box-shadow: 0 8px 28px rgba(0,0,0,0.18); }
.hc-flair-btn { font-family: inherit; font-size: 13px; font-weight: 700; color: #2f3a3c; background: #ffffff; border: 1px solid #d4dfe1; border-radius: 6px; padding: 5px 10px; cursor: pointer; line-height: 1.2; }
.hc-flair-btn:hover { background: #eef6f7; border-color: #cfe3e6; }
.hc-flair-swatch { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.15); cursor: pointer; padding: 0; }
.hc-flair-save { font-family: inherit; font-size: 13px; font-weight: 700; color: var(--accent-ink); background: var(--accent); border: none; border-radius: 6px; padding: 6px 14px; cursor: pointer; }

/* Checkboxes: 14x14, no native glyph, accent fill when checked */
input[type="checkbox"].hal-check {
  appearance: none; -webkit-appearance: none;
  width: 14px; height: 14px; margin: 0; border-radius: 3px;
  border: 1px solid #c9c9c9; background: #fff; cursor: pointer; flex-shrink: 0;
}
input[type="checkbox"].hal-check:checked { background: var(--accent); border-color: var(--accent); }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card { border: 1px solid #e6e6e6; border-radius: 12px; background: #ffffff; }
.card-hover:hover { border-color: var(--accent); }

/* ── Status / error lines under forms ──────────────────────────────────────── */
.form-note { font-size: 13.5px; line-height: 1.55; margin: 0; }
.form-note.err { color: #b04a4a; }
.form-note.ok { color: var(--accent-deep); }

.rel-gh-source {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-bottom: 12px; padding: 12px 14px; border: 1px solid #d9e6e8;
  border-radius: 10px; background: #f6fafb;
}
.rel-gh-selected { margin-top: 4px; font-size: 14px; font-weight: 700; color: #333; }
.rel-gh-help { margin-top: 3px; font-size: 12px; line-height: 1.45; color: #777; }
.rel-gh-dialog {
  width: min(680px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 40px));
  border: 1px solid #cfe3e6; border-radius: 16px; padding: 22px;
  background: #fff; color: var(--ink); box-shadow: 0 20px 70px rgba(6,24,29,0.25);
}
.rel-gh-dialog::backdrop { background: rgba(6,24,29,0.48); }
.rel-gh-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.rel-gh-dialog-head h2 { margin: 0; font-size: 25px; line-height: 1.15; }
.rel-gh-search-label { display: flex; flex-direction: column; gap: 6px; margin: 20px 0 12px; }
.rel-gh-results { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; max-height: 430px; overflow-y: auto; }
.rel-gh-result {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 12px; border: 1px solid #e2e8e9; border-radius: 9px; background: #fff;
}
.rel-gh-result-meta { min-width: 0; }
.rel-gh-result-tag { font-size: 14px; font-weight: 800; color: #222; overflow-wrap: anywhere; }
.rel-gh-result-name { margin-top: 2px; font-size: 12px; color: #777; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .rel-gh-source, .rel-gh-result { align-items: stretch; flex-direction: column; }
}

/* ── Background animations (hero grid, scanline, blink, floating token) ────── */
@keyframes hcBlink { 0%, 49% { opacity: 1 } 50%, 100% { opacity: 0 } }
@keyframes hcGrid { from { background-position: 0 0 } to { background-position: 0 -26px } }
@keyframes hcScan { 0% { transform: translateY(-120%) } 100% { transform: translateY(520%) } }
@keyframes hcFloat { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-7px) } }
@keyframes hcBallX { from { left: 8% } to { left: 88% } }
@keyframes hcBallY { from { top: 16% } to { top: 80% } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
}

/* ── The Guide (#/docs): gated reading view + sidebar ──────────────────────── */
.guide-content { min-width: 0; max-width: 760px; }
.guide-noselect { user-select: none; -webkit-user-select: none; }
.guide-noselect ::selection { background: transparent; }
.guide-content .pm-editor, .guide-content .pm-editor * { user-select: text; -webkit-user-select: text; }  /* editing stays selectable */
.guide-h2 { font-size: clamp(22px, 2.6vw, 30px); line-height: 1.15; letter-spacing: -0.02em; font-weight: 800; color: #111; margin: 0 0 14px; }
.guide-summary { font-size: 16px; line-height: 1.6; color: #6a6a6a; margin: 0 0 20px; }
.guide-list { font-size: 15.5px; line-height: 1.7; color: #3a3a3a; margin: 0; padding-left: 22px; }
.guide-list > li { margin: 0 0 12px; }
.guide-sublist { margin: 8px 0 6px; padding-left: 20px; color: #555; }
.guide-sublist > li { margin: 0 0 5px; font-size: 14.5px; }
.guide-page-body { font-size: 16px; line-height: 1.75; color: #3a3a3a; }
.guide-group { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 1.5px; color: #9a9a9a; font-weight: 700; margin: 16px 0 6px; padding-left: 10px; }
.guide-group:first-child { margin-top: 0; }
.guide-link { display: block; width: 100%; text-align: left; background: none; border: none; cursor: pointer; font-family: inherit; font-size: 13.5px; line-height: 1.35; color: #555; padding: 6px 10px; border-radius: 7px; }
.guide-link:hover { background: #f2f6f7; color: #1a1a1a; }
.guide-link.active { background: #eef6f7; color: var(--accent-deep); font-weight: 700; }

/* ── Small screens ─────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .nav-links { display: none !important; }   /* footer carries the same links */
  #guide-body { grid-template-columns: 1fr !important; }
  #guide-nav { position: static !important; max-height: none !important; flex-direction: row !important; flex-wrap: wrap; }
}
