/* =========================================================
   Sindhi Connect — Design System ("Midnight & Gold")
   Colors come from the logo: ink black, amber gold, topi red.
   ========================================================= */
:root {
  /* Color */
  --ink: #0e1016;          /* dark surfaces, primary text */
  --ink-2: #171a22;        /* raised dark surface */
  --ink-line: #2a2e3a;     /* borders on dark */
  --gold: #e9a825;         /* the one accent */
  --gold-hover: #f4bb45;
  --gold-text: #8a5d00;    /* gold for text on light bg (AA) */
  --red: #a61e2a;          /* small accents only */
  --paper: #faf8f4;        /* light section bg */
  --white: #ffffff;
  --text: #16181d;
  --muted: #565b66;        /* secondary text on light (AA) */
  --muted-dark: #a9adb8;   /* secondary text on dark (AA) */
  --line: #e7e2d8;

  /* Type */
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-sindhi: "Noto Naskh Arabic", serif;
  --fs-sm: .875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.25rem;
  --fs-xl: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  --fs-hero: clamp(2.25rem, 1.4rem + 3.4vw, 3.75rem);

  /* Space (4px scale) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  /* Shape */
  --r-sm: 8px;
  --r-md: 12px;
  --max: 1160px;
  --header-h: 76px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 {
  margin: 0;
  line-height: 1.15;
  font-weight: 600;
}
h1, h2 { font-family: var(--font-display); letter-spacing: -.01em; }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); line-height: 1.3; }
p { margin: 0; }

a { color: inherit; }

[lang="sd"] { font-family: var(--font-sindhi); }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--s-5);
}

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

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: 200;
  padding: var(--s-2) var(--s-4);
  background: var(--gold);
  color: var(--ink);
  font-weight: 600;
  border-radius: var(--r-sm);
  text-decoration: none;
}
.skip-link:focus { top: var(--s-3); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 var(--s-5);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font: 600 var(--fs-base)/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--gold); color: var(--ink); }
.btn-primary:hover { background: var(--gold-hover); }
.btn-secondary { background: var(--ink); color: var(--white); }
.btn-secondary:hover { background: #2a2e3a; }
.btn-ghost { border-color: rgba(255, 255, 255, .35); color: var(--white); }
.btn-ghost:hover { border-color: var(--white); background: rgba(255, 255, 255, .06); }
.btn-sm { min-height: 40px; padding: 0 var(--s-4); font-size: var(--fs-sm); }
.btn-block { width: 100%; }

.text-link {
  font-weight: 600;
  color: var(--gold-text);
  text-decoration: none;
}
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 1. Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--ink);
  border-bottom: 1px solid var(--ink-line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}
.logo { display: flex; border-radius: var(--r-sm); }
/* Crop the square logo's black padding down to the artwork */
.logo-img { width: 132px; height: 74px; object-fit: cover; mix-blend-mode: lighten; }

/* Navigation (desktop). The mobile panel is under "Tablet & mobile navigation". */
.nav-list {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-list > li { position: relative; display: flex; align-items: center; }
.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--s-3);
  color: var(--muted-dark);
  font-size: .95rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color .15s;
}
.nav-link:hover { color: var(--white); }
.nav-link[aria-current="page"] { color: var(--white); box-shadow: inset 0 -2px 0 var(--gold); }
.footer-links a[aria-current="page"] { color: var(--white); }

/* Dropdown arrow button */
.submenu-toggle {
  display: grid;
  place-items: center;
  width: 24px;
  height: 44px;
  margin-left: calc(var(--s-2) * -1);
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted-dark);
  cursor: pointer;
  transition: color .15s;
}
.submenu-toggle:hover { color: var(--white); }
.submenu-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .2s;
}
.has-menu.is-open .submenu-toggle svg { transform: rotate(180deg); }

/* Dropdown panel */
.submenu {
  position: absolute;
  top: calc(100% + 14px);
  left: calc(var(--s-3) * -1);
  z-index: 10;
  min-width: 280px;
  margin: 0;
  padding: var(--s-2);
  list-style: none;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: 0 18px 44px rgba(14, 16, 22, .2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  /* a short delay before hiding gives the pointer time to reach the panel */
  transition: opacity .18s, transform .18s, visibility 0s .25s;
}
/* invisible bridge across the gap, so moving the mouse down doesn't close the menu */
.submenu::before { content: ""; position: absolute; left: 0; right: 0; top: -16px; height: 16px; }
.has-menu.is-open > .submenu {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .18s, transform .18s;
}
@media (hover: hover) and (min-width: 1025px) {
  .has-menu:hover > .submenu { opacity: 1; visibility: visible; transform: none; transition: opacity .18s, transform .18s; }
  .has-menu:hover .submenu-toggle svg { transform: rotate(180deg); }
}
.submenu a {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: .9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color .15s;
}
.submenu a:hover,
.submenu a[aria-current="page"] { background: var(--paper); }
.submenu a:focus-visible { outline-offset: -2px; background: var(--paper); }
.submenu-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: #fdf6e6;
}
.submenu-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--gold-text);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Pages (app.js shows one at a time) */
main [data-page][hidden] { display: none; }
main [data-page]:focus { outline: none; }
.page-enter { animation: page-enter .35s ease both; }
@keyframes page-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* CSS-only mobile menu toggle */
.nav-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; }
.nav-toggle-label { display: none; }

