/* Hosted contact pages: shared layout. Colours, fonts and radius come from the site's tokens
   (GET /theme/<site>.css, built from config/mail.yaml); brand touches live in sites/<site>/site.css.
   No framework, no external request. Logical properties throughout, so rtl needs no overrides. */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
[dir="rtl"] body { font-family: var(--font-arabic, var(--font-sans, system-ui, sans-serif)); }

main { flex: 1; position: relative; }

h1, h2, h3 { margin: 0; font-family: var(--font-heading, inherit); line-height: 1.15; text-wrap: balance; }
[dir="rtl"] :is(h1, h2, h3) { font-family: inherit; line-height: 1.4; }
h1 { font-size: clamp(1.9rem, 4.6vw, 3.1rem); letter-spacing: -0.03em; }
[dir="rtl"] h1 { letter-spacing: 0; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: var(--accent); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; }
[hidden] { display: none !important; }

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }

.skip {
  position: absolute;
  inset-inline-start: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
}
.skip:focus { top: 1rem; }

.backdrop { position: absolute; inset: 0 0 auto; height: 26rem; z-index: -1; pointer-events: none; }

/* Header */
.top { border-bottom: 1px solid var(--line); }
.top__inner { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; flex-wrap: wrap; min-height: 4.25rem; padding-block: 0.6rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); font-weight: 700; font-size: 1.15rem; letter-spacing: 0.01em; text-decoration: none; }
.brand__mark { width: 2rem; height: 2rem; border-radius: 8px; }
.brand b { color: var(--accent); font-weight: 700; }
/* Brand names are written left to right, whatever the page direction */
.brand__name { direction: ltr; unicode-bidi: isolate; }
.top__nav { display: flex; align-items: center; gap: 0.5rem 1.25rem; flex-wrap: wrap; font-size: 0.93rem; }
.langs { display: flex; gap: 0.15rem; }
.langs a { display: block; padding: 0.3rem 0.6rem; border-radius: 999px; color: var(--muted); text-decoration: none; }
.langs a:hover { color: var(--ink); }
.langs a[aria-current] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.back { color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); text-decoration: underline; }
.back::before { content: "←"; margin-inline-end: 0.4rem; }
[dir="rtl"] .back::before { content: "→"; }

/* Page head */
.head { padding: clamp(2rem, 6vw, 4rem) 0 clamp(1.75rem, 4vw, 2.75rem); }
.head h1 { max-width: 20em; }
.eyebrow { display: inline-flex; align-items: center; gap: 0.6rem; margin: 0 0 1rem; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
[dir="rtl"] .eyebrow { letter-spacing: 0; font-size: 0.9rem; }
.lead { max-width: 40em; margin: 1.1rem 0 0; font-size: clamp(1.05rem, 1.6vw, 1.22rem); color: var(--muted); }

/* Layout: form + aside */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; padding-bottom: clamp(3rem, 8vw, 5rem); }
.aside { display: grid; gap: 1.25rem; }
.aside:not(:has(.aside__card)) { align-self: end; }
.aside p { margin: 0; }
.aside__card { padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.aside__card h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }
.aside__card p, .aside__card dd { color: var(--muted); font-size: 0.95rem; }
.ticks li { position: relative; padding: 0.35rem 0; padding-inline-start: 1.6rem; color: var(--muted); font-size: 0.97rem; }
.ticks li::before { content: "✓"; position: absolute; inset-inline-start: 0; color: var(--accent-2); font-weight: 700; }
.facts { margin: 0 0 1.1rem; }
.facts dt { font-size: 0.8rem; color: var(--muted); }
.facts dd { margin: 0; color: var(--ink); font-weight: 600; }
.trust { margin: 0 0 0.4rem; padding-top: 1rem; border-top: 1px solid var(--line); font-family: inherit; font-size: 0.85rem; color: var(--accent-2); }

/* Form */
.card { padding: clamp(1.25rem, 3vw, 2.25rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.form__title { font-size: 1.35rem; margin-bottom: 0.5rem; }
.form__note { margin: 0 0 1.25rem; font-size: 0.875rem; color: var(--muted); }

.switch { margin: 0 0 1rem; padding: 0; border: 0; min-width: 0; }
.switch legend { padding: 0; margin-bottom: 0.5rem; font-size: 0.92rem; font-weight: 600; }
.switch__options { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 0.3rem; padding: 0.3rem; border: 1px solid var(--line-strong); border-radius: calc(var(--radius) - 2px); background: var(--field); }
.switch__option { position: relative; display: block; }
.switch__option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch__option span { display: grid; place-items: center; min-height: 2.75rem; padding: 0.5rem 0.75rem; border-radius: calc(var(--radius) - 6px); color: var(--muted); font-weight: 600; text-align: center; line-height: 1.25; transition: background-color 0.15s ease, color 0.15s ease; }
.switch__option input:hover + span { color: var(--ink); }
.switch__option input:checked + span { background: var(--button); color: var(--button-ink); }
.switch__option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.25rem; }
.field { display: grid; gap: 0.4rem; align-content: start; margin: 0 0 1.15rem; min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field label { font-size: 0.92rem; font-weight: 600; }
.field__req { color: var(--accent); }
.field :is(input, select, textarea) {
  width: 100%;
  min-height: 2.9rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background-color: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field ::placeholder { color: var(--muted); opacity: 0.75; }
.field :is(input, select, textarea):focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field :is(input, select, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field textarea { resize: vertical; min-height: 9rem; line-height: 1.5; }
.field select { text-overflow: ellipsis; }
.field [aria-invalid="true"] { border-color: var(--danger); }
.field__error { margin: 0; font-size: 0.875rem; color: var(--danger); }
[dir="rtl"] .field [dir="ltr"] { text-align: right; }

/* Off-screen rather than display:none, which some robots detect */
.trap { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

.status { margin: 0 0 1.15rem; padding: 0.75rem 1rem; border: 1px solid var(--line-strong); border-radius: 10px; font-size: 0.95rem; }
.status--error { border-color: var(--danger); color: var(--danger); }

.form__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; }
.form__foot p { margin: 0; flex: 1 1 14rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.7rem 1.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-ink);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn:hover:not([disabled]) { box-shadow: 0 10px 26px -12px var(--button); }
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.is-sending .btn[disabled] { cursor: progress; }
.btn--ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn--ghost:hover:not([disabled]) { border-color: var(--ink); box-shadow: none; }

.done:focus { outline: none; }
.done h2 { color: var(--accent-2); font-size: 1.5rem; margin-bottom: 0.6rem; }
.done p { color: var(--muted); margin-bottom: 1.5rem; }

/* Footer */
.foot { border-top: 1px solid var(--line); background: var(--bg-tint); color: var(--muted); font-size: 0.88rem; }
.foot__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; padding-block: 1.25rem; }
.foot p { margin: 0; }
.foot ul { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--ink); }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 620px) {
  .fields { grid-template-columns: minmax(0, 1fr); }
  .form__foot .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
