/* ============================================================
   MilitarySci Theme — WP integration layer (theme.css)
   Extends the ported design system with facing
   components: pagination, entity placeholders, auth pages,
   portal tables, state pages, admin-bar neutralization.
   ============================================================ */

/* ---------- card cover placeholder (no image yet) ---------- */
.mcard-cover { display: block; }
.mcard-cover .cover-glyph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  background:
    radial-gradient(120% 120% at 85% 15%, color-mix(in srgb, var(--tone, var(--brand)) 16%, transparent), transparent 60%),
    var(--surface-3);
}
.card .mcard-cover { position: relative; }
.card-ph { opacity: .55; }

/* ---------- pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 26px 0 8px; }
.pg-btn, .pg-num {
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 38px; height: 38px; padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13.5px; font-weight: 600;
  transition: var(--t-fast);
}
.pg-num.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.pg-btn:hover, .pg-num:hover { border-color: var(--brand); color: var(--brand); }
.pg-dots { color: var(--text-3); padding: 0 4px; }

/* ---------- listing layout ---------- */
.listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.listing-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 18px 0 22px; }
.listing-toolbar .spacer { flex: 1; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px;
  border-radius: var(--r-pill); border: 1px solid var(--hairline);
  background: var(--surface); color: var(--text-2);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.filter-chip select {
  border: none; background: transparent; color: inherit;
  font: inherit; outline: none; max-width: 150px; cursor: pointer;
}
.filter-chip.on { border-color: var(--brand); color: var(--brand); background: var(--brand-softer); }

/* ---------- single entity ---------- */
.ent-hero { display: flex; flex-direction: column; gap: 16px; }
.ent-hero-cover {
  border-radius: var(--r-xl); overflow: hidden;
  aspect-ratio: 5 / 2; background: var(--surface-3);
  position: relative;
}
.ent-hero-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ent-hero-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ent-hero h1 { font-size: clamp(24px, 3.4vw, 34px); margin: 4px 0; letter-spacing: -.02em; }
.ent-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-inline-start: auto; }
.meta-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.meta-table th, .meta-table td { text-align: start; padding: 9px 12px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.meta-table th { color: var(--text-3); font-weight: 600; white-space: nowrap; width: 220px; }
.meta-table td { color: var(--text); }
.entity-body { font-size: 15.5px; line-height: 1.9; }
.entity-body img { max-width: 100%; height: auto; border-radius: var(--r-md); }
.entity-body h2, .entity-body h3 { margin: 26px 0 10px; }
.entity-body a { color: var(--brand); }
.entity-body ul, .entity-body ol { padding-inline-start: 22px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- state pages (closed module, 404, denied…) ---------- */
.state-page { min-height: 58vh; display: flex; align-items: center; justify-content: center; padding: 48px 0; }
.state-page .state { max-width: 560px; }
.state-icon-wrap {
  width: 74px; height: 74px; border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px;
  background: var(--brand-soft); color: var(--brand);
}
.state-icon-wrap.tone-warn { background: var(--warn-soft); color: var(--warn); }
.state-icon-wrap.tone-danger { background: var(--danger-soft); color: var(--danger); }
.state-icon-wrap.tone-ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- auth pages ---------- */
.auth-shell { min-height: 72vh; display: grid; place-items: center; padding: 40px 0; }
.auth-box {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-2);
  padding: 30px 28px;
}
.auth-box .brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.auth-title { font-size: 21px; margin: 0 0 6px; }
.auth-sub { color: var(--text-2); font-size: 13.5px; margin: 0 0 20px; }
.auth-foot-row { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .f-input, .field input[type="text"], .field input[type="email"],
.field input[type="password"], .field input[type="url"], .field textarea, .field select {
  width: 100%;
  height: 44px; padding: 0 14px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--hairline-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: 14px;
  transition: var(--t-fast);
}
.field textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.field-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin: 4px 0 14px; }

/* ---------- notes (success/error) ---------- */
.note { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); font-size: 13.5px; margin-bottom: 16px; }
.note-ok { background: var(--ok-soft); color: var(--ok); }
.note-warn { background: var(--warn-soft); color: var(--warn); }
.note-danger { background: var(--danger-soft); color: var(--danger); }
.note-info { background: var(--info-soft); color: var(--info); }

