/* DBIM v3.0 implementation layer for the SDMA Meghalaya static website. */
:root {
  --dbim-key: #0F5757;
  --dbim-shade-2: #2D8686;
  --dbim-shade-3: #75BDBD;
  --dbim-shade-4: #A6D9D9;
  --dbim-shade-5: #D9F2F2;
  --dbim-linen: #EBEAEA;
  --dbim-white: #FFFFFF;
  --dbim-text: #150202;
  --dbim-black: #000000;
  --dbim-gov-blue: #1D0A69;
  --dbim-success: #198754;
  --dbim-warning: #FFC107;
  --dbim-error: #DC3545;
  --dbim-info: #0D6EFD;
  --dbim-grey-1: #C6C6C6;
  --dbim-grey-2: #8E8E8E;
  --dbim-grey-3: #606060;
  --dbim-focus: #0F5757;

  /* Map the original site theme tokens to the selected DBIM Green group. */
  --bg: var(--dbim-white);
  --surface: var(--dbim-white);
  --ink: var(--dbim-text);
  --muted: var(--dbim-grey-3);
  --line: var(--dbim-grey-1);
  --brand: var(--dbim-key);
  --brand-d: var(--dbim-key);
  --brand-l: var(--dbim-shade-5);
  --on-brand: var(--dbim-white);
  --on-brand-muted: var(--dbim-white);
  --accent: var(--dbim-warning);
  --link: var(--dbim-info);
  --link-hover: var(--dbim-key);
  --focus: var(--dbim-focus);
  --chip: var(--dbim-linen);
  --font: "Noto Sans", sans-serif;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  color: var(--dbim-text);
  font-family: "Noto Sans", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

h1,
body .hero h1,
body .pagehead h1,
body .layout > main > h1 {
  font-size: 36px;
  line-height: 1.25;
}

h2,
body .prose h2,
body .card h2,
body .section-title,
body .site-footer h2 {
  font-size: 24px;
  line-height: 1.3;
}

h3,
body .prose h3 {
  font-size: 20px;
  line-height: 1.35;
}

h4 {
  font-size: 16px;
  line-height: 1.4;
}

p,
li,
td,
th {
  line-height: 1.5;
}

small,
.small,
.doc-meta,
.file,
.count,
.site-footer .legal {
  font-size: 12px;
}

:focus-visible {
  outline: 3px solid var(--dbim-focus) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 2px var(--dbim-white);
}

img {
  max-width: 100%;
  height: auto;
}

button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

button:not(:disabled),
[role="button"],
a {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

a {
  color: var(--dbim-info);
}

a:hover {
  color: var(--dbim-key);
}

.hero {
  background: linear-gradient(135deg, var(--dbim-key), var(--dbim-shade-2));
}

.site-footer {
  background: var(--dbim-key) !important;
  color: var(--dbim-white);
}

.site-footer a,
.site-footer a:visited {
  color: var(--dbim-white);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.site-footer a:hover {
  color: var(--dbim-white);
  text-decoration-thickness: 2px;
}

.primary a:focus-visible,
.nav-toggle:focus-visible {
  outline-color: var(--dbim-focus) !important;
}

table th,
table thead td {
  text-align: center;
}

table.data th,
table.data thead td {
  text-align: center;
}

table td {
  text-align: left;
}

table td:is([data-type="number"], .number) {
  text-align: right;
}

.btn,
.cookie-actions button {
  min-height: 44px;
  padding: 0.65rem 1rem;
}

.cookie-consent {
  position: fixed;
  z-index: 10000;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  max-width: 72rem;
  margin: auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem 1.25rem;
  border: 2px solid var(--dbim-key);
  border-radius: 0.35rem;
  background: var(--dbim-white);
  color: var(--dbim-text);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.cookie-consent[hidden] {
  display: none !important;
}

.cookie-consent h2 {
  margin: 0 0 0.3rem;
  color: var(--dbim-key);
  font-size: 20px;
}

.cookie-consent p {
  margin: 0;
}

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.cookie-actions button {
  border: 2px solid var(--dbim-key);
  border-radius: 0.25rem;
  font: inherit;
  font-weight: 600;
}

.cookie-accept {
  background: var(--dbim-key);
  color: var(--dbim-white);
}

.cookie-reject,
.cookie-customize {
  background: var(--dbim-white);
  color: var(--dbim-key);
}

.cookie-options {
  grid-column: 1 / -1;
  padding-top: 0.75rem;
  border-top: 1px solid var(--dbim-grey-1);
}

.cookie-options label {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin: 0.5rem 0;
}

.cookie-options input {
  min-width: 1rem;
  min-height: 1rem;
  margin-top: 0.35rem;
}

.cookie-settings-link {
  display: inline-block;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.cookie-settings-link:hover {
  color: var(--dbim-white);
}

.persona-strip {
  padding: 1.5rem 0;
  border-block: 1px solid var(--dbim-shade-4);
  background: var(--dbim-shade-5);
}

.persona-strip h2 {
  margin-top: 0;
  margin-bottom: 0.85rem;
  color: var(--dbim-key);
}

.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
}

/* DBIM icon scale: use the prescribed 24px and 32px functional sizes. */
.search svg,
.quick svg,
.nav-toggle svg,
.a11y-head-ico svg,
.a11y-close svg {
  width: 24px;
  height: 24px;
}

.tool-btn svg,
.tile-ico svg {
  width: 32px;
  height: 32px;
}

.persona-card {
  display: block;
  height: 100%;
  padding: 1rem;
  border: 1px solid var(--dbim-grey-1);
  border-radius: 0.35rem;
  background: var(--dbim-white);
  color: var(--dbim-key);
  font-weight: 600;
  text-decoration: none;
}

.persona-card span {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.4;
}

.persona-card:hover,
.persona-card:focus-visible {
  background: var(--dbim-key);
  color: var(--dbim-white);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.hero .btn.hero-secondary {
  border-color: var(--dbim-white);
  background: transparent;
  color: var(--dbim-white) !important;
}

.hero .btn.hero-secondary:hover {
  background: var(--dbim-white);
  color: var(--dbim-key) !important;
}

.search-filters {
  display: grid;
  grid-template-columns: minmax(14rem, 2fr) repeat(3, minmax(10rem, 1fr));
  gap: 0.85rem;
  align-items: end;
  margin: 1.25rem 0;
  padding: 1rem;
  border: 1px solid var(--dbim-grey-1);
  border-radius: 0.5rem;
  background: var(--dbim-linen);
}

.search-filters label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
}

.search-filters input,
.search-filters select {
  min-width: 0;
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--dbim-grey-3);
  border-radius: 0.25rem;
  background: var(--dbim-white);
  color: var(--dbim-text);
  font: inherit;
}

.search-filters button {
  grid-column: 1 / -1;
  justify-self: start;
  min-height: 44px;
  padding: 0.6rem 1rem;
  border: 2px solid var(--dbim-key);
  border-radius: 0.25rem;
  background: var(--dbim-key);
  color: var(--dbim-white);
  font: inherit;
  font-weight: 600;
}

.search-summary {
  min-height: 1.5em;
  margin: 1rem 0;
  font-weight: 600;
}

.search-results {
  display: grid;
  gap: 0.75rem;
}

.search-result {
  padding: 1rem;
  border: 1px solid var(--dbim-grey-1);
  border-radius: 0.35rem;
  background: var(--dbim-white);
}

.search-result h2 {
  margin: 0;
  font-size: 20px;
}

.search-result h2 a {
  color: var(--dbim-key);
}

.search-result-meta {
  margin: 0.35rem 0;
  color: var(--dbim-grey-3);
  font-size: 12px;
}

.search-result > p:last-child {
  margin-bottom: 0;
}

.search-empty {
  margin: 1rem 0;
  padding: 1rem;
  border-left: 4px solid var(--dbim-key);
  background: var(--dbim-shade-5);
}

@media (max-width: 760px) {
  body {
    font-size: 14px;
  }

  h1,
  body .hero h1,
  body .pagehead h1,
  body .layout > main > h1 {
    font-size: 24px;
  }

  h2,
  body .prose h2,
  body .card h2,
  body .section-title,
  body .site-footer h2 {
    font-size: 20px;
  }

  h3,
  body .prose h3 {
    font-size: 16px;
  }

  h4 {
    font-size: 14px;
  }

  small,
  .small,
  .doc-meta,
  .file,
  .count,
  .site-footer .legal {
    font-size: 10px;
  }

  .cookie-consent {
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
    max-height: 80vh;
    padding: 0.85rem;
    overflow: auto;
    grid-template-columns: 1fr;
  }

  .cookie-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .cookie-actions button {
    width: 100%;
  }

  .persona-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .partner {
    display: block;
    flex: 0 0 auto;
  }

  .partner img {
    display: block;
    width: auto;
    height: 4.5rem;
  }

  .search-filters {
    grid-template-columns: 1fr;
  }

  .search-filters button {
    justify-self: stretch;
  }
}

@media (max-width: 960px) {
  .hero img {
    display: block;
    order: -1;
  }
}

@media (max-width: 420px) {
  .persona-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
