/* The contact form of an Ares app's website, laid out like the iPhone apps' Contact & support (empire-ios
   Shared/Support, Shared/Design/FormPieces.swift): topic, message, "Answer to", Send, then a calm "it's arrived".
   Shared by every such page, byte for byte (web/shared/forms/README.md): aresium.de/contact (a copy in aresium
   web/public/forms/) and the hub's www.ares-empire.de/contact and /arestemis/contact (webauth/contact.py).

   This file is the layout only. Each page loads its app's look after it, which sets every custom property used here
   for the dark look (:root) and the light one (html[data-theme="light"]): aresium web/public/forms/contact.css,
   ares-empire web/contact/empire.css and arestemis.css. Both repos test that a look sets them all.

   The markup it styles (written by aresium src/web/contact-page.ts and ares-empire webauth/contact.py):
   .page > header.top (a.home with img + span, a.lang), main > section.compose (h1, p.lead, form.contact) and
   section.sent (.sent-mark, h2, p, a.back), footer.legal; then div.band with one span per letter (span.space between
   two words). Inside the form: label.heading, .glass.topic (.topic-icon, select, .chevrons), .glass.box (textarea),
   p.counter, fieldset.reply (.glass with two inputs and an hr), p.note, .trap, .problems (p.problem), button with
   .spinner. */

:root {
  --sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

[hidden] { display: none !important; }   /* also for the topic icons (SVG) */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  font-family: var(--sans); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  position: relative; overflow-x: hidden;
}
/* the wall's light: the app's colour from the top and the far corner (ProvinceWall) */
body::before, body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; }
body::before { background: var(--glow1), var(--glow2); }
/* the app's god sunk into the wall (EmpireStyle's backdrop), faint so the form stays the subject: on a wide screen at
   the left edge, fading out before the form; narrower, behind the header as in the app, fading out before the topic.
   --bust is the picture (a statue's head in profile, facing right, on a transparent ground; or none), --bust-opacity
   how faint it is. In the light look it is pressed into the wall as a grey relief. */
body::after {
  background: var(--bust) no-repeat left -24px bottom / auto min(80vh, 720px);
  opacity: var(--bust-opacity);
  /* faded on every side: the picture's own edges never show, and it ends before the form */
  -webkit-mask-image: radial-gradient(min(30vw, 420px) min(42vh, 380px) at min(13vw, 190px) calc(100% - min(38vh, 340px)), #000 40%, transparent 100%);
  mask-image: radial-gradient(min(30vw, 420px) min(42vh, 380px) at min(13vw, 190px) calc(100% - min(38vh, 340px)), #000 40%, transparent 100%);
}
html[data-theme="light"] body::after { mix-blend-mode: multiply; filter: grayscale(1); }
@media (max-width: 1179px) {
  body::after {
    position: absolute; bottom: auto; height: 420px;
    background-position: -80px -10px; background-size: auto 420px;
    -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent 88%);
    mask-image: linear-gradient(180deg, #000 30%, transparent 88%);
  }
}

.page {
  position: relative; z-index: 1; flex: 1; width: min(100%, 560px); margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 8px max(18px, env(safe-area-inset-left));
}
a:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* ── top: the mark and the name, the other language ──────────────────────── */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 34px; }
.home {
  display: inline-flex; align-items: center; gap: 10px; border-radius: 10px;
  color: var(--ink); text-decoration: none; font-size: 17px; font-weight: 700; letter-spacing: -0.01em;
}
.home img { width: 34px; height: 34px; object-fit: contain; }
.lang {
  display: inline-flex; align-items: center; height: 38px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line-soft); background: var(--card); color: var(--ink-2);
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
  font-size: 13.5px; font-weight: 600; text-decoration: none; transition: color .2s, border-color .2s, background .2s;
}
.lang:hover { color: var(--ink); border-color: var(--ink-3); background: var(--card-2); }

h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.15; }
.lead { margin: 10px 0 0; font-size: 15px; line-height: 1.55; color: var(--ink-2); max-width: 46ch; }

/* ── the form ─────────────────────────────────────────────────────────────── */
.contact { margin-top: 30px; }
.heading {
  display: block; margin: 26px 0 10px; padding: 0 4px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
}
.contact > .heading:first-child { margin-top: 0; }
.heading .optional { font-weight: 500; letter-spacing: 0.02em; text-transform: none; }

/* glass: the blurred card with a bright edge that fades (GlassCard) */
.glass {
  position: relative; border: 1px solid transparent; border-radius: 16px;
  background: var(--spec) padding-box, linear-gradient(var(--card), var(--card)) padding-box, var(--glass-edge) border-box;
  -webkit-backdrop-filter: blur(22px) saturate(140%); backdrop-filter: blur(22px) saturate(140%);
  box-shadow: var(--shadow), inset 0 1px 0 var(--edge);
  transition: box-shadow .15s ease-out, opacity .2s;
}
.glass:focus-within { box-shadow: var(--shadow), inset 0 1px 0 var(--edge), 0 0 0 2px var(--focus); }
.glass select:focus-visible { outline: none; }   /* the card shows the focus */
.contact[aria-busy="true"] .glass { opacity: 0.55; }