/* ---------- 2. Hero ---------- */
.hero {
  background:
    radial-gradient(ellipse 60% 70% at 85% 30%, rgba(233, 168, 37, .12), transparent 70%),
    var(--ink);
  color: var(--white);
  padding: var(--s-8) 0;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  align-items: center;
  gap: var(--s-7);
}
.hero-tagline {
  margin-bottom: var(--s-4);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gold);
}
.hero h1 { font-size: clamp(2.125rem, 1.4rem + 2.4vw, 3.25rem); max-width: 18ch; }
.hero-sub {
  margin-top: var(--s-5);
  font-size: var(--fs-md);
  color: var(--muted-dark);
  max-width: 52ch;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-6);
}
/* Sindhi line (also used at the top of the calculator page's hero) */
.hero-script {
  margin-bottom: var(--s-4);
  font-size: 1.375rem;
  color: var(--gold);
  text-align: left;
}
/* on the home hero it sits under the buttons, as a signature line */
.hero .hero-script {
  margin: var(--s-6) 0 0;
  padding-top: var(--s-4);
  border-top: 1px solid var(--ink-line);
  font-size: 1.25rem;
}
/* The original banner, uncropped */
.hero-photo { position: relative; margin: 0 var(--s-4) var(--s-4) 0; }
.hero-photo::before {
  content: "";
  position: absolute;
  inset: var(--s-4) calc(var(--s-4) * -1) calc(var(--s-4) * -1) var(--s-4);
  border: 1px solid rgba(233, 168, 37, .45);
  border-radius: 20px;
}
.hero-photo img {
  position: relative;
  width: 100%;
  height: auto;
  border-radius: 16px;
  border: 1px solid var(--ink-line);
  box-shadow: 0 24px 56px rgba(0, 0, 0, .5);
}
.js-reveal .hero-text,
.js-reveal .hero-photo { animation: page-enter .6s ease both; }
.js-reveal .hero-photo { animation-delay: .1s; }

/* Home: "What you'll find" cards */
.explore-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
  margin: 0;
  padding: 0;
  list-style: none;
}
.explore-card {
  display: flex;
  flex-direction: column;
  padding: var(--s-5);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: box-shadow .15s, transform .15s;
}
.explore-card:hover { box-shadow: 0 12px 32px rgba(14, 16, 22, .08); transform: translateY(-2px); }
.explore-card .feature-icon { margin-bottom: var(--s-4); }
.explore-card h3 { font-size: var(--fs-md); }
.explore-card > p { margin-top: var(--s-2); font-size: .9375rem; color: var(--muted); }
.explore-points {
  display: grid;
  gap: var(--s-2);
  margin: var(--s-4) 0 var(--s-5);
  padding: var(--s-4) 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
  font-size: var(--fs-sm);
  color: var(--text);
}
.explore-points li { position: relative; padding-left: var(--s-4); }
.explore-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .6em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}
.explore-card .text-link { margin-top: auto; }

/* Section heading with a link on the right */
.section-head-split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-3) var(--s-5);
  max-width: none;
}

/* Home: closing call to action */
.cta-band { padding: var(--s-8) 0; background: var(--ink); color: var(--white); }
.cta-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-5); }
.cta-band h2 { font-size: var(--fs-xl); }
.cta-band p { margin-top: var(--s-2); color: var(--muted-dark); }
.cta-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); }

/* Links to the Education Fund Calculator (education-calculator.html) */
.explore-tool {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: calc(var(--s-2) * -1) 0 var(--s-4);
  padding: var(--s-2) var(--s-3);
  border: 1px solid #ecd9ad;
  border-radius: var(--r-sm);
  background: #fdf6e6;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  transition: border-color .15s;
}
.explore-tool:hover { border-color: var(--gold-text); }
.explore-tool svg,
.tool-banner svg {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--gold-text);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tool-banner {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  margin: 0 0 var(--s-8);
  padding: var(--s-5) var(--s-6);
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--white);
  text-decoration: none;
  transition: transform .15s, box-shadow .15s;
}
.tool-banner:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(14, 16, 22, .2); }
.tool-banner .feature-icon { background: var(--ink-2); border-color: var(--ink-line); }
.tool-banner .feature-icon svg { width: 24px; height: 24px; stroke: var(--gold); }
.tool-banner-text { display: grid; gap: 2px; flex: 1; }
.tool-banner-label { font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.tool-banner-title { font: 600 1.25rem/1.3 var(--font-display); }
.tool-banner-desc { font-size: var(--fs-sm); color: var(--muted-dark); }
.tool-banner-cta { flex: none; font-weight: 600; color: var(--gold); }

/* ---------- Sections ---------- */
.section { padding: var(--s-9) 0; }
.section-paper { background: var(--paper); border-block: 1px solid var(--line); }
.section-head { max-width: 640px; margin-bottom: var(--s-7); }
.eyebrow {
  margin-bottom: var(--s-3);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold-text);
}
.lead { margin-top: var(--s-4); font-size: var(--fs-md); color: var(--muted); }

