/* Microbial Metabolism Explorer — warm earth-tone design system.
   Fonts load from Google when online; robust serif/sans fallbacks otherwise. */
@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;1,500&family=Inter:wght@400;500;600&display=swap");

:root {
  --cream-bg: rgb(251, 237, 226);
  --amber-orange: rgb(216, 104, 29);
  --deep-brown: rgb(41, 26, 17);
  --peach: rgb(231, 184, 128);
  --burnt: rgb(141, 64, 28);
  --sand: rgb(239, 217, 188);
  --amber: rgb(222, 146, 71);
  --rust: rgb(180, 94, 43);

  --panel-bg: rgba(255, 249, 241, 0.86);
  --panel-border: rgba(141, 64, 28, 0.22);
  --soft-shadow: 0 12px 36px rgba(41, 26, 17, 0.08);
  --focus-ring: 0 0 0 3px rgba(216, 104, 29, 0.22);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--deep-brown);
  background: radial-gradient(circle at top left, #fff8ef 0, var(--cream-bg) 44%, #f7e4cf 100%);
  min-height: 100vh;
}

h1, h2, .species-name {
  font-family: "Cormorant Garamond", "Spectral", Georgia, serif;
  letter-spacing: -0.02em;
  margin: 0;
}

.section-label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.14em;
  color: var(--burnt); text-transform: uppercase;
}
.muted { color: rgba(141, 64, 28, 0.6); font-size: 12px; }

/* ---------- shell ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 20px;
  padding: 22px;
  max-width: 1640px;
  margin: 0 auto;
}
.header { grid-column: 1 / -1; }
.sidebar { grid-column: 1; }
.main { grid-column: 2; display: flex; flex-direction: column; gap: 20px; }

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: var(--soft-shadow);
  padding: 18px;
}

/* ---------- header ---------- */
.header { display: flex; align-items: center; justify-content: space-between; }
.header__brand { display: flex; align-items: center; gap: 14px; }
.header__leaf { width: 40px; height: 40px; }
.header__title { font-size: 36px; font-weight: 600; color: var(--deep-brown); }
.header__subtitle { font-size: 16px; color: var(--amber-orange); margin-top: 2px; }
.meta-card {
  display: flex; gap: 26px; padding: 12px 18px;
  background: var(--panel-bg); border: 1px solid var(--peach);
  border-radius: 16px; box-shadow: var(--soft-shadow);
}
.meta-card__label { display: block; font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--burnt); }
.meta-card__value { font-size: 18px; font-weight: 600; }

/* ---------- sidebar ---------- */
.sidebar { display: flex; flex-direction: column; gap: 12px; }
.strain-list { display: flex; flex-direction: column; gap: 8px; }
.strain-card {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 14px; cursor: pointer; text-align: left;
  background: rgba(255, 252, 246, 0.7); border: 1px solid transparent;
  font-family: inherit; color: inherit; transition: all 0.14s ease;
}
.strain-card:hover { border-color: var(--peach); transform: translateX(2px); }
.strain-card:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.strain-card.is-selected { border-color: var(--amber-orange);
  background: rgba(231, 184, 128, 0.28); }
.strain-card__icon { width: 40px; height: 40px; border-radius: 12px; object-fit: contain;
  background: rgba(255, 249, 241, 0.8); padding: 3px; }
.strain-card__text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.strain-card__species { font-style: italic; font-size: 12px;
  color: var(--burnt); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strain-card__id { font-size: 13px; font-weight: 600; }
.strain-card__check { opacity: 0; color: var(--amber-orange); font-weight: 700; }
.strain-card.is-selected .strain-card__check { opacity: 1; }
.sidebar-note { margin-top: 6px; padding: 12px; border-radius: 14px;
  background: rgba(239, 217, 188, 0.4); font-size: 12px; line-height: 1.7; color: var(--burnt); }

/* ---------- main grid ---------- */
.main-grid {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px;
}
.plate-card, .detail-card { display: flex; flex-direction: column; gap: 14px; }

/* ---------- strain summary ---------- */
.strain-summary { display: flex; align-items: center; gap: 16px; }
.medallion { width: 92px; height: 92px; border-radius: 999px; flex-shrink: 0;
  background: rgba(255, 249, 241, 0.95); border: 2px solid var(--peach);
  display: flex; align-items: center; justify-content: center; box-shadow: var(--soft-shadow); }
.medallion__img { width: 78px; height: 78px; object-fit: contain; border-radius: 999px; }
.species-name { font-size: 26px; font-style: italic; font-weight: 600; }
.strain-summary__id { font-size: 14px; color: var(--burnt); margin-bottom: 6px; }
.trait-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 11px; padding: 3px 10px; border-radius: 999px;
  background: var(--sand); border: 1px solid var(--peach); color: var(--burnt); }

/* ---------- plate toolbar ---------- */
.plate-toolbar { display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px; }
.kpi-select label, .hover-toggle label { font-size: 12px; margin-right: 12px; cursor: pointer; }
.kpi-select input, .hover-toggle input { margin-right: 4px; accent-color: var(--amber-orange); }

/* ---------- plate ---------- */
.plate {
  display: grid;
  grid-template-columns: 22px repeat(12, minmax(0, 1fr));
  gap: 5px; align-items: center;
  padding: 14px; border-radius: 16px;
  background: rgba(255, 249, 241, 0.55); border: 1px solid var(--panel-border);
}
.plate__corner { }
.plate__colhead, .plate__rowhead { font-size: 11px; color: var(--burnt);
  text-align: center; font-weight: 600; }
