/* Roomie Match legal site. Colours and fonts follow the app's theme. */
:root {
  --primary: #0A326F;              /* Roomie Match navy, from the logo */
  --primary-soft: rgba(10, 50, 111, 0.08);
  --secondary: #FF2D87;
  --bg: #F6F8FF;
  --surface: #FFFFFF;
  --alternate: #E4E9FA;
  --text: #0A0A0F;
  --muted: #626274;
  --error: #D92D20;
  --error-soft: #FFF1F0;
  --success: #00A37D;
  --pending: #FFF4C2;
  --pending-text: #6B5900;
  --radius: 20px;
  --shadow: 0 4px 20px rgba(10, 10, 40, 0.06);
  --font: 'Urbanist', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #457DD3;            /* lighter tint of the navy, readable on dark */
    --primary-soft: rgba(69, 125, 211, 0.16);
    --secondary: #FF5CA1;
    --bg: #0A0A0F;
    --surface: #1A1A24;
    --alternate: #2A2A38;
    --text: #FFFFFF;
    --muted: #A0A0B4;
    --error: #FF6B60;
    --error-soft: #2C1414;
    --success: #00E091;
    --pending: #3A3210;
    --pending-text: #FFE27A;
    --shadow: none;
  }
}
html[dir="rtl"] { --font: 'IBM Plex Sans Arabic', 'Urbanist', system-ui, 'Segoe UI', Tahoma, sans-serif; }
html[data-ui="ar"] [data-lang="en"], html[data-ui="en"] [data-lang="ar"] { display: none !important; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 17px; line-height: 1.7; overflow-wrap: anywhere;
}
html[dir="rtl"] body { line-height: 1.85; }
a { color: var(--primary); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 8px;
}

/* Header */
.top {
  position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--alternate);
}
.top-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 800; font-size: 19px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: #FFFFFF; border: 1px solid var(--alternate); padding: 4px;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.top-nav { display: flex; gap: 4px; margin-inline-start: auto; }
.top-nav a {
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 15px; padding: 8px 12px; border-radius: 999px;
}
.top-nav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }
.lang-switch { display: flex; background: var(--bg); border: 1px solid var(--alternate); border-radius: 999px; padding: 3px; flex: none; }
.lang-switch button {
  border: 0; background: transparent; color: var(--muted); font: 700 14px var(--font); padding: 6px 12px;
  border-radius: 999px; cursor: pointer; min-height: 34px;
}
html[data-ui="en"] .lang-switch [data-set-lang="en"], html[data-ui="ar"] .lang-switch [data-set-lang="ar"] {
  background: var(--primary); color: #fff;
}
@media (max-width: 860px) {
  .top-nav { display: none; }
  .lang-switch { margin-inline-start: auto; }
}

/* Draft banner and open decisions */
.draft-banner { display: none; }
html[data-draft] .draft-banner {
  display: block; background: var(--pending); color: var(--pending-text); font-size: 14px; font-weight: 600;
  text-align: center; padding: 8px 16px;
}
.pending { border-radius: 6px; padding: 0 4px; }
html[data-draft] .pending { background: var(--pending); color: var(--pending-text); }

/* Layout */
.hero { max-width: 1080px; margin: 0 auto; padding: 40px 16px 8px; }
.eyebrow { color: var(--primary); font-weight: 700; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; margin: 0 0 8px; }
html[dir="rtl"] .eyebrow { letter-spacing: 0; }
h1 { font-size: clamp(30px, 6vw, 44px); line-height: 1.15; margin: 0 0 12px; font-weight: 800; }
.lede { color: var(--muted); font-size: 19px; margin: 0; max-width: 680px; }
.meta { color: var(--muted); font-size: 14px; margin-top: 16px; }

.layout { max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; }
.toc { position: sticky; top: 84px; font-size: 15px; }
.toc summary { font-weight: 700; margin: 0 0 8px; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: '▾'; color: var(--muted); display: none; }
.toc:not([open]) summary { margin: 0; }
.toc ol { list-style: none; margin: 0; padding: 0; border-inline-start: 2px solid var(--alternate); }
.toc a { display: block; padding: 6px 14px; color: var(--muted); text-decoration: none; line-height: 1.4; }
.toc a:hover { color: var(--primary); }
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .toc { position: static; background: var(--surface); border: 1px solid var(--alternate); border-radius: var(--radius); padding: 12px 16px; }
  .toc summary::after { display: inline; }
  .toc[open] summary::after { content: '▴'; }
}

.doc { background: var(--surface); border: 1px solid var(--alternate); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(20px, 4vw, 40px); }
.doc section + section { margin-top: 36px; padding-top: 4px; }
.doc h2 { font-size: 23px; line-height: 1.3; margin: 0 0 12px; font-weight: 800; }
.doc h3 { font-size: 18px; margin: 20px 0 6px; }
.doc p { margin: 0 0 12px; }
.doc ul, .doc ol { margin: 0 0 12px; padding-inline-start: 22px; }
.doc li { margin-bottom: 6px; }
.doc li::marker { color: var(--primary); }

