/*
 * Refuelr public web pages — Emerald Alabaster theme
 * Source: docs/ui/stitch_refuelr/emerald_alabaster/DESIGN.md
 *
 * Hard rules (enforced by convention, grep-gated in CI):
 *   - No 1px solid borders to separate content. Use tonal shifts.
 *   - No pure black (#000). Body text uses var(--on-surface) / #191c1e.
 *   - var(--primary-container) is a SURFACE color only. Never a text color
 *     (#10b981 on #ffffff = 2.6:1, fails WCAG AA).
 *   - No drop shadows. Only --shadow-ambient for floating elements.
 *   - No text-align: justify. Manrope at 16px justified looks broken.
 *   - No horizontal dividers in lists. Vertical spacing + tonal alternation.
 */

/* Manrope variable font, latin subset, self-hosted to avoid third-party
 * font loading on the privacy policy page.
 * Source: Google Fonts (manrope v20), latin subset, unicode-range latin only.
 * Single woff2 covers weights 400–700 via variable-font axes. */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/css/fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Surfaces — tonal layering */
  --surface: #f7f9fb;
  --surface-container-low: #f2f4f6;
  --surface-container-lowest: #ffffff;
  --surface-container-high: #e6e8ea;
  --surface-container-highest: #e0e3e5;
  --surface-dim: #d8dadc;

  /* Emerald engine */
  --primary: #006c49;
  --primary-container: #10b981; /* FILL ONLY — never color: */
  --on-primary: #ffffff;
  --on-primary-container: #00422b;
  --primary-fixed: #6ffbbe;

  /* Functional */
  --on-surface: #191c1e;
  --on-surface-variant: #3c4a42;
  --secondary: #515f74;
  --tertiary: #a43a3a; /* Destructive */
  --tertiary-tint: rgba(164, 58, 58, 0.08);
  --tertiary-hover: #8a2e2e;

  /* Shapes */
  --radius-button: 0.375rem;
  --radius-card: 0.75rem;
  --radius-pill: 9999px;

  /* Signature gradient */
  --gradient-primary: linear-gradient(135deg, var(--primary), var(--primary-container));

  /* Ambient elevation (not a drop shadow) */
  --shadow-ambient: 0 12px 32px rgba(25, 28, 30, 0.06);

  /* Focus */
  --focus-glow: 0 0 0 4px rgba(0, 108, 73, 0.16);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--on-surface);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Accessible skip link */
.skip-link {
  position: absolute;
  top: -48px;
  left: 1rem;
  padding: 0.75rem 1rem;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius-button);
  font-weight: 600;
  text-decoration: none;
  z-index: 100;
  transition: top 0.15s ease;
}
.skip-link:focus-visible {
  top: 1rem;
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Page container — white card on surface background, tonal layering */
.container {
  max-width: 880px;
  margin: 2.5rem auto;
  background: var(--surface-container-lowest);
  border-radius: var(--radius-card);
  padding: clamp(2rem, 5vw, 4rem);
  box-shadow: var(--shadow-ambient);
}

/* Prose measure — cap line length for readability */
main p,
main ul,
main ol {
  max-width: 68ch;
}
main p,
main li {
  text-align: left;
  hyphens: none;
}

/* Typography scale */
h1 {
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--on-surface);
  font-weight: 700;
  margin-bottom: 0.5rem;
}
h2 {
  font-size: 1.5rem;
  line-height: 1.3;
  color: var(--primary);
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}
h3 {
  font-size: 1.125rem;
  line-height: 1.4;
  color: var(--on-surface-variant);
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
p {
  margin-bottom: 1rem;
}

/* Meta label for "Last Updated" and similar */
.last-updated {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  margin-bottom: 2rem;
  font-weight: 600;
}

/* Links */
a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Back link — ghost style with arrow */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9375rem;
}
.back-link::before {
  content: "←";
  display: inline-block;
  font-size: 1.125rem;
  line-height: 1;
}

