/* ---------- Design tokens ---------- */
:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --text: #17211d;
  --text-muted: #55625c;
  --border: #d9e2de;
  --brand: #0b7a5a;
  --brand-strong: #075c43;
  --brand-soft: #e1f2ec;
  --on-brand: #ffffff;
  --ok: #157347;
  --ok-soft: #dcf3e6;
  --bad: #b42318;
  --bad-soft: #fde7e4;
  --warn-soft: #fff4d6;
  --warn-border: #f0c95b;
  --whatsapp: #1e8e4e;
  --on-ok: #ffffff;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 14px rgb(0 0 0 / 5%);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1513;
    --surface: #18201d;
    --surface-2: #202a26;
    --text: #e8efec;
    --text-muted: #a2b1aa;
    --border: #2e3a35;
    --brand: #3fbf8f;
    --brand-strong: #6fd6ac;
    --brand-soft: #173a2e;
    --on-brand: #06231a;
    --ok: #5fd08f;
    --ok-soft: #173a27;
    --bad: #ff8a7a;
    --bad-soft: #3d1d1a;
    --warn-soft: #352c12;
    --warn-border: #8a6d1c;
    --whatsapp: #3cc174;
    --on-ok: #06231a;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1513;
  --surface: #18201d;
  --surface-2: #202a26;
  --text: #e8efec;
  --text-muted: #a2b1aa;
  --border: #2e3a35;
  --brand: #3fbf8f;
  --brand-strong: #6fd6ac;
  --brand-soft: #173a2e;
  --on-brand: #06231a;
  --ok: #5fd08f;
  --ok-soft: #173a27;
  --bad: #ff8a7a;
  --bad-soft: #3d1d1a;
  --warn-soft: #352c12;
  --warn-border: #8a6d1c;
  --whatsapp: #3cc174;
  --on-ok: #06231a;
  --shadow: none;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.5em;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.3rem;
}

h3 {
  font-size: 1.1rem;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--brand-strong);
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.container {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

.muted {
  color: var(--text-muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Header and navigation ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  flex: 1;
  min-width: 0;
}

.brand span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--brand);
  color: var(--on-brand);
  display: grid;
  place-items: center;
}

.lang-btn {
  flex: none;
  border: 1.5px solid var(--brand);
  background: transparent;
  color: var(--brand-strong);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

.nav {
  display: flex;
  gap: 4px;
  border-top: 1px solid var(--border);
}

.nav a {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 3px solid transparent;
}

.nav a[aria-current="page"] {
  color: var(--brand-strong);
  border-bottom-color: var(--brand);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 10px 18px;
  border-radius: 12px;
  border: none;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  cursor: pointer;
}

.btn svg {
  width: 22px;
  height: 22px;
  flex: none;
}

.btn-primary {
  background: var(--brand);
  color: var(--on-brand);
}

.btn-whatsapp {
  background: var(--whatsapp);
  color: var(--on-ok);
}

.btn-outline {
  background: var(--surface);
  color: var(--brand-strong);
  border: 1.5px solid var(--border);
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ---------- Sections and cards ---------- */
main {
  padding: 20px 0 32px;
}

section {
  margin-bottom: 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.hero-photo {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.hero-body {
  padding: 18px;
}

.hero .tagline {
  color: var(--text-muted);
}

.status {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 16px;
  background: var(--bad-soft);
  color: var(--bad);
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.status.is-open {
  background: var(--ok-soft);
  color: var(--ok);
}

.status.is-unknown {
  background: var(--surface-2);
  color: var(--text);
}

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.notice svg {
  width: 24px;
  height: 24px;
  flex: none;
  margin-top: 2px;
}

.notice p {
  margin: 0;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
}

.link-card .icon {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  display: grid;
  place-items: center;
}

.link-card .icon svg {
  width: 26px;
  height: 26px;
}

.link-card .arrow {
  margin-left: auto;
  color: var(--brand);
  font-size: 1.5rem;
}

.services {
  display: grid;
  gap: 12px;
}

@media (min-width: 640px) {
  .services {
    grid-template-columns: repeat(3, 1fr);
  }
}

.service .icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}

.service .icon svg {
  width: 24px;
  height: 24px;
}

.service p {
  margin: 0;
  color: var(--text-muted);
}

.facts {
  margin: 0;
  display: grid;
  gap: 10px;
}

.facts div {
  display: grid;
  gap: 2px;
}

.facts dt {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.facts dd {
  margin: 0;
  font-weight: 600;
}

/* ---------- Medicines page ---------- */
.search {
  position: sticky;
  top: calc(var(--header-h, 105px) + env(safe-area-inset-top, 0px));
  z-index: 5;
  background: var(--bg);
  padding: 8px 0 10px;
}

.search input {
  width: 100%;
  min-height: 52px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  padding: 10px 14px 10px 44px;
  font-size: 1.05rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2355625c' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  background-size: 22px;
}

.search input:focus {
  border-color: var(--brand);
  outline: none;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 2px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 14px;
  min-height: 40px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
}

.chip[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

.list-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 6px 0 10px;
}

.med-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.med {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.med:first-child {
  border-top: none;
}

.med-info {
  flex: 1;
  min-width: 0;
}

.med-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.med-group {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.badge {
  flex: none;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.ask-link {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  color: var(--whatsapp);
  border: 1.5px solid var(--border);
}

.ask-link svg {
  width: 22px;
  height: 22px;
}

.empty {
  text-align: center;
  padding: 22px 16px;
}

.empty .btn {
  margin-top: 4px;
}

/* ---------- Contact page ---------- */
.contact-list {
  display: grid;
  gap: 12px;
}

.hours {
  width: 100%;
  border-collapse: collapse;
}

.hours td {
  padding: 9px 4px;
  border-top: 1px solid var(--border);
}

.hours tr:first-child td {
  border-top: none;
}

.hours td:last-child {
  text-align: right;
}

.hours tr.today td {
  font-weight: 700;
  color: var(--brand-strong);
}

.emergency {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.emergency a {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.emergency strong {
  display: block;
  font-size: 1.3rem;
  color: var(--bad);
}

.emergency .wide {
  grid-column: 1 / -1;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0 28px;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.site-footer p {
  margin: 0 0 6px;
}

.site-footer .rx {
  font-weight: 600;
  color: var(--text);
}

.site-footer a {
  color: var(--text-muted);
}
