/* Discoveries — styles.css
   Tokens from ../_shared/theme.css are inherited.
   This file defines layout, card variants, badges, controls.
*/

:root {
  --bg-main:        #11130E;
  --bg-card:        #1A1C15;
  --bg-card-hover:  #22251D;
  --accentMain:     #379392;
  --accentGold:     #D8B67F;
  --textWhite:      rgba(255,255,255,0.90);
  --textMuted:      rgba(255,255,255,0.55);
  --borderDim:      rgba(255,255,255,0.08);
  --borderHighlight:#379392;

  /* Hero block height — hero card + side cards share this */
  --hero-height: 420px;
}

/* Match Media/Discoveries layout primitives exactly */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }

body {
  background-color: var(--bg-main);
  color: var(--textWhite);
}

/* ── Construction banner ──────────────────────────────────────────────────── */
@keyframes pulse-border {
  0%, 100% { border-color: rgba(55,147,146,0.6); }
  50%      { border-color: rgba(55,147,146,0.1); }
}
.construction-banner { animation: pulse-border 2s infinite; }

/* ── Shared utilities ─────────────────────────────────────────────────────── */
.container-max { max-width: 1200px; margin-left: auto; margin-right: auto; }
.accent-bar    { width: 40px; height: 4px; background: var(--accentMain); margin-bottom: 8px; }

.sr-only {
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

/* ── Nav (CANONICAL) ─────────────────────────────────────────────────────── */
.navlink {
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--textMuted);
  transition: color 140ms ease;
  text-decoration: none;
}
.navlink:hover    { color: var(--textWhite); }
.navlink--active  { color: var(--textWhite); }

/* ──────────────────────────────────────────────────────────────────────────
   Controls (CANONICAL)
   Row 1: Search (left) + Sort (right)
   Row 2: Filters span combined width and wrap within it
   Sort height matches search height
   ────────────────────────────────────────────────────────────────────────── */
.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 14px;
  row-gap: 12px;
  align-items: start;

  border: 1px solid var(--borderDim);
  background: var(--bg-card);
  border-radius: 12px;
  padding: 14px;
}

/* Search sits in col 1, row 1 */
.controls__left {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;

  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Sort sits in col 2, row 1 */
.controls__right {
  grid-column: 2;
  grid-row: 1;

  display: flex;
  align-items: stretch;
  gap: 10px;
}

/* Inputs / selects (unified typography + sizing) */
.control-input,
.control-select {
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--bg-main);
  color: var(--textWhite);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  transition: all 140ms ease;

  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* Search takes full width of left column */
.control-input { width: 100%; }
.control-input::placeholder {
  color: var(--textMuted);
  text-transform: none;
  letter-spacing: 0.02em;
  font-family: "Montserrat", sans-serif;
  font-size: 13px;
}

/* Focus behavior */
.control-input:focus,
.control-select:focus {
  border-color: var(--accentMain);
  background-color: var(--bg-card-hover);
  box-shadow: 0 0 15px rgba(55,147,146,0.15);
}

/* Sort: same height as search bar */
.control-select {
  min-width: 220px;
  width: 220px;

  height: 44px;
  padding: 0 14px;
  line-height: 44px;

  white-space: nowrap;
}

/* Filters span BOTH columns (combined width), row 2 */
.chip-row {
  grid-column: 1 / -1;
  grid-row: 2;

  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 100%;
}

/* Chips (CANONICAL) */
.chip {
  border: 1px solid var(--borderDim);
  background: var(--bg-main);
  color: var(--textMuted);
  border-radius: 8px;
  padding: 9px 12px;
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 140ms ease;
  white-space: nowrap;
}
.chip:hover { color: var(--textWhite); border-color: rgba(255,255,255,0.25); }
.chip--active,
.chip[aria-selected="true"] {
  background: rgba(55,147,146,0.12);
  border-color: var(--accentMain);
  color: var(--textWhite);
}

/* ── Meta row (CANONICAL) ─────────────────────────────────────────────────── */
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.meta-row__left, .meta-row__right { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.meta-text {
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--textMuted);
}

/* Mobile: stack sort under search, filters under that */
@media (max-width: 720px) {
  .controls { grid-template-columns: 1fr; }
  .controls__right {
    grid-column: 1;
    grid-row: 2;
    justify-content: flex-end;
  }
  .chip-row {
    grid-column: 1;
    grid-row: 3;
  }
  .control-select { width: 100%; min-width: 0; }
}

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 4px;
  border: 1px solid var(--borderDim);
  white-space: nowrap;
  flex-shrink: 0;
}
.badge--sm { font-size: 9px; padding: 3px 7px; letter-spacing: 0.12em; }

