/* Wildlife of India — public site
   Palette: lichen ground, forest ink, peacock teal, turmeric focus.
   Type: Martel (display, Devanagari + Latin), Mukta (text). Both from Indian foundries. */

:root {
  --ground: #EEF1E7;
  --paper: #FFFFFF;
  --ink: #17261D;
  --moss: #4A6352;
  --line: #CBD5C3;
  --peacock: #0B6A74;
  --peacock-deep: #07535B;
  --turmeric: #E0A526;

  --f-display: "Martel", "Noto Serif Devanagari", Georgia, serif;
  --f-text: "Mukta", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", sans-serif;

  --wrap: 72rem;
  --radius: 4px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-text);
  font-size: 1.0625rem;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--peacock); text-underline-offset: 0.18em; }
a:hover { color: var(--peacock-deep); }
:focus-visible { outline: 3px solid var(--turmeric); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 800; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 700; }
p { margin: 0 0 1em; }
.muted { color: var(--moss); }
.visually-hidden, .hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }
.wrap.narrow { max-width: 44rem; }

.skip-link { position: absolute; left: -999px; top: 0.5rem; background: var(--paper); padding: 0.5rem 1rem; z-index: 10; }
.skip-link:focus { left: 0.5rem; }

/* Header */
.site-header { background: var(--ink); color: var(--ground); }
.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 4rem; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 0.6rem; color: inherit; text-decoration: none; }
.brand-mark { font-family: var(--f-display); font-weight: 800; font-size: 1.6rem; color: var(--turmeric); line-height: 1; }
.brand-name { font-family: var(--f-display); font-weight: 700; font-size: 1.05rem; }
.site-nav { display: flex; gap: 1.25rem; margin-left: auto; }
.site-nav a { color: var(--ground); text-decoration: none; padding: 0.25rem 0; border-bottom: 2px solid transparent; }
.site-nav a:hover { border-bottom-color: var(--line); color: var(--paper); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--turmeric); }
.nav-toggle { display: none; margin-left: auto; background: none; color: var(--ground); border: 1px solid var(--moss); border-radius: var(--radius); padding: 0.3rem 0.8rem; font: inherit; }

/* Hero: the Devanagari word is the page's one loud element */
.hero { padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(2rem, 5vw, 3.5rem); border-bottom: 1px solid var(--line); }
.hero-hindi {
  font-family: var(--f-display); font-weight: 800; color: var(--peacock);
  font-size: clamp(4.5rem, 17vw, 11.5rem); line-height: 1.2; margin: 0 0 0.15em;
}
.hero-title { font-size: clamp(1.9rem, 4vw, 2.75rem); margin: 0.4rem 0 0.4rem; }
.hero-lead { font-size: 1.2rem; max-width: 36rem; color: var(--moss); }
.hero-count { color: var(--moss); font-size: 0.95rem; margin-top: 1rem; }

.search { display: flex; max-width: 34rem; margin-top: 1.5rem; }
.search input {
  flex: 1; min-width: 0; font: inherit; padding: 0.75rem 1rem;
  border: 2px solid var(--ink); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); background: var(--paper);
}
.search button, .filters button, .form button {
  font: inherit; font-weight: 700; background: var(--ink); color: var(--paper);
  border: 2px solid var(--ink); padding: 0.7rem 1.25rem; cursor: pointer;
}
.search button { border-radius: 0 var(--radius) var(--radius) 0; }
.search button:hover, .filters button:hover, .form button:hover { background: var(--peacock-deep); border-color: var(--peacock-deep); }

/* Sections */
.section { padding: clamp(2rem, 5vw, 3.5rem) 0; }
.section--tight { padding-top: 1.5rem; }
.section-title { margin-bottom: 1.25rem; }
.page-head { padding: 2.5rem 0 1rem; }
.page-hindi { font-family: var(--f-display); font-weight: 800; color: var(--peacock); font-size: clamp(2.5rem, 8vw, 4.5rem); line-height: 1; margin: 0; }
.lead { font-size: 1.15rem; color: var(--moss); max-width: 40rem; }

