/* ==========================================================================
   MALGEAS — styles.css
   --------------------------------------------------------------------------
   HOW THIS FILE IS ORGANISED
     1. Design tokens  (colours, spacing, radius, shadows) — change colours HERE
     2. Reset & base
     3. Layout helpers (container, sections, grids)
     4. Components (header, nav, buttons, cards, product, footer)
     5. Motion & accessibility preferences
     6. Responsive breakpoints (all at the bottom of each section)

   EDITING SAFELY
     * Colours are defined once, in section 1. Prefer changing a token over
       inventing a new colour: the light and dark themes both use them.
     * Every text/background pair in both themes has been checked against
       WCAG 2.2 AA (contrast >= 4.5:1 for body text, >= 3:1 for large text
       and UI borders). If you change a colour, re-check it before shipping.
     * Keep the braces balanced: every "{" needs its "}".
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS — light theme is the default
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light dark;

  /* Brand */
  --brand: #0b4fbd;            /* links, buttons, accents (7.0:1 on white)  */
  --brand-strong: #083b8f;     /* hover / pressed                            */
  --brand-soft: #e8effb;       /* tinted background for highlights           */
  --on-brand: #ffffff;         /* text placed on --brand                     */

  /* Surfaces */
  --bg: #ffffff;
  --bg-alt: #f4f6f9;
  --surface: #ffffff;
  --border: #d8dee7;        /* decorative hairline: not required to reach 3:1 */
  --border-strong: #7d8794; /* control outlines: 3.64:1 on white (WCAG 1.4.11)   */

  /* Text (all >= 4.5:1 on --bg and --bg-alt) */
  --text: #101620;
  --text-muted: #4a5563;

  /* Feedback / draft marker */
  --warn-bg: #fdf3e3;
  --warn-border: #e0a94a;
  --warn-text: #7a4a00;

  /* Focus ring */
  --focus: #0b4fbd;

  /* Shape & depth */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgb(16 22 32 / 6%), 0 1px 3px rgb(16 22 32 / 4%);
  --shadow-md: 0 10px 30px -12px rgb(16 22 32 / 18%), 0 2px 8px rgb(16 22 32 / 5%);

  /* Rhythm */
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --space-7: 4.5rem;
  --section-y: clamp(3.5rem, 8vw, 6.5rem);
  --container: 72rem;

  /* Type */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  --leading: 1.65;
  --header-h: 4.25rem;
}

/* Optional manual override, set by main.js on <html data-theme="dark"> */
:root[data-theme="dark"] {
  --brand: #7cb0ff;
  --brand-strong: #a8caff;
  --brand-soft: #12233a;
  --on-brand: #06101f;

  --bg: #0b0f14;
  --bg-alt: #0f151d;
  --surface: #121a24;
  --border: #24313f;
  --border-strong: #5f7488;

  --text: #e9eff7;
  --text-muted: #a7b4c4;

  --warn-bg: #2a1f10;
  --warn-border: #a5720f;
  --warn-text: #ffc06b;

  --focus: #7cb0ff;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%), 0 1px 3px rgb(0 0 0 / 30%);
  --shadow-md: 0 14px 34px -14px rgb(0 0 0 / 70%), 0 2px 10px rgb(0 0 0 / 35%);
}

/* Automatic dark theme for visitors who never used the switch */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #7cb0ff;
    --brand-strong: #a8caff;
    --brand-soft: #12233a;
    --on-brand: #06101f;

    --bg: #0b0f14;
    --bg-alt: #0f151d;
    --surface: #121a24;
    --border: #24313f;
    --border-strong: #5f7488;

    --text: #e9eff7;
    --text-muted: #a7b4c4;

    --warn-bg: #2a1f10;
    --warn-border: #a5720f;
    --warn-text: #ffc06b;

    --focus: #7cb0ff;

    --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%), 0 1px 3px rgb(0 0 0 / 30%);
    --shadow-md: 0 14px 34px -14px rgb(0 0 0 / 70%), 0 2px 10px rgb(0 0 0 / 35%);
  }
}

/* --------------------------------------------------------------------------
   2. RESET & BASE
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: var(--leading);
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; }

img, svg { display: block; max-width: 100%; }

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover { color: var(--brand-strong); }

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

::selection {
  background: var(--brand);
  color: var(--on-brand);
}

/* Skip link: invisible until it receives keyboard focus */
.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -150%);
  z-index: 100;
  padding: 0.7rem 1.1rem;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none;
  transition: transform 120ms ease-out;
}

.skip-link:focus-visible {
  transform: translate(-50%, 0);
  color: var(--on-brand);
}

/* Hidden from sight, still read by screen readers */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Elements that only work with JavaScript are hidden without it */
.js-only { display: none; }
.js .js-only { display: inline-flex; }

