/*! weblab 0.3.1 */

/* Mobile first. Narrow is the default; breakpoints only add layout.
   Everything is class-scoped so host widgets are never restyled by accident. */

:root {
  color-scheme: dark;

  /* Palette — locked. */
  --wl-bg: #050821;
  --wl-surface: #121548;
  --wl-surface-strong: #0b123d;
  --wl-text: #ffffff;
  --wl-muted: #b5c5e8;
  --wl-link: #b5c5e8;
  --wl-gold: #f4b223;
  --wl-on-gold: #121548;
  --wl-blue: #425cc7;
  --wl-border: rgba(181, 197, 232, 0.28);
  --wl-success: #50e2e3;
  --wl-danger: #ff8f9d;

  /* Shape */
  --wl-radius: 8px;
  --wl-radius-pill: 999px;
  --wl-shadow: 0 6px 18px rgba(5, 8, 33, 0.35);

  /* Space scale */
  --wl-space-1: 0.25rem;
  --wl-space-2: 0.5rem;
  --wl-space-3: 0.75rem;
  --wl-space-4: 1rem;
  --wl-space-6: 1.5rem;
  --wl-space-8: 2rem;
  --wl-space-12: 3rem;

  /* Type scale */
  --wl-font: Sora, "Segoe UI", sans-serif;
  --wl-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --wl-text-xs: 0.75rem;
  --wl-text-sm: 0.875rem;
  --wl-text-base: 1rem;
  --wl-text-lg: 1.125rem;
  --wl-text-xl: clamp(1.25rem, 1.1rem + 0.7vw, 1.5rem);
  --wl-text-2xl: clamp(1.5rem, 1.25rem + 1.2vw, 2rem);
  --wl-text-3xl: clamp(1.85rem, 1.4rem + 2vw, 2.6rem);
  --wl-leading: 1.65;
  --wl-leading-tight: 1.2;
  --wl-measure: 68ch;

  /* Widths */
  --wl-max: 1500px;
}

.wl-page,
.wl-page * {
  box-sizing: border-box;
}

.wl-page {
  margin: 0;
  min-height: 100dvh;
  background: var(--wl-bg);
  color: var(--wl-text);
  font-family: var(--wl-font);
  font-size: var(--wl-text-base);
  line-height: var(--wl-leading);
  -webkit-text-size-adjust: 100%;
}

.wl-page body {
  margin: 0;
  min-height: 100dvh;
  background: inherit;
  color: inherit;
  font: inherit;
}

.wl-page a {
  color: var(--wl-link);
  text-decoration: none;
}

.wl-page a:hover,
.wl-page a:focus-visible {
  text-decoration: underline;
}

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

/* The hidden attribute wins over any display the classes below set. */
.wl-page [hidden] {
  display: none !important;
}

/* ---------- Shell ---------- */

.wl-shell {
  max-width: var(--wl-max);
  margin: 0 auto;
  padding: var(--wl-space-4);
  display: grid;
  gap: var(--wl-space-6);
}

/* ---------- Chrome ----------
   Topbar and footer are hairline bars, not floating cards.
   Add .wl-boxed to either to restore the card treatment. */

.wl-topbar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--wl-space-4);
  padding: var(--wl-space-2) 0 var(--wl-space-4);
  border-bottom: 1px solid var(--wl-border);
}

.wl-footer {
  padding: var(--wl-space-4) 0 var(--wl-space-2);
  border-top: 1px solid var(--wl-border);
  color: var(--wl-muted);
  font-size: var(--wl-text-sm);
}

.wl-footer p {
  margin: 0;
  line-height: var(--wl-leading);
}

.wl-boxed {
  background: var(--wl-surface);
  color: var(--wl-text);
  border: 1px solid var(--wl-border);
  border-radius: var(--wl-radius);
  box-shadow: var(--wl-shadow);
  padding: var(--wl-space-3) var(--wl-space-4);
}

/* ---------- Surfaces ---------- */

.wl-panel {
  display: grid;
  gap: var(--wl-space-3);
  background: var(--wl-surface);
  color: var(--wl-text);
  border: 1px solid var(--wl-border);
  border-radius: var(--wl-radius);
  box-shadow: var(--wl-shadow);
  padding: var(--wl-space-4);
}

.wl-panel form {
  display: grid;
  gap: var(--wl-space-3);
}

/* ---------- Text ---------- */

.wl-brand {
  display: grid;
  gap: var(--wl-space-1);
}

.wl-kicker {
  margin: 0 0 var(--wl-space-1);
  font-size: var(--wl-text-xs);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--wl-muted);
}