/* ---------- generic WP page content ---------- */
.wp-page-content { max-width: 780px; margin-inline: auto; font-size: 15.5px; line-height: 1.95; }
.wp-page-content > *:first-child { margin-top: 0; }
.wp-page-content a { color: var(--brand); }
.wp-page-content h2 { font-size: 21px; margin: 26px 0 10px; }
.wp-page-content h3 { font-size: 17px; margin: 20px 0 8px; }
.wp-page-content ul, .wp-page-content ol { padding-inline-start: 22px; display: flex; flex-direction: column; gap: 6px; }
.wp-page-content blockquote { border-inline-start: 3px solid var(--brand); padding: 8px 16px; background: var(--surface-2); border-radius: var(--r-md); margin: 16px 0; }
.wp-page-content img { max-width: 100%; height: auto; border-radius: var(--r-md); }
.wp-page-content table { width: 100%; border-collapse: collapse; }
.wp-page-content th, .wp-page-content td { border: 1px solid var(--hairline); padding: 8px 12px; text-align: start; }

/* ---------- section hero (archive head) ---------- */
.sec-hero { padding: 34px 0 6px; }
.sec-hero .overline { color: var(--hue, var(--brand)); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 11.5px; margin: 0 0 6px; }
.sec-hero h1 { font-size: clamp(26px, 3.6vw, 38px); margin: 0 0 8px; letter-spacing: -.02em; }
.sec-hero .sec-sub { color: var(--text-2); max-width: 640px; margin: 0 0 4px; font-size: 15px; }
.sec-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.sec-stat {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-md); padding: 10px 16px; min-width: 120px;
}
.sec-stat b { font-size: 19px; letter-spacing: -.02em; }
.sec-stat span { font-size: 12px; color: var(--text-3); }

/* ---------- member row ---------- */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.member-cell {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); padding: 14px;
  transition: var(--t-fast);
}
.member-cell:hover { border-color: var(--brand); box-shadow: var(--sh-1); transform: translateY(-1px); }
.member-cell .m-name { font-weight: 700; font-size: 14px; }
.member-cell .m-sub { font-size: 12px; color: var(--text-3); }

/* ---------- admin-bar neutralization (admins only see it) ---------- */
body.admin-bar .topbar { top: 32px; }
@media screen and (max-width: 782px) { body.admin-bar .topbar { top: 46px; } }
#wpadminbar { direction: ltr; }

/* ---------- comments ---------- */
.comments-area { margin-top: 30px; }
.comment-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--hairline); }
.comment-item .c-body { flex: 1; }
.comment-item .c-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.comment-item .c-author { font-weight: 700; font-size: 13.5px; }
.comment-item .c-date { font-size: 11.5px; color: var(--text-3); }
.comment-item .c-text { font-size: 14px; line-height: 1.8; }
.comment-form textarea { min-height: 90px; }

/* ---------- portal ---------- */
.portal-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.portal-tab {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: var(--r-pill); border: 1px solid var(--hairline);
  background: var(--surface); color: var(--text-2);
  font-size: 13.5px; font-weight: 600;
}
.portal-tab.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.portal-company-bar {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 18px;
}

/* ---------- theme settings live preview helpers ---------- */
.mst-tools-out.err { color: #DE3757 !important; }

/* ---------- compact density option ---------- */
html[data-density="compact"] { --topbar-h: 52px; --segnav-h: 42px; }
html[data-density="compact"] .main { padding-top: 18px; }

/* ---------- dark-mode safety for placeholders ---------- */
[data-theme="dark"] .mcard-cover .cover-glyph { background: radial-gradient(120% 120% at 85% 15%, color-mix(in srgb, var(--tone, var(--brand)) 18%, transparent), transparent 60%), var(--surface-3); }

/* ---------- utility ---------- */
.tone-eq { --tone: var(--d-eq); }
.tone-co { --tone: var(--d-co); }
.tone-ex { --tone: var(--d-ex); }
.tone-pe { --tone: var(--d-pe); }
.tone-rp { --tone: var(--d-rp); }
.tone-ev { --tone: var(--d-ev); }
.tone-brand { --tone: var(--brand); }
