/* Event download landing page.
 *
 * Translated from docs/mockup/main.html, whose styles are all inline. Here they
 * are class rules, because the rendered page must stay free of inline styles so
 * that `Content-Security-Policy: default-src 'self'` holds.
 *
 * Class names come from the plan's CSS Class Contract and are the interface to
 * the template (Task 7) and to app.js (Task 12). Every colour is declared once
 * in `:root` and used through `var(...)` afterwards.
 *
 * Structure this file assumes, matching the mockup element for element:
 *
 *   body
 *     .page
 *       .page__stripe                 8 px orange edge, decorative
 *       .page__body
 *         header.site-header   > div  band + centred row
 *         main                 > div.layout
 *             section.intro
 *             .card                   <form> or <div>, one of three states
 *         footer.site-footer   > div  band + centred row
 */

/* ---------------------------------------------------------------- fonts -- */

/* Local woff2 only — never a web font over the network. */

@font-face {
  font-family: "Inter";
  src: url("fonts/inter-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("fonts/inter-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("fonts/inter-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("fonts/inter-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-italic-400.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ------------------------------------------------------------- palette -- */

:root {
  --orange: #E8722C;
  --orange-dark: #B4531A;
  --text: #1A1A1A;
  --text-soft: #4A4A4A;
  --text-muted: #6B6B6B;
  --surface: #FAFAF9;
  --surface-accent: #FDF1E8;
  --line: #E8E8E8;
  --field-border: #CFCFCF;
  --white: #FFFFFF;
  --error: var(--orange-dark);
  --shadow: 0 12px 32px rgba(26, 26, 26, 0.08);
  --content-width: 1200px;
  --gutter: clamp(20px, 4vw, 48px);
  --font-sans: Inter, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Source Serif 4", Georgia, serif;
}

/* ---------------------------------------------------------------- base -- */

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

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

body {
  margin: 0;
  height: 100%;
  background: var(--white);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

/* A visible focus ring everywhere — WCAG 2.1 AA, and the only reason the
   keyboard path through the form is usable at all. */
:focus-visible {
  outline: 2px solid var(--orange-dark);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --------------------------------------------------------------- frame -- */

.page {
  min-height: 100%;
  display: flex;
  background: var(--white);
  color: var(--text);
}

.page__stripe {
  flex: 0 0 8px;
  background: var(--orange);
}

.page__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* The three centred rows of the page: header, main content, footer. */
.site-header > div,
.layout,
.site-footer > div {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 22px var(--gutter);
}

/* -------------------------------------------------------------- header -- */

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

.site-header > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
}

.site-header__logo {
  display: block;
  line-height: 0;
}

.site-header__logo img {
  height: 44px;
  width: auto;
  display: block;
}

.event-badge {
  display: flex;
  align-items: center;
  gap: 14px;
}

.event-badge__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.event-badge__logo {
  height: 52px;
  width: auto;
  display: block;
  border-radius: 2px;
}

/* -------------------------------------------------------------- layout -- */

main {
  flex: 1 0 auto;
}

.layout {
  padding-block: clamp(32px, 6vw, 80px);
  display: flex;
  flex-wrap: wrap;
  gap: clamp(36px, 5vw, 72px);
  align-items: flex-start;
}

.intro {
  flex: 1 1 460px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.intro__eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--orange-dark);
}

.intro__title {
  margin: 0;
  font-size: clamp(38px, 4.6vw, 60px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 700;
}

/* Large type is the one place the bright orange carries enough contrast. */
.intro__accent {
  color: var(--orange);
}

.intro__subtitle {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(18px, 1.8vw, 22px);
  line-height: 1.4;
  color: var(--text-muted);
}

/* ----------------------------------------------------------- event info -- */

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  font-size: 14px;
  color: var(--text-soft);
}

.meta__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* The inline SVGs stroke with `currentColor`, so their colour lives here. */
.meta__icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--orange);
}

/* -------------------------------------------------------------- preview -- */

.preview {
  margin: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview__image {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.preview__caption {
  font-size: 13px;
  color: var(--text-muted);
}

/* ----------------------------------------------------------------- card -- */

/* The card is the right-hand column itself — form, thanks and expired views
   all use it, so `.card` may sit on a <form> or on a <div>. */
.card {
  flex: 1 1 380px;
  max-width: 480px;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(24px, 3vw, 36px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card__icon {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card__icon--success {
  background: var(--orange);
  color: var(--white);
}

.card__icon--expired {
  background: var(--surface-accent);
  color: var(--orange-dark);
}

.card__title {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 700;
}

/* The mockup sizes the heading per state; the icon tells the states apart. */
.card__icon--success ~ .card__title {
  font-size: 30px;
  line-height: 1.2;
}

.card__icon--expired ~ .card__title {
  font-size: 24px;
}

.card__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-soft);
}

.card__icon--success ~ .card__title + .card__text {
  font-size: 16px;
}

.card__text a {
  color: var(--orange-dark);
  font-weight: 600;
}

/* --------------------------------------------------------------- fields -- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field__label {
  font-size: 13px;
  font-weight: 600;
}

.field__required {
  color: var(--orange-dark);
}

.field__optional {
  font-weight: 400;
  color: var(--text-muted);
}

/* 48 px tall and 16 px type: a comfortable touch target, and iOS does not
   zoom the viewport when the field takes focus. */
.field__input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--field-border);
  border-radius: 4px;
  background: var(--white);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
}

.field__input::placeholder {
  color: var(--text-muted);
}

/* Not colour alone: the border also thickens, and a `.field__error` message
   is rendered next to it. */
.field__input--invalid {
  border-color: var(--error);
  border-width: 2px;
}

.field__error {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--error);
}

/* ----------------------------------------------------------- checkboxes -- */

.check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-soft);
  cursor: pointer;
}