/* ---------- 3. About ---------- */
.about {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: var(--s-8);
  align-items: start;
}
.features { display: grid; gap: var(--s-6); margin: 0; padding: 0; list-style: none; }
.feature { display: flex; gap: var(--s-4); }
.feature-icon {
  flex: none;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--paper);
  border: 1px solid var(--line);
}
.feature-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--red);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.feature h3 { margin-bottom: var(--s-1); }
.feature p { color: var(--muted); }

/* ---------- Founder ---------- */
.founder { background: var(--ink); color: var(--white); }
.founder-inner {
  display: grid;
  grid-template-columns: 5fr 6fr;
  gap: var(--s-8);
  align-items: center;
}
.founder-photo {
  position: relative;
  margin: 0 var(--s-4) var(--s-4) 0;
}
/* thin gold frame, offset behind the portrait */
.founder-photo::before {
  content: "";
  position: absolute;
  inset: var(--s-4) calc(var(--s-4) * -1) calc(var(--s-4) * -1) var(--s-4);
  border: 1px solid rgba(233, 168, 37, .45);
  border-radius: 20px;
}
/* The photo is a wide banner; show the portrait side of it, uncropped in height */
.founder-photo img {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  object-position: left center;
  border-radius: 20px;
  border: 1px solid var(--ink-line);
  box-shadow: 0 24px 56px rgba(0, 0, 0, .45);
}
.founder .eyebrow { color: var(--gold); }
.founder-id {
  margin-top: var(--s-6);
  padding-left: var(--s-4);
  border-left: 2px solid var(--gold);
}
.founder-name { font: 600 1.5rem/1.2 var(--font-display); }
.founder-role { margin-top: var(--s-1); font-size: var(--fs-sm); font-weight: 500; color: var(--gold); }
.founder-bio {
  display: grid;
  gap: var(--s-4);
  margin-top: var(--s-5);
  max-width: 56ch;
  font-size: var(--fs-md);
  color: var(--muted-dark);
}
.founder-motto {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-style: italic;
  color: var(--white);
}
.founder-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-5);
  margin: var(--s-7) 0 0;
  padding: var(--s-6) 0 0;
  border-top: 1px solid var(--ink-line);
  list-style: none;
}
.founder-features .feature-icon { background: var(--ink-2); border-color: var(--ink-line); margin-bottom: var(--s-3); }
.founder-features .feature-icon svg { stroke: var(--gold); }
.founder-features h3 { font-size: var(--fs-base); }
.founder-features p { margin-top: var(--s-1); font-size: var(--fs-sm); color: var(--muted-dark); }

/* Fade-up on scroll; only active once app.js has added .js-reveal */
.js-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .6s ease, transform .6s ease;
}
.js-reveal [data-reveal].is-visible { opacity: 1; transform: none; }
.js-reveal .founder-text[data-reveal] { transition-delay: .12s; }

@media (max-width: 1024px) {
  .founder-inner { grid-template-columns: 2fr 3fr; gap: var(--s-6); align-items: start; }
  /* features become rows: icon left, text right */
  .founder-features { grid-template-columns: 1fr; gap: var(--s-4); margin-top: var(--s-6); padding-top: var(--s-5); }
  .founder-features li { display: grid; grid-template-columns: 48px 1fr; column-gap: var(--s-4); }
  .founder-features .feature-icon { grid-row: span 2; margin-bottom: 0; }
}
@media (max-width: 760px) {
  .founder-inner { grid-template-columns: 1fr; gap: var(--s-7); }
  .founder-photo { width: min(100% - var(--s-4), 440px); }
}

/* ---------- 4. Knowledge Hub ---------- */
:root {
  /* ajrak-inspired lattice: gold diamonds with a centre dot */
  --kh-motif: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28'%3E%3Cpath d='M14 3l11 11-11 11L3 14z' fill='none' stroke='%23e9a825' stroke-opacity='.28'/%3E%3Ccircle cx='14' cy='14' r='2' fill='%23e9a825' fill-opacity='.4'/%3E%3C/svg%3E");
}
.kh-head { max-width: 760px; }
.kh-script { margin-bottom: var(--s-3); font-size: var(--fs-lg); color: var(--gold-text); text-align: left; }
.kh-pillars {
  margin-top: var(--s-5);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text);
}
.kh-pillars span { margin: 0 var(--s-2); color: var(--gold); }

