/* ==========================================================================
   VIN Status – styles.css
   Shared design of all public pages (served as /web/css/styles.css).
   Loaded first on every page; page-specific styles live in a separate file per page.
   Font: Cabin (SIL OFL) as woff2 in static/web/fonts/ (see @font-face).
   Structure: variables · base · building blocks (buttons, header) · demo and result cards
              · form fields · footer and sub pages · helper classes
   Mobile first, one breakpoint from 48em (768 px), a second from 64em (1024 px).
   ========================================================================== */

/* ---------- Variables --------------------------------------------------- */
@font-face {
  font-family: "Cabin";
  src: url("../fonts/cabin-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Cabin";
  src: url("../fonts/cabin-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Cabin";
  src: url("../fonts/cabin-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  /* Flyer palette */
  --navy:        #002d4e;   /* flyer background, headings */
  --navy-90:     #0b3a5f;
  --navy-70:     #506e85;   /* body text on a light background, muted */
  --amber:       #f9b114;   /* accent: "Weg.", buttons, bars */
  --amber-dark:  #d99700;
  --grey:        #eaeaea;   /* flyer cards */
  --grey-light:  #f4f5f6;
  --white:       #ffffff;

  /* Demo and form: a lighter, more serious blue */
  --blue:        #2a6ebb;
  --blue-dark:   #1f5a9e;
  --blue-tint:   #e8f1fb;
  --blue-line:   #b9d3ef;

  /* Warning, as on the flyer */
  --danger:      #c0392b;
  --danger-tint: #f9ebe8;
  --ok:          #1e7a4d;
  --ok-tint:     #e7f5ec;

  --text:        #1b2b3a;
  --text-muted:  #4a6074;

  --font: "Cabin", "Open Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;

  --radius:      12px;
  --radius-sm:   8px;
  --space:       clamp(1rem, 0.6rem + 1.6vw, 1.5rem);
  --section-y:   clamp(3rem, 2rem + 4vw, 5.5rem);
  --wrap:        72rem;
  --header-h:    4rem;
  --shadow:      0 1px 2px rgba(0, 45, 78, .08), 0 6px 20px rgba(0, 45, 78, .08);
}

/* ---------- Base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;           /* 17 px */
  line-height: 1.6;
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  /* Sticky footer: on short pages (thank-you page, Impressum, ...) the footer sits at the bottom of the window. */
  display: flex; flex-direction: column;
  min-height: 100vh; min-height: 100dvh;
}
main { flex: 1 0 auto; }        /* fills the space between header and footer (sticky footer, tinted pages) */
img, svg { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.15; color: var(--navy); font-weight: 700; text-wrap: balance; }
h1 { font-size: clamp(2.25rem, 1.4rem + 4.2vw, 4rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.5rem); }
h3 { font-size: 1.25rem; }
p  { margin: 0 0 1em; max-width: 65ch; }
a  { color: var(--blue-dark); text-underline-offset: .18em; }
a:hover { color: var(--navy); }
ul, ol { margin: 0; padding: 0; list-style: none; }
strong { font-weight: 700; }
code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .04em; }
small, .small { font-size: .875rem; }
.source { font-size: .8125rem; color: var(--text-muted); margin: .5rem 0 0; }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; border-radius: 4px; }
.on-dark :focus-visible, .site-header :focus-visible { outline-color: var(--amber); }
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--amber); color: var(--navy); padding: .6rem 1rem; border-radius: var(--radius-sm); font-weight: 700;
}
.skip-link:focus { top: 1rem; }

.wrap { width: min(100% - 2 * var(--space), var(--wrap)); margin-inline: auto; }
.section { padding-block: var(--section-y); scroll-margin-top: var(--header-h); }
.section--grey { background: var(--grey-light); }
.section__head { max-width: 46rem; margin-bottom: 2.25rem; }
.section__head p { color: var(--text-muted); font-size: 1.125rem; }
.eyebrow {
  display: inline-block; margin-bottom: .75rem;
  font-size: .875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--blue);
}

