/* Editing a page in place (js/community-wiki.js): the Edit buttons on the
   section headings' divider lines, the section editors, the page tools,
   pending changes, history and the new-page form. Everything reads the
   site's own design tokens, with plain fallbacks. */

/* the Edit button sits on the heading's divider line, at the column's
   right edge, quiet like a wiki's [edit] */
.cw-has-edit{ position: relative; }
.cw-edit{
  position: absolute; top: -10px; right: 0; z-index: 2;
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px;
  font: 500 .72rem/1.4 var(--display, inherit); letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-dim, #9aa6bf); background: var(--bg, #070a14); border: 1px solid var(--line, rgba(255,255,255,.15));
  cursor: pointer; white-space: nowrap;
}
.cw-edit:hover{ color: var(--text, #fff); border-color: var(--line-strong, rgba(255,255,255,.4)); }
.cw-edit:focus-visible, .cw-btn:focus-visible, .cw-link:focus-visible{ outline: 2px solid var(--cyan, #29aae1); outline-offset: 2px; }
.cw-has-edit-inline{ display: flex; align-items: center; gap: 8px; }
.cw-edit--inline{ position: static; order: 2; margin-left: auto; }
.cw-edit--locked{ cursor: default; opacity: .7; }
.cw-has-edit > .cw-pend{ position: absolute; top: -10px; right: 74px; }
.cw-pend{ font: 500 .7rem/1.4 var(--display, inherit); letter-spacing: .05em; text-transform: uppercase; padding: 2px 6px; color: #04060d; background: var(--cyan, #29aae1); text-decoration: none; }
.cw-pend--inline{ order: 1; margin-left: auto; }
.cw-has-edit-inline:has(.cw-pend--inline) .cw-edit--inline{ margin-left: 0; }
.content .cw-pend{ color: #04060d; text-decoration: none; }
.cw-icon{ display: inline-flex; width: 12px; height: 12px; }
.cw-icon svg{ width: 100%; height: 100%; fill: currentColor; }
.cw-menu{ position: absolute; top: 14px; right: 0; z-index: 5; display: grid; min-width: 180px; background: var(--panel-2, #111a30); border: 1px solid var(--line-strong, rgba(255,255,255,.4)); }
.cw-menu button{ padding: 8px 12px; text-align: left; font: inherit; font-size: .9rem; color: var(--text, #fff); background: none; border: 0; cursor: pointer; }
.cw-menu button:hover{ background: var(--panel, #0c1222); }

/* page tools */
.cw-bar{ display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 0 0 14px; font-size: .82rem; color: var(--text-faint, #66728c); }
.cw-link{ padding: 0; font: inherit; color: var(--cyan, #29aae1); background: none; border: 0; cursor: pointer; text-decoration: underline; text-decoration-color: rgba(41,170,225,.4); text-underline-offset: 3px; }
.content .cw-bar a.cw-link{ color: var(--cyan, #29aae1); }
.cw-lock{ display: inline-flex; align-items: center; gap: 4px; color: var(--text-dim, #9aa6bf); }

/* controls */
.cw-btn{ display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px; font: 600 .78rem/1.2 var(--display, inherit); letter-spacing: .05em; text-transform: uppercase; color: var(--text, #fff); background: var(--panel-2, #111a30); border: 1px solid var(--line, rgba(255,255,255,.15)); cursor: pointer; text-decoration: none; }
.cw-btn:hover{ border-color: var(--line-strong, rgba(255,255,255,.4)); }
.cw-btn:disabled{ opacity: .45; cursor: default; }
.cw-btn--primary{ background: var(--electric, var(--blue, #1973d1)); border-color: transparent; }
.cw-btn--small{ padding: 4px 8px; font-size: .7rem; }
.cw-input{ width: 100%; box-sizing: border-box; padding: 8px 10px; font: inherit; font-size: .95rem; color: var(--text, #fff); background: var(--panel-2, #111a30); border: 1px solid var(--line, rgba(255,255,255,.15)); }
.cw-input:focus{ outline: none; border-color: var(--cyan, #29aae1); }
.cw-input:invalid{ border-color: #d9534f; }
.cw-textarea{ min-height: 6.5em; resize: vertical; line-height: 1.5; }
.cw-actions{ display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.cw-muted{ color: var(--text-faint, #66728c); font-size: .85rem; }
.cw-status{ margin: 8px 0 0; font-size: .9rem; color: var(--text-dim, #9aa6bf); }
.cw-status--warn{ color: #ffb4a8; }
.cw-status--ok{ color: var(--cyan, #29aae1); }

/* the editor, in place of the section */
.cw-editor{ display: grid; gap: 10px; margin: 0 0 24px; padding: 14px; background: var(--panel, #0c1222); border: 1px solid var(--line-strong, rgba(255,255,255,.4)); }
.cw-editor__intro{ margin: 0; font-size: .9rem; }
.cw-list{ display: grid; gap: 12px; }
.cw-item{ display: grid; gap: 6px; padding: 10px; background: var(--bg, #070a14); border: 1px solid var(--line, rgba(255,255,255,.15)); }
.cw-item__head{ display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cw-item__label{ font: 600 .74rem/1.3 var(--display, inherit); letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim, #9aa6bf); }
.cw-item__head .cw-item__label{ margin-right: auto; }
.cw-count{ font-size: .75rem; color: var(--text-faint, #66728c); }
.cw-cites{ display: grid; gap: 6px; }
.cw-cite{ display: grid; grid-template-columns: auto 1fr 1.4fr auto auto; gap: 6px; align-items: center; }
.cw-cite__n{ font-size: .8rem; color: var(--cyan, #29aae1); }
.cw-specs{ display: grid; grid-template-columns: minmax(7em, auto) 1fr 1fr; gap: 6px 8px; align-items: center; margin-bottom: 8px; font-size: .9rem; }
.cw-specs strong{ font: 600 .74rem/1.3 var(--display, inherit); letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim, #9aa6bf); }
.cw-refs, .cw-group{ display: grid; gap: 8px; }
.cw-chips{ display: flex; flex-wrap: wrap; gap: 6px; }
.cw-chip{ display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 9px; font-size: .85rem; color: var(--text, #fff); background: var(--panel-2, #111a30); border: 1px solid var(--line, rgba(255,255,255,.15)); }
.cw-chip--new{ border-style: dashed; }
.cw-chip__x{ width: 22px; height: 22px; padding: 0; font-size: 1rem; line-height: 1; color: var(--text-dim, #9aa6bf); background: none; border: 0; cursor: pointer; }
.cw-picker__field{ position: relative; }
.cw-suggest{ position: absolute; left: 0; right: 0; top: 100%; z-index: 6; display: grid; max-height: 260px; overflow: auto; background: var(--panel-2, #111a30); border: 1px solid var(--line-strong, rgba(255,255,255,.4)); }
.cw-suggest[hidden], .cw-menu[hidden]{ display: none; }
.cw-suggest__item{ padding: 7px 10px; font: inherit; font-size: .9rem; text-align: left; color: var(--text, #fff); background: none; border: 0; cursor: pointer; }
.cw-suggest__item:hover, .cw-suggest__item:focus{ background: var(--panel, #0c1222); outline: none; }
.cw-suggest__new{ color: var(--cyan, #29aae1); }
.cw-releases{ display: grid; gap: 6px; }
.cw-release{ display: grid; grid-template-columns: 1.3fr 1fr auto 1fr auto; gap: 6px; align-items: center; }
.cw-datepick{ width: 2.6em; padding: 6px 4px; color: transparent; }
.cw-datepick::-webkit-datetime-edit{ display: none; }
.cw-datepick::-webkit-calendar-picker-indicator{ filter: invert(.8); margin: 0; cursor: pointer; }
.cw-sources{ display: grid; gap: 6px; }
.cw-preview{ padding: 10px 12px; border-left: 2px solid var(--cyan, #29aae1); background: var(--bg, #070a14); }
.cw-preview__body p:last-child{ margin-bottom: 0; }
.cw-fresh{ margin: 0 0 18px; padding: 10px 12px; border-left: 2px solid var(--cyan, #29aae1); }

/* pending changes and history */
.cw-pending{ margin: 0 0 22px; padding: 12px 14px; background: var(--panel, #0c1222); border: 1px solid var(--cyan, #29aae1); }
.cw-pending__title{ margin: 0 0 8px; }
.cw-change, .cw-rev{ padding: 10px 0; border-top: 1px solid var(--line, rgba(255,255,255,.15)); }
.cw-change__meta{ margin: 0 0 4px; font-size: .85rem; color: var(--text-dim, #9aa6bf); }
.cw-change__summary{ margin: 0 0 6px; font-style: italic; }
.cw-rev--current{ border-left: 2px solid var(--cyan, #29aae1); padding-left: 10px; }
.cw-diff{ font-size: .92rem; line-height: 1.55; }
.cw-diff__block{ margin: 0 0 6px; }
.cw-diff__label{ display: block; font: 600 .68rem/1.3 var(--display, inherit); letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint, #66728c); }
.cw-diff del{ color: #ffd2cc; background: rgba(217, 83, 79, .28); text-decoration: line-through; text-decoration-color: rgba(255, 140, 130, .8); }
.cw-diff ins{ color: #d4ffe0; background: rgba(46, 160, 90, .3); text-decoration: none; }
.cw-dialog{ width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: 16px; color: var(--text-body, #c9d2e4); background: var(--bg, #070a14); border: 1px solid var(--line-strong, rgba(255,255,255,.4)); }
.cw-dialog::backdrop{ background: rgba(0, 0, 0, .6); }
.cw-dialog__head{ display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.cw-dialog__head h2{ margin: 0; font-size: 1.25rem; color: var(--text, #fff); }
.cw-dialog .cw-input{ margin-bottom: 8px; }
.cw-history{ margin-top: 8px; }
.cw-notice{ position: fixed; z-index: 80; left: 16px; right: 16px; bottom: 16px; max-width: 30rem; margin: 0 auto; padding: 10px 14px; color: var(--text, #fff); background: var(--panel-2, #111a30); border: 1px solid var(--line-strong, rgba(255,255,255,.4)); box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.cw-notice--ok{ border-color: var(--cyan, #29aae1); }

/* facts and entries in fixed columns */
.cw-facts{ display: grid; grid-template-columns: minmax(9em, auto) 1fr; gap: 8px 12px; align-items: center; }
.cw-row{ display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.cw-row__cell{ display: grid; gap: 4px; }
.cw-dateset{ display: flex; gap: 6px; align-items: center; }
.cw-dateset .cw-date{ flex: 1; }
.cw-cite--row{ grid-template-columns: auto 1fr 1.4fr auto; }

/* the page-type chooser */
.cw-typemenu{ position: absolute; z-index: 60; display: grid; min-width: 200px; padding: 6px 0; background: var(--panel-2, #111a30); border: 1px solid var(--line-strong, rgba(255,255,255,.4)); box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.cw-typemenu__title{ margin: 0; padding: 4px 14px 6px; font: 600 .68rem/1.3 var(--display, inherit); letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint, #66728c); }
.cw-typemenu a{ padding: 8px 14px; color: var(--text, #fff); text-decoration: none; font-size: .95rem; }
.cw-typemenu a:hover, .cw-typemenu a:focus{ background: var(--panel, #0c1222); color: var(--cyan, #29aae1); outline: none; }

/* a draft of a new page: its banner, and the duplicate check under its name */
.cw-draftbar{ position: sticky; top: 72px; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 14px 0 0; padding: 10px 14px;
  background: rgba(12,18,34,.94); border: 1px solid rgba(255,210,122,.55); box-shadow: 0 8px 26px rgba(0,0,0,.4); backdrop-filter: blur(6px); }
.cw-draftbar__badge{ padding: 3px 8px; font: 700 .7rem/1.3 var(--display, inherit); letter-spacing: .14em; text-transform: uppercase; color: #04060d; background: #ffd27a; }
.cw-draftbar__text{ flex: 1 1 320px; font-size: .92rem; color: var(--text-body, #c9d2e4); }
.cw-draftbar__state{ font-size: .85rem; color: var(--text-faint, #66728c); }
.cw-draftbar__state--warn{ color: #ffb4a8; }
.cw-draftbar__acts{ display: flex; flex-wrap: wrap; gap: 8px; }
.cw-draftbar__acts .cw-actions{ margin: 0; }
.cw-dupmenu{ position: relative; z-index: 20; display: grid; gap: 2px; margin: -4px 0 12px; padding: 8px; max-width: 640px; background: var(--panel-2, #111a30); border: 1px solid var(--line-strong, rgba(255,255,255,.4)); box-shadow: 0 12px 30px rgba(0,0,0,.45); }
.cw-dupmenu[hidden]{ display: none; }
.cw-dupmenu__head{ margin: 4px 6px 2px; font: 600 .68rem/1.3 var(--display, inherit); letter-spacing: .14em; text-transform: uppercase; color: var(--cyan, #29aae1); }
.cw-dupmenu__item{ display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px; border-top: 1px solid var(--line, rgba(255,255,255,.15)); }
.cw-dupmenu__name{ font-weight: 600; color: var(--text, #fff); }
.cw-dupmenu__item .cw-btn{ margin-left: auto; }
.cw-dupmenu__close{ justify-self: start; margin: 4px 6px 0; font-size: .82rem; }
.cw-missing{ color: #ffd27a !important; }
.cw-missing::before{ background: #ffd27a !important; }
.gr-draft .gr-field--empty{ cursor: pointer; }
.gr-draft .gr-field--empty:hover{ border-color: var(--cyan, #29aae1); color: var(--text-dim, #9aa6bf); }
.cw-drafts{ list-style: none; padding: 0; margin: 0; }
.cw-drafts li{ padding: 10px 0; border-top: 1px solid var(--line, rgba(255,255,255,.15)); }
.cw-drafts a{ font-weight: 600; }

@media (max-width: 600px){
  .cw-edit{ top: -11px; padding: 2px 6px 2px 5px; font-size: .68rem; }
  .cw-has-edit > .cw-pend{ right: 64px; }
  .cw-cite{ grid-template-columns: auto 1fr; }
  .cw-cite .cw-btn{ justify-self: start; }
  .cw-release{ grid-template-columns: 1fr 1fr; }
  .cw-specs{ grid-template-columns: 1fr 1fr; }
  .cw-specs > span:first-child, .cw-specs > label{ grid-column: 1 / -1; }
  .cw-facts{ grid-template-columns: 1fr; gap: 4px; }
  .cw-facts > label{ margin-top: 6px; }
  .cw-draftbar{ top: 60px; }
}