.wl-title {
  margin: 0;
  color: var(--wl-text);
  font-size: var(--wl-text-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: var(--wl-leading-tight);
}

.wl-title-lg {
  font-size: var(--wl-text-3xl);
}

.wl-subtitle {
  margin: var(--wl-space-2) 0 0;
  color: var(--wl-muted);
  line-height: var(--wl-leading);
  max-width: var(--wl-measure);
}

.wl-brand .wl-subtitle {
  margin: 0;
  font-size: var(--wl-text-sm);
}

.wl-page code {
  font-family: var(--wl-mono);
  font-size: 0.9em;
  color: var(--wl-muted);
}

/* ---------- Nav ---------- */

.wl-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wl-space-2);
}

.wl-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: var(--wl-space-2) var(--wl-space-4);
  border-radius: var(--wl-radius-pill);
  border: 1px solid var(--wl-border);
  background: var(--wl-surface-strong);
  color: var(--wl-muted);
  font-size: var(--wl-text-sm);
  text-decoration: none;
}

.wl-nav a:hover,
.wl-nav a:focus-visible {
  color: var(--wl-text);
  border-color: var(--wl-muted);
  text-decoration: none;
}

.wl-nav a[aria-current="page"] {
  border-color: var(--wl-gold);
  color: var(--wl-gold);
}

/* ---------- Layout ---------- */

.wl-layout {
  display: grid;
  /* minmax(0, 1fr), not 1fr: a bare 1fr track is minmax(auto, 1fr) and
     refuses to shrink below its content's min-content width, which lets a
     wide child push the whole page sideways. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--wl-space-6);
  align-items: start;
}

/* Grid and flex items default to min-width: auto, so a wide child refuses
   to shrink and overflows its track. Let the containers' children shrink. */
.wl-layout > *,
.wl-main > *,
.wl-panel > * {
  min-width: 0;
}

.wl-card-grid {
  display: grid;
  gap: var(--wl-space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
}

/* ---------- Buttons ---------- */

.wl-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wl-space-2);
}

.wl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: var(--wl-space-2) var(--wl-space-6);
  border-radius: var(--wl-radius-pill);
  font: inherit;
  font-size: var(--wl-text-sm);
  font-weight: 600;
  cursor: pointer;
}

.wl-btn-primary {
  background: var(--wl-gold);
  color: var(--wl-on-gold);
  border: 0;
}

.wl-btn-ghost {
  background: transparent;
  color: var(--wl-gold);
  border: 1px solid var(--wl-gold);
}

.wl-page a.wl-btn {
  text-decoration: none;
}

.wl-page a.wl-btn-primary {
  color: var(--wl-on-gold);
}

.wl-page a.wl-btn-ghost {
  color: var(--wl-gold);
}

/* ---------- Inputs ---------- */

.wl-input {
  width: 100%;
  min-height: 40px;
  padding: var(--wl-space-2) var(--wl-space-3);
  border-radius: var(--wl-radius);
  border: 1px solid var(--wl-blue);
  background: var(--wl-surface-strong);
  color: var(--wl-text);
  font: inherit;
}

.wl-input::placeholder {
  color: var(--wl-muted);
}

/* ---------- Chips ---------- */

.wl-pill,
.wl-chip,
.wl-badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--wl-radius-pill);
  border: 1px solid var(--wl-border);
  background: var(--wl-surface-strong);
  color: var(--wl-text);
  padding: var(--wl-space-1) var(--wl-space-3);
  font-size: var(--wl-text-xs);
  line-height: 1.4;
}

/* A chip rendered as a <button> (filters, toggles) keeps the page font and
   gets a real tap target. Badges and status chips keep their compact size. */
button.wl-chip,
button.wl-pill {
  appearance: none;
  font: inherit;
  font-size: var(--wl-text-xs);
  cursor: pointer;
}

.wl-chip-btn {
  min-height: 2.5rem;
  padding-inline: var(--wl-space-4);
  font-size: var(--wl-text-sm);
}

.wl-chip[aria-pressed="true"],
.wl-chip-btn[aria-pressed="true"] {
  border-color: var(--wl-gold);
  color: var(--wl-gold);
}

.wl-chip-pass {
  border-color: var(--wl-success);
  color: var(--wl-success);
}

.wl-chip-warn {
  border-color: var(--wl-gold);
  color: var(--wl-gold);
}

.wl-chip-block {
  border-color: var(--wl-danger);
  color: var(--wl-danger);
}

.wl-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wl-space-2);
}

/* ---------- Notes ----------
   Full-width inline message. A chip is a pill; this is the block form. */