/* Specimen tags */
.tag-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr)); }
.tag { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tag-link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.tag-link:hover .tag-name { text-decoration: underline; text-decoration-thickness: 2px; }
.tag-photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.tag-body { padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.tag-name { margin: 0; font-size: 1.1rem; }
.sci { font-style: italic; color: var(--moss); margin: 0; font-size: 0.95rem; }
.tag .status { margin-top: auto; align-self: flex-start; }

/* Plates: Hindi name as artwork when no photo exists */
.plate {
  aspect-ratio: 4 / 3; display: flex; align-items: flex-end; padding: 0.9rem 1rem;
  color: rgba(255, 255, 255, 0.94); overflow: hidden;
}
.plate-word { font-family: var(--f-display); font-weight: 800; font-size: clamp(2.2rem, 4.2vw, 3rem); line-height: 1.05; word-break: break-word; }
.plate--large { aspect-ratio: 5 / 4; padding: 1.5rem; }
.plate--large .plate-word { font-size: clamp(3.5rem, 9vw, 6.5rem); }
.plate--mammals { background: #7A4E2D; }
.plate--birds { background: #0B6A74; }
.plate--reptiles { background: #56652A; }
.plate--amphibians { background: #2F7D5B; }
.plate--aquatic-life { background: #1F4E79; }
.plate--insects { background: #A86B12; }
.plate--other-invertebrates { background: #6B3F5E; }

/* IUCN status chips — official Red List colours */
.status { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.85rem; line-height: 1.2; color: var(--ink); }
.status-code { display: inline-block; min-width: 2.1rem; text-align: center; font-weight: 700; padding: 0.15rem 0.35rem; border-radius: 3px; border: 1px solid transparent; }
.status--cr .status-code { background: #D81E05; color: #fff; }
.status--en .status-code { background: #FC7F3F; color: #1a1a1a; }
.status--vu .status-code { background: #F9E814; color: #1a1a1a; }
.status--nt .status-code { background: #CCE226; color: #1a1a1a; }
.status--lc .status-code { background: #60C659; color: #1a1a1a; }
.status--dd .status-code { background: #D1D1C6; color: #1a1a1a; }
.status--ne .status-code { background: #fff; border-color: #9aa393; color: #1a1a1a; }

.status-legend { margin: 1.5rem 0 0; display: grid; gap: 0.75rem; }
.status-legend div { display: grid; grid-template-columns: 13rem 1fr; gap: 1rem; align-items: baseline; }
.status-legend dd { margin: 0; color: var(--moss); }

/* Browse by group */
.section--groups { background: var(--paper); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.group-list { list-style: none; margin: 0; padding: 0; }
.group-row { border-top: 1px solid var(--line); }
.group-row:last-child { border-bottom: 1px solid var(--line); }
.group-row a { display: grid; grid-template-columns: 13rem 1fr; gap: 1.5rem; padding: 1.25rem 0.25rem; color: inherit; text-decoration: none; }
.group-row a:hover { background: var(--ground); }
.group-hindi { font-family: var(--f-display); font-weight: 800; font-size: 2rem; line-height: 1.1; color: var(--moss); }
.group-row a:hover .group-hindi { color: var(--peacock); }
.group-main { display: flex; flex-direction: column; gap: 0.2rem; }
.group-name { font-family: var(--f-display); font-weight: 700; font-size: 1.25rem; }
.group-count { font-family: var(--f-text); font-weight: 500; font-size: 0.9rem; color: var(--moss); margin-left: 0.35rem; }
.group-desc { max-width: 42rem; }
.group-examples { color: var(--moss); font-size: 0.95rem; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: flex-end; padding: 1rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.filters label { display: flex; flex-direction: column; font-size: 0.9rem; font-weight: 500; gap: 0.25rem; }
.filters input, .filters select { font: inherit; padding: 0.5rem 0.6rem; border: 1px solid #9aa393; border-radius: var(--radius); background: var(--paper); min-width: 12rem; }
.filters button { border-radius: var(--radius); padding: 0.5rem 1.1rem; }
.result-count { margin: 1.25rem 0 1rem; color: var(--moss); }
.empty { padding: 2rem; background: var(--paper); border: 1px dashed var(--line); border-radius: var(--radius); }
.pager { display: flex; gap: 1.25rem; justify-content: center; align-items: center; margin-top: 2rem; }

/* Creature page */
.creature { padding: 2rem 0 1rem; }
.creature-top { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 2.5rem; align-items: end; }
.creature-visual img { width: 100%; border-radius: var(--radius); }
.creature-visual figcaption { font-size: 0.85rem; color: var(--moss); margin-top: 0.4rem; }
.creature-visual .plate { border-radius: var(--radius); }
.crumb { margin-bottom: 0.25rem; }
.names { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; align-items: baseline; margin-bottom: 0.75rem; }
.names .hindi { font-family: var(--f-display); font-weight: 700; font-size: 1.5rem; }
.creature-head .status { margin-bottom: 1rem; }
.creature-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 2.5rem; margin-top: 2.5rem; }
.prose { max-width: 40rem; font-size: 1.1rem; }
.prose h2 { margin-top: 1.5em; font-size: 1.3rem; }
.fact { margin-top: 1.75rem; padding: 1.1rem 1.25rem; background: var(--paper); border-left: 4px solid var(--turmeric); }
.fact h2 { font-size: 1.05rem; margin: 0 0 0.3rem; }
.fact p { margin: 0; }
.facts { margin: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem 1.25rem; align-self: start; }
.facts div { padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.facts div:last-child { border-bottom: 0; }
.facts dt { font-weight: 700; font-size: 0.9rem; color: var(--moss); }
.facts dd { margin: 0.15rem 0 0; }
.tag-grid--four { grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }

/* Forms & notices */
.form { display: grid; gap: 1rem; }
.form label { display: grid; gap: 0.3rem; font-weight: 500; }
.form input, .form textarea { font: inherit; padding: 0.65rem 0.75rem; border: 1px solid #9aa393; border-radius: var(--radius); background: var(--paper); }
.form button { justify-self: start; border-radius: var(--radius); }
.notice { padding: 0.9rem 1.1rem; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line); margin-bottom: 1rem; }
.notice--ok { border-color: #60C659; background: #F0FAEE; }
.notice--error { border-color: #D81E05; background: #FDF0EE; }

/* Footer */
.site-footer { background: var(--ink); color: var(--ground); padding: 2.5rem 0; margin-top: 2rem; }
.site-footer a { color: var(--turmeric); }
.site-footer .muted { color: #9fb2a5; }
.footer-hindi { font-family: var(--f-display); font-weight: 800; font-size: 1.75rem; color: var(--turmeric); margin-bottom: 0.5rem; }

/* Small screens */
@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; width: 100%; flex-direction: column; gap: 0; padding-bottom: 0.75rem; }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 0.6rem 0; border-bottom: 1px solid #2c3d32; }
  .group-row a, .status-legend div { grid-template-columns: 1fr; gap: 0.35rem; }
  .creature-top, .creature-body { grid-template-columns: 1fr; gap: 1.5rem; }
  .filters input, .filters select { min-width: 0; width: 100%; }
  .filters label { flex: 1 1 100%; }
  .tag-grid, .tag-grid--four { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .plate { padding: 0.6rem 0.7rem; }
  .plate-word { font-size: 1.55rem; }
  .tag-body { padding: 0.65rem 0.7rem 0.75rem; }
  .tag-name { font-size: 1rem; }
  .sci, .status { font-size: 0.8rem; }
  .status { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