/* Category cards */
.kh-cats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4);
  margin: 0;
  padding: 0;
  list-style: none;
}
.kh-cat {
  display: grid;
  grid-template-columns: 48px 1fr;
  column-gap: var(--s-4);
  align-content: start;
  width: 100%;
  height: 100%;
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--white);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.kh-cat:hover { border-color: #d8cfbd; box-shadow: 0 8px 24px rgba(14, 16, 22, .08); transform: translateY(-2px); }
.kh-cat[aria-pressed="true"] { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.kh-cat:focus-visible { border-radius: var(--r-md); }
.kh-cat .feature-icon { grid-row: span 3; }
.kh-cat-name { font-weight: 600; font-size: var(--fs-md); line-height: 1.3; }
.kh-cat-desc { margin-top: var(--s-1); font-size: var(--fs-sm); color: var(--muted); }
.kh-cat-count { margin-top: var(--s-3); font-size: var(--fs-sm); font-weight: 600; color: var(--gold-text); }

/* Library: heading, search, sort, filters */
.kh-library { margin-top: var(--s-8); }
.kh-library-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
  margin-bottom: var(--s-5);
}
.kh-library-head h3 { font-family: var(--font-display); font-size: 1.75rem; }
.kh-count { font-size: var(--fs-sm); color: var(--muted); }
.kh-toolbar { display: grid; grid-template-columns: 1fr auto; gap: var(--s-3); }
.kh-search { position: relative; }
.kh-search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.9;
  stroke-linecap: round;
  pointer-events: none;
}
.kh-search input,
.kh-sort select {
  min-height: 48px;
  border: 1px solid #cfc8bb;
  border-radius: var(--r-sm);
  background: var(--white);
  color: var(--text);
  font: inherit;
  font-size: 1rem; /* 16px stops iOS zooming in on focus */
  transition: border-color .15s;
}
.kh-search input { width: 100%; padding: 0 var(--s-4) 0 44px; }
.kh-search input::placeholder { color: var(--muted); }
.kh-sort { display: flex; align-items: center; gap: var(--s-3); font-size: var(--fs-sm); font-weight: 600; }
.kh-sort select { padding: 0 var(--s-4); cursor: pointer; }
.kh-search input:hover,
.kh-sort select:hover { border-color: #a39b8c; }
.kh-search input:focus-visible,
.kh-sort select:focus-visible { border-color: var(--ink); outline-offset: 1px; }

.kh-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-4) 0 var(--s-6); }
.kh-chip {
  flex: none;
  min-height: 40px;
  padding: 0 var(--s-4);
  border: 1px solid #d8cfbd;
  border-radius: 999px;
  background: var(--white);
  color: var(--text);
  font: 500 var(--fs-sm)/1 var(--font-body);
  cursor: pointer;
  transition: border-color .15s, background-color .15s, color .15s;
}
.kh-chip:hover { border-color: var(--gold-text); background: #fdf6e6; }
.kh-chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--white); }
.kh-chip:focus-visible { border-radius: 999px; }

/* Resource cards */
.kh-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-5);
  margin: 0;
  padding: 0;
  list-style: none;
}
.kh-grid[hidden] { display: none; }
.kh-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--white);
  transition: box-shadow .15s, transform .15s;
}
.kh-card:hover { box-shadow: 0 12px 32px rgba(14, 16, 22, .1); transform: translateY(-2px); }

