/* KNOX BANK — the main page.
 *
 * Taken from the owner's `main page layout/KNOX_BANK_Standalone_Main_Page`
 * folder, which is the authority for how this screen looks. Two things were
 * changed on the way in, and nothing else:
 *
 *  1. Every rule is scoped to `#landing-page`. The standalone file styled bare
 *     `body`, `h1`, `form`, `button` and `.field`, which inside this app would
 *     have reached the product shell and the admin console. The one rule that
 *     genuinely belongs to the document — the viewport lock — is on
 *     `body.landing-active`, a class `showLayer()` sets and clears, so the
 *     shell can still scroll.
 *
 *  2. The palette is declared here rather than inherited. The app has a dark
 *     theme; the main page is deliberately light in every theme, so it carries
 *     its own tokens and cannot be recoloured by a setting a visitor has not
 *     been offered yet.
 *
 * The layout's whole idea is that it fits one viewport with no scrolling: a
 * fixed header, a hero row that takes the remaining height, and the package
 * shelf pinned under it. That is why the heights are clamped against `svh`
 * rather than left to content.
 */

#landing-page {
  /* The design's own palette, so the dark theme cannot reach in here. */
  --accent: oklch(0.53 0.20 255);
  --accent-hover: oklch(0.46 0.19 255);
  --accent-soft: oklch(0.94 0.035 255);
  --accent-border: oklch(0.63 0.11 255);
  --navy: oklch(0.34 0.095 248);
  --on-navy: oklch(0.975 0.012 250);
  --canvas: oklch(0.975 0.012 250);
  --surface-solid: oklch(0.995 0.004 250);
  --border: oklch(0.90 0.014 250);
  --border-strong: oklch(0.74 0.022 250);
  --text: oklch(0.20 0.028 255);
  --text-muted: oklch(0.42 0.024 255);
  --success: oklch(0.52 0.115 155);
  --danger: oklch(0.55 0.19 25);
  --on-accent: oklch(0.985 0.008 250);
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --r-xl: 12px;
  --shadow-glass: 0 4px 20px color-mix(in oklab, var(--text) 6%, transparent);
  --shell: 1240px;

  height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  color: var(--text);
  background: var(--canvas);
  font-size: 0.875rem;
  line-height: 1.45;
}

/* The page is a single screen. Only while it is the visible layer. */
body.landing-active { overflow: hidden; }

#landing-page :where(button, input, select) { font: inherit; }
#landing-page :where(button, a) { -webkit-tap-highlight-color: transparent; }
#landing-page img { display: block; max-width: 100%; }
#landing-page .shell { width: min(calc(100% - 32px), var(--shell)); margin-inline: auto; }

#landing-page .skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: var(--r-sm);
  transform: translateY(-150%);
}
#landing-page .skip-link:focus { transform: translateY(0); }
#landing-page :where(a, button, input, select):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* ── Header ──────────────────────────────────────────────────────────────── */

#landing-page .site-header,
#landing-page .header-inner { min-height: 62px; }
#landing-page .site-header { background: var(--surface-solid); }
#landing-page .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--border);
}
#landing-page .brand {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-decoration: none;
  white-space: nowrap;
  gap: 9px;
}
/*
 * The standalone page cropped the full lockup (logo plus wordmark) down to the
 * round mark with a 94px image inside a 46px window. `knox-logo-mark.png` is
 * that same crop already, at a third of the bytes, and the app's sidebar
 * loads it too — so it is one cached file instead of a second copy of the
 * 1.7 MB original.
 */
#landing-page .brand-mark {
  width: 46px;
  height: 46px;
  overflow: hidden;
  flex: 0 0 auto;
  border: 1px solid color-mix(in oklab, var(--accent-border) 50%, transparent);
  border-radius: var(--r-lg);
  background: var(--accent);
  box-shadow: 0 3px 12px color-mix(in oklab, var(--accent) 14%, transparent);
}
#landing-page .brand-mark img { width: 100%; height: 100%; object-fit: cover; }
#landing-page .telegram-nav { display: flex; align-items: center; gap: 8px; }
#landing-page .telegram-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 650;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--r-md);
}
/*
 * Two lines on the bot link: the sketch in `Yassir.pdf` captions it "For more
 * question", and a caption belongs inside the link it describes rather than
 * beside it. The channel link uses the same wrapper with no caption so both
 * labels sit on one baseline.
 */
#landing-page .telegram-label { display: grid; line-height: 1.2; }
/* The channel link has no caption; an empty first row keeps both labels on
   the same line instead of one riding higher than the other. */
#landing-page [data-telegram="channel"] .telegram-label::before {
  content: "\00a0";
  font-size: 0.62rem;
  line-height: 1.2;
}
#landing-page .telegram-label small {
  font-size: 0.62rem;
  font-weight: 550;
  color: var(--text-muted);
}
#landing-page .telegram-nav a:hover { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-border); }
#landing-page .telegram-nav a:hover .telegram-label small { color: inherit; }
#landing-page .telegram-nav svg { width: 18px; height: 18px; fill: var(--accent); flex: 0 0 auto; }

