/* ==========================================================================
   EKOW Ride — ekow.app
   Plain CSS. No external requests: all fonts are self-hosted in /fonts.
   ========================================================================== */

/* ---------- Fonts (self-hosted, SIL Open Font License — see fonts/OFL-*.txt) */

@font-face {
  font-family: "Barlow Condensed";
  src: url("fonts/barlow-condensed-latin-800-normal.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("fonts/barlow-condensed-latin-800-italic.woff2") format("woff2");
  font-weight: 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("fonts/barlow-condensed-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Barlow";
  src: url("fonts/barlow-latin-300-normal.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Barlow";
  src: url("fonts/barlow-latin-300-italic.woff2") format("woff2");
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Barlow";
  src: url("fonts/barlow-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- Design tokens */

:root {
  /* Brand palette (matches www.ekowsystems.com) */
  --navy: #0B1830;
  --blue: #1D4ED8;
  --blue-hover: #1E40AF;
  --sky: #93C5FD;
  --white: #FFFFFF;
  --black: #000000;

  /* Type */
  --font-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  /* Light mode (default) */
  --bg: var(--white);
  --text: var(--black);
  --muted: #4B5563;
  --line: rgba(0, 0, 0, 0.12);
  --surface: #F5F7FB;
  --dot: rgba(11, 24, 48, 0.12);
  /* #93C5FD is too pale to read on white, so in light mode the
     "highlight" role uses royal blue instead. */
  --accent: var(--blue);
  --link: var(--blue);

  --max: 72rem;
  --gutter: clamp(1rem, 4vw, 2rem);

  color-scheme: light dark;
}

/* Dark mode: follows the device setting unless the visitor picked a theme
   with the toggle (theme.js sets data-theme on <html>). Both blocks must match. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--navy);
    --text: var(--white);
    --muted: #A9B4C8;
    --line: rgba(255, 255, 255, 0.12);
    --surface: #0F1F3D;
    --dot: rgba(147, 197, 253, 0.14);
    --accent: var(--sky);
    /* Royal blue on navy is low-contrast for small text, so links use sky. */
    --link: var(--sky);
  }
}

:root[data-theme="dark"] {
  --bg: var(--navy);
  --text: var(--white);
  --muted: #A9B4C8;
  --line: rgba(255, 255, 255, 0.12);
  --surface: #0F1F3D;
  --dot: rgba(147, 197, 253, 0.14);
  --accent: var(--sky);
  --link: var(--sky);
  color-scheme: dark;
}

:root[data-theme="light"] {
  color-scheme: light;
}

/* ---------- Base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  /* Subtle dotted grid */
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 1.125rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
}

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

a {
  color: var(--link);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

strong {
  font-weight: 500;
}

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: var(--gutter);
  top: 0.5rem;
  z-index: 10;
  background: var(--blue);
  color: var(--white);
  padding: 0.5rem 1rem;
}

/* ---------- Typography */

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  line-height: 0.95;
  letter-spacing: 0.005em;
  margin: 0 0 1rem;
}

h1 {
  font-size: clamp(3rem, 11vw, 7.5rem);
}

h2 {
  font-size: clamp(1.75rem, 4.5vw, 2.75rem);
  line-height: 1;
}

h3 {
  font-size: 1.375rem;
  line-height: 1.1;
}

/* Highlighted key word inside a heading: italic + accent colour */
.hl {
  font-style: italic;
  color: var(--accent);
}

/* Eyebrow / label text */
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin: 0 0 1.25rem;
}

.lead {
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  line-height: 1.5;
  max-width: 38ch;
  margin: 0 0 2rem;
}

.muted {
  color: var(--muted);
}

/* Placeholder marker — easy to spot visually and with a text search for [PLACEHOLDER] */
.placeholder {
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--muted);
}

.btn .placeholder {
  font-size: inherit;
  color: inherit;
}

/* ---------- Header */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.logo {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3em;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
}

/* For when the real logo file is dropped in (see README) */
.logo img {
  display: block;
  height: 2rem;
  width: auto;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text);
  text-decoration: none;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--accent);
}

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

.site-nav {
  margin-left: auto;
}

/* ---------- Light/dark toggle (hidden unless theme.js runs) */

.theme-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  cursor: pointer;
}

.js .theme-toggle {
  display: inline-flex;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.theme-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Show the moon in light mode (click for dark), the sun in dark mode */
.theme-toggle .icon-sun {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* ---------- Sections */

.hero {
  padding: clamp(4rem, 14vw, 9rem) 0 clamp(3rem, 10vw, 6rem);
}

.section {
  padding: clamp(3rem, 8vw, 5rem) 0;
  border-top: 1px solid var(--line);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  border: 1px solid var(--line);
  padding: 0.6rem 1rem;
}

.status::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Buttons / download badges */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.75rem 1.5rem;
  background: var(--blue);
  color: var(--white);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  text-decoration: none;
  border: 2px solid var(--blue);
}

.btn:hover {
  background: var(--blue-hover);
  border-color: var(--blue-hover);
}

.btn[aria-disabled="true"] {
  background: transparent;
  color: var(--muted);
  border: 2px dashed var(--line);
  cursor: not-allowed;
}

.downloads {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.download-card {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1.5rem;
}

.download-card h3 {
  margin-bottom: 0.25rem;
}

.download-card p {
  margin: 0 0 1.25rem;
  font-size: 1rem;
}

.download-card .btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ---------- Feature grid (about page) */

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.grid-3 .num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.grid-3 p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

/* ---------- Long-form legal pages */

.prose {
  max-width: 44rem;
}

.prose h2 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.prose p,
.prose li {
  font-size: 1.0625rem;
}

.prose ul {
  padding-left: 1.25rem;
}

.prose li + li {
  margin-top: 0.4rem;
}

.prose h3 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.prose address {
  font-style: normal;
}

.table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.prose th,
.prose td {
  text-align: left;
  vertical-align: top;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
}

.prose th {
  background: var(--surface);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.toc {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
}

.toc ol {
  margin: 0;
  padding-left: 1.25rem;
  columns: 2 14rem;
  column-gap: 2rem;
}

.toc li {
  font-size: 0.95rem;
  break-inside: avoid;
}

.meta {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* ---------- Footer */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 1.75rem;
  padding-bottom: 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

/* Ekowsystems company mark (inline SVG, strokes use currentColor) */
.company {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
}

.company-logo {
  display: block;
  flex: none;
  width: 2rem;
  height: 2rem;
  color: var(--text);
}

.company-logo--lg {
  width: 5rem;
  height: 5rem;
  margin-bottom: 1.5rem;
}

.site-footer ul {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer a {
  color: var(--text);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

/* ---------- Small screens */

@media (max-width: 40rem) {
  /* Row 1: logo + toggle. Row 2: nav. */
  .theme-toggle {
    order: 2;
    margin-left: auto;
  }
  .site-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
  }
  .site-nav ul {
    gap: 0.25rem 1.25rem;
  }
  .btn {
    width: 100%;
  }
}
