/* v2/shell.css — theme variables + app shell (header/nav/feedback).
   Loaded on EVERY page (public + admin) from page_header.php.
   #541: one theme system — dark OR light, never mixed. System default,
   manual toggle persists in cookie `gemtheme` (read server-side to avoid flash). */

:root, html[data-theme="dark"] {
  --bg:      #0f1114;
  --bg2:     #16191e;
  --card:    #1c2026;
  --line:    #2a2f38;
  --tx:      #ece9e2;
  --tx2:     #a8adb8;
  --gold:    #d4af7a;
  --gold2:   #e8cf9e;
  --blue:    #7aa5dd;
  --ok:      #6fd08c;
  --err:     #e07a7a;
  --shadow:  rgba(0,0,0,.45);
  --ph-bg:   radial-gradient(circle at 50% 42%, #232830 0%, #14171c 75%);
}
html[data-theme="light"] {
  --bg:      #f6f4ef;
  --bg2:     #ffffff;
  --card:    #ffffff;
  --line:    #ddd6c8;
  --tx:      #23241f;
  --tx2:     #6b6a62;
  --gold:    #a8813f;
  --gold2:   #8a6a2f;
  --blue:    #3a6ea5;
  --ok:      #2e8b57;
  --err:     #b03a3a;
  --shadow:  rgba(60,50,20,.14);
  --ph-bg:   radial-gradient(circle at 50% 42%, #efece4 0%, #e2ded2 75%);
}
@media (prefers-color-scheme: light) {
  html:not([data-theme]) {
    --bg:      #f6f4ef;
    --bg2:     #ffffff;
    --card:    #ffffff;
    --line:    #ddd6c8;
    --tx:      #23241f;
    --tx2:     #6b6a62;
    --gold:    #a8813f;
    --gold2:   #8a6a2f;
    --blue:    #3a6ea5;
    --ok:      #2e8b57;
    --err:     #b03a3a;
    --shadow:  rgba(60,50,20,.14);
    --ph-bg:   radial-gradient(circle at 50% 42%, #efece4 0%, #e2ded2 75%);
  }
}

/* ---------- global shell ---------- */
html { background: var(--bg); }
body, body#body-pd {
  background: var(--bg) !important;
  color: var(--tx);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
a { color: var(--blue); }
::selection { background: var(--gold); color: #1c180d; }

/* neutralise the legacy light shell around v2 pages (#541) */
.xheight-100.bg-light, .bg-light { background: var(--bg) !important; }
.container, .container-fluid { color: var(--tx); }
input, select, textarea {
  background: var(--bg2); color: var(--tx);
  border: 1px solid var(--line); border-radius: 9px;
}
/* #600: bootstrap's .form-control (0,1,0) out-specifies the bare element rules
   above and painted inputs white in BOTH themes — white-on-white in light mode.
   Match its specificity so theme colours always win. */
.form-control, .form-select {
  background: var(--bg2); color: var(--tx);
  border: 1px solid var(--line); border-radius: 9px;
}
.form-control::placeholder, .form-select::placeholder { color: var(--tx2); opacity: 1; }
.form-floating > label { color: var(--tx2); }
.form-floating > .form-control:focus ~ label { color: var(--gold2); }
.form-check-input { background-color: var(--bg2); border-color: var(--line); }
.form-check-input:checked { background-color: var(--gold); border-color: var(--gold); }
/* #562: the native dropdown LIST ignores the control's dark background and
   paints white — light inherited text turned every option invisible. Force
   readable chips no matter the theme. */
option, optgroup { background: #ffffff; color: #1f222b; }
html[data-theme="light"] option, html[data-theme="light"] optgroup { background: #ffffff; color: #1f222b; }
select:invalid, select option[value=""] { color: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: -1px; }
.btn { border-radius: 9px; }
.table { color: var(--tx); }
.table th, .table td { border-color: var(--line); }
.card { background: var(--card); border-color: var(--line); color: var(--tx); }

/* ---------- header bar (#548/#549/#540) ---------- */
.gm-header {
  position: sticky; top: 0; z-index: 1030;
  display: flex; align-items: center; gap: 18px;
  padding: 8px 18px;
  background: color-mix(in srgb, var(--bg2) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.gm-header .brand {
  display: flex; align-items: center; gap: 10px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 17px; font-weight: 600; color: var(--tx);
  text-decoration: none; white-space: nowrap;
}
.gm-header .brand img { width: 30px; height: 30px; border-radius: 9px; display: block; }
.gm-nav { display: flex; align-items: center; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.gm-nav::-webkit-scrollbar { display: none; }
.gm-nav a {
  color: var(--tx2); text-decoration: none; font-size: 13.5px;
  padding: 7px 12px; border-radius: 999px; white-space: nowrap;
  transition: .14s;
}
.gm-nav a:hover { color: var(--tx); background: var(--card); }
.gm-nav a.on { color: var(--gold2); background: color-mix(in srgb, var(--gold) 14%, transparent); font-weight: 600; }
.gm-right { display: flex; align-items: center; gap: 8px; }
.gm-iconbtn {
  background: var(--card); color: var(--tx2); border: 1px solid var(--line);
  width: 34px; height: 34px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
  transition: .14s;
}
.gm-iconbtn:hover { color: var(--gold2); border-color: var(--gold); }
.gm-user { font-size: 12px; color: var(--tx2); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- feedback widget (#532) ---------- */
#gm-fb-btn {
  position: fixed; right: 16px; bottom: 16px; z-index: 1080;
  width: 46px; height: 46px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--gold); color: #20180c; font-size: 20px; font-weight: 700;
  box-shadow: 0 6px 18px var(--shadow);
}
#gm-fb-btn:hover { transform: scale(1.06); }
.gm-fb-mask {
  position: fixed; inset: 0; z-index: 1090; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.gm-fb-card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 16px;
  max-width: 460px; width: 100%; padding: 18px; box-shadow: 0 18px 50px var(--shadow);
}
.gm-fb-card h3 { margin: 0 0 4px; font-size: 17px; color: var(--tx); }
.gm-fb-card p.hint { margin: 0 0 12px; color: var(--tx2); font-size: 12.5px; }
.gm-fb-card input, .gm-fb-card textarea {
  width: 100%; margin-bottom: 10px; padding: 10px 12px; font-size: 14px; box-sizing: border-box;
}
.gm-fb-card textarea { min-height: 90px; resize: vertical; }
.gm-fb-row { display: flex; gap: 8px; justify-content: flex-end; }
.gm-fb-row button {
  border-radius: 999px; padding: 9px 20px; font-weight: 600; cursor: pointer; border: 1px solid var(--line);
  background: var(--card); color: var(--tx);
}
.gm-fb-row button.primary { background: var(--gold); border-color: var(--gold); color: #20180c; }
.gm-fb-row button:disabled { opacity: .55; cursor: default; }

@media (max-width: 720px) {
  .gm-header { gap: 10px; padding: 8px 12px; }
  .gm-header .brand span.t { display: none; }
  .gm-user { display: none; }
}

/* #575: search link becomes an icon on small phones (big-font overflow) */
@media (max-width: 700px) {
  .gm-nav a .gm-mtext { display: none; }
  .gm-nav a i { font-size: 18px; }
  .gm-nav a { padding: 8px 10px; }
}

/* #579: opt out of browser auto-dark (Samsung Internet / Chrome force-dark was
   muddying the site's own light theme into a dark earth tone on phones). The site
   themes itself — the browser must never darken it. */
html[data-theme="light"], html:not([data-theme]) { color-scheme: only light; }
html[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { html:not([data-theme]) { color-scheme: dark; } }

/* #600 CSS cache-bust marker: shell.css?v=7 */