/* ── Hero ────────────────────────────────────────────────────────────────── */

#landing-page .page-layout {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) clamp(132px, 21svh, 174px);
  gap: 10px;
  padding-block: 10px 12px;
}
#landing-page .hero-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: clamp(18px, 3vw, 44px);
}
#landing-page .story-panel {
  position: relative;
  overflow: hidden;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto;
  align-content: center;
  gap: clamp(8px, 1.2svh, 12px);
  padding: clamp(10px, 2svh, 20px) clamp(8px, 1.5vw, 18px);
}
#landing-page .story-panel > * { position: relative; }
#landing-page .story-core {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto;
  gap: clamp(8px, 1.5svh, 14px);
  place-items: center;
  align-content: center;
}
/* The lockup ships on white; multiply drops it onto the canvas. */
#landing-page .story-logo {
  width: min(100%, 750px);
  height: 284px;
  max-height: 284px;
  justify-self: center;
  object-fit: cover;
  object-position: center;
  mix-blend-mode: multiply;
  filter: saturate(1.08) contrast(1.04);
  transform: translateY(-15%);
  margin-bottom: -42px;
}
#landing-page .benefit-list {
  width: 100%;
  margin: -24px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  border-block: 1px solid var(--border);
}
#landing-page .benefit-list li {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(7px, 1vw, 12px);
  padding: clamp(10px, 1.5svh, 14px) 10px;
  font-size: clamp(0.86rem, 1.3vw, 1.08rem);
  font-weight: 680;
  line-height: 1.25;
  text-align: center;
  border-right: 1px solid var(--border);
}
#landing-page .benefit-list li:last-child { border-right: 0; }
#landing-page .benefit-icon {
  width: clamp(24px, 3vw, 34px);
  height: clamp(24px, 3vw, 34px);
  flex: 0 0 auto;
  object-fit: contain;
}
#landing-page h1 {
  margin: 8px 0 0;
  color: var(--text);
  font-size: clamp(1.45rem, 2.8vw, 2.55rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

/* ── The three doors ─────────────────────────────────────────────────────── */

#landing-page .access-panel {
  position: relative;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  padding: clamp(14px, 2.5svh, 24px);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-lg);
  isolation: isolate;
  background: var(--navy);
  box-shadow: var(--shadow-glass);
}
#landing-page .access-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: url("../assets/knox-medical-background-clean-tall.png") center / cover no-repeat;
}
#landing-page .access-panel > * { position: relative; z-index: 1; }
#landing-page .access-actions {
  grid-row: 1;
  width: min(100%, 320px);
  display: grid;
  gap: clamp(8px, 1.4svh, 12px);
}
#landing-page .button {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-weight: 650;
  cursor: pointer;
}
#landing-page .button small { display: block; font-size: 0.7rem; font-weight: 500; line-height: 1; }
#landing-page .button-primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
#landing-page .button-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
#landing-page .button-secondary { color: var(--text); background: var(--surface-solid); border-color: var(--border-strong); }
#landing-page .button-secondary:hover { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-border); }

#landing-page .status-message {
  grid-row: 2;
  width: 100%;
  margin: 0;
  padding-top: 4px;
  color: var(--on-navy);
  font-size: 0.7rem;
  font-weight: 650;
  text-align: center;
}
#landing-page .status-message:empty { display: none; }
#landing-page .status-message.is-error { color: oklch(0.82 0.13 25); }

/* ── Package shelf ───────────────────────────────────────────────────────── */

#landing-page .package-shelf {
  position: relative;
  min-height: 0;
  overflow: hidden;
  padding: 34px 14px 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-solid);
}
#landing-page .package-shelf > h2 {
  position: absolute;
  top: 0;
  left: 14px;
  margin: 0;
  padding: 8px 0 0;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
#landing-page .package-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-solid);
}
#landing-page .package-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
#landing-page .package-card {
  min-width: 0;
  min-height: 88px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-right: 1px solid var(--border);
  background: var(--surface-solid);
}
#landing-page .package-card h3 { margin: 0; font-size: clamp(0.76rem, 1.35vw, 1rem); line-height: 1.15; }
/* Price and question count. The catalogue gives both; neither is content. */
#landing-page .package-meta {
  grid-column: 1;
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.3;
}
#landing-page .package-action {
  grid-row: 1 / span 2;
  grid-column: 2;
  min-width: 112px;
  min-height: 44px;
  padding: 7px 11px;
  border: 1px solid color-mix(in oklab, var(--accent-border) 58%, transparent);
  border-radius: var(--r-md);
  color: var(--accent);
  background: color-mix(in oklab, var(--accent-soft) 74%, transparent);
  font-size: 0.73rem;
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
}
#landing-page .package-action:hover { background: var(--accent-soft); border-color: var(--accent-border); }
/* One row across the whole grid: loading, an error, or an empty catalogue. */
#landing-page .package-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 88px;
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: center;
}
#landing-page .more-button {
  width: 100%;
  min-height: 78px;
  align-self: center;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  color: var(--accent);
  background: var(--surface-solid);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