.contact select, .contact textarea, .contact input {
  display: block; width: 100%; margin: 0; border: 0; border-radius: 16px; background: transparent;
  color: var(--ink); font: inherit; font-size: 16px;   /* 16px, or Safari on the iPhone zooms into the field */
  outline: none;
}
.contact textarea::placeholder, .contact input::placeholder { color: var(--ink-3); opacity: 1; }

/* the topic: one row, the system menu opens on it (the iPhone form's Menu); its icon in the app's highlight */
.topic-icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%); display: flex;
  color: var(--highlight); pointer-events: none;
}
.topic-icon .icon { width: 20px; height: 20px; }
.topic select {
  -webkit-appearance: none; appearance: none; min-height: 52px; padding: 0 44px 0 52px;
  font-weight: 600; letter-spacing: -0.01em; cursor: pointer; text-overflow: ellipsis;
}
.topic select option { color: var(--ink); background: var(--bg); font-weight: 500; }
.chevrons {
  position: absolute; right: 16px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%);
  color: var(--ink-3); pointer-events: none;
}

/* eight lines to start with, growing with the text where the browser can (as the iPhone form's box) */
.box textarea { min-height: 212px; max-height: 70vh; padding: 16px; line-height: 1.5; resize: none; field-sizing: content; }
.counter { margin: 8px 4px 0; text-align: right; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.counter.over { color: var(--issue); }

/* the address to answer to and the name, one card with a line between (the iPhone form's reply box) */
.reply { margin: 0; padding: 0; border: 0; min-width: 0; }
.reply legend { float: left; width: 100%; }
.reply legend + * { clear: both; }
.reply input { min-height: 52px; padding: 0 16px; }
.reply hr { margin: 0 0 0 16px; border: 0; border-top: 1px solid var(--line-soft); }

.note { margin: 14px 4px 0; font-size: 12.5px; line-height: 1.55; color: var(--ink-3); }
.note + .note { margin-top: 6px; }
.note a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--soft-edge); text-underline-offset: 2px; }
.note a:hover { color: var(--ink); }

/* the honeypot: off screen, out of the tab order, hidden from screen readers; only bots fill it */
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* why it did not go through, in the soft problem colour (FormProblem) */
.problems { margin-top: 22px; }
.problem {
  display: flex; align-items: flex-start; gap: 8px; margin: 0 4px 12px;
  font-size: 13.5px; line-height: 1.45; color: var(--problem); overflow-wrap: anywhere;
}
.problem .icon { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.problem a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* the main button (FormButtonStyle: the app's accent, or ivory without one); the sent page's "Back" looks the same */
.contact button, .sent .back {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 50px;
  margin: 0; padding: 0 16px; border: 0; border-radius: 12px; background: var(--button); color: var(--button-ink);
  font: inherit; font-size: 16px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: opacity .15s ease-out;
}
.contact button:hover, .sent .back:hover { opacity: 0.9; }
.contact button:active, .sent .back:active { opacity: 0.75; }
.contact button:disabled { cursor: progress; opacity: 0.75; }
.spinner {
  display: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite;
}
.busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
  .glass, .lang, .contact button, .sent .back { transition: none; }
}

/* ── sent: the calm "it's arrived" (CalmDone), its mark in the app's highlight ─ */
.sent { display: flex; flex-direction: column; align-items: center; padding: 56px 10px 0; text-align: center; outline: none; }
.sent-mark {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  color: var(--highlight); background: var(--soft-fill); border: 1px solid var(--soft-edge);
}
.sent-mark .icon { width: 26px; height: 26px; stroke-width: 2.4; }
.sent h2 { margin: 22px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.sent p { margin: 10px 0 0; max-width: 34ch; font-size: 14.5px; line-height: 1.6; color: var(--ink-2); overflow-wrap: anywhere; }
.sent .back { margin-top: 40px; }

/* ── the privacy policy and imprint, quiet ───────────────────────────────── */
.legal { margin: 36px 0 0; text-align: center; font-size: 12px; color: var(--ink-3); }
.legal a { color: var(--ink-3); text-decoration: none; }
.legal a:hover { color: var(--ink); }

/* ── the app's name across the full width at the end (the iPhone apps' WordmarkBand) ─
   --band-size: about the width over the number of letters (WordmarkBand.letterSize); a span.space is half a letter
   wide, so two words read apart. --band-fill: the letters' paint, by default ink fading into the wall. */
.band {
  position: relative; z-index: 0; display: flex; justify-content: space-between; margin-top: 18px; padding: 0 4px;
  overflow: hidden; font-weight: 700; font-size: var(--band-size); line-height: 0.76;
  letter-spacing: -0.015em; opacity: 0.9; user-select: none; -webkit-user-select: none;
}
.band span {
  background: var(--band-fill);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.band .space { width: 0.5em; }

@media (min-width: 720px) {
  .top { margin-bottom: 48px; }
  h1 { font-size: 34px; }
}
