/* =====================================================================
   Blog Automation – Word document / code view (js/editmode.js, editor in js/pages/articles.js). Colours only from theme.css tokens.
   ===================================================================== */
/* first visit: choose the view */
.em-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.em-opt { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.em-opt:hover { border-color: var(--border-strong); }
.em-opt:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-50); }
[data-mode="dark"] .em-opt:has(input:checked) { background: var(--surface-3); }
.em-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.em-opt input { position: absolute; top: 14px; right: 14px; margin: 0; accent-color: var(--accent); }
.em-ico { display: inline-flex; align-self: flex-start; padding: 10px; border-radius: var(--radius); background: var(--surface-3); color: var(--text-2); }
.em-opt:has(input:checked) .em-ico { background: var(--accent); color: var(--accent-contrast); }
.em-ico .ico { width: 22px; height: 22px; }
.em-opt b { display: block; font-size: var(--fs); }
.em-opt small { display: block; margin-top: 4px; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.45; }
.em-def { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: var(--fs-sm); font-weight: 500; cursor: pointer; }
.em-def input { width: 16px; height: 16px; accent-color: var(--accent); }
.em-note { margin: 8px 0 0; }
@media (max-width: 560px) { .em-pick { grid-template-columns: 1fr; } }

/* editor header: Word | Code | Preview as ONE control on one line */
.bp-viewgrp { display: inline-flex; align-items: center; gap: 2px; height: 36px; padding: 3px; flex: none; white-space: nowrap;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.bp-modesw { display: inline-flex; gap: 2px; }
.bp-modesw button, .bp-vg-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border: 0; border-radius: 999px; background: none;
  color: var(--text-2); font: 500 var(--fs-sm)/1 var(--font); cursor: pointer; }
.bp-modesw button:hover, .bp-vg-btn:hover { background: var(--surface-3); color: var(--text); }
.bp-modesw button.active { background: var(--text); color: var(--surface); font-weight: 600; }
[data-mode="dark"] .bp-modesw button.active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.bp-modesw button:focus-visible, .bp-vg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.bp-modesw .ico, .bp-vg-btn .ico { width: 15px; height: 15px; }
.bp-vg-sep { width: 1px; height: 18px; margin: 0 2px; background: var(--border); }
@media (min-width: 701px) { .bp-ehead > .row:last-child { flex-wrap: nowrap; } }

/* the code view */
.bp-code { display: flex; flex-direction: column; gap: 10px; }
.bp-code[hidden] { display: none; }
.bp-code-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius); background: var(--surface-2); color: var(--text-2); }
.bp-code-ta { min-height: 520px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text);
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.bp-code-ta:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.bp-code-warn { margin: 0; }
.bp-code-warn[hidden] { display: none; }