#landing-page .more-button[aria-disabled="true"] {
  cursor: default;
  color: var(--text-muted);
  opacity: 0.55;
}
#landing-page .more-arrow { font-size: 1rem; line-height: 1; }
#landing-page .package-status {
  position: absolute;
  inset-inline: 14px;
  bottom: 2px;
  min-height: 1em;
  margin: 0;
  color: var(--success);
  font-size: 0.7rem;
  font-weight: 650;
  text-align: center;
}
#landing-page .package-status.is-error { color: var(--danger); }

/* ── Narrow ──────────────────────────────────────────────────────────────── */

@media (max-width: 700px) {
  body.landing-active { overflow-y: auto; }
  #landing-page { height: auto; min-height: 100svh; }
  #landing-page .site-header,
  #landing-page .header-inner { min-height: 54px; }
  #landing-page .shell { width: min(calc(100% - 16px), var(--shell)); }
  #landing-page .header-inner { gap: 5px; }
  #landing-page .brand { gap: 6px; font-size: 0.72rem; }
  #landing-page .brand-mark { width: 40px; height: 40px; }
  #landing-page .telegram-nav { gap: 0; }
  #landing-page .telegram-nav a { gap: 4px; padding: 3px 5px; font-size: 0.64rem; }
  #landing-page .telegram-label small { font-size: 0.54rem; }
  #landing-page .telegram-nav svg { width: 14px; height: 14px; }
  #landing-page .page-layout { grid-template-rows: auto auto; align-content: start; gap: 8px; padding-block: 6px 10px; }
  #landing-page .hero-grid { grid-template-columns: 1fr; grid-template-rows: auto 178px; gap: 8px; }
  #landing-page .story-panel { padding: 8px 10px; }
  #landing-page .story-core { gap: 8px; }
  #landing-page .story-logo { width: min(100%, 318px); height: 120px; max-height: 120px; margin-bottom: -18px; }
  #landing-page .benefit-list { margin-top: -10px; }
  #landing-page .benefit-list li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    place-items: center;
    gap: 4px;
    padding: 7px 4px;
    font-size: clamp(0.62rem, 2.7vw, 0.76rem);
    text-align: left;
  }
  #landing-page .benefit-icon { width: 20px; height: 20px; }
  #landing-page h1 { margin-top: 3px; font-size: clamp(1.12rem, 5.5vw, 1.4rem); line-height: 1.08; }
  #landing-page .access-panel { padding: 8px; box-shadow: none; }
  #landing-page .access-panel::before { background-image: url("../assets/knox-medical-background-clean-wide.png"); }
  #landing-page .access-actions { gap: 6px; }
  #landing-page .button { padding: 6px 10px; }
  #landing-page .package-shelf { padding: 25px 7px 18px; }
  #landing-page .package-shelf > h2 { left: 7px; padding-top: 5px; }
  #landing-page .package-status { inset-inline: 7px; bottom: 1px; font-size: 0.58rem; }
  #landing-page .package-row { grid-template-columns: minmax(0, 1fr) 52px; }
  #landing-page .package-card { min-height: 84px; grid-template-columns: 1fr; gap: 4px; padding: 7px 5px; text-align: center; }
  #landing-page .package-card h3 { font-size: 0.65rem; line-height: 1.12; }
  #landing-page .package-meta { font-size: 0.58rem; }
  #landing-page .package-action { grid-row: auto; grid-column: 1; width: 100%; min-width: 0; padding: 5px 3px; font-size: 0.6rem; }
  #landing-page .more-button { min-height: 84px; font-size: 0.68rem; }
}

@media (max-width: 360px) {
  #landing-page .brand { font-size: 0.65rem; }
  /* At this width the caption costs more than it explains. */
  #landing-page .telegram-label small { display: none; }
  #landing-page .telegram-nav a { padding-inline: 3px; font-size: 0.58rem; }
  #landing-page .telegram-nav svg { display: none; }
}

@media (max-height: 680px) {
  #landing-page .page-layout { grid-template-rows: minmax(0, 1fr) 154px; }
  #landing-page .story-panel { padding-block: 8px; }
  #landing-page .benefit-list li { padding-block: 5px; }
  #landing-page .access-panel { padding: 4px; }
  #landing-page .access-actions { gap: 4px; }
  #landing-page .package-card { min-height: 72px; }
}

@media (max-width: 700px) and (max-height: 680px) {
  #landing-page .hero-grid { grid-template-rows: minmax(0, 1fr) 170px; }
  #landing-page .access-actions { gap: 2px; }
}

@media (max-height: 500px) {
  body.landing-active { overflow: auto; }
  #landing-page { height: auto; min-height: 100svh; }
  #landing-page .page-layout { min-height: 500px; }
}
