/* =====================================================================
   NaturalHerbLibrary — Unified Stylesheet (styles.css)
   ---------------------------------------------------------------------
   This file merges the original base styles with the mobile/override
   layer, so you can load a single stylesheet site‑wide.
   Replace existing <link> tags with just:
     <link rel="stylesheet" href="assets/styles.css">
   ===================================================================== */

/* == Variables ======================================================= */
:root {
  --bg: #0F1115;
  --surface: #171a21;
  --text: #e8eef9;
  --muted: #9fb0c7;
  --accent: #7FE0E3;
  --border: #223049;
  --radius: 16px;
  --maxw: 1100px;
}

/* == Base Reset ====================================================== */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 24px; }

/* == Header ========================================================== */
.header {
  position: sticky;
  top: 0;
  background: rgba(15, 17, 21, .85);
  backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo  { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #b3f0f1); }
.title { font-size: 18px; font-weight: 700; letter-spacing: .3px; }
.nav   { display: flex; gap: 16px; margin-left: auto; }

/* Ensure header text is readable on the dark header */
.header .logo, .header a.logo, .header nav a { color: #eaf3f7; text-decoration: none; }

/* == Grid / Rows ===================================================== */
.row { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 960px) { .row { grid-template-columns: 260px 1fr; } }

/* == Cards =========================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}

/* == Typography ====================================================== */
.kicker { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.h1 { font-size: 28px; margin: 8px 0 0; font-weight: 800; }
.small { font-size: 13px; color: var(--muted); }

/* == Tags ============================================================ */
ul.tags { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px; }
ul.tags li { font-size: 12px; border: 1px solid var(--border); padding: 2px 8px; border-radius: 999px; color: #cfe0ff; }

/* == Tables ========================================================== */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: #11151d; text-align: left; color: #cfe0ff; font-weight: 600; }
tr:last-child td { border-bottom: 0; }

/* == Alerts ========================================================== */
.alert { border-left: 4px solid var(--accent); padding: 12px 14px; background: #0b0e14; border-radius: 10px; }

/* == Footer ========================================================== */
.footer { margin-top: 48px; padding: 24px; border-top: 1px solid var(--border); color: var(--muted); }

/* == Illustration placeholders ====================================== */
.illustration {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 4/3; border: 1px dashed var(--border);
  border-radius: 12px; background: #11151d; margin: 8px 0 0;
}

/* ====================================================================
   RESPONSIVE + INDEX/MONOGRAPH ENHANCEMENTS
   (formerly in assets/styles.mobile.css)
   ==================================================================== */

/* Fluid type scale */
:root{
  --step--1: clamp(.80rem, .77rem + .3vw, .95rem);
  --step-0:  clamp(.95rem, .90rem + .5vw, 1.05rem);
  --step-1:  clamp(1.05rem, 1.0rem + .8vw, 1.25rem);
  --step-2:  clamp(1.25rem, 1.1rem + 1.5vw, 1.75rem);
  --step-3:  clamp(1.5rem, 1.3rem + 2vw, 2.25rem);
}
h1{ font-size: var(--step-3); line-height: 1.1; }
h2{ font-size: var(--step-2); line-height: 1.15; }
h3{ font-size: var(--step-1); line-height: 1.2; }
p,li{ font-size: var(--step-0); line-height: 1.6; }

/* Keep media fluid */
img, svg, video, canvas{ max-width:100%; height:auto; }

/* Panels/hero parity on Index */
.hero, .intro, .panel, .card{ background: var(--surface); color: var(--text); }
.hero h1, .intro h1{ color: var(--text); }

/* Herb Index — Thumbnail Grid (replaces wide table on most screens) */
.herb-table{ display:none; } /* keep in DOM but hidden by default */
.index-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(260px,1fr));
  gap:16px; margin-top:16px;
}
.index-grid .herb-card{
  display:grid; grid-template-columns:84px 1fr; gap:12px; align-items:center;
  padding:12px; border-radius:12px; background:var(--surface); border:1px solid var(--border);
}
.index-grid .herb-fig{ display:block; aspect-ratio:1/1; border-radius:10px; overflow:hidden; }
.index-grid .herb-fig img{ width:100%; height:100%; object-fit:contain; }
.index-grid .herb-meta h3{ margin:0 0 6px; font-size: var(--step-1); }

/* Monograph — Large Hero Illustration */
.mono-hero{ margin:12px 0 16px; }
.mono-hero img{ max-width:100%; height:auto; border-radius:18px; }

/* Sidebar alternate thumbnails (classic / modern / hybrid) */
.thumb-alt{ margin:16px 0; padding:12px; border:1px solid var(--border); border-radius:12px; background:var(--surface); }
.thumb-alt h3{ margin:0 0 8px; font-size:var(--step-1); }
.thumb-list{ list-style:none; display:flex; gap:8px; padding:0; margin:0; }
.thumb-list li{ display:block; }
.thumb-list img{ display:block; width:72px; height:72px; object-fit:contain; border-radius:10px; }

/* Sticky filter bar (if present) */
.filter-bar{ position: sticky; top: 0; z-index: 50; backdrop-filter: saturate(140%) blur(6px); }
.filter-bar .controls{ display:grid; grid-template-columns:1fr 1fr; gap:8px; }
@media (min-width:700px){ .filter-bar .controls{ grid-template-columns: repeat(4,1fr); } }

/* Touch target sizing */
button, .btn, .chip, select, input[type="search"]{ min-height:44px; }

/* Optional: show the wide table only on very large screens */
@media (min-width: 1200px){
  /* Uncomment to display the legacy table on ultra-wide screens:
  .herb-table{ display: table; width:100%; }
  */
}

/* Respect system light mode (keeps color vars in one place) */
@media (prefers-color-scheme: light){
  :root{
    --bg:#f8fafc; --surface:#ffffff; --text:#0f172a; --muted:#64748b; --border:#d5d9e0;
  }
}