/* ---------- IDE look (js/editmode.js ideEditor): dark theme in light AND dark mode, like a code editor ---------- */
.ide { --ide-bg: #1e2230; --ide-gut: #171a25; --ide-top: #141722; --ide-fg: #c9d1e0; --ide-num: #59617a; --ide-line: rgba(255, 255, 255, .04);
  --ide-tag: #f07178; --ide-attr: #e0a35f; --ide-val: #a6d785; --ide-pun: #7f8aa3; --ide-com: #6b7489; --ide-ent: #5fc7d6; --ide-sel: rgba(97, 136, 228, .38);
  --ide-pad: 14px; --ide-gw: 52px;
  border-radius: var(--radius-lg); overflow: hidden; border: 1px solid #2a2f40; background: var(--ide-bg); box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.08)); }
.ide-top { display: flex; align-items: center; gap: 8px; padding: 0 8px 0 0; background: var(--ide-top); border-bottom: 1px solid #262b3b; min-height: 38px; }
.ide-tab { display: inline-flex; align-items: center; gap: 7px; align-self: stretch; padding: 0 14px; background: var(--ide-bg); color: #e6ebf5; border-right: 1px solid #262b3b;
  border-top: 2px solid var(--coral); font: 500 12.5px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ide-tab .ico { width: 14px; height: 14px; color: var(--coral); }
.ide-info { margin-left: auto; color: var(--ide-num); font: 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ide-btn { border: 1px solid #2f3546; background: #232838; color: #c9d1e0; border-radius: 6px; padding: 5px 10px; font: 500 12px/1 var(--font); cursor: pointer; }
.ide-btn:hover { background: #2b3144; color: #fff; }
.ide-btn:focus-visible { outline: 2px solid var(--coral); outline-offset: 1px; }
.ide-body { position: relative; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #3a4156 transparent;
  background: linear-gradient(to right, var(--ide-gut) 0 var(--ide-gw), #262b3b var(--ide-gw) calc(var(--ide-gw) + 1px), transparent calc(var(--ide-gw) + 1px)) local; }
.ide-body::-webkit-scrollbar { width: 10px; } .ide-body::-webkit-scrollbar-thumb { background: #3a4156; border-radius: 99px; border: 3px solid var(--ide-bg); }
/* the highlighted copy and the textarea MUST share font, size, line height, padding and wrapping */
.ide-hl, .ide .ide-ta { margin: 0; padding: var(--ide-pad) var(--ide-pad) var(--ide-pad) calc(var(--ide-gw) + var(--ide-pad)); font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  tab-size: 2; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; letter-spacing: 0; }
.ide-hl { position: absolute; top: 0; left: 0; right: 0; overflow: visible; color: var(--ide-fg); pointer-events: none; counter-reset: ln; }   /* full text height – it scrolls together with the field */
.ide .ide-ta { position: relative; display: block; width: 100%; border: 0; border-radius: 0; resize: none; overflow: hidden; background: transparent;
  color: transparent; caret-color: #ffcc66; -webkit-text-fill-color: transparent; box-shadow: none; min-height: 200px; }
.ide .ide-ta:focus { outline: none; box-shadow: none; border: 0; }
.ide .ide-ta::selection { background: var(--ide-sel); -webkit-text-fill-color: transparent; }
.ide:focus-within { border-color: color-mix(in srgb, var(--coral) 55%, #2a2f40); }
.ide-hl .l { position: relative; counter-increment: ln; min-height: 1.65em; }
.ide-hl .l::before { content: counter(ln); position: absolute; left: calc(-1 * (var(--ide-gw) + var(--ide-pad))); width: calc(var(--ide-gw) - 12px); text-align: right; color: var(--ide-num); }
.ide-hl i { font-style: normal; }
.ide-hl .t { color: var(--ide-tag); } .ide-hl .a { color: var(--ide-attr); } .ide-hl .v { color: var(--ide-val); } .ide-hl .p { color: var(--ide-pun); }
.ide-hl .c { color: var(--ide-com); font-style: italic; } .ide-hl .e { color: var(--ide-ent); }
.bp-code-bar { margin: 0; }

/* the editor column has a fixed height (it stays in view, css/editor.css): the code view fills it and scrolls INSIDE the dark box */
@media (min-width: 901px) {
  .bp-main .bp-paper > .bp-code:not([hidden]) { flex: 1 1 auto; min-height: 260px; display: flex; flex-direction: column; }
  .bp-main .bp-code > :not(.ide) { flex-shrink: 0; }
  .bp-main .bp-code .ide { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .bp-main .bp-code .ide-top { flex-shrink: 0; }
  .bp-main .bp-code .ide-body { flex: 1; min-height: 0; }
}
@media (max-width: 900px) { .bp-code .ide-body { max-height: 70vh; } }
.bp-code-warn b { display: block; }
.bp-code-warn p { margin: 4px 0 0; }
.bp-cw-acts { margin-top: 10px; gap: 8px; }
.bp-save[data-state="held"] { color: var(--warn-text, #b45309); font-weight: 600; }
/* custom code: live preview (sandboxed page from routes/code.js) and the company switch */
.code-prev { display: block; width: 100%; height: min(72vh, 820px); border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.c-code-card { margin-top: 16px; }
.c-code-card h3 { display: flex; align-items: center; gap: 8px; }
/* IDE colours for CSS (<style>, style="…") and JavaScript (<script>, on…="…") – js/editmode.js highlight() */
.ide-hl .k { color: #c792ea; }                 /* keywords, @media, !important */
.ide-hl .s { color: #a6d785; }                 /* strings */
.ide-hl .n { color: #f78c6c; }                 /* numbers, units, colours, true/false/null */
.ide-hl .f { color: #82aaff; }                 /* function calls, CSS functions */
.ide-hl .pr { color: #b2ccd6; }                /* object properties */
.ide-hl .id { color: #e6ebf5; }                /* names */
.ide-hl .o { color: #89ddff; }                 /* operators, brackets */
.ide-hl .cp { color: #80cbc4; }                /* CSS properties */
.ide-hl .cv { color: #e6ebf5; }                /* CSS keyword values */
.ide-hl .sel { color: #ffcb6b; }               /* CSS .class / #id selectors */
.ide-hl .ps { color: #c792ea; }                /* :hover, ::after, :root */
/* IDE full screen (button in the IDE bar, Esc ends it) */
.ide-btn { display: inline-flex; align-items: center; gap: 6px; }
.ide-btn .ico { width: 14px; height: 14px; }
.ide.ide-full { position: fixed; inset: 0; z-index: 120;   /* over the app shell and the editor, under menus (150) and toasts (200) */
  display: flex; flex-direction: column; border-radius: 0; border: 0; }
.ide.ide-full .ide-top { min-height: 44px; padding-right: 12px; }
.ide.ide-full .ide-body { flex: 1; min-height: 0; overflow-y: auto; }
.ide.ide-full .ide-hl, .ide.ide-full .ide-ta { font-size: 14px; }
.ide.ide-full .ide-ta { min-height: calc(100vh - 44px); }
html.ide-full-open, html.ide-full-open body { overflow: hidden; }
@media (min-width: 1100px) { .ide.ide-full .ide-hl, .ide.ide-full .ide-ta { padding-right: max(24px, calc((100vw - 1400px) / 2)); } }
/* IDE live preview: code left, rendered page right (full screen); stacked on narrow screens */
.ide-prev[hidden] { display: none; }
.ide.ide-full.ide-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
.ide.ide-split .ide-top { grid-column: 1 / -1; }
.ide.ide-split .ide-body { grid-column: 1; grid-row: 2; }
.ide.ide-split .ide-prev { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; min-height: 0; border-left: 1px solid #262b3b; background: #fff; }
.ide-prev-bar { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 8px 0 12px; background: var(--ide-top); color: #c9d1e0; font: 500 12px/1 var(--font); border-bottom: 1px solid #262b3b; }
.ide-prev-bar > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.ide-prev-bar .ico { width: 14px; height: 14px; }
.ide-prev-state { margin-left: auto; color: var(--ide-num); }
.ide-prev-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
.ide-prev-bar [data-prev-close] { margin-left: 4px; padding: 4px 6px; }
.ide-btn[aria-pressed="true"] { background: #2f3650; color: #fff; border-color: #3a4156; }
@media (max-width: 900px) { .ide.ide-full.ide-split { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr); } .ide.ide-split .ide-prev { grid-column: 1; grid-row: 3; border-left: 0; border-top: 1px solid #262b3b; } }

/* sign-in pages: light / dark switch next to the language (pages/auth.js) */
.auth-top { align-items: center; }
.au-modebtn { width: 38px; height: 38px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px; }
.au-modebtn:hover { color: var(--text); background: var(--surface-3); }
/* sign-in step 2: the e-mail of step 1 with "Ändern" (pages/auth.js views.loginPassword) */
.au-who { display: flex; align-items: center; gap: 10px; margin: 4px 0 18px; padding: 8px 12px 8px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); min-width: 0; }
.au-who-av { width: 28px; height: 28px; font-size: 12px; flex: none; }
.au-who b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: var(--fs-sm); }
.au-who a { flex: none; }