/* --------------------------------------------------------------------------
   3. LAYOUT
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1.15rem, 4vw, 2.5rem);
}

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

.section__head {
  max-width: 46rem;
  margin-bottom: clamp(2rem, 4vw, 3rem);
  display: grid;
  gap: var(--space-3);
}

.section__title { font-size: clamp(1.55rem, 1.2rem + 1.6vw, 2.3rem); }

.section__lead {
  color: var(--text-muted);
  font-size: clamp(1.02rem, 1rem + 0.3vw, 1.15rem);
  max-width: 42rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
}

.grid { display: grid; gap: var(--space-4); }
.grid--two { grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); }
.grid--three { grid-template-columns: repeat(auto-fit, minmax(16.5rem, 1fr)); }

/* --------------------------------------------------------------------------
   4a. HEADER & NAVIGATION
   -------------------------------------------------------------------------- */
/* Solid background first: browsers without color-mix()/backdrop-filter
   still get an opaque, readable header. The translucent blur is an upgrade. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
}

@supports (background-color: color-mix(in srgb, red 50%, transparent)) {
  .site-header { background-color: color-mix(in srgb, var(--bg) 88%, transparent); }
}

@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
  .site-header {
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    backdrop-filter: saturate(140%) blur(10px);
  }
}

.site-header.is-scrolled { box-shadow: var(--shadow-sm); }

.site-header__inner {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "brand actions"
    "nav nav";
  align-items: center;
  gap: 0.5rem 1rem;
  min-height: var(--header-h);
  padding-block: 0.55rem;
}

.site-header__actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  grid-area: brand;
}

.brand:hover { color: var(--text); }
.brand__mark { width: 2rem; height: 2rem; border-radius: 7px; }

.nav-toggle {
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.8rem;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
}

.nav-toggle__bars {
  position: relative;
  display: block;
  width: 1.05rem;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.nav-toggle__bars::before { top: -5px; }
.nav-toggle__bars::after { top: 5px; }

.icon-button {
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
}

.icon-button:hover { border-color: var(--brand); color: var(--brand); }
.icon { display: block; }

/* Show the icon that matches the current theme */
.icon--sun { display: none; }
:root[data-theme="dark"] .icon--sun { display: block; }
:root[data-theme="dark"] .icon--moon { display: none; }

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

.site-nav {
  grid-area: nav;
  width: 100%;
}

.js .site-nav { display: none; }
.js .site-nav.is-open { display: block; }

.site-nav__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
  padding-block: 0.25rem;
}

.site-nav__link {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}

.site-nav__link:hover {
  color: var(--text);
  background-color: var(--brand-soft);
}

.site-nav__link[aria-current="true"] { color: var(--brand); }

.site-nav__link--cta {
  color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

/* --------------------------------------------------------------------------
   4b. HERO
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3.5rem, 9vw, 7rem);
  border-bottom: 1px solid var(--border);
  background-image:
    radial-gradient(60rem 30rem at 82% -10%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 70%),
    radial-gradient(45rem 24rem at 8% 0%, color-mix(in srgb, var(--brand) 9%, transparent), transparent 65%);
}

.hero__inner { display: grid; gap: var(--space-4); }
.hero__title { font-size: clamp(2.1rem, 1.35rem + 3.4vw, 3.6rem); max-width: 22ch; }

.hero__lead {
  max-width: 44rem;
  font-size: clamp(1.06rem, 1rem + 0.45vw, 1.3rem);
  color: var(--text-muted);
}

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

.hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.5rem;
  margin-top: var(--space-2);
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.hero__facts li {
  position: relative;
  padding-left: 1.4rem;
}

.hero__facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--brand);
}

/* --------------------------------------------------------------------------
   4c. BUTTONS
   -------------------------------------------------------------------------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.4rem;
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease,
    border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.button--primary {
  background-color: var(--brand);
  color: var(--on-brand);
  box-shadow: var(--shadow-sm);
}

.button--primary:hover {
  background-color: var(--brand-strong);
  color: var(--on-brand);
}

.button--ghost {
  background-color: transparent;
  color: var(--brand);
  border-color: var(--border-strong);
}

.button--ghost:hover {
  background-color: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-strong);
}

.button--small { padding: 0.6rem 1.05rem; font-size: 0.9375rem; }
.button--large { padding: 0.95rem 1.6rem; font-size: 1.0625rem; }

/* --------------------------------------------------------------------------
   4d. CARDS, FEATURES, PRODUCT, ABOUT, CONTACT
   -------------------------------------------------------------------------- */
.card {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-4);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: var(--space-1);
  border-radius: var(--radius-sm);
  color: var(--brand);
  background-color: var(--brand-soft);
}

.card__title { font-size: 1.15rem; }
.card__text { color: var(--text-muted); }

.feature {
  padding: var(--space-4);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm);
}

