/* =============================================================================
   MiH — quiet editorial style for the eqnorms dashboard
   See looks/MiH_design_spec.md for the source of truth.
   ============================================================================= */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400..600;1,9..144,400..600&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

:root {
  --mih-ink:        #2c2825;
  --mih-ink-soft:   #4a423d;
  --mih-ink-faint:  #6b625b;
  --mih-paper:      #f6f2ea;
  --mih-paper-deep: #ede5d6;
  --mih-paper-warm: #f3ece0;
  --mih-paper-edge: #cfc4ae;
  --mih-rust:       #b85c3c;
  --mih-rust-deep:  #94472d;
  --mih-moss:       #5a6b3f;
  --mih-moss-deep:  #44542d;
  --mih-teal:       #3d6168;
  --mih-teal-deep:  #2b474c;
  --mih-gold:       #c79547;
  --mih-gold-deep:  #a17630;
  --mih-ash:        #b8b0a3;

  --mih-font-display: "Fraunces", Cambria, "EB Garamond", serif;
  --mih-font-body:    "IBM Plex Sans", Calibri, "Source Sans 3", sans-serif;
  --mih-font-mono:    "IBM Plex Mono", Consolas, "JetBrains Mono", monospace;
}

/* ---- Page atmosphere ---------------------------------------------------- */
html, body {
  background: var(--mih-paper);
  color: var(--mih-ink);
  font-family: var(--mih-font-body);
  font-size: 15px;
  letter-spacing: 0.005em;
  line-height: 1.55;
}

.container-fluid, .container { background: transparent; }

p, label, .help-block, .shiny-input-container > label {
  color: var(--mih-ink);
}
.shiny-input-container > label { font-weight: 500; }

a { color: var(--mih-rust-deep); text-decoration: underline; }
a:hover, a:focus { color: var(--mih-rust); text-decoration: underline; }

/* ---- Typography --------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--mih-font-display);
  font-weight: 500;
  letter-spacing: -0.008em;
  color: var(--mih-ink);
  margin-top: 1.2em;
  margin-bottom: 0.5em;
}
h1 { font-size: 1.8rem; letter-spacing: -0.012em; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
h5, h6 {
  font-family: var(--mih-font-body);
  font-weight: 600;
  color: var(--mih-ink);
  letter-spacing: 0.005em;
}

code, pre, .verbatim, kbd {
  font-family: var(--mih-font-mono);
  font-size: 0.9em;
  background: var(--mih-paper-deep);
  border: 1px solid var(--mih-paper-edge);
  padding: 1px 4px;
}
pre {
  padding: 10px 12px;
  background: var(--mih-ink);
  color: #e6dcc8;
  border-left: 3px solid var(--mih-gold);
  border-right: none;
  border-top: none;
  border-bottom: none;
}

/* ---- Masthead ----------------------------------------------------------- */
.mih-masthead {
  background: linear-gradient(180deg, #221f1c, var(--mih-ink));
  color: #f6f2ea;
  padding: 14px 24px 0 24px;
  position: relative;
  margin-bottom: 0;
}
.mih-masthead-inner {
  display: flex;
  align-items: center;
  gap: 18px;
}
.mih-masthead-logo {
  height: 44px;
  width: auto;
  display: block;
}
.mih-masthead-divider {
  width: 1px;
  height: 44px;
  background: rgba(246,242,234,0.18);
}
.mih-masthead-titleblock {
  flex: 1;
  min-width: 0;
}
.mih-eyebrow {
  font-family: var(--mih-font-mono);
  font-weight: 500;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--mih-gold);
  margin-bottom: 2px;
}
.mih-masthead-title {
  font-family: var(--mih-font-display);
  font-weight: 500;
  letter-spacing: -0.012em;
  font-size: 1.4rem;
  color: #f6f2ea;
  line-height: 1.15;
}
.mih-masthead-title em {
  font-style: italic;
  color: var(--mih-gold);
  font-weight: 500;
}
.mih-masthead-meta {
  font-family: var(--mih-font-mono);
  font-size: 0.78rem;
  color: rgba(246,242,234,0.55);
  text-align: right;
  line-height: 1.4;
  white-space: nowrap;
}
.mih-stripe-rule {
  display: flex;
  width: 100%;
  height: 6px;
  opacity: 0.92;
  margin-top: 14px;
}
.mih-stripe-rule > div { flex: 1; height: 100%; }
.mih-stripe-rust { background: var(--mih-rust); }
.mih-stripe-gold { background: var(--mih-gold); }
.mih-stripe-moss { background: var(--mih-moss); }
.mih-stripe-teal { background: var(--mih-teal); }

/* ---- Tabs --------------------------------------------------------------- */
.nav-tabs {
  border-bottom: 1px solid var(--mih-paper-edge);
  margin-top: 12px;
  margin-bottom: 16px;
  padding-left: 12px;
}
.nav-tabs > li > a {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--mih-ink-soft);
  font-weight: 500;
  font-family: var(--mih-font-body);
  padding: 8px 14px;
  margin-right: 4px;
  border-bottom: 2px solid transparent;
}
.nav-tabs > li > a:hover, .nav-tabs > li > a:focus {
  background: transparent;
  color: var(--mih-ink);
  border-bottom: 2px solid var(--mih-paper-edge);
}
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
  background: transparent;
  color: var(--mih-ink);
  border-bottom: 2px solid var(--mih-rust);
  font-weight: 600;
}

