/* SDME portal: mobile-first app-style UI. Tokens first, then base, layout, components. */
:root {
  --forest: #12392F;
  --forest-2: #1B4F40;
  --saffron: #E9A23B;
  --maroon: #7B2432;
  --ink: #15201B;
  --muted: #5A6A62;
  --surface: #F3F6F2;
  --card: #FFFFFF;
  --line: #DCE3DB;
  --open: #17794F;
  --closed: #8A5A1F;
  --c: var(--forest);
  --bar-h: 60px;
  --bottom-h: 64px;
  --r-card: 20px;
  --r-tile: 14px;
  --font-body: "Mukta", "Noto Sans Kannada", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Newsreader", "Noto Serif Kannada", Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #0D1713; --card: #14211B; --ink: #E7EEE9; --muted: #9DB0A5; --line: #25362D;
    --open: #4CC38A; --closed: #E0B36A;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 12px); }
body {
  margin: 0; background: var(--surface); color: var(--ink);
  font: 400 1.0625rem/1.55 var(--font-body);
  padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px));
}
:lang(kn) body, html[lang="kn"] body { line-height: 1.7; }
img, svg { max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: -0.005em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--saffron); color: #1b1b1b; padding: 10px 14px; border-radius: 10px; z-index: 100; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* App bar */
.appbar { position: sticky; top: 0; z-index: 50; background: var(--forest); color: #fff; padding-top: env(safe-area-inset-top, 0px); transition: box-shadow .2s; }
.appbar.is-scrolled { box-shadow: 0 2px 14px rgba(0,0,0,.25); }
.appbar__row { height: var(--bar-h); max-width: 1120px; margin-inline: auto; padding-inline: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand__mark { display: grid; flex: none; }
.brand__text { display: grid; line-height: 1.15; min-width: 0; }
.brand__text strong { font: 600 1.05rem var(--font-head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand__text small { font-size: .78rem; opacity: .8; }
.appbar__tools { display: flex; align-items: center; gap: 8px; }
.lang { display: inline-flex; background: rgba(255,255,255,.12); border-radius: 999px; padding: 3px; }
.lang a { text-decoration: none; font-size: .86rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; min-height: 32px; display: grid; place-items: center; }
.lang a[aria-current="true"] { background: var(--saffron); color: #1b1b1b; }
.util { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.12); text-decoration: none; }

/* Desktop top nav (hidden on phones) */
.topnav { display: none; background: var(--card); border-bottom: 1px solid var(--line); }
.topnav ul { max-width: 1120px; margin-inline: auto; padding-inline: 14px; display: flex; gap: 4px; }
.topnav a { display: inline-flex; align-items: center; gap: 8px; padding: 12px 14px; text-decoration: none; font-weight: 500; color: var(--muted); border-bottom: 3px solid transparent; }
.topnav a:hover { color: var(--ink); }
.topnav a[aria-current="page"] { color: var(--forest); border-color: var(--saffron); }
@media (prefers-color-scheme: dark) { .topnav a[aria-current="page"] { color: var(--saffron); } }

/* Bottom nav (phones) */
.bottomnav { position: fixed; inset: auto 0 0 0; z-index: 60; height: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); display: grid; grid-template-columns: repeat(5, 1fr); background: var(--card); border-top: 1px solid var(--line); }
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 500; min-width: 0; padding: 6px 2px; }
.bottomnav a span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bottomnav a[aria-current="page"] { color: var(--forest); font-weight: 600; }
.bottomnav a[aria-current="page"] .ic { background: var(--saffron); color: #1b1b1b; border-radius: 999px; padding: 4px 14px; box-sizing: content-box; width: 22px; }
@media (prefers-color-scheme: dark) { .bottomnav a[aria-current="page"] { color: var(--saffron); } }

/* Hero: the one memorable element is the layered ridge line */
.hero { position: relative; background: var(--forest); color: #fff; overflow: hidden; padding: 28px 0 96px; }
.hero__ridge { position: absolute; inset: auto 0 0 0; width: 100%; height: 110px; }
.hero__body { position: relative; }
.hero h1 { font-size: clamp(1.8rem, 6.5vw, 3rem); max-width: 18ch; }
.hero p { margin-top: 10px; max-width: 46ch; opacity: .9; }
.hero__search { margin-top: 20px; display: flex; align-items: center; gap: 10px; background: #fff; color: #1b1b1b; border-radius: 999px; padding: 0 18px; min-height: 52px; max-width: 560px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.hero__search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: inherit; min-height: 48px; outline: none; }
.hero__search:focus-within { outline: 3px solid var(--saffron); outline-offset: 2px; }

/* Sections */
.block { padding-block: 22px 6px; }
.block__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.block__head h2 { font-size: 1.35rem; }
.more { display: inline-flex; align-items: center; gap: 4px; color: var(--forest); font-weight: 600; text-decoration: none; font-size: .95rem; }
@media (prefers-color-scheme: dark) { .more { color: var(--saffron); } }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: -48px; position: relative; }
.quick__item { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; text-decoration: none; font-weight: 600; min-height: 64px; box-shadow: 0 6px 18px rgba(18,57,47,.12); }
.quick__item .ic { color: var(--maroon); flex: none; }
@media (prefers-color-scheme: dark) { .quick__item .ic { color: var(--saffron); } }
.pagehead { background: var(--forest); color: #fff; padding: 22px 0 26px; border-radius: 0 0 28px 28px; }
.pagehead h1 { font-size: clamp(1.6rem, 5.5vw, 2.4rem); }
.pagehead p { margin-top: 6px; opacity: .88; max-width: 60ch; }
.mission { background: var(--maroon); color: #fff; margin-top: 28px; padding: 30px 0; }
.mission__text { font: 500 clamp(1.25rem, 4.2vw, 1.9rem)/1.35 var(--font-head); max-width: 34ch; }
.mission__src { margin-top: 10px; font-size: .9rem; opacity: .8; }

/* Filter bar */
.filterbar { padding-top: 16px; display: grid; gap: 12px; position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top, 0px)); z-index: 40; background: var(--surface); padding-bottom: 10px; }
.search { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; min-height: 48px; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--ink); min-height: 44px; outline: none; }
.search:focus-within { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(233,162,59,.55); }
.pills { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; scroll-snap-type: x proximity; margin-inline: -16px; padding-inline: 16px; }
.pills::-webkit-scrollbar { display: none; }
.pill { flex: none; scroll-snap-align: start; font: 500 .95rem var(--font-body); color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; min-height: 44px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.pill__n { font-size: .8rem; color: var(--muted); }
.pill[aria-pressed="true"] { background: var(--forest); color: #fff; border-color: var(--forest); }
.pill[aria-pressed="true"] .pill__n { color: #fff; opacity: .8; }
.results { color: var(--muted); font-size: .9rem; margin: 6px 0 10px; }
.group { margin-bottom: 22px; }
.group__title { font-size: 1.3rem; margin: 10px 0 12px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--r-card); }

/* Cards */
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: min(84%, 340px); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: -16px; padding: 2px 16px 10px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail .card { scroll-snap-align: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px; display: flex; flex-direction: column; gap: 10px; border-top: 4px solid var(--c); }
.card__top { display: flex; gap: 12px; align-items: flex-start; }
.tile { flex: none; width: 48px; height: 48px; border-radius: var(--r-tile); background: color-mix(in srgb, var(--c) 14%, var(--card)); color: var(--c); display: grid; place-items: center; }
@media (prefers-color-scheme: dark) { .tile { color: color-mix(in srgb, var(--c) 55%, #fff); } }
.card__head { min-width: 0; }
.card__cat { font-size: .82rem; color: var(--muted); }
.card__title { font-size: 1.15rem; margin-top: 1px; }
.card__desc { color: var(--ink); opacity: .86; font-size: 1rem; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 8%, var(--card)); color: var(--ink); }
.badge--open { background: color-mix(in srgb, var(--open) 16%, var(--card)); color: var(--open); }
.badge--open::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--open); margin-right: 6px; vertical-align: 1px; }
.badge--closed { background: color-mix(in srgb, var(--closed) 16%, var(--card)); color: var(--closed); }
.badge--accent { background: var(--saffron); color: #231a05; }
.meta { display: grid; gap: 4px; color: var(--muted); font-size: .92rem; }
.meta li { display: flex; gap: 8px; align-items: flex-start; }
.meta .ic { flex: none; margin-top: 4px; }
.card__actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--forest); color: #fff; text-decoration: none; font-weight: 600; font-size: .95rem; }
.btn--ghost { background: transparent; color: var(--forest); border: 1px solid var(--forest); }
@media (prefers-color-scheme: dark) { .btn { background: var(--saffron); color: #1b1b1b; } .btn--ghost { background: transparent; color: var(--saffron); border-color: var(--saffron); } }
.tips { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--saffron); border-radius: var(--r-card); padding: 18px; }
.tips h2 { font-size: 1.2rem; margin-bottom: 8px; }
.tips li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.tips li:last-child { border: 0; }
.tips__note { margin-top: 10px; color: var(--muted); font-size: .9rem; }

/* Footer */
.footer { margin-top: 36px; background: var(--forest); color: #E6EFEA; padding: 28px 0 18px; }
.footer__grid { display: grid; gap: 22px; }
.footer__name { font: 600 1.1rem var(--font-head); color: #fff; }
.footer__muted { opacity: .8; margin-top: 4px; font-size: .95rem; max-width: 40ch; }
.footer__links { display: grid; gap: 2px; }
.footer__links a { display: inline-block; padding: 6px 0; text-decoration: none; }
.footer__links a:hover { text-decoration: underline; }
.footer__copy { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.18); font-size: .85rem; opacity: .75; }

/* Tablet and up */
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .quick { grid-template-columns: repeat(4, 1fr); }
  .rail { grid-auto-columns: 340px; }
}
@media (min-width: 900px) {
  :root { --bottom-h: 0px; }
  body { padding-bottom: 0; }
  .bottomnav { display: none; }
  .topnav { display: block; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .rail { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(4, 1fr); overflow: visible; margin-inline: 0; padding-inline: 0; }
  .footer__grid { grid-template-columns: 2fr 1fr 1fr; }
  .filterbar { grid-template-columns: minmax(240px, 340px) 1fr; align-items: center; top: calc(var(--bar-h) + 49px); }
  .pills { margin-inline: 0; padding-inline: 0; flex-wrap: wrap; }
  .hero { padding-block: 56px 120px; }
  .hero__ridge { height: 150px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .appbar, .topnav, .bottomnav, .filterbar { display: none; } body { padding: 0; } }