/* Designed cover, used when a resource has no thumbnail (or it fails to load) */
.kh-cover {
  --tone: var(--ink);
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 30%, rgba(0, 0, 0, .35) 100%),
    var(--kh-motif) center / 28px,
    var(--tone);
}
.kh-cover[data-cat="business"] { --tone: #1f2b4f; }      /* indigo */
.kh-cover[data-cat="history"] { --tone: #6b1522; }       /* ajrak crimson */
.kh-cover[data-cat="personalities"] { --tone: var(--ink-2); }
.kh-cover[data-cat="literature"] { --tone: #4f1d18; }       /* madder */
.kh-cover[data-cat="finance"] { --tone: #16392f; }       /* deep green */
.kh-cover[data-cat="development"] { --tone: #232f47; }   /* slate */
/* thin gold frame, like a book cover */
.kh-cover::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(233, 168, 37, .4);
  border-radius: 6px;
}
.kh-emblem {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid rgba(233, 168, 37, .6);
  border-radius: 50%;
  background: var(--tone);
}
.kh-emblem svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.kh-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.kh-featured {
  position: absolute;
  top: var(--s-4);
  left: var(--s-4);
  padding: 2px var(--s-2);
  border-radius: 4px;
  background: var(--gold);
  color: var(--ink);
  font-size: .75rem;
  font-weight: 600;
}

.kh-card-body { display: flex; flex-direction: column; flex: 1; padding: var(--s-5); }
.kh-card-cat {
  margin-bottom: var(--s-2);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold-text);
}
.kh-card-title { margin: 0; font: 600 var(--fs-md)/1.35 var(--font-body); }
.kh-card-desc { margin-top: var(--s-2); font-size: .9375rem; color: var(--muted); }
.kh-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
  margin-top: var(--s-4);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.kh-type {
  padding: 2px var(--s-2);
  border-radius: 4px;
  background: #f6e7c4;
  color: var(--ink);
  font-size: .75rem;
  font-weight: 600;
}
.kh-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: auto; padding-top: var(--s-5); }
.kh-btn-outline { border-color: #cfc8bb; color: var(--text); }
.kh-btn-outline:hover { border-color: var(--ink); }

/* Empty state */
.kh-empty {
  display: grid;
  justify-items: center;
  gap: var(--s-3);
  padding: var(--s-8) var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--white);
  text-align: center;
}
.kh-empty[hidden] { display: none; }
.kh-empty .kh-emblem { --tone: var(--ink); margin-bottom: var(--s-2); background: var(--kh-motif) center / 28px, var(--ink); }
.kh-empty h4 { margin: 0; font: 600 var(--fs-lg)/1.3 var(--font-display); }
.kh-empty p { max-width: 44ch; color: var(--muted); }
.kh-empty .btn { margin-top: var(--s-2); }
.kh-noscript { color: var(--muted); }

/* ---------- About: intro, mission & vision, discover ---------- */
.about-text { margin-top: var(--s-4); color: var(--muted); }
.about-why { margin-bottom: var(--s-5); font-family: var(--font-display); font-size: 1.5rem; }
.mv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); }
.mv-card {
  padding: var(--s-6);
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: var(--r-md);
}
.mv-card .feature-icon { margin-bottom: var(--s-4); }
.mv-card h3 { font-family: var(--font-display); font-size: 1.5rem; }
.mv-card p { margin-top: var(--s-3); font-size: var(--fs-md); color: var(--muted); }
.discover-title { margin: var(--s-8) 0 var(--s-5); font-family: var(--font-display); font-size: 1.5rem; }
.discover-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.discover-grid li {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-weight: 500;
}
.discover-grid .feature-icon { width: 40px; height: 40px; }
.discover-grid .feature-icon svg { width: 20px; height: 20px; }

/* ---------- Knowledge Hub extras ---------- */
.kh-spotlight { margin-bottom: var(--s-8); }
.kh-spotlight[hidden] { display: none; }
.kh-subtitle { margin-bottom: var(--s-4); font-family: var(--font-display); font-size: 1.5rem; }
/* Large horizontal card for the featured resource */
.kh-card-wide { display: grid; grid-template-columns: 1fr 1.2fr; }
.kh-card-wide .kh-cover { aspect-ratio: auto; min-height: 280px; }
.kh-card-wide .kh-card-body { padding: var(--s-6); justify-content: center; }
.kh-card-wide .kh-card-title { font-family: var(--font-display); font-size: 1.75rem; }
.kh-card-wide .kh-card-desc { font-size: var(--fs-md); }
.kh-card-wide .kh-actions { margin-top: 0; }

/* ---------- Resources page ---------- */
.res-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4);
  margin: 0 0 var(--s-8);
  padding: 0;
  list-style: none;
}
.res-tile {
  display: grid;
  gap: var(--s-1);
  height: 100%;
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  color: inherit;
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.res-tile:hover { border-color: #d8cfbd; box-shadow: 0 8px 24px rgba(14, 16, 22, .08); transform: translateY(-2px); }
.res-tile .feature-icon { margin-bottom: var(--s-3); background: var(--white); }
.res-tile-name { font-weight: 600; font-size: var(--fs-md); }
.res-tile-count { font-size: var(--fs-sm); font-weight: 600; color: var(--gold-text); }
.res-block + .res-block { margin-top: var(--s-8); padding-top: var(--s-8); border-top: 1px solid var(--line); }
.res-block > h3 { font-family: var(--font-display); font-size: 1.5rem; }
.res-block-sub { margin: var(--s-1) 0 var(--s-5); color: var(--muted); }
.res-block .kh-empty { padding: var(--s-7) var(--s-5); background: var(--paper); }

/* ---------- Videos & Podcasts page ---------- */
.videos-latest { margin-bottom: var(--s-8); }
.videos-latest[hidden] { display: none; }
.series-grid .kh-featured { background: var(--white); }
.notify {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-top: var(--s-7);
  padding: var(--s-5) var(--s-6);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-weight: 500;
}

/* ---------- 7. Forms ---------- */
.forms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-5);
}
.panel {
  padding: var(--s-6);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.panel-sub { margin-top: var(--s-2); color: var(--muted); }
.form { display: grid; gap: var(--s-4); margin-top: var(--s-5); }
.field { display: grid; gap: var(--s-2); }
.field label { font-size: var(--fs-sm); font-weight: 600; }
.req { color: var(--red); }
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: var(--s-3) var(--s-4);
  font: inherit;
  color: var(--text);
  background: var(--white);
  border: 1px solid #cfc8bb;
  border-radius: var(--r-sm);
  transition: border-color .15s;
}
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: #a39b8c; }
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible { border-color: var(--ink); outline-offset: 1px; }
.field textarea { resize: vertical; min-height: 120px; }
.form .btn { margin-top: var(--s-2); }
.form .btn:disabled { opacity: .6; cursor: wait; }
/* spam trap: hidden from people, filled in by bots */
.hp-field { position: absolute; left: -9999px; }
.form-status:empty { display: none; }
.form-status { padding: var(--s-3) var(--s-4); border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 500; }
.form-status.is-success { background: #e6f4ec; color: #1d5b3a; }
.form-status.is-error { background: #fbe9ea; color: var(--red); }
.form-note { margin-top: var(--s-4); font-size: var(--fs-sm); color: var(--muted); }

/* ---------- 8. Footer ---------- */
.site-footer {
  background: var(--ink);
  color: var(--muted-dark);
  padding: var(--s-8) 0 var(--s-5);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-6);
  padding-bottom: var(--s-7);
}
.footer-name { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600; color: var(--white); }
.footer-script { margin-top: var(--s-1); font-size: var(--fs-lg); color: var(--gold); text-align: left; }
.footer-tag { margin-top: var(--s-2); font-size: var(--fs-sm); }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-6);
  margin: 0;
  padding: 0;
  list-style: none;
}
.footer-links a { text-decoration: none; transition: color .15s; }
.footer-links a:hover { color: var(--white); }
.copyright {
  padding-top: var(--s-5);
  border-top: 1px solid var(--ink-line);
  font-size: var(--fs-sm);
}