/* Inner / nested tabs (data sub-tabs) look the same but slightly smaller */
.tabbable .tabbable .nav-tabs > li > a {
  font-size: 0.9em;
  padding: 6px 12px;
}

/* ---- Panels / sidebars / cards ----------------------------------------- */
.well, .sidebar, .sidebarPanel, .panel, .shiny-input-panel {
  background: var(--mih-paper-deep);
  border: 0;
  border-left: 3px solid var(--mih-teal);
  border-radius: 0;
  box-shadow: none;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.well h4:first-child, .well h5:first-child,
.sidebarPanel h4:first-child, .sidebarPanel h5:first-child {
  margin-top: 0;
}

/* Editorial accent classes for cards (apply via div(class=...)) */
.mih-card-rust { border-left-color: var(--mih-rust); }
.mih-card-moss { border-left-color: var(--mih-moss); }
.mih-card-gold { border-left-color: var(--mih-gold); }
.mih-card-teal { border-left-color: var(--mih-teal); }

/* ---- Buttons ------------------------------------------------------------ */
.btn, .shiny-download-link, a.shiny-download-link {
  border-radius: 0;
  box-shadow: none;
  font-family: var(--mih-font-body);
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid var(--mih-ink);
  background: transparent;
  color: var(--mih-ink);
  padding: 6px 14px;
  transition: background 0.12s, color 0.12s;
}
.btn:hover, .btn:focus,
.shiny-download-link:hover, .shiny-download-link:focus {
  background: var(--mih-paper-deep);
  color: var(--mih-ink);
  outline: 2px solid var(--mih-rust);
  outline-offset: 1px;
}
.btn-primary {
  background: var(--mih-rust);
  border-color: var(--mih-rust);
  color: #f6f2ea;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--mih-rust-deep);
  border-color: var(--mih-rust-deep);
  color: #f6f2ea;
  outline: 2px solid var(--mih-gold);
  outline-offset: 1px;
}
.btn-default { /* same as base .btn */ }

/* ---- Inputs ------------------------------------------------------------- */
.form-control, input[type="text"], input[type="number"],
select, .selectize-input, textarea {
  border-radius: 0 !important;
  background: var(--mih-paper) !important;
  border: 1px solid var(--mih-paper-edge) !important;
  color: var(--mih-ink) !important;
  box-shadow: none !important;
  font-family: var(--mih-font-body);
}
.form-control:focus, .selectize-input.focus, select:focus,
input[type="text"]:focus, input[type="number"]:focus, textarea:focus {
  border-color: var(--mih-rust) !important;
  outline: 2px solid var(--mih-rust);
  outline-offset: 1px;
}
.selectize-dropdown {
  border-radius: 0 !important;
  border: 1px solid var(--mih-paper-edge) !important;
  background: var(--mih-paper);
}
.selectize-dropdown .active {
  background: var(--mih-paper-deep);
  color: var(--mih-ink);
}

/* radio / checkbox: slight tweak */
.radio label, .checkbox label { font-weight: 400; color: var(--mih-ink); }

/* File input has its own awful chrome — calm it down */
.form-group .btn-file {
  background: var(--mih-paper);
  color: var(--mih-ink);
  border: 1px solid var(--mih-paper-edge);
}
.progress {
  border-radius: 0;
  background: var(--mih-paper-deep);
  border: 1px solid var(--mih-paper-edge);
}
.progress-bar { background-color: var(--mih-rust); }

/* Disabled / "unmatched" placeholder for the PSW panel */
.mih-placeholder {
  font-family: var(--mih-font-body);
  color: var(--mih-ink-faint);
  font-style: italic;
  padding: 16px 18px;
  background: var(--mih-paper-warm);
  border-left: 3px solid var(--mih-paper-edge);
}

/* ---- Tables ------------------------------------------------------------- */
table, .table {
  font-family: var(--mih-font-body);
  border-collapse: collapse;
  border: 1px solid var(--mih-paper-edge);
  width: auto;
  margin-top: 4px;
  margin-bottom: 16px;
}
.table thead th, table thead th, table th, .table > thead > tr > th {
  font-family: var(--mih-font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-size: 0.72rem;
  color: var(--mih-ink-faint);
  background: var(--mih-paper-deep);
  border-bottom: 2px solid var(--mih-ink) !important;
  border-top: 0;
  padding: 6px 10px;
  text-align: left;
}
.table tbody td, table tbody td, table td, .table > tbody > tr > td {
  border-top: 0;
  border-bottom: 1px solid var(--mih-paper-edge);
  padding: 5px 10px;
  vertical-align: top;
}
.table > tbody > tr:nth-of-type(odd) > td,
table > tbody > tr:nth-of-type(odd) > td {
  background: var(--mih-paper);
}
.table > tbody > tr:nth-of-type(even) > td,
table > tbody > tr:nth-of-type(even) > td {
  background: var(--mih-paper-deep);
}
/* numeric columns: prefer mono font + right alignment */
.table td:not(:first-child),
table td:not(:first-child) {
  font-family: var(--mih-font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---- Plotly modebar tweak (keep editorial calm) ----------------------- */
.modebar { background: transparent !important; }

/* ---- Help text ---------------------------------------------------------- */
.help-block, .shiny-help-text {
  color: var(--mih-ink-faint);
  font-size: 0.85em;
  font-style: italic;
}

/* ---- Footer / app-version chip ---------------------------------------- */
.mih-version {
  font-family: var(--mih-font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--mih-ink-faint);
}