.plate__rowhead { text-align: right; padding-right: 2px; }
.well {
  aspect-ratio: 1 / 1; width: 100%; border-radius: 999px; cursor: pointer;
  border: 1.5px solid rgba(141, 64, 28, 0.28);
  background: var(--sand); padding: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.well__label { font-size: 8px; color: rgba(41, 26, 17, 0.45); pointer-events: none; }
.well:hover { transform: scale(1.12); box-shadow: 0 4px 12px rgba(41, 26, 17, 0.18); z-index: 2; }
.well:focus-visible { outline: none; box-shadow: var(--focus-ring); z-index: 3; }
.well.is-selected {
  border: 2.5px solid var(--amber-orange);
  box-shadow: 0 0 0 3px rgba(216, 104, 29, 0.25), 0 4px 14px rgba(216, 104, 29, 0.35);
  z-index: 4;
}
/* Controls keep a KPI background color (inline) with a translucent hatch overlay on top. */
.well--control {
  background-image: repeating-linear-gradient(45deg,
    rgba(41, 26, 17, 0.42) 0, rgba(41, 26, 17, 0.42) 1.5px,
    transparent 1.5px, transparent 5px);
  border-style: dashed;
}
.well--nodata { background-color: rgba(239, 217, 188, 0.25); border-style: dashed;
  border-color: var(--peach); }
.well--empty { background: transparent; border: none; aspect-ratio: 1 / 1; }
.plate-hint { font-size: 12px; color: var(--burnt); text-align: center; }

/* ---------- plate legend / key ---------- */
.plate-wrap { display: flex; flex-direction: column; gap: 10px; }
.plate-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  padding: 2px 4px; font-size: 11px; color: var(--burnt); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-title { font-weight: 600; color: var(--deep-brown); margin-right: 4px; }
.legend-scale__end { font-size: 10px; color: rgba(141, 64, 28, 0.7); }
.legend-bar { width: 112px; height: 11px; border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: linear-gradient(to right, #fff3df 0%, #dea047 45%, #d8681d 80%, #8d401c 100%); }
.legend-label { color: var(--burnt); }
.legend-swatch { width: 15px; height: 15px; border-radius: 999px; display: inline-block;
  border: 1.5px solid rgba(141, 64, 28, 0.4); background-color: var(--sand); }
.legend-swatch--control { border-style: dashed; background-image: repeating-linear-gradient(45deg,
  rgba(41, 26, 17, 0.42) 0, rgba(41, 26, 17, 0.42) 1.5px, transparent 1.5px, transparent 5px); }
.legend-swatch--missing { border-style: dashed; border-color: var(--peach);
  background-color: rgba(239, 217, 188, 0.25); }

/* ---------- detail panel ---------- */
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid var(--panel-border); padding-bottom: 10px; margin-bottom: 6px; }
.panel-head__well { font-size: 18px; font-weight: 700; color: var(--amber-orange);
  letter-spacing: 0.04em; margin-right: 10px; }
.panel-head__cond { font-size: 14px; color: var(--deep-brown); }
.panel-head__group { font-size: 11px; color: var(--burnt); }
.growth-graph { height: 340px; }

/* ---------- kpi tiles ---------- */
.kpi-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0; margin-top: 6px; border: 1px solid var(--panel-border); border-radius: 12px;
  overflow: hidden; background: rgba(255, 249, 241, 0.6); }
.kpi-tile { padding: 8px 6px; text-align: center; border-right: 1px solid var(--panel-border); }
.kpi-tile:last-child { border-right: none; }
.kpi-tile__label { display: block; font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--burnt); }
.kpi-tile__value { display: block; font-size: 15px; font-weight: 700; color: var(--deep-brown); }
.kpi-tile__unit { display: block; font-size: 9px; color: rgba(141, 64, 28, 0.6); }

/* ---------- conditions ---------- */
.conditions-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.conditions { display: flex; flex-direction: column; gap: 14px; }
.cond-group__title { font-size: 12px; font-weight: 600; color: var(--rust); margin-bottom: 6px; }
.cond-group__pills { display: flex; flex-wrap: wrap; gap: 7px; }
.cond-pill {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-family: inherit;
  background: rgba(255, 252, 246, 0.8); border: 1px solid var(--peach); color: var(--deep-brown);
  transition: all 0.12s ease;
}
.cond-pill:hover { background: var(--sand); transform: translateY(-1px); }
.cond-pill:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.cond-pill.is-active {
  background: linear-gradient(135deg, var(--amber-orange), var(--rust));
  color: #fff8ef; border-color: var(--rust);
}
.cond-pill__badge { font-size: 10px; opacity: 0.7; }

/* ---------- footer ---------- */
.footer { text-align: center; font-size: 12px; color: var(--burnt); padding: 6px 0 12px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar, .main { grid-column: 1; }
  .strain-list { flex-direction: row; flex-wrap: wrap; }
  .strain-card { width: auto; flex: 1 1 160px; }
  .main-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .kpi-strip { grid-template-columns: repeat(7, 86px); overflow-x: auto; }
  .header { flex-direction: column; align-items: flex-start; gap: 12px; }
}