.summary { background: var(--primary-soft); border-radius: 16px; padding: 18px 20px; margin-bottom: 32px; }
.summary h2 { font-size: 18px; margin-bottom: 8px; }
.summary ul { margin: 0; }
.note { border-inline-start: 4px solid var(--primary); background: var(--bg); border-radius: 10px; padding: 12px 16px; margin: 12px 0; }
.note.warn { border-color: var(--error); background: var(--error-soft); }

.table-wrap { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--alternate); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.55; }
th, td { text-align: start; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--alternate); }
th { background: var(--bg); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
@media (max-width: 600px) {
  table.stack thead { display: none; }
  table.stack tr { display: block; border-bottom: 1px solid var(--alternate); padding: 8px 0; }
  table.stack td { display: block; border: 0; padding: 4px 12px; }
  table.stack td::before { content: attr(data-th); display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
  html[dir="rtl"] table.stack td::before { text-transform: none; }
}

/* Index cards */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 640px) { .cards { grid-template-columns: minmax(0, 1fr); } }
.card {
  display: block; background: var(--surface); border: 1px solid var(--alternate); border-radius: var(--radius);
  padding: 22px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--primary); transform: translateY(-2px); }
.card .ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); margin-bottom: 12px; }
.card h2 { margin: 0 0 4px; font-size: 20px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.card.danger .ico { background: var(--error-soft); color: var(--error); }

/* Steps and form */
.steps { counter-reset: s; list-style: none; padding: 0 !important; }
.steps li { counter-increment: s; position: relative; padding-inline-start: 46px; margin-bottom: 14px; min-height: 32px; }
.steps li::before {
  content: counter(s); position: absolute; inset-inline-start: 0; top: 0; width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 15px;
}
.option { border: 1px solid var(--alternate); border-radius: 16px; padding: 20px; margin: 16px 0; }
.option h3 { margin-top: 0; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); vertical-align: middle; margin-inline-start: 6px; }
form { display: grid; gap: 14px; margin-top: 8px; }
label { font-weight: 700; font-size: 15px; display: block; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 14px; font-weight: 400; margin-top: 4px; }
input[type="email"], input[type="password"], textarea {
  width: 100%; font: 16px var(--font); color: var(--text); background: var(--bg); border: 1px solid var(--alternate);
  border-radius: 12px; padding: 12px 14px; min-height: 48px;
}
textarea { resize: vertical; min-height: 96px; }
input[type="email"] { direction: ltr; text-align: start; }
html[dir="rtl"] input[type="email"] { text-align: right; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 15px; }
.check input { width: 20px; height: 20px; margin-top: 4px; flex: none; accent-color: var(--error); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 24px;
  border-radius: 999px; border: 0; font: 700 16px var(--font); cursor: pointer; text-decoration: none;
}
.btn-danger { background: var(--error); color: #fff; }
.btn-primary { background: var(--primary); color: #fff; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-ghost { background: var(--primary-soft); color: var(--primary); }
.btn.copied::after { content: ' ✓'; }
.form-error { color: var(--error); font-weight: 600; font-size: 15px; margin: 0; }
.ready { border: 2px solid var(--success); border-radius: 16px; padding: 20px; margin-top: 20px; }
.ready h3 { margin-top: 0; }
.ready:focus { outline: none; }
.ready textarea { min-height: 170px; font-size: 14px; direction: ltr; text-align: left; }
html[dir="rtl"] .ready textarea { direction: rtl; text-align: right; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* Account email links (/reset) */
.layout.narrow { display: block; max-width: 640px; margin: 0; margin-inline: auto; }
.hero:has(+ .layout.narrow) { max-width: 640px; }
.state:focus { outline: none; }
.state[hidden] { display: none; }
.state form { margin-top: 16px; }
html[dir="rtl"] input[type="password"] { text-align: right; }

/* Footer */
.foot { border-top: 1px solid var(--alternate); background: var(--surface); }
.foot-inner { max-width: 1080px; margin: 0 auto; padding: 24px 16px; display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; font-size: 15px; color: var(--muted); }
.foot-inner nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.foot-inner a { color: var(--muted); text-decoration: none; }
.foot-inner a:hover { color: var(--primary); }
.foot-inner .contact { margin-inline-start: auto; }
@media (max-width: 640px) { .foot-inner .contact { margin-inline-start: 0; } }
bdi, .ltr { unicode-bidi: isolate; }
.ltr { direction: ltr; }
@media print { .top, .toc, .foot, .draft-banner { display: none !important; } .layout { display: block; } .doc { border: 0; box-shadow: none; } }