.feature__title { font-size: 1.06rem; margin-bottom: var(--space-1); }
.feature__text { color: var(--text-muted); font-size: 0.98rem; }

.product {
  display: grid;
  gap: var(--space-4);
  padding: clamp(1.35rem, 3vw, 2rem);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.product__body { display: grid; gap: var(--space-2); align-content: start; }
.product__title { font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.6rem); }
.product__text { color: var(--text-muted); max-width: 46rem; }

.product__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  padding: 0;
}

.product__meta li {
  padding: 0.24rem 0.7rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.product__side {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-4);
  background-color: var(--bg-alt);
  border-radius: var(--radius);
}

.product__side-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.product__side-text { font-size: 0.95rem; color: var(--text-muted); }

.about {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
}

.about__text { display: grid; gap: var(--space-3); max-width: 40rem; }
.about__text p { color: var(--text-muted); }
.about__text .section__title { color: var(--text); }
.about__text .eyebrow { margin-bottom: var(--space-1); }
.about__note { font-size: 0.9375rem; }

.about__panel {
  padding: var(--space-5);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.about__panel-title { font-size: 1.06rem; margin-bottom: var(--space-3); }

.checklist { list-style: none; display: grid; gap: 0.7rem; }

.checklist li {
  position: relative;
  padding-left: 1.9rem;
  font-size: 0.97rem;
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.28em;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background-color: var(--brand-soft);
  box-shadow: inset 0 0 0 2px var(--brand);
}

.contact-card {
  display: grid;
  gap: var(--space-5);
  align-items: center;
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-image:
    radial-gradient(40rem 20rem at 100% 0%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%);
  background-color: var(--surface);
  box-shadow: var(--shadow-md);
}

.contact-card__text { display: grid; gap: var(--space-3); }
.contact-card__action { display: grid; gap: var(--space-2); justify-items: start; }
.contact-card__hint { font-size: 0.9rem; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   4e. FOOTER
   -------------------------------------------------------------------------- */
.site-footer {
  padding-block: clamp(2.5rem, 6vw, 4rem) 2rem;
  background-color: var(--bg-alt);
  border-top: 1px solid var(--border);
}

.site-footer__grid {
  display: grid;
  gap: var(--space-5);
  padding-bottom: var(--space-5);
}

.site-footer__brand { display: grid; gap: var(--space-2); align-content: start; }

.site-footer__tagline {
  max-width: 22rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.site-footer__heading {
  margin-bottom: var(--space-2);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.site-footer__list {
  list-style: none;
  display: grid;
  gap: 0.35rem;
  font-size: 0.95rem;
}

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

.site-footer__list a:hover { color: var(--brand); }

.legal-list {
  list-style: none;
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: var(--space-3);
  font-size: 0.9rem;
}

.legal-list--draft {
  background-color: var(--warn-bg);
  border: 2px dashed var(--warn-border);
  border-radius: var(--radius-sm);
  color: var(--warn-text);
}

.legal-list__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.95;
}

.legal-list__value { display: block; }

.legal-list a { color: inherit; }

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  justify-content: space-between;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.site-footer__copy { margin: 0; }
.site-footer__privacy { margin: 0; }

/* --------------------------------------------------------------------------
   5. MOTION — only when JavaScript is on and the visitor allows it
   -------------------------------------------------------------------------- */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (hover: hover) {
  .card:hover,
  .feature:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
  }

  .card,
  .feature { transition: box-shadow 160ms ease, transform 160ms ease; }

  .button--primary:hover { transform: translateY(-1px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }

  .card:hover,
  .feature:hover,
  .button--primary:hover { transform: none; }
}

/* --------------------------------------------------------------------------
   6. RESPONSIVE
   -------------------------------------------------------------------------- */
@media (min-width: 48rem) {
  /* Desktop: one row — logo, navigation, then the theme switch */
  .site-header__inner {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand nav actions";
    gap: 0.5rem var(--space-4);
  }

  /* Desktop navigation: always visible, the toggle disappears */
  .site-nav,
  .js .site-nav { display: block; width: auto; justify-self: end; }

  .site-nav__list { flex-wrap: nowrap; }
  .nav-toggle { display: none !important; }

  .product { grid-template-columns: minmax(0, 1.6fr) minmax(15rem, 1fr); }

  .about { grid-template-columns: minmax(0, 1.15fr) minmax(17rem, 0.85fr); }

  .contact-card { grid-template-columns: minmax(0, 1.4fr) minmax(14rem, 1fr); }

  .site-footer__grid { grid-template-columns: 1.2fr 0.6fr 1.6fr; }
}

@media (min-width: 62rem) {
  .site-footer__grid { gap: var(--space-6); }
}

@media (max-width: 30rem) {
  .button { width: 100%; }
  .hero__actions { display: grid; }
  .legal-list { padding: var(--space-2); }
}
