/* =============================================================================
   worldcitizen.app — main stylesheet
   Order: @font-face → tokens (light + dark) → base → layout → components → motion
   ========================================================================== */

/* ----------------------------------------------------------------------------
   Fonts — self-hosted Inter as the cross-platform fallback to the system UI
   font. The files are optional: if assets/fonts/*.woff2 are absent the stack
   falls back to -apple-system / Segoe UI / Roboto and the site still looks
   right. See assets/fonts/README.md for how to add them.
   ------------------------------------------------------------------------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/inter-600.woff2") format("woff2");
}

/* ----------------------------------------------------------------------------
   Design tokens
   ------------------------------------------------------------------------- */
:root {
  color-scheme: light dark;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Inter", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;

  /* light theme */
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-soft: #6e6e73;
  --hairline: rgba(0, 0, 0, 0.1);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-ink: #ffffff;
  --nav-bg: rgba(255, 255, 255, 0.72);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.12);
  --focus: #0071e3;

  --radius-card: 20px;
  --radius-input: 12px;
  --radius-pill: 980px;
  --maxw: 1024px;
  --pad-inline: clamp(20px, 5vw, 40px);
  --pad-section: clamp(64px, 10vw, 140px);

  --step-hero: clamp(2.5rem, 1.6rem + 4vw, 4.5rem);
  --step-h2: clamp(1.75rem, 1.2rem + 2.6vw, 2.75rem);
  --step-h3: clamp(1.25rem, 1.05rem + 1vw, 1.625rem);
  --step-lead: clamp(1.0625rem, 1rem + 0.4vw, 1.3125rem);
  --step-body: 1.0625rem;
}

/* dark — manual override (wins in both directions) */
:root[data-theme="dark"] {
  --bg: #000000;
  --bg-alt: #141416;
  --surface: #1d1d1f;
  --text: #f5f5f7;
  --text-soft: #a1a1a6;
  --hairline: rgba(255, 255, 255, 0.12);
  --accent: #2997ff;
  --accent-hover: #47a6ff;
  --accent-ink: #ffffff;
  --nav-bg: rgba(0, 0, 0, 0.72);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.6);
  --focus: #2997ff;
}

/* dark — OS default (only when the user has not forced light) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-alt: #141416;
    --surface: #1d1d1f;
    --text: #f5f5f7;
    --text-soft: #a1a1a6;
    --hairline: rgba(255, 255, 255, 0.12);
    --accent: #2997ff;
    --accent-hover: #47a6ff;
    --accent-ink: #ffffff;
    --nav-bg: rgba(0, 0, 0, 0.72);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.6);
    --focus: #2997ff;
  }
}

/* ----------------------------------------------------------------------------
   Base
   ------------------------------------------------------------------------- */
html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-body);
  font-weight: 400;
  letter-spacing: -0.003em;
}

h1,
h2,
h3 {
  font-weight: 600;
  letter-spacing: -0.015em;
}

a:not([class]) {
  color: var(--accent);
  text-underline-offset: 0.15em;
}
a:not([class]):hover {
  text-decoration: underline;
}

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

/* Programmatic focus target after route changes — no visible ring. */
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible {
  outline: none;
}

::selection {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}

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

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1200;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  transform: translateY(-150%);
  transition: transform 0.2s ease;
}
.skip-link:focus {
  transform: translateY(0);
}

/* ----------------------------------------------------------------------------
   Layout primitives
   ------------------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--pad-inline);
}

.section {
  padding-block: var(--pad-section);
  background: var(--bg);
}
.section--alt {
  background: var(--bg-alt);
}

.section__head {
  max-width: 46ch;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
.section__head--center {
  margin-inline: auto;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

h2.section__title {
  font-size: var(--step-h2);
}

.section__lead {
  margin-top: 1rem;
  font-size: var(--step-lead);
  color: var(--text-soft);
  letter-spacing: -0.01em;
}

.grid {
  display: grid;
  gap: clamp(1rem, 2.5vw, 1.75rem);
}
@media (min-width: 640px) {
  .grid--2 {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 900px) {
  .grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1100px) {
  .grid--4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ----------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1;
  transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease,
    transform 0.2s ease;
  white-space: nowrap;
}
.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--ghost {
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text);
}
.btn--ghost:hover {
  background: color-mix(in srgb, var(--text) 10%, transparent);
}

.btn--text {
  padding: 0;
  border-radius: 4px;
  color: var(--accent);
  font-size: inherit;
}
.btn--text::after {
  content: "\203A";
  transition: transform 0.2s ease;
}
.btn--text:hover {
  text-decoration: underline;
}
.btn--text:hover::after {
  transform: translateX(3px);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.btn-row--center {
  justify-content: center;
}

/* ----------------------------------------------------------------------------
   Hero
   ------------------------------------------------------------------------- */
