/*
 * Styles for the server-rendered public pages (home, subject and worksheet landing).
 *
 * These pages must be readable and complete before any JavaScript runs, so they do
 * not share the application bundle's stylesheet. Kept deliberately small: tokens,
 * layout, and a handful of components.
 */

:root {
  --wsm-bg: #f6f7f9;
  --wsm-surface: #ffffff;
  --wsm-surface-2: #f1f3f6;
  --wsm-border: #e2e5ea;
  --wsm-text: #1a1f2b;
  --wsm-text-muted: #5c6575;
  --wsm-accent: #2563eb;
  --wsm-accent-contrast: #ffffff;
  --wsm-accent-soft: #eaf0ff;

  --wsm-radius-sm: 6px;
  --wsm-radius: 10px;
  --wsm-radius-lg: 16px;

  --wsm-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --wsm-shadow: 0 2px 8px rgba(16, 24, 40, 0.07);

  --wsm-space-1: 4px;
  --wsm-space-2: 8px;
  --wsm-space-3: 12px;
  --wsm-space-4: 16px;
  --wsm-space-5: 24px;
  --wsm-space-6: 32px;
  --wsm-space-7: 48px;
  --wsm-space-8: 64px;

  --wsm-max-width: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --wsm-bg: #101319;
    --wsm-surface: #171b23;
    --wsm-surface-2: #1e232d;
    --wsm-border: #2a303c;
    --wsm-text: #e9ecf2;
    --wsm-text-muted: #9aa3b2;
    --wsm-accent: #6f9cff;
    --wsm-accent-contrast: #0d1017;
    --wsm-accent-soft: #1c2536;

    --wsm-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --wsm-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  }
}

body {
  margin: 0;
  background: var(--wsm-bg);
  color: var(--wsm-text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wsm-shell {
  max-width: var(--wsm-max-width);
  margin: 0 auto;
  padding: 0 var(--wsm-space-5);
}

/* ---------------------------------------------------------------- header */

.wsm-public-header {
  border-bottom: 1px solid var(--wsm-border);
  background: var(--wsm-surface);
}

.wsm-public-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--wsm-space-4);
  min-height: 64px;
  flex-wrap: wrap;
}

.wsm-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--wsm-space-2);
  font-weight: 650;
  font-size: 1.0625rem;
  color: var(--wsm-text);
  text-decoration: none;
}

.wsm-brand img {
  max-height: 32px;
  width: auto;
}

.wsm-public-nav {
  display: flex;
  align-items: center;
  gap: var(--wsm-space-2);
  flex-wrap: wrap;
}

/*
 * Scoped with :not(.wsm-button) on purpose. `.wsm-public-nav a` (0,1,1) outranks
 * `.wsm-button` (0,1,0), so without this the call-to-action in the header inherited
 * the muted link colour and rendered as dark grey text on a blue fill.
 */
.wsm-public-nav a:not(.wsm-button) {
  color: var(--wsm-text-muted);
  text-decoration: none;
  padding: var(--wsm-space-2) var(--wsm-space-3);
  border-radius: var(--wsm-radius-sm);
  font-size: 0.9375rem;
}

.wsm-public-nav a:not(.wsm-button):hover {
  color: var(--wsm-text);
  background: var(--wsm-surface-2);
}

.wsm-public-nav .wsm-button {
  font-size: 0.9375rem;
}

/* --------------------------------------------------------------- buttons */

.wsm-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--wsm-space-2);
  /* 44px min target keeps this usable on touch without extra media queries. */
  min-height: 44px;
  padding: 0 var(--wsm-space-5);
  border-radius: var(--wsm-radius);
  border: 1px solid transparent;
  background: var(--wsm-accent);
  color: var(--wsm-accent-contrast);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.wsm-button:hover {
  filter: brightness(1.06);
}

.wsm-button--ghost {
  background: var(--wsm-surface);
  color: var(--wsm-text);
  border-color: var(--wsm-border);
}

.wsm-button--ghost:hover {
  background: var(--wsm-surface-2);
  filter: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--wsm-accent);
  outline-offset: 2px;
  border-radius: var(--wsm-radius-sm);
}

/* ------------------------------------------------------------------ hero */