/* ---------- Building blocks --------------------------------------------- */
/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 3rem; padding: .7rem 1.5rem;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; border-radius: 999px;
  transition: background-color .15s, color .15s, border-color .15s, transform .15s;
}
.btn:active { transform: translateY(1px); }
.btn--amber   { background: var(--amber); color: var(--navy); }
.btn--amber:hover { background: var(--amber-dark); color: var(--navy); }
.btn--outline { border-color: rgba(255,255,255,.7); color: var(--white); }
.btn--outline:hover { background: var(--white); color: var(--navy); }
.btn--blue    { background: var(--blue); color: var(--white); }
.btn--blue:hover { background: var(--blue-dark); color: var(--white); }
.btn--block   { width: 100%; }
.btn--sm      { min-height: 2.5rem; padding: .45rem 1.1rem; font-size: .95rem; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: var(--navy); color: var(--white);
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.site-header .wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--white); text-decoration: none; font-size: 1.5rem; font-weight: 700; line-height: 1; }
.brand:hover { color: var(--white); }
.brand { white-space: nowrap; }
.site-header .btn { white-space: nowrap; padding-inline: 1rem; }
/* The logo (img/logo.svg) is a square shield with a car; it is decorative, the brand name follows as text. */
.brand img { width: 2.5rem; height: 2.5rem; flex: none; }
@media (max-width: 23em) { .brand { font-size: 1.25rem; } .site-header .btn { font-size: .875rem; padding-inline: .8rem; } }
.nav { display: none; }
.nav a { color: rgba(255,255,255,.88); text-decoration: none; font-weight: 600; padding: .5rem .25rem; }
.nav a:hover { color: var(--amber); }
@media (min-width: 48em) {
  .nav { display: flex; gap: 1.75rem; margin-left: auto; margin-right: 1.5rem; }
}

/* ---------- Demo card (light blue) -------------------------------------- */
.demo { background: var(--blue-tint); }
.demo__box { background: var(--white); border: 1px solid var(--blue-line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(1.25rem, 1rem + 2vw, 2rem); max-width: 40rem; }
.demo__label { display: block; margin-bottom: .5rem; font-weight: 700; color: var(--navy); }
.demo__row { display: flex; flex-direction: column; gap: .75rem; }
.demo__row .input { flex: 1; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .06em; text-transform: uppercase; }
@media (min-width: 36em) { .demo__row { flex-direction: row; } .demo__row .btn { flex: none; } }

/* Result cards */
.result { margin-top: 1.25rem; padding: 1rem 1.25rem 1rem 4rem; position: relative; border-radius: var(--radius-sm); border: 2px solid; }
.result::before {
  content: "!"; position: absolute; left: 1rem; top: 1rem; width: 2.1rem; height: 2.1rem;
  display: grid; place-items: center; border-radius: 6px; font-weight: 700; font-size: 1.25rem; color: var(--white);
}
.result strong { display: block; font-size: 1.125rem; }
.result p { margin: .25rem 0 0; }
.result--danger { background: var(--danger-tint); border-color: var(--danger); color: var(--danger); }
.result--danger::before { background: var(--danger); }
.result--neutral { background: var(--blue-tint); border-color: var(--blue-line); color: var(--navy); }
.result--neutral::before { content: "i"; background: var(--blue); font-style: italic; }
.result--error { background: #fff8e6; border-color: var(--amber); color: var(--navy); }
.result--error::before { background: var(--amber); color: var(--navy); }

/* ---------- Form fields ------------------------------------------------- */
.field { display: grid; gap: .35rem; }
.field label, .field .label { font-weight: 700; color: var(--navy); font-size: .9688rem; }
.field .opt { font-weight: 400; color: var(--text-muted); }
.field .hint { font-size: .875rem; color: var(--text-muted); }

.input, .select, .textarea {
  width: 100%; min-height: 3rem; padding: .65rem .9rem;
  font: inherit; font-size: 1rem;            /* at least 16 px: prevents zoom on iOS */
  color: var(--text); background: var(--white);
  border: 1.5px solid #9db3c8; border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 7rem; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: #7b8d9d; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--blue); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(42,110,187,.2); }
/* Thymeleaf errors: th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'" */
.is-invalid, .input:user-invalid, .textarea:user-invalid { border-color: var(--danger); }
.is-invalid:focus { box-shadow: 0 0 0 4px rgba(192,57,43,.18); }
.error { color: var(--danger); font-size: .9rem; font-weight: 600; margin: 0; }
.field-error-summary { padding: .9rem 1.1rem; border: 2px solid var(--danger); background: var(--danger-tint); border-radius: var(--radius-sm); color: var(--danger); font-weight: 600; }

/* ---------- Footer and sub pages ---------------------------------------- */
.site-footer { margin-top: auto; background: var(--navy); color: rgba(255,255,255,.85); padding-block: 1.125rem; font-size: .9375rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: .5rem 2rem; justify-content: space-between; align-items: center; }
.site-footer a { color: var(--white); text-underline-offset: .18em; }
.site-footer a:hover { color: var(--amber); }
.site-footer ul { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }

.page { padding-block: var(--section-y); }       /* thank-you page, Impressum (legal notice), Datenschutz (privacy statement) */
.page .wrap { max-width: 46rem; }
.page h1 { font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem); }
.page h2 { font-size: 1.5rem; margin-top: 2rem; }
.page .list { list-style: disc; padding-left: 1.25rem; margin: 0 0 1em; max-width: 65ch; }   /* bullet list in long texts (privacy statement) */
.page .list li { margin-bottom: .4rem; }

/* ---------- Helper classes ---------------------------------------------- */
.on-dark { color: var(--white); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
@media print {
  .site-footer, .site-header { display: none; }
  body { font-size: 11pt; }
}