.hero {
  padding-block: clamp(5rem, 14vh, 9rem) var(--pad-section);
  text-align: center;
  background:
    radial-gradient(
      60% 50% at 50% 0%,
      color-mix(in srgb, var(--accent) 10%, transparent),
      transparent 70%
    ),
    var(--bg);
}
.hero h1 {
  font-size: var(--step-hero);
  line-height: 1.05;
  max-width: 18ch;
  margin-inline: auto;
}
.hero__lead {
  margin: 1.5rem auto 0;
  max-width: 52ch;
  font-size: var(--step-lead);
  color: var(--text-soft);
  letter-spacing: -0.01em;
}
.hero .btn-row {
  margin-top: 2.25rem;
}

/* ----------------------------------------------------------------------------
   Cards / feature blocks
   ------------------------------------------------------------------------- */
.card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: clamp(1.5rem, 4vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.card__icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.card__icon svg {
  width: 22px;
  height: 22px;
}
.card h3 {
  font-size: var(--step-h3);
}
.card p {
  color: var(--text-soft);
}

/* Work tiles */
.tile {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.35rem;
  min-height: 220px;
  padding: 1.5rem;
  border-radius: var(--radius-card);
  border: 1px solid var(--hairline);
  background: linear-gradient(
    155deg,
    color-mix(in srgb, var(--accent) 14%, var(--bg-alt)),
    var(--bg-alt)
  );
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.tile__tag {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.tile__title {
  font-size: var(--step-h3);
  font-weight: 600;
  letter-spacing: -0.015em;
}
.tile__result {
  color: var(--text-soft);
}

/* Value list */
.checklist {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.5rem;
}
.checklist li {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  color: var(--text-soft);
}
.checklist li::before {
  content: "";
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 15%, transparent)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%230071e3' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E")
    center / 14px no-repeat;
}

.prose {
  max-width: 60ch;
}
.prose > * + * {
  margin-top: 1.1rem;
}
.prose p {
  color: var(--text-soft);
  font-size: var(--step-lead);
}

/* ----------------------------------------------------------------------------
   Contact form
   ------------------------------------------------------------------------- */
.form {
  max-width: 560px;
  display: grid;
  gap: 1.1rem;
}
.field {
  display: grid;
  gap: 0.4rem;
}
.field label {
  font-size: 0.9375rem;
  font-weight: 500;
}
.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-input);
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}
.field textarea {
  min-height: 140px;
  resize: vertical;
}
/* honeypot */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.form__note {
  font-size: 0.9375rem;
  color: var(--text-soft);
}
.form__status {
  font-size: 0.9375rem;
  padding: 12px 14px;
  border-radius: var(--radius-input);
  display: none;
}
.form__status[data-state="ok"] {
  display: block;
  background: color-mix(in srgb, #34c759 16%, transparent);
  color: color-mix(in srgb, #248a3d 90%, var(--text));
}
.form__status[data-state="error"] {
  display: block;
  background: color-mix(in srgb, #ff3b30 15%, transparent);
  color: color-mix(in srgb, #d70015 88%, var(--text));
}
.btn[disabled] {
  opacity: 0.55;
  pointer-events: none;
}

/* ----------------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--hairline);
  padding-block: 3rem;
  background: var(--bg);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}
.site-footer a {
  color: var(--text-soft);
  font-size: 0.9375rem;
}
.site-footer a:hover {
  color: var(--text);
}
.site-footer__meta {
  color: var(--text-soft);
  font-size: 0.875rem;
}

/* ----------------------------------------------------------------------------
   View transitions / scroll reveal
   ------------------------------------------------------------------------- */
main {
  min-height: 60vh;
}

/* Only hide when JS is available to reveal them again. */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.js .reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
