/* ==========================================================================
   mithaq — design system
   --------------------------------------------------------------------------
   Single source of truth for mithaq.de. Loaded by the static Pages documents
   AND by the Worker-rendered result pages (same origin), which is why it lives
   in public/ at a stable, unhashed path.

   Tokens and type roles follow mithaq-social-studio.html verbatim:
     Fraunces   -> display / serif
     Geist      -> body / sans
     Geist Mono -> eyebrows, labels, meta
     Amiri      -> ALL Arabic (ميثاق, ۞) — never Fraunces
   ========================================================================== */

/* ---------- self-hosted fonts (no Google Fonts CDN) ---------- */

/* Fraunces — variable (wght 300..600 + opsz). */
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces.woff2") format("woff2");
  font-weight: 300 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-italic.woff2") format("woff2");
  font-weight: 300 600;
  font-style: italic;
  font-display: swap;
}

/* Geist — body. */
@font-face {
  font-family: "Geist";
  src: url("/fonts/geist-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("/fonts/geist-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* Geist Mono — eyebrows, labels, meta. */
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/geist-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/geist-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* Amiri — Arabic only. unicode-range keeps it off Latin runs. */
@font-face {
  font-family: "Amiri";
  src: url("/fonts/amiri-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

/* ---------- tokens ---------- */

:root {
  --paper: #f6f1e7;
  --paper-deep: #efe7d6;
  --bg-card: #fbf8f1;
  --ink: #211c14;
  --ink-soft: #5a5141;
  --ink-mute: #8a7f68;
  --rule: #d9cfba;
  --pine: #1f3d32;
  --pine-deep: #16302a;
  --brass: #a8854e;
  --brass-soft: #c4a877;
  --brass-ink: #8a6a37;
  --night: #17140f;

  /* Not a brand token — error/validation only. */
  --error: #9a3b2e;

  --serif: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --arabic: "Amiri", "Iowan Old Style", serif;

  --maxw: 1080px;
}

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

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink);
  background: radial-gradient(120% 80% at 50% -8%, var(--paper-deep) 0%, var(--paper) 46%) fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection {
  background: var(--pine);
  color: var(--paper);
}

/* Subtle eight-point geometric texture. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill='none' stroke='%231f3d32' stroke-width='1'%3E%3Cpath d='M30 4 L42 16 L56 16 L56 30 L42 42 L42 56 L30 56 L18 44 L4 44 L4 30 L18 18 L18 4 Z' transform='translate(0,0) scale(0.5)'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 46px 46px;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- brand: wortmarke + seal ---------- */

/* mithaq<span class="ar">ميثاق</span> */
.mark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 25px;
  letter-spacing: 0.005em;
  color: var(--ink);
  text-decoration: none;
}
.mark .ar {
  font-family: var(--arabic);
  font-weight: 400;
  color: var(--brass);
  margin-left: 0.32em;
  letter-spacing: 0;
  font-size: 0.86em;
}

/* Achtpunkt-Siegel ۞ (Rub-el-Hizb) — die mithaq-Signatur. */
.seal {
  font-family: var(--arabic);
  line-height: 1;
  color: var(--brass);
}

/* ---------- meta type role (Geist Mono) ---------- */

.eyebrow {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0 0 22px;
}

.badge {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pine);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 6px 13px;
  background: rgba(255, 255, 255, 0.35);
  white-space: nowrap;
}

/* ---------- top bar ---------- */

header.bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 30px 28px 0;
  max-width: var(--maxw);
  margin: 0 auto;
}

/* ---------- hero ---------- */

.hero {
  padding: 76px 0 18px;
}

h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(42px, 7.2vw, 84px);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0 0 26px;
  max-width: 14ch;
}
h1 em {
  font-style: italic;
  color: var(--pine);
}

.lede {
  font-size: clamp(17px, 2.1vw, 21px);
  color: var(--ink-soft);
  max-width: 56ch;
  margin: 0 0 14px;
}

.verse {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: var(--pine-deep);
  font-size: 18px;
  margin: 30px 0 0;
}
.verse .ref {
  display: block;
  font-style: normal;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
  margin-top: 8px;
}

/* ---------- staggered reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}
.d1 { animation-delay: 0.05s; }
.d2 { animation-delay: 0.16s; }
.d3 { animation-delay: 0.27s; }
.d4 { animation-delay: 0.38s; }
.d5 { animation-delay: 0.5s; }
.d6 { animation-delay: 0.62s; }

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .done.show {
    animation: none;
    opacity: 1;
    transform: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ---------- pillars ---------- */

.pillars {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
  margin: 64px 0 8px;
}
.pillar {
  background: var(--paper);
  padding: 30px 28px;
}
.pillar .num {
  font-family: var(--mono);
  color: var(--brass-soft);
  font-size: 12px;
  letter-spacing: 0.14em;
  display: block;
  margin-bottom: 14px;
}
.pillar h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 21px;
  margin: 0 0 8px;
  color: var(--ink);
}
.pillar p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
}

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