/* Holds whether or not the two checkboxes share a wrapper element. */
.check + .check {
  margin-top: 12px;
}

.check__input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  flex: 0 0 auto;
  accent-color: var(--orange-dark);
}

.check__text a {
  color: var(--orange-dark);
}

/* -------------------------------------------------------------- buttons -- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 4px;
  background: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
}

/* The dark orange is the only one that carries white text at AA.
   `min-height`, never `height`: the label comes from the event YAML, and a long
   one wraps to two or three lines. A fixed box would let it render outside the
   button, on top of the note below. */
.button--primary {
  width: 100%;
  min-height: 54px;
  padding: 8px 22px;
  background: var(--orange-dark);
  color: var(--white);
  text-align: center;
}

.button--secondary {
  min-height: 48px;
  padding: 8px 22px;
  border: 1.5px solid var(--orange-dark);
  color: var(--orange-dark);
  font-size: 15px;
  text-align: center;
}

.button--ghost {
  padding: 0 4px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.button--primary:hover {
  filter: brightness(0.92);
}

.button--secondary:hover,
.button--ghost:hover {
  background: var(--surface-accent);
}

.button:disabled,
.button[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  filter: none;
}

/* ---------------------------------------------------------- form chrome -- */

.form__note {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* Form-wide notice: the rate-limit text, or a failed request. */
.form__message {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-accent);
  color: var(--orange-dark);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

/* The honeypot stays in the accessibility tree's blind spot: off-screen
   rather than `display: none`, which some bots skip. */
.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

/* --------------------------------------------------------------- thanks -- */

.divider {
  height: 1px;
  margin: 6px 0;
  border: 0;
  background: var(--line);
}

.thanks__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

/* --------------------------------------------------------------- footer -- */

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

.site-footer > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  font-size: 13px;
  color: var(--text-muted);
}

.site-footer__claim {
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-soft);
}

/* `IHRE ZEIT.` is emphasised in the claim; the markup carries no colour. */
.site-footer__claim strong {
  font-weight: inherit;
  color: var(--orange-dark);
}

.site-footer__legal a {
  color: var(--text-muted);
}

/* --------------------------------------------------- single column < 860 -- */

@media (max-width: 860px) {
  .layout {
    flex-direction: column;
    align-items: stretch;
    gap: 22px;
  }

  /* The intro's children become items of `.layout`, so the card can be
     ordered between the title and the preview — the spec wants the form
     directly under the headline on a phone. */
  .intro {
    display: contents;
  }

  .intro__eyebrow {
    order: 1;
  }

  .intro__title {
    order: 2;
  }

  .intro__subtitle {
    order: 3;
  }

  .card {
    order: 4;
    max-width: none;
    margin: 6px 0;
  }

  .meta {
    order: 5;
  }

  .preview {
    order: 6;
    margin: 0;
  }

  .site-header > div,
  .layout,
  .site-footer > div {
    padding-inline: 16px;
  }
}
