:root {
  --paper: #f4efe6;
  --paper-2: #ebe4d6;
  --reb: #4f000b;
  --ink: #1c1915;
  --ink-soft: #5e574c;
  --line: #d6cec0;
  --serif: "Fraunces", "Times New Roman", serif;
  --sans: "Outfit", "Helvetica Neue", sans-serif;
  --arabic: "IBM Plex Sans Arabic", "Outfit", sans-serif;
  --pad: clamp(1.15rem, 4vw, 2.5rem);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

html[data-theme="night"] {
  --paper: #14110f;
  --paper-2: #1c1815;
  --reb: #c45c64;
  --ink: #f4efe6;
  --ink-soft: #b8aea2;
  --line: #3a332c;
  color-scheme: dark;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}

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

body {
  min-height: 100dvh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0.01em;
  text-rendering: optimizeLegibility;
  background:
    linear-gradient(90deg, transparent 47px, color-mix(in srgb, var(--reb) 55%, transparent) 47px, color-mix(in srgb, var(--reb) 55%, transparent) 48px, transparent 48px),
    var(--paper);
  background-attachment: fixed;
}

body[dir="rtl"] {
  font-family: var(--arabic);
  background:
    linear-gradient(90deg, transparent calc(100% - 48px), color-mix(in srgb, var(--reb) 55%, transparent) calc(100% - 48px), color-mix(in srgb, var(--reb) 55%, transparent) calc(100% - 47px), transparent calc(100% - 47px)),
    var(--paper);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

h1,
p {
  margin: 0;
}

.stage {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(1.05rem + var(--safe-top)) var(--pad) 1.05rem;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.wordmark {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: 0.12em;
  font-size: 0.95rem;
}

.brand-tag {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.brand-tag::before {
  content: "·";
  margin-inline-end: 0.45rem;
  color: color-mix(in srgb, var(--ink) 28%, var(--line));
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.theme-btn {
  width: 2.9rem;
  height: 2.9rem;
  display: grid;
  place-items: center;
}

.theme-btn svg {
  width: 1.15rem;
  height: 1.15rem;
}

.lang-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 2.9rem;
  border: 1px solid color-mix(in srgb, var(--ink) 22%, var(--line));
}

.lang-switch button {
  min-width: 3.1rem;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.lang-switch button.is-on {
  background: var(--ink);
  color: var(--paper);
}

main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.2rem var(--pad) 2.4rem;
  max-width: 52rem;
}

.mark {
  color: var(--reb);
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  margin-bottom: 0.85rem;
}

h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3.1rem, 12vw, 7.4rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
  max-width: 11ch;
}

body[dir="rtl"] h1 {
  letter-spacing: 0;
  font-family: var(--arabic);
  font-weight: 400;
}

.rule {
  width: 3.2rem;
  height: 1px;
  background: var(--reb);
  margin: 1.5rem 0 1.15rem;
}

.lead {
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: 22rem;
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.6rem 1.4rem;
  padding: 1.2rem var(--pad) calc(1.4rem + var(--safe-bottom));
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.foot-links {
  display: flex;
  gap: 1.1rem;
}

.foot-links a:hover {
  color: var(--ink);
}

@media (max-width: 640px) {
  body,
  body[dir="rtl"] {
    background: var(--paper);
  }

  h1 {
    font-size: clamp(2.7rem, 16vw, 4.2rem);
  }
}