/* Lists — custom markers, no bullet points, vertical rhythm */
main ul,
main ol {
  list-style: none;
  margin: 1rem 0 1.5rem 0;
}
main ul li,
main ol li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.625rem;
}
main ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 0.5rem;
  height: 0.5rem;
  background: var(--primary-container);
  border-radius: var(--radius-pill);
}
main ol {
  counter-reset: list;
}
main ol li {
  counter-increment: list;
}
main ol li::before {
  content: counter(list) ".";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Nested lists inside the warning block inherit dot markers */
.warning ul li::before {
  background: var(--tertiary);
}

/* Contact / callout block — tonal shift, no 1px border */
.contact {
  background: var(--surface-container-low);
  padding: 1.75rem 2rem;
  border-radius: var(--radius-card);
  margin-top: 3rem;
}
.contact h2 {
  margin-top: 0;
}

/* Destructive button — --tertiary solid */
.btn-destructive {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0.875rem 1.5rem;
  background: var(--tertiary);
  color: var(--on-primary);
  border: none;
  border-radius: var(--radius-button);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.btn-destructive:hover:not(:disabled) {
  background: var(--tertiary-hover);
}
.btn-destructive:focus-visible {
  outline: 2px solid var(--tertiary);
  outline-offset: 3px;
}
.btn-destructive:disabled {
  background: var(--surface-container-highest);
  color: var(--on-surface-variant);
  cursor: not-allowed;
}

/* Form fields — tonal background + WCAG-compliant border, ghost focus ring.
 *
 * NOTE: Form inputs override the Emerald Alabaster "no border / ghost border
 * at 20% opacity" rule because that rule cannot meet WCAG 2.1 SC 1.4.11
 * (3:1 non-text contrast) on a white container. --surface-container-highest
 * (#e0e3e5) vs --surface-container-lowest (#ffffff) is only ~1.3:1, so users
 * with low vision cannot identify field boundaries without a visible border.
 * The base fill still uses the spec token; the border is the only deviation.
 */
.form-field {
  margin-bottom: 1.5rem;
}
label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  font-weight: 600;
  margin-bottom: 0.5rem;
}
input[type="email"],
input[type="text"],
input[type="password"] {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0.75rem 1rem;
  background: var(--surface-container-highest);
  color: var(--on-surface);
  border: 1px solid rgba(60, 74, 66, 0.65); /* measured 3.18:1 vs white, WCAG 2.1 SC 1.4.11 */
  border-radius: var(--radius-button);
  font-family: inherit;
  font-size: 1rem;
  transition: box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
input[type="email"]::placeholder,
input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: var(--on-surface-variant);
  opacity: 0.65;
}
input[type="email"]:focus,
input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  background: var(--surface-container-lowest);
  box-shadow: 0 0 0 2px var(--primary), var(--focus-glow);
}

/* Destructive warning block — --tertiary tint, not mint */
.warning {
  background: var(--tertiary-tint);
  color: var(--on-surface);
  padding: 1.5rem 1.75rem;
  border-radius: var(--radius-card);
  margin-bottom: 2rem;
}
.warning strong {
  color: var(--tertiary);
}
.warning p {
  margin-bottom: 0.75rem;
}
.warning p:last-child {
  margin-bottom: 0;
}
.warning ul {
  margin: 0.75rem 0;
}

/* Acknowledgment of destructive action — NEUTRAL, not celebratory emerald */
.success-message {
  display: none;
  background: var(--surface-container-low);
  color: var(--on-surface);
  padding: 2rem;
  border-radius: var(--radius-card);
  text-align: left;
}
.success-message h2 {
  color: var(--on-surface);
  margin-top: 0;
  margin-bottom: 0.75rem;
}
.success-message p {
  margin-bottom: 0.75rem;
}
.success-message p:last-child {
  margin-bottom: 0;
}

/* =========================================================================
 * Landing page (.hero) — only used by index.html
 * Full-bleed signature gradient section above the content card
 * ========================================================================= */
.hero {
  background: var(--gradient-primary);
  color: var(--on-primary);
  padding: clamp(3rem, 10vw, 6rem) 1.5rem;
  text-align: center;
}
.hero-inner {
  max-width: 760px;
  margin: 0 auto;
}
.hero h1 {
  color: var(--on-primary);
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}
.hero .tagline {
  font-size: 1.125rem;
  opacity: 0.92;
  margin-bottom: 0;
  font-weight: 500;
}

/* Landing page features card sits below hero */
.landing-body {
  max-width: 760px;
  margin: -2.5rem auto 2.5rem auto;
  background: var(--surface-container-lowest);
  border-radius: var(--radius-card);
  padding: clamp(2rem, 5vw, 3rem);
  box-shadow: var(--shadow-ambient);
  position: relative;
}
.landing-body .description {
  margin-bottom: 2rem;
  color: var(--on-surface);
}
.landing-body h2 {
  margin-top: 0;
  margin-bottom: 1rem;
}
.landing-body .features ul {
  margin: 0 0 2rem 0;
}
.landing-body .footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  background: var(--surface-container-low);
  margin-left: calc(clamp(2rem, 5vw, 3rem) * -1);
  margin-right: calc(clamp(2rem, 5vw, 3rem) * -1);
  margin-bottom: calc(clamp(2rem, 5vw, 3rem) * -1);
  padding: 1.5rem clamp(2rem, 5vw, 3rem);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}
.landing-body .footer .company {
  margin-left: auto;
  color: var(--on-surface-variant);
  font-size: 0.875rem;
}

/* =========================================================================
 * Responsive
 * ========================================================================= */
@media (max-width: 640px) {
  /* Body font-size stays at 1rem (16px) — legal pages must not drop below
     the readability floor, per Emerald Alabaster spec rule. */
  .container {
    margin: 1rem;
    padding: clamp(1.25rem, 6vw, 2rem);
  }
  h1 {
    font-size: 1.75rem;
  }
  h2 {
    font-size: 1.25rem;
    margin-top: 2rem;
  }
  .hero {
    padding: 3.5rem 1.25rem 4rem 1.25rem;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .landing-body {
    margin: -2rem 1rem 1.5rem 1rem;
    padding: 1.75rem 1.5rem;
  }
  .landing-body .footer {
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    margin-bottom: -1.75rem;
    padding: 1.25rem 1.5rem;
  }
}

@media (max-width: 480px) {
  .landing-body .footer {
    flex-direction: column;
    align-items: flex-start;
  }
  .landing-body .footer .company {
    margin-left: 0;
  }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
