/* Docs page for web.ohidur.com (rendered by src/docs/page.ts). */

:root {
  --bg: #f3f7f5;
  --surface: #ffffff;
  --ink: #12261e;
  --muted: #4f6259;
  --line: #d3ddd8;
  --line-strong: #a7b9b0;
  --green: #006a4e;
  --green-ink: #00563f;
  --on-green: #ffffff;
  --wash: rgba(0, 106, 78, 0.055);
  --wash-strong: rgba(0, 106, 78, 0.1);
  --red: #d42a3c;
  --red-wash: rgba(212, 42, 60, 0.09);
  --code-bg: #0d2820;
  --code-ink: #d8e9e0;
  --code-muted: #8fb2a4;
  --code-button: #1c4537;
  --code-border: transparent;
  --j-key: #8fdcbc;
  --j-str: #f1d58f;
  --j-num: #ffa0aa;
  --j-lit: #b9c6ff;

  --font: 'Anek Bangla', 'Noto Sans Bengali', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* Fallback is per character: Anek Bangla after the generic family fills in Bengali glyphs that monospace fonts lack. */
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'Segoe UI Mono', Menlo, Consolas, monospace, 'Anek Bangla';
  --max: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
  --bleed: max(var(--gutter), calc((100% - var(--max)) / 2));
  --radius: 6px;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1511;
    --surface: #101d18;
    --ink: #e1ebe6;
    --muted: #9cb1a7;
    --line: #22352d;
    --line-strong: #3b544a;
    --green: #3fbf8c;
    --green-ink: #62d2a6;
    --on-green: #04150e;
    --wash: rgba(63, 191, 140, 0.06);
    --wash-strong: rgba(63, 191, 140, 0.13);
    --red: #ff6f7d;
    --red-wash: rgba(255, 111, 125, 0.12);
    --code-bg: #132820;
    --code-ink: #d3e4dc;
    --code-muted: #86a698;
    --code-button: #1d3a2f;
    --code-border: rgba(255, 255, 255, 0.07);
  }
}

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

[hidden] {
  display: none !important;
}

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--font);
  font-kerning: normal;
}

a {
  color: var(--green-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

code,
pre {
  font-family: var(--mono);
}

:not(pre) > code {
  font-size: 0.86em;
  padding: 0.08em 0.32em;
  border-radius: 4px;
  background: var(--wash-strong);
  overflow-wrap: anywhere;
}

p {
  margin: 0 0 1em;
}

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

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 10;
  padding: 8px 14px;
  background: var(--surface);
  border-radius: var(--radius);
}

.skip:focus {
  top: 12px;
}

/* ---- Top bar ------------------------------------------------------------------------------ */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 16px var(--bleed);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 650;
  font-stretch: 112%;
  text-decoration: none;
}

.logo {
  width: 28px;
  height: 28px;
  color: var(--green);
}

.logo-dot {
  fill: var(--red);
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  font-size: 15px;
}

.topbar nav a {
  color: var(--muted);
  text-decoration: none;
}

.topbar nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ---- Hero --------------------------------------------------------------------------------- */

.hero {
  padding: clamp(40px, 7vw, 88px) var(--bleed) clamp(32px, 4vw, 48px);
}

.hero h1 {
  margin: 0 0 20px;
  font-size: clamp(2.5rem, 8.5vw, 4.75rem);
  font-weight: 720;
  font-stretch: 125%;
  line-height: 0.98;
  letter-spacing: -0.025em;
}

.lead {
  max-width: 62ch;
  font-size: clamp(1.0625rem, 1.6vw, 1.1875rem);
  line-height: 1.55;
}

.base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 24px 0 0;
}

.base > span {
  color: var(--muted);
}

.base code {
  font-size: 15px;
}

.base .copy {
  position: static;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
  box-shadow: none;
}

.base .copy:hover {
  background: var(--wash-strong);
}

/* ---- Explorer: the administrative hierarchy as nested boundaries ------------------------- */

.explorer {
  padding: clamp(28px, 4vw, 44px) var(--bleed) clamp(32px, 5vw, 56px);
  background: var(--surface);
  border-block: 1px solid var(--line);
}

.explorer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 32px;
  margin-bottom: 28px;
}

.explorer-head h2 {
  margin: 0 0 6px;
  font-size: clamp(1.5rem, 3vw, 2.125rem);
  font-weight: 680;
  font-stretch: 116%;
  line-height: 1.1;
}

.explorer-head p {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
}

.lang {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}

.lang button {
  padding: 5px 14px 4px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: 500 15px/1.2 var(--font);
  cursor: pointer;
}

.lang button[aria-pressed='true'] {
  background: var(--green);
  color: var(--on-green);
}

.explorer-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
}