.badge--new-taxon    { background: rgba(55,147,146,0.10);  border-color: rgba(55,147,146,0.45);  color: #80CBC4; }
.badge--new-specimen { background: rgba(93,156,89,0.10);   border-color: rgba(93,156,89,0.45);   color: #A5D6A7; }
.badge--trackway     { background: rgba(216,182,127,0.10); border-color: rgba(216,182,127,0.45); color: #FFE0B2; }
.badge--egg-nest     { background: rgba(230,126,34,0.10);  border-color: rgba(230,126,34,0.45);  color: #FFCC80; }
.badge--range        { background: rgba(52,152,219,0.10);  border-color: rgba(52,152,219,0.45);  color: #90CAF9; }
.badge--reexam       { background: rgba(156,39,176,0.10);  border-color: rgba(156,39,176,0.45);  color: #CE93D8; }
.badge--unclassified { background: rgba(255,255,255,0.03); border-color: var(--borderDim);       color: var(--textMuted); }

.badge--recency        { }
.badge--recency-new    { background: rgba(55,147,146,0.15); border-color: var(--accentMain);           color: var(--accentMain); }
.badge--recency-recent { background: rgba(216,182,127,0.12); border-color: rgba(216,182,127,0.5);      color: var(--accentGold); }

/* ── Shared card elements ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--borderDim);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
  display: flex;
  flex-direction: column;
}
.card:hover {
  border-color: var(--accentMain);
  background: var(--bg-card-hover);
  box-shadow: 0 6px 24px rgba(0,0,0,0.28);
}

/* Top accent bar (hero + grid cards) */
.card__accent-bar {
  height: 4px;
  width: 100%;
  flex-shrink: 0;
}
.card__accent-bar--thin { height: 3px; }

/* Left strip (side cards) */
.card__side-strip {
  width: 5px;
  flex-shrink: 0;
  align-self: stretch;
}

/* Meta row inside cards */
.card__meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

/* Links row */
.card__links {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 10px;
}
.card__links--hero { margin-top: 24px; }

/* ── Typography shared ────────────────────────────────────────────────────── */
.date {
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accentMain);
}
.date--sm { font-size: 10px; }

.source-label {
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--textMuted);
  opacity: 0.65;
}

.link {
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accentMain);
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 120ms ease;
}
.link:hover { opacity: 0.75; }
.link--muted { color: var(--textMuted); }
.link--muted:hover { color: var(--textWhite); opacity: 1; }
.link--side {
  font-size: 10px;
  letter-spacing: 0.10em;
  margin-top: auto;
}


/* ══════════════════════════════════════════════════════════════════════════
   HERO BLOCK — top 4 items: 1 large hero (2/3) + 3 stacked side cards (1/3)
   ══════════════════════════════════════════════════════════════════════════ */

#hero-block { margin-bottom: 24px; }

/* Full-width single-item fallback — no longer used but kept for safety */
.hero-block__single { width: 100%; }
.hero-block__single .card--hero { height: auto; min-height: var(--hero-height); }

/* Two-column layout — always used */
.hero-block__layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  height: var(--hero-height);
}

.hero-block__main { height: 100%; }

.hero-block__side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
}

/* "No more results" placeholder in side panel when < 2 items */
.hero-block__no-more {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--borderDim);
  border-radius: 10px;
  opacity: 0.5;
}

/* Collapse to stacked on mobile */
@media (max-width: 767px) {
  .hero-block__layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .hero-block__side { height: auto; }
  :root { --hero-height: auto; }
}


/* ── Hero card ────────────────────────────────────────────────────────────── */
.card--hero {
  height: 100%;
  flex-direction: column;
}

.card__body--hero {
  display: flex;
  flex-direction: column;
  padding: 24px 28px 24px;
  flex: 1;
  overflow: hidden;
}

.title--hero {
  font-family: "Montserrat", sans-serif;
  font-weight: 900;
  font-size: clamp(18px, 2.2vw, 26px);
  line-height: 1.2;
  color: var(--textWhite);
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  /* Allow 2 lines max then clip — keeps layout locked */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.desc--hero {
  font-size: 14px;
  line-height: 1.65;
  color: var(--textMuted);
  margin: 0;
  flex: 1;
  /* Clip overflow so card doesn't expand */
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* ── Side cards ───────────────────────────────────────────────────────────── */
.card--side {
  flex: 1;               /* Each side card shares the side column height equally */
  flex-direction: row;   /* strip left, body right */
  min-height: 0;         /* Allow shrinking inside flex */
  overflow: hidden;
}

.card__body--side {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.title--side {
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.25;
  color: var(--textWhite);
  margin: 0 0 6px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* ══════════════════════════════════════════════════════════════════════════
   4-COL GRID — items 5+ below the hero block
   ══════════════════════════════════════════════════════════════════════════ */

#feed-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) { #feed-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { #feed-grid { grid-template-columns: 1fr; } }

/* ── Grid card ────────────────────────────────────────────────────────────── */
.card--grid {
  flex-direction: column;
}

.card__body--grid {
  display: flex;
  flex-direction: column;
  padding: 14px 16px 14px;
  flex: 1;
}

.title--grid {
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.25;
  color: var(--textWhite);
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.desc--grid {
  font-size: 12px;
  line-height: 1.55;
  color: var(--textMuted);
  margin: 0 0 10px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Load More ────────────────────────────────────────────────────────────── */
.load-more {
  border: 1px solid var(--borderDim);
  background: var(--bg-card);
  color: var(--textWhite);
  border-radius: 8px;
  padding: 11px 24px;
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}
.load-more:hover:not(:disabled) {
  border-color: var(--accentMain);
  background: var(--bg-card-hover);
}
.load-more:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}
/* -------------------------------------------------------------------------
   Detail page wrapper — replaces misused .controls class
   ---------------------------------------------------------------------- */
.detail-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--borderDim);
  border-radius: 12px;
  padding: 40px;
}

@media (max-width: 720px) {
  .detail-card {
    padding: 24px 16px;
  }
}