/* ---------- Tablet & mobile navigation (hamburger menu) ---------- */
@media (max-width: 1024px) {
  .nav-toggle-label {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-right: calc(var(--s-2) * -1);
    cursor: pointer;
    border-radius: var(--r-sm);
  }
  .nav-toggle:focus-visible + .nav-toggle-label { outline: 3px solid var(--gold); }
  .nav-toggle-icon,
  .nav-toggle-icon::before,
  .nav-toggle-icon::after {
    display: block;
    position: relative;
    width: 22px;
    height: 2px;
    background: var(--white);
    transition: transform .15s, background-color .15s;
  }
  .nav-toggle-icon::before,
  .nav-toggle-icon::after { content: ""; position: absolute; left: 0; }
  .nav-toggle-icon::before { top: -7px; }
  .nav-toggle-icon::after { top: 7px; }
  .nav-toggle:checked + .nav-toggle-label .nav-toggle-icon { background: transparent; }
  .nav-toggle:checked + .nav-toggle-label .nav-toggle-icon::before { transform: translateY(7px) rotate(45deg); }
  .nav-toggle:checked + .nav-toggle-label .nav-toggle-icon::after { transform: translateY(-7px) rotate(-45deg); }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - var(--header-h));
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--ink);
    border-bottom: 1px solid var(--ink-line);
    box-shadow: 0 16px 32px rgba(0, 0, 0, .35);
  }
  .nav-toggle:checked ~ .site-nav { display: block; }
  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-width: var(--max);
    margin: 0 auto;
    padding: var(--s-2) var(--s-5) var(--s-5);
  }
  .nav-list > li { flex-wrap: wrap; border-bottom: 1px solid var(--ink-line); }
  .nav-link { flex: 1; min-height: 52px; padding: 0; font-size: var(--fs-base); }
  .nav-link[aria-current="page"] { box-shadow: none; color: var(--gold); }
  .submenu-toggle { width: 52px; height: 52px; margin: 0 calc(var(--s-3) * -1) 0 0; }
  .submenu-toggle svg { width: 20px; height: 20px; }
  .submenu {
    position: static;
    display: none;
    width: 100%;
    min-width: 0;
    padding: 0 0 var(--s-3);
    background: none;
    border: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
  }
  .submenu::before { display: none; }
  .has-menu.is-open > .submenu { display: block; }
  .submenu a { min-height: 48px; padding: var(--s-2); color: var(--muted-dark); }
  .submenu a:hover,
  .submenu a:focus-visible { background: var(--ink-2); color: var(--white); }
  .submenu-icon { background: var(--ink-2); border: 1px solid var(--ink-line); }
  .submenu-icon svg { stroke: var(--gold); }
}

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
  .hero { padding: var(--s-7) 0; }
  .hero-inner { grid-template-columns: 1fr 1fr; gap: var(--s-6); }
  .about { grid-template-columns: 1fr; gap: var(--s-7); }
  .explore-grid { grid-template-columns: repeat(2, 1fr); }
  .kh-cats, .kh-grid { grid-template-columns: repeat(2, 1fr); }
  .res-tiles { grid-template-columns: repeat(3, 1fr); }
  .discover-grid { grid-template-columns: repeat(2, 1fr); }
  .kh-card-wide { grid-template-columns: 1fr 1fr; }
}

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  :root { --header-h: 64px; }
  .container { padding: 0 var(--s-4); }
  .logo-img { width: 112px; height: 63px; }
  .nav-list { padding: var(--s-2) var(--s-4) var(--s-5); }

  /* Photo (with the logo) first, so both are seen straight away */
  .hero { padding: var(--s-5) 0 var(--s-7); }
  .hero-inner { grid-template-columns: 1fr; gap: var(--s-5); }
  .hero-tagline { margin-bottom: var(--s-3); font-size: .8125rem; }
  .hero-sub { margin-top: var(--s-4); font-size: var(--fs-base); }
  .hero-actions { margin-top: var(--s-5); }
  .hero-photo { order: -1; margin: 0 var(--s-3) var(--s-3) 0; }
  .hero-photo::before { inset: var(--s-3) calc(var(--s-3) * -1) calc(var(--s-3) * -1) var(--s-3); }
  .hero-actions .btn { flex: 1 1 auto; }

  .section { padding: var(--s-8) 0; }
  .section-head { margin-bottom: var(--s-6); }
  .forms, .mv-grid, .explore-grid, .res-tiles, .discover-grid { grid-template-columns: 1fr; }
  .panel, .mv-card { padding: var(--s-5); }
  .cta-actions { width: 100%; }
  .cta-actions .btn { flex: 1 1 auto; }
  .notify { padding: var(--s-5); }
  .notify .btn { width: 100%; }
  .res-tile { grid-template-columns: 48px 1fr; column-gap: var(--s-4); padding: var(--s-4); }
  .res-tile .feature-icon { grid-row: span 2; margin-bottom: 0; }
  .tool-banner { flex-wrap: wrap; align-items: flex-start; gap: var(--s-4); padding: var(--s-5); }
  .tool-banner-text { flex-basis: calc(100% - 64px); }

  .kh-cats, .kh-grid { grid-template-columns: 1fr; }
  .kh-card-wide { grid-template-columns: 1fr; }
  .kh-card-wide .kh-cover { min-height: 0; aspect-ratio: 16 / 9; }
  .kh-card-wide .kh-card-body { padding: var(--s-5); }
  .kh-card-wide .kh-card-title { font-size: 1.375rem; }
  .kh-cat { padding: var(--s-4); }
  .kh-library { margin-top: var(--s-7); }
  .kh-toolbar { grid-template-columns: 1fr; }
  .kh-sort select { flex: 1; }
  /* filter chips scroll sideways instead of wrapping into many rows */
  .kh-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-inline: calc(var(--s-4) * -1);
    padding: 2px var(--s-4) var(--s-1);
    scrollbar-width: none;
  }
  .kh-chips::-webkit-scrollbar { display: none; }
  .kh-empty { padding: var(--s-7) var(--s-4); }

  .footer-inner { flex-direction: column; padding-bottom: var(--s-6); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  .page-enter, .js-reveal .hero-text, .js-reveal .hero-photo { animation: none; }
}