.wl-note {
  display: block;
  padding: var(--wl-space-3) var(--wl-space-4);
  border: 1px solid var(--wl-border);
  border-left: 3px solid var(--wl-muted);
  border-radius: var(--wl-radius);
  background: var(--wl-surface-strong);
  color: var(--wl-text);
  font-size: var(--wl-text-sm);
  line-height: var(--wl-leading);
}

.wl-note-danger {
  border-left-color: var(--wl-danger);
}

.wl-note-success {
  border-left-color: var(--wl-success);
}

/* ---------- Prose ----------
   Article flow. Scoped so it never leaks onto host markup. */

.wl-prose {
  max-width: var(--wl-measure);
  line-height: var(--wl-leading);
  color: var(--wl-text);
  /* Bare URLs used as link text have no break opportunity and would
     otherwise push the page wider than the viewport on a phone. */
  overflow-wrap: break-word;
}

.wl-prose > :first-child {
  margin-top: 0;
}

.wl-prose > :last-child {
  margin-bottom: 0;
}

.wl-prose p {
  margin: 0 0 var(--wl-space-4);
}

/* Markdown sources sometimes emit h1 inside an article. Render it at the
   h2 level so it never competes with the page title. */
.wl-prose h1 {
  margin: var(--wl-space-8) 0 var(--wl-space-3);
  font-size: var(--wl-text-2xl);
  font-weight: 600;
  line-height: var(--wl-leading-tight);
  letter-spacing: -0.02em;
}

.wl-prose h2 {
  margin: var(--wl-space-8) 0 var(--wl-space-3);
  font-size: var(--wl-text-xl);
  font-weight: 600;
  line-height: var(--wl-leading-tight);
  letter-spacing: -0.01em;
}

.wl-prose h3 {
  margin: var(--wl-space-6) 0 var(--wl-space-2);
  font-size: var(--wl-text-lg);
  font-weight: 600;
  line-height: var(--wl-leading-tight);
}

.wl-prose h4 {
  margin: var(--wl-space-6) 0 var(--wl-space-2);
  font-size: var(--wl-text-base);
  font-weight: 600;
}

.wl-prose ul,
.wl-prose ol {
  margin: 0 0 var(--wl-space-4);
  padding-left: var(--wl-space-6);
}

.wl-prose li {
  margin: 0 0 var(--wl-space-2);
}

.wl-prose li > ul,
.wl-prose li > ol {
  margin: var(--wl-space-2) 0 0;
}

.wl-prose a {
  color: var(--wl-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.wl-prose strong {
  color: var(--wl-text);
  font-weight: 600;
}

.wl-prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: var(--wl-space-6) 0;
  border-radius: var(--wl-radius);
}

.wl-prose figure {
  margin: var(--wl-space-6) 0;
}

.wl-prose figure img {
  margin: 0;
}

.wl-prose figcaption {
  margin-top: var(--wl-space-2);
  color: var(--wl-muted);
  font-size: var(--wl-text-sm);
}

.wl-prose video,
.wl-prose iframe {
  display: block;
  max-width: 100%;
  margin: var(--wl-space-6) 0;
  border-radius: var(--wl-radius);
}

.wl-prose pre {
  margin: 0 0 var(--wl-space-4);
  padding: var(--wl-space-4);
  border: 1px solid var(--wl-border);
  border-radius: var(--wl-radius);
  background: var(--wl-surface-strong);
  overflow-x: auto;
  font-family: var(--wl-mono);
  font-size: var(--wl-text-sm);
  line-height: 1.5;
}

.wl-prose pre code {
  color: var(--wl-text);
  font-size: inherit;
}

.wl-prose blockquote {
  margin: var(--wl-space-6) 0;
  padding: var(--wl-space-1) 0 var(--wl-space-1) var(--wl-space-4);
  border-left: 3px solid var(--wl-gold);
  color: var(--wl-muted);
}

.wl-prose blockquote p:last-child {
  margin-bottom: 0;
}

.wl-prose hr {
  margin: var(--wl-space-8) 0;
  border: 0;
  border-top: 1px solid var(--wl-border);
}

.wl-table-wrap {
  margin: 0 0 var(--wl-space-4);
  overflow-x: auto;
}

.wl-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--wl-text-sm);
}

.wl-prose th,
.wl-prose td {
  padding: var(--wl-space-2) var(--wl-space-3);
  border-bottom: 1px solid var(--wl-border);
  text-align: left;
}

.wl-prose th {
  color: var(--wl-muted);
  font-weight: 600;
}

/* ---------- Focus ---------- */

.wl-btn:focus-visible,
.wl-input:focus-visible,
.wl-nav a:focus-visible,
button.wl-chip:focus-visible,
a.wl-chip:focus-visible {
  outline: 2px solid var(--wl-blue);
  outline-offset: 2px;
}