.signup {
  margin: 86px auto 40px;
  max-width: 620px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 40px clamp(24px, 5vw, 48px) 36px;
  box-shadow: 0 24px 60px -36px rgba(31, 61, 50, 0.4);
  backdrop-filter: blur(2px);
}
.signup h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.15;
  margin: 0 0 8px;
}
.signup .sub {
  color: var(--ink-soft);
  margin: 0 0 28px;
  font-size: 15px;
}

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

.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.field label .opt {
  color: var(--ink-mute);
  text-transform: none;
  letter-spacing: 0.02em;
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

input,
select,
textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 12px 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea {
  resize: vertical;
  min-height: 76px;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--pine);
  box-shadow: 0 0 0 3px rgba(31, 61, 50, 0.12);
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235a5141' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* Honeypot — must stay reachable for bots, invisible to people. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.consent {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin: 20px 0 4px;
}
.consent input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  flex: 0 0 auto;
  accent-color: var(--pine);
}
.consent label {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.45;
}
.consent a {
  color: var(--pine);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.err {
  display: none;
  color: var(--error);
  font-size: 12.5px;
  margin-top: 6px;
}
.field.invalid .err {
  display: block;
}
.field.invalid input,
.field.invalid select {
  border-color: var(--error);
}

button.cta {
  width: 100%;
  margin-top: 22px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--paper);
  background: var(--pine);
  border: 1px solid var(--pine);
  border-radius: 10px;
  padding: 15px 18px;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.06s ease;
}
button.cta:hover {
  background: var(--pine-deep);
  border-color: var(--pine-deep);
}
button.cta:active {
  transform: translateY(1px);
}
button.cta:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}
button.cta[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.founders {
  font-family: var(--mono);
  text-align: center;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 18px 0 0;
}

/* Form-level notice (e.g. gated while the DSE is not live). */
.notice {
  border: 1px dashed var(--rule);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.4);
  padding: 14px 16px;
  margin: 0 0 24px;
  color: var(--ink-soft);
  font-size: 13.5px;
}
.notice strong {
  color: var(--ink);
  font-weight: 500;
}

/* ---------- success state ---------- */

.done {
  display: none;
  text-align: center;
  padding: 14px 0 6px;
}
.done.show {
  display: block;
  animation: rise 0.6s ease forwards;
}
.done .seal {
  font-size: 44px;
  margin-bottom: 12px;
}
.done h2 {
  margin-bottom: 10px;
}
.done p {
  color: var(--ink-soft);
  font-size: 15px;
  max-width: 42ch;
  margin: 0 auto;
}

/* ---------- worker-rendered result pages ---------- */

.result {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: clamp(64px, 14vh, 140px) auto 40px;
  padding: 44px clamp(24px, 5vw, 48px) 40px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--rule);
  border-radius: 18px;
  box-shadow: 0 24px 60px -36px rgba(31, 61, 50, 0.4);
  text-align: center;
}
.result .seal {
  font-size: 46px;
  margin-bottom: 14px;
}
.result h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(28px, 4.4vw, 38px);
  line-height: 1.14;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  max-width: none;
}
.result p {
  color: var(--ink-soft);
  font-size: 15px;
  max-width: 46ch;
  margin: 0 auto 10px;
}
.result .actions {
  margin-top: 26px;
}
.result a.link {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--pine);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.result a.link:hover {
  color: var(--pine-deep);
}

/* ---------- prose (Impressum / Datenschutz) ---------- */

.prose {
  padding: 56px 0 24px;
  max-width: 72ch;
}
.prose h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.1;
  margin: 0 0 8px;
  max-width: none;
}
.prose h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 21px;
  margin: 34px 0 8px;
}
.prose p,
.prose li {
  color: var(--ink-soft);
  font-size: 15.5px;
}
.prose a {
  color: var(--pine);
  text-underline-offset: 2px;
}
.prose address {
  font-style: normal;
  color: var(--ink-soft);
  font-size: 15.5px;
}

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

footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--rule);
  margin-top: 40px;
  padding: 26px 0 44px;
}
footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 26px;
  align-items: center;
  justify-content: space-between;
}
footer .copy {
  font-family: var(--mono);
  color: var(--ink-mute);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
}
/* The seal, once, quietly. */
footer .copy .seal {
  font-size: 15px;
  color: var(--brass-soft);
}
footer .links {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
footer a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13.5px;
}
footer a:hover {
  color: var(--pine);
}
footer a:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- responsive ---------- */

@media (max-width: 620px) {
  .pillars {
    grid-template-columns: 1fr;
  }
  .row {
    grid-template-columns: 1fr;
  }
  .hero {
    padding-top: 54px;
  }
  header.bar {
    padding-top: 24px;
  }
  footer .wrap {
    justify-content: flex-start;
  }
}