/* =========================================================
   Sindhi Connect Chat widget (markup is built in app.js)
   ========================================================= */
.sc-chat {
  --sc-edge: var(--s-5);
  --sc-launcher: 56px;
  --sc-online: #4cc38a;
  position: fixed;
  right: var(--sc-edge);
  bottom: var(--sc-edge);
  z-index: 150;
}

/* ---------- Floating button ---------- */
.sc-chat-launcher {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--sc-launcher);
  height: var(--sc-launcher);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--gold);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(14, 16, 22, .28);
  transition: background-color .15s, transform .15s;
}
.sc-chat-launcher:hover { background: var(--gold-hover); transform: translateY(-2px); }
.sc-chat-launcher:focus-visible { border-radius: 50%; outline-color: var(--ink); box-shadow: 0 0 0 3px var(--white), 0 6px 20px rgba(14, 16, 22, .28); }
.sc-chat-launcher span { grid-area: 1 / 1; transition: opacity .15s, transform .15s; }
.sc-chat svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sc-chat-launcher-close { opacity: 0; transform: rotate(-45deg); }
.sc-chat.is-open .sc-chat-launcher-open { opacity: 0; transform: rotate(45deg); }
.sc-chat.is-open .sc-chat-launcher-close { opacity: 1; transform: none; }

/* Tooltip */
.sc-chat-launcher::after {
  content: attr(data-tooltip);
  position: absolute;
  right: calc(100% + var(--s-3));
  top: 50%;
  transform: translateY(-50%);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--white);
  font: 500 var(--fs-sm)/1.2 var(--font-body);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
.sc-chat:not(.is-open) .sc-chat-launcher:hover::after,
.sc-chat:not(.is-open) .sc-chat-launcher:focus-visible::after { opacity: 1; }

/* ---------- Window ---------- */
.sc-chat-window {
  position: absolute;
  right: 0;
  bottom: calc(var(--sc-launcher) + var(--s-3));
  display: flex;
  flex-direction: column;
  width: 400px;
  height: min(620px, calc(100vh - var(--sc-launcher) - var(--sc-edge) * 2 - var(--s-3)));
  height: min(620px, calc(100dvh - var(--sc-launcher) - var(--sc-edge) * 2 - var(--s-3)));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 20px 56px rgba(14, 16, 22, .24);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .2s, transform .2s, visibility 0s .2s;
}
.sc-chat.is-open .sc-chat-window {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .2s, transform .2s;
}
.sc-chat-window:focus-visible { outline-offset: 0; border-radius: 16px; }