/* ---------- Opt-in height fill ----------
   Width stays --wl-max and shrinks below it. Pages that omit
   .wl-main / .wl-fill keep a content-sized grid. */

.wl-page:has(.wl-shell > .wl-main),
.wl-page:has(.wl-shell.wl-fill),
.wl-page:has(.wl-shell > .wl-main) body,
.wl-page:has(.wl-shell.wl-fill) body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.wl-shell.wl-fill,
.wl-shell:has(> .wl-main) {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--wl-max);
  margin-inline: auto;
  min-height: 100dvh;
}

/* Single-card pages — sign-in, confirmations — that should not stretch to
   --wl-max. Declared after the fill rules above, which re-assert --wl-max at
   the same specificity. */
.wl-shell-narrow,
.wl-shell.wl-shell-narrow:has(> .wl-main) {
  max-width: 34rem;
}

.wl-shell.wl-fill > .wl-topbar,
.wl-shell.wl-fill > .wl-footer,
.wl-shell:has(> .wl-main) > .wl-topbar,
.wl-shell:has(> .wl-main) > .wl-footer {
  flex: 0 0 auto;
}

.wl-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--wl-space-6);
  padding: var(--wl-space-6) 0;
}

/* ---------- Hero ----------
   Intro block: kicker, large title, one-line subtitle, actions. */

.wl-hero {
  display: grid;
  gap: var(--wl-space-4);
  max-width: var(--wl-measure);
}

.wl-hero > * {
  margin: 0;
}

/* ---------- Stage ----------
   Frame for a canvas or map. Children fill it; height comes from the
   viewport so the stage is most of a phone screen and controls sit below. */

.wl-stage {
  position: relative;
  min-height: clamp(20rem, 60vh, 44rem);
  border-radius: var(--wl-radius);
  overflow: hidden;
  background: var(--wl-surface-strong);
}

.wl-stage > canvas,
.wl-stage > .wl-stage-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---------- Stepper ----------
   <ol class="wl-stepper"><li aria-current="step">…</li></ol>
   Numbers come from the list; done steps get .wl-step-done. */

.wl-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wl-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: wl-step;
}

.wl-stepper > li {
  display: inline-flex;
  align-items: center;
  gap: var(--wl-space-2);
  min-height: 2.5rem;
  padding: var(--wl-space-1) var(--wl-space-3) var(--wl-space-1) var(--wl-space-1);
  border: 1px solid var(--wl-border);
  border-radius: var(--wl-radius-pill);
  background: var(--wl-surface-strong);
  color: var(--wl-muted);
  font-size: var(--wl-text-sm);
  counter-increment: wl-step;
}

.wl-stepper > li::before {
  content: counter(wl-step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--wl-radius-pill);
  border: 1px solid currentColor;
  font-size: var(--wl-text-xs);
  font-weight: 600;
}

.wl-stepper > li[aria-current="step"] {
  border-color: var(--wl-gold);
  color: var(--wl-text);
}

.wl-stepper > li[aria-current="step"]::before {
  background: var(--wl-gold);
  border-color: var(--wl-gold);
  color: var(--wl-on-gold);
}

.wl-stepper > li.wl-step-done {
  color: var(--wl-success);
}

.wl-stepper > li.wl-step-done::before {
  content: "\2713";
}

/* ---------- Utilities ---------- */

.wl-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Lists ---------- */

.wl-list {
  display: flex;
  flex-direction: column;
  gap: var(--wl-space-4);
}

.wl-list-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--wl-space-3);
  min-width: 0;
  background: var(--wl-surface);
  color: var(--wl-text);
  border: 1px solid var(--wl-border);
  border-radius: var(--wl-radius);
  box-shadow: var(--wl-shadow);
  padding: var(--wl-space-4);
}

.wl-panel:has(> .wl-list) {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.wl-panel > .wl-list {
  flex: 1 1 auto;
  min-height: 0;
}

/* ---------- Breakpoints ---------- */

@media (min-width: 40rem) {
  .wl-shell {
    padding: var(--wl-space-6);
  }

  .wl-topbar {
    flex-direction: row;
    align-items: center;
  }

  .wl-list-item {
    flex-direction: row;
    align-items: center;
    gap: var(--wl-space-4);
  }
}

@media (min-width: 70rem) {
  .wl-layout {
    grid-template-columns: minmax(0, 1fr) 20rem;
  }
}

/* ---------- Motion ----------
   The template has no animation; hosts that add some get the guard here. */

@media (prefers-reduced-motion: reduce) {
  .wl-page *,
  .wl-page *::before,
  .wl-page *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