.wsm-hero {
  padding: var(--wsm-space-8) 0 var(--wsm-space-7);
}

.wsm-hero__title {
  margin: 0 0 var(--wsm-space-4);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 700;
  max-width: 18ch;
}

.wsm-hero__lead {
  margin: 0 0 var(--wsm-space-6);
  font-size: clamp(1.0625rem, 2.2vw, 1.1875rem);
  color: var(--wsm-text-muted);
  max-width: 60ch;
}

.wsm-hero__actions {
  display: flex;
  gap: var(--wsm-space-3);
  flex-wrap: wrap;
}

/* --------------------------------------------------------------- section */

.wsm-section {
  padding: var(--wsm-space-7) 0;
  border-top: 1px solid var(--wsm-border);
}

.wsm-section__title {
  margin: 0 0 var(--wsm-space-2);
  font-size: 1.375rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.wsm-section__lead {
  margin: 0 0 var(--wsm-space-5);
  color: var(--wsm-text-muted);
  max-width: 62ch;
}

/* ----------------------------------------------------------------- cards */

.wsm-grid {
  display: grid;
  gap: var(--wsm-space-4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}

.wsm-card {
  display: flex;
  flex-direction: column;
  gap: var(--wsm-space-2);
  padding: var(--wsm-space-5);
  background: var(--wsm-surface);
  border: 1px solid var(--wsm-border);
  border-radius: var(--wsm-radius);
  box-shadow: var(--wsm-shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.wsm-card:hover {
  box-shadow: var(--wsm-shadow);
  border-color: var(--wsm-accent);
}

.wsm-card__title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 620;
}

.wsm-card__text {
  margin: 0;
  color: var(--wsm-text-muted);
  font-size: 0.9375rem;
}

.wsm-card__meta {
  margin-top: auto;
  padding-top: var(--wsm-space-2);
  display: flex;
  gap: var(--wsm-space-2);
  flex-wrap: wrap;
}

.wsm-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--wsm-accent-soft);
  color: var(--wsm-accent);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.wsm-tag--muted {
  background: var(--wsm-surface-2);
  color: var(--wsm-text-muted);
}

/* ----------------------------------------------------------------- steps */

.wsm-steps {
  display: grid;
  gap: var(--wsm-space-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  counter-reset: wsm-step;
  list-style: none;
  margin: 0;
  padding: 0;
}

.wsm-steps li {
  counter-increment: wsm-step;
}

.wsm-steps li::before {
  content: counter(wsm-step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-bottom: var(--wsm-space-3);
  border-radius: 50%;
  background: var(--wsm-accent-soft);
  color: var(--wsm-accent);
  font-weight: 700;
}

.wsm-steps h3 {
  margin: 0 0 var(--wsm-space-1);
  font-size: 1rem;
  font-weight: 620;
}

.wsm-steps p {
  margin: 0;
  color: var(--wsm-text-muted);
  font-size: 0.9375rem;
}

/* ----------------------------------------------------------- plain pages */

.wsm-content {
  padding: var(--wsm-space-7) 0;
}

.wsm-content__inner {
  max-width: 72ch;
  margin: 0 auto;
  padding: 0 var(--wsm-space-5);
}

.wsm-content__title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  line-height: 1.2;
  margin: 0 0 var(--wsm-space-4);
}

/* ---------------------------------------------------------------- footer */

.wsm-site-footer {
  border-top: 1px solid var(--wsm-border);
  background: var(--wsm-surface);
  padding: var(--wsm-space-6) 0;
  margin-top: var(--wsm-space-7);
}

.wsm-site-footer__inner {
  max-width: var(--wsm-max-width);
  margin: 0 auto;
  padding: 0 var(--wsm-space-5);
  color: var(--wsm-text-muted);
  font-size: 0.875rem;
}

.wsm-site-footer__line {
  margin: 0 0 var(--wsm-space-1);
}

/* The application supplies its own footer chrome. */
body.wsm-app .wsm-site-footer {
  display: none;
}

@media (max-width: 600px) {
  .wsm-shell {
    padding: 0 var(--wsm-space-4);
  }

  .wsm-hero {
    padding: var(--wsm-space-6) 0 var(--wsm-space-5);
  }

  .wsm-hero__actions .wsm-button {
    width: 100%;
  }
}