/* ---------- Header ---------- */
.sc-chat-header {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4);
  background: var(--ink);
  color: var(--white);
}
.sc-chat-avatar {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #000 url("assets/logo.jpg") center / 190% no-repeat;
  border: 1px solid var(--ink-line);
}
.sc-chat-avatar-lg { width: 44px; height: 44px; }
.sc-chat-title { flex: 1; min-width: 0; }
.sc-chat-name { font: 600 var(--fs-md)/1.2 var(--font-display); }
.sc-chat-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: .8125rem;
  color: var(--muted-dark);
}
.sc-chat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sc-online); }
.sc-chat-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted-dark);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.sc-chat-close:hover { background: var(--ink-2); color: var(--white); }
.sc-chat-close svg { width: 20px; height: 20px; }

/* ---------- Conversation ---------- */
.sc-chat-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
}
.sc-chat-log:focus-visible { outline-offset: -3px; }
.sc-chat-row { display: flex; align-items: flex-end; gap: var(--s-2); }
.sc-chat-row-user { justify-content: flex-end; }
.sc-chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: .9375rem;
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.sc-chat-row-bot .sc-chat-bubble {
  background: var(--white);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  color: var(--text);
}
.sc-chat-row-user .sc-chat-bubble {
  background: var(--gold);
  border-bottom-right-radius: 4px;
  color: var(--ink);
}

/* Quick replies */
.sc-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  padding-left: 36px; /* lines up with bot bubbles (avatar + gap) */
}
.sc-chat-chip {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #d8cfbd;
  border-radius: 999px;
  background: var(--white);
  color: var(--text);
  font: 500 var(--fs-sm)/1 var(--font-body);
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.sc-chat-chip:hover { border-color: var(--gold-text); background: #fdf6e6; }
.sc-chat-chip:focus-visible { border-radius: 999px; outline-color: var(--ink); }

/* Typing indicator */
.sc-chat-typing {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0 var(--s-4) var(--s-2);
  background: var(--paper);
  font-size: .8125rem;
  color: var(--muted);
}
.sc-chat-typing[hidden] { display: none; }
.sc-chat-typing-dots { display: inline-flex; gap: 3px; }
.sc-chat-typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  animation: sc-chat-blink 1.2s infinite both;
}
.sc-chat-typing-dots i:nth-child(2) { animation-delay: .2s; }
.sc-chat-typing-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes sc-chat-blink {
  0%, 80%, 100% { opacity: .25; }
  40% { opacity: 1; }
}

/* ---------- Input ---------- */
.sc-chat-form {
  display: flex;
  align-items: flex-end;
  gap: var(--s-2);
  padding: var(--s-3);
  border-top: 1px solid var(--line);
  background: var(--white);
}
.sc-chat-input {
  flex: 1;
  min-height: 44px;
  max-height: 112px;
  padding: 10px 14px;
  border: 1px solid #cfc8bb;
  border-radius: var(--r-md);
  background: var(--white);
  color: var(--text);
  font: inherit;
  font-size: 1rem; /* 16px stops iOS zooming in on focus */
  line-height: 1.4;
  resize: none;
  transition: border-color .15s;
}
.sc-chat-input::placeholder { color: var(--muted); }
.sc-chat-input:focus-visible { border-color: var(--ink); outline-offset: 1px; border-radius: var(--r-md); }
.sc-chat-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  background: var(--gold);
  color: var(--ink);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.sc-chat-send:hover { background: var(--gold-hover); }
.sc-chat-send:focus-visible { outline-color: var(--ink); border-radius: var(--r-md); }
.sc-chat-send:disabled { background: #efeae0; color: #a39b8c; cursor: not-allowed; }
.sc-chat-send svg { width: 20px; height: 20px; }

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
  .sc-chat-window { width: 380px; }
}

/* ---------- Mobile ---------- */
@media (max-width: 520px) {
  .sc-chat { --sc-edge: var(--s-4); }
  .sc-chat-window {
    position: fixed;
    left: 3vw;
    right: 3vw;
    width: auto; /* 94% of the screen */
    bottom: calc(var(--sc-edge) + var(--sc-launcher) + var(--s-3));
    height: min(620px, calc(100vh - var(--sc-launcher) - var(--sc-edge) * 2 - var(--s-3)));
    height: min(620px, calc(100dvh - var(--sc-launcher) - var(--sc-edge) * 2 - var(--s-3)));
  }
  .sc-chat-launcher::after { display: none; } /* no hover on touch */
  /* keep the page's last line clear of the floating button */
  .site-footer { padding-bottom: calc(var(--sc-launcher, 56px) + var(--s-6)); }
  .sc-chat-bubble { max-width: 86%; }
}

@media (prefers-reduced-motion: reduce) {
  .sc-chat-typing-dots i { animation: none; opacity: .6; }
}