.frame {
  min-width: 0;
  margin: 0;
  padding: 10px 16px 18px;
  border: 2px solid var(--green);
  border-radius: 12px;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

/* Boundary styles follow map convention: the higher the level, the heavier the line. */
.frame-division {
  border-width: 3px;
}

.frame-district {
  margin-top: 18px;
  border-style: dashed;
  border-radius: 10px;
}

.frame-upazila {
  margin-top: 18px;
  border-style: dotted;
  border-radius: 8px;
}

.frame-union {
  margin-top: 18px;
  border-width: 1px;
  border-radius: 6px;
}

/* Washes stack, so each chosen level reads a shade deeper. */
.frame.has-value {
  background: var(--wash);
}

.frame:disabled {
  border-color: var(--line-strong);
}

.frame legend {
  padding: 0 6px;
  font-weight: 640;
  font-stretch: 110%;
}

.frame:disabled legend {
  color: var(--muted);
  font-weight: 500;
}

.count {
  color: var(--muted);
  font-weight: 400;
  font-stretch: 100%;
  font-variant-numeric: tabular-nums;
}

/* "You are here": the innermost chosen level. */
.frame.is-current > legend::after {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--red);
  vertical-align: 0.05em;
  animation: pin 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.5);
}

@keyframes pin {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

.frames select {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 40px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 6l4.5 4.5L12.5 6' fill='none' stroke='%23778b82' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 12px center / 16px;
  color: var(--ink);
  font: 400 16px/1.2 var(--font);
  appearance: none;
  cursor: pointer;
}

.frames select:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.address {
  display: block;
  min-height: 3.2em;
  margin-top: 18px;
  font-size: 1.0625rem;
  line-height: 1.5;
}

.address .place {
  display: block;
  font-weight: 600;
}

.address .site {
  font-size: 15px;
}

.console {
  min-width: 0;
  padding: 18px 20px 20px;
  border: 1px solid var(--code-border);
  border-radius: 14px;
  background: var(--code-bg);
  color: var(--code-ink);
}

.console-req {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font: 14px/1.4 var(--mono);
  overflow-wrap: anywhere;
}

.console-req a {
  color: var(--code-ink);
  text-decoration: none;
}

.console-req a:hover {
  text-decoration: underline;
}

.console .method-get {
  color: var(--j-key);
  background: rgba(143, 220, 188, 0.14);
}

.console-status,
.result-status {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  min-height: 1.6em;
  margin: 10px 0 12px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.console-status {
  color: var(--code-muted);
}

.console .code {
  max-height: min(460px, 60vh);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.console .status-ok {
  color: var(--j-key);
}

.console .status-error {
  color: var(--j-num);
}

/* ---- Reference layout --------------------------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  gap: 56px;
  padding: 0 var(--bleed);
}

.toc {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: 40px 4px 40px 0;
  font-size: 15px;
  line-height: 1.35;
}

.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc > ul > li + li {
  margin-top: 18px;
}

.toc > ul > li > a {
  color: var(--ink);
  font-weight: 620;
  font-stretch: 108%;
}

.toc ul ul {
  margin-top: 6px;
  border-left: 1px solid var(--line);
}

.toc ul ul a {
  display: block;
  margin-left: -1px;
  padding: 4px 0 4px 12px;
  border-left: 2px solid transparent;
  color: var(--muted);
}

.toc a {
  text-decoration: none;
}

.toc a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.toc ul ul a[aria-current] {
  border-left-color: var(--green);
  color: var(--green-ink);
}

.content {
  max-width: 800px;
  padding: 8px 0 96px;
}

.doc-section {
  padding-top: 48px;
  scroll-margin-top: 8px;
}

.doc-section > h2 {
  margin: 0 0 16px;
  font-size: clamp(1.75rem, 3.4vw, 2.25rem);
  font-weight: 700;
  font-stretch: 118%;
  line-height: 1.1;
}

.doc-section > h3 {
  margin: 36px 0 10px;
  font-size: 1.3125rem;
  font-weight: 640;
  font-stretch: 106%;
  scroll-margin-top: 16px;
}

/* ---- Operations --------------------------------------------------------------------------- */

.op {
  margin-top: 36px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 8px;
}

.op h3 {
  margin: 0 0 8px;
  font-size: 1.3125rem;
  font-weight: 640;
  font-stretch: 106%;
  line-height: 1.25;
}

.op h3 a {
  color: inherit;
  text-decoration: none;
}

.op h3 a:hover {
  text-decoration: underline;
}

.op h4 {
  margin: 26px 0 8px;
  font-size: 1rem;
  font-weight: 640;
  font-stretch: 104%;
}

.sig {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0 0 14px;
}

.sig .path {
  padding: 0;
  background: none;
  font-size: 15px;
}

code var {
  color: var(--green-ink);
  font-style: normal;
}

.method {
  display: inline-block;
  padding: 2px 7px 1px;
  border-radius: 4px;
  font: 700 12.5px/1.45 var(--mono);
  letter-spacing: 0.02em;
}

.method-get {
  color: var(--green-ink);
  background: var(--wash-strong);
}

.method-post,
.method-put,
.method-patch,
.method-delete {
  color: var(--red);
  background: var(--red-wash);
}

.tag-deprecated {
  padding: 1px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
}

.op-deprecated h3 {
  color: var(--muted);
}

.note {
  padding: 10px 14px;
  border-left: 3px solid var(--red);
  background: var(--red-wash);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 15px;
}

/* Field tables */

.fields {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.5;
}

.fields th,
.fields td {
  padding: 9px 14px 9px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.fields thead th {
  border-bottom-color: var(--line-strong);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.fields tbody th {
  font-weight: 400;
  white-space: nowrap;
}

.fields:not(.fields-2):not(.fields-3) th:nth-child(2) {
  width: 4.5rem;
}

.fields:not(.fields-2) th:first-child {
  width: 9rem;
}

.req {
  display: block;
  color: var(--red);
  font-size: 13px;
}

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

.migrate {
  margin: 8px 0 12px;
}

/* Responses */

.responses {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
}

.responses li {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.status {
  font-family: var(--mono);
  font-weight: 700;
}

.status-ok {
  color: var(--green-ink);
}

.status-redirect {
  color: var(--muted);
}

.status-error {
  color: var(--red);
}

.ctype {
  color: var(--muted);
  font: 13px/1.9 var(--mono);
  text-align: right;
}

/* Code */

.code-wrap {
  position: relative;
  margin: 12px 0;
}

.code {
  max-height: 420px;
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  border: 1px solid var(--code-border);
  border-radius: 10px;
  background: var(--code-bg);
  color: var(--code-ink);
  font-size: 14px;
  line-height: 1.6;
  tab-size: 2;
}

.code-wrap .code {
  padding-right: 72px;
}

.j-key {
  color: var(--j-key);
}

.j-str {
  color: var(--j-str);
}

.j-num {
  color: var(--j-num);
}

.j-lit {
  color: var(--j-lit);
}

.j-note {
  color: var(--code-muted);
  font-style: italic;
}

.copy {
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 3px 10px 2px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  /* Opaque, so code scrolled sideways doesn't show through. */
  background: var(--code-button);
  box-shadow: -10px 0 10px var(--code-bg);
  color: var(--code-ink);
  font: 500 13px/1.4 var(--font);
  cursor: pointer;
}

.copy:hover {
  border-color: rgba(255, 255, 255, 0.32);
}

/* Try it */

.try {
  margin-top: 22px;
  padding: 4px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.try h4 {
  margin: 12px 0 10px;
}

.try-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.field label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.field label span {
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font: 14px var(--mono);
}

.button {
  padding: 9px 18px 8px;
  border: 0;
  border-radius: var(--radius);
  background: var(--green);
  color: var(--on-green);
  font: 600 15px/1.3 var(--font);
  font-stretch: 105%;
  cursor: pointer;
}

.button:hover {
  background: var(--green-ink);
}

.button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.result {
  margin-top: 14px;
}

.result-url {
  margin: 0;
  font: 14px/1.4 var(--mono);
  overflow-wrap: anywhere;
}

.result-status {
  color: var(--muted);
}

.result img {
  display: block;
  max-width: 100%;
  max-height: 360px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

/* ---- Footer ------------------------------------------------------------------------------- */

.footer {
  padding: 28px var(--bleed) 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
}

.footer p {
  margin: 0;
}

/* ---- Narrow screens ----------------------------------------------------------------------- */

@media (max-width: 960px) {
  .explorer-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .toc {
    position: static;
    max-height: none;
    padding: 28px 0 24px;
    border-bottom: 1px solid var(--line);
  }

  .toc > ul {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
  }

  .toc > ul > li + li {
    margin-top: 0;
  }

  .toc ul ul {
    display: none;
  }
}

@media (max-width: 640px) {
  .hero h1 {
    font-stretch: 108%;
  }

  .fields:not(.fields-2) thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .fields:not(.fields-2) tr {
    display: block;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }

  .fields:not(.fields-2) th,
  .fields:not(.fields-2) td {
    display: inline;
    padding: 0 10px 0 0;
    border: 0;
  }

  .fields:not(.fields-2) td:last-child {
    display: block;
    padding-top: 4px;
  }

  .fields:not(.fields-2) .req {
    display: inline;
    margin-left: 6px;
  }

  .responses li {
    grid-template-columns: 3.4rem minmax(0, 1fr);
  }

  .ctype {
    grid-column: 2;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
