/* RASPIRA -- public site, account and checkout (docs/67).
   The same calm, mature visual language as the Brain (brain_ui/static/app.css):
   warm paper background, one deep-green accent, Vazirmatn, generous space.
   Standalone on purpose: the Brain page keeps its own stylesheet. No
   frameworks, no CDN, no inline styles (the CSP forbids them). */

@font-face {
  font-family: "Vazirmatn";
  src: url("/brain/assets/vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f7f5f1;
  --surface: #ffffff;
  --surface-2: #f1eee8;
  --hairline: #e6e1d8;
  --hairline-strong: #d3ccc0;
  --ink: #1c1a17;
  --ink-2: #4f4a43;
  --ink-3: #7d766c;
  --accent: #2f5d4f;
  --accent-strong: #234739;
  --accent-ink: #f8f6f2;
  --accent-soft: #e6ede9;
  --caution-bg: #f9f1e6;
  --caution-border: #ecd9bd;
  --caution-ink: #6b4a1c;
  --urgent-bg: #f8ebe8;
  --urgent-border: #e6c6bf;
  --urgent-ink: #7a2e22;
  --focus: #2f5d4f;
  --radius-s: 10px;
  --radius-m: 14px;
  --radius-l: 20px;
  --shadow: 0 1px 2px rgba(28, 26, 23, 0.04), 0 8px 28px rgba(28, 26, 23, 0.05);
  --font: "Vazirmatn", "Vazir", "Noto Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  --measure: 44rem;
  --wide: 68rem;
  --gutter: clamp(16px, 4vw, 28px);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #151412;
    --surface: #1d1c19;
    --surface-2: #242320;
    --hairline: #34322d;
    --hairline-strong: #46433c;
    --ink: #f1ede6;
    --ink-2: #c8c1b5;
    --ink-3: #8f887c;
    --accent: #8fb8a6;
    --accent-strong: #a9cdbc;
    --accent-ink: #10201a;
    --accent-soft: #223129;
    --caution-bg: #2b2418;
    --caution-border: #4d3d22;
    --caution-ink: #e2c390;
    --urgent-bg: #2d1b17;
    --urgent-border: #4d2c25;
    --urgent-ink: #e6ac9f;
    --focus: #a9cdbc;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 28px rgba(0, 0, 0, 0.25);
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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);
  font-size: 16px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent-strong);
}

button {
  font: inherit;
  color: inherit;
}

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

.skip-link {
  position: absolute;
  inset-inline-start: 12px;
  top: -48px;
  padding: 8px 14px;
  border-radius: var(--radius-s);
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.ltr {
  direction: ltr;
  unicode-bidi: isolate;
}

/* ------------------------------------------------------------------ */
/* Header                                                              */
/* ------------------------------------------------------------------ */

.site-header {
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
}

.site-header-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex;
  align-items: center;
  gap: 12px 28px;
  flex-wrap: wrap;
}

.site-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.site-brand-fa {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.site-brand-en {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--ink-3);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  flex: 1;
}

.site-nav a,
.site-account {
  color: var(--ink-2);
  text-decoration: none;
  font-size: 15px;
}

.site-nav a:hover,
.site-account:hover {
  color: var(--ink);
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

.site-account {
  padding: 6px 16px;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
}

/* ------------------------------------------------------------------ */
/* Main                                                                */
/* ------------------------------------------------------------------ */

.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 56px) var(--gutter);
}

.site-main-narrow {
  max-width: var(--measure);
  margin: 0 auto;
}

.site-main-center {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.page-title {
  margin: 6px 0 0;
  font-size: clamp(26px, 4.2vw, 36px);
  line-height: 1.4;
  font-weight: 800;
}

.page-lede {
  margin: 14px 0 0;
  max-width: var(--measure);
  color: var(--ink-2);
  font-size: 17px;
}

.section {
  margin-top: clamp(32px, 6vw, 56px);
}

.section-title {
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 700;
}

/* Prose (legal documents, about, product copy) */

.prose {
  max-width: var(--measure);
  color: var(--ink);
}

.prose h2 {
  margin: 32px 0 8px;
  font-size: 20px;
  font-weight: 700;
}

.prose h3 {
  margin: 22px 0 6px;
  font-size: 17px;
  font-weight: 700;
}

.prose p {
  margin: 10px 0;
  color: var(--ink-2);
}

.prose ul {
  margin: 10px 0;
  padding-inline-start: 22px;
  color: var(--ink-2);
}

.prose li {
  margin: 4px 0;
}

.content-fact {
  color: var(--ink);
  font-weight: 600;
}

.content-missing {
  color: var(--caution-ink);
  font-weight: 700;
}

.meta-line {
  margin: 10px 0 0;
  color: var(--ink-3);
  font-size: 13px;
}

/* Notices */

.notice {
  margin: 18px 0 0;
  padding: 12px 16px;
  border-radius: var(--radius-m);
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 15px;
}

.notice-caution {
  background: var(--caution-bg);
  border-color: var(--caution-border);
  color: var(--caution-ink);
}

.notice-success {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--ink);
}

.notice-urgent {
  background: var(--urgent-bg);
  border-color: var(--urgent-border);
  color: var(--urgent-ink);
}

/* Cards and grids */

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 30px);
}

.card + .card {
  margin-top: 18px;
}

.card-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
}

.card-text {
  margin: 8px 0 0;
  color: var(--ink-2);
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
}

.grid .card + .card {
  margin-top: 0;
}

.checklist {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.checklist li {
  position: relative;
  margin: 8px 0;
  padding-inline-start: 26px;
  color: var(--ink-2);
}

.checklist li::before {
  content: "";
  position: absolute;
  inset-inline-start: 2px;
  top: 0.62em;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.85;
}

/* Buttons */

.button,
.submit-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 15px;
  padding: 11px 24px;
  min-height: 44px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, transform 140ms ease;
}

.button:hover,
.submit-button:hover {
  background: var(--accent-strong);
}

.button:active,
.submit-button:active {
  transform: translateY(1px);
}

.button-quiet {
  background: transparent;
  color: var(--accent-strong);
  border: 1px solid var(--hairline-strong);
}

.button-quiet:hover {
  background: var(--surface-2);
}

.button[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

.actions {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.inline-form {
  margin: 0;
}

.link-button {
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 14px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.link-button:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

/* Product page */

.product-hero {
  display: grid;
  gap: clamp(24px, 5vw, 48px);
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: start;
}

@media (max-width: 820px) {
  .product-hero {
    grid-template-columns: 1fr;
  }
}

.offer-card {
  position: sticky;
  top: 20px;
}

.offer-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.offer {
  padding: 16px 0;
  border-bottom: 1px solid var(--hairline);
}

.offer:last-child {
  border-bottom: 0;
}

.offer-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.offer-price {
  margin: 4px 0 0;
  font-size: 24px;
  font-weight: 800;
}

.offer-price-unit {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
}

.offer-terms {
  margin: 2px 0 12px;
  color: var(--ink-3);
  font-size: 14px;
}

/* Tables (orders) */

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  text-align: start;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}

.data-table th {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 600;
}

.summary-list {
  margin: 12px 0 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 20px;
}

.summary-list dt {
  color: var(--ink-3);
  font-size: 14px;
}

.summary-list dd {
  margin: 0;
  font-weight: 600;
}

.total-row {
  font-size: 18px;
  font-weight: 800;
}

.status {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink-2);
  white-space: nowrap;
}

.status-paid {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-pending_payment {
  background: var(--caution-bg);
  color: var(--caution-ink);
}

.status-payment_failed,
.status-cancelled,
.status-refunded {
  background: var(--urgent-bg);
  color: var(--urgent-ink);
}

/* Forms (account, checkout) */

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}

.form-label {
  font-size: 14px;
  font-weight: 600;
}

.form-input {
  font: inherit;
  font-size: 16px;
  padding: 10px 14px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-m);
  background: var(--surface);
  color: var(--ink);
}

.form-input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.form-hint {
  color: var(--ink-3);
  font-size: 13px;
}

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  font-size: 14px;
  color: var(--ink-2);
}

.consent input {
  margin-top: 6px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex: none;
}

/* Account sign-in cards (docs/64; same shape as the Brain's) */

.login-card {
  width: min(100%, 27rem);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  padding: clamp(22px, 5vw, 32px);
}

.login-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.login-support {
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 15px;
}

.login-error {
  margin: 16px 0 0;
  padding: 10px 14px;
  border-radius: var(--radius-m);
  background: var(--urgent-bg);
  border: 1px solid var(--urgent-border);
  color: var(--urgent-ink);
  font-size: 14px;
}

.login-form {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: start;
}

.login-label {
  font-size: 14px;
  font-weight: 600;
}

.login-input {
  direction: ltr;
  text-align: end;
  font: inherit;
  font-size: 17px;
  padding: 11px 14px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-m);
  background: var(--surface);
  color: var(--ink);
}

.login-input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.login-submit {
  align-self: flex-start;
  margin-top: 6px;
}

.identity-ltr {
  direction: ltr;
  unicode-bidi: isolate;
}

.identity-code {
  text-align: center;
  letter-spacing: 0.35em;
  font-size: 20px;
}

.identity-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.identity-inline-form {
  margin: 0;
}

.identity-link,
.identity-link-button {
  white-space: nowrap;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.identity-link:hover,
.identity-link-button:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.identity-note {
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 13px;
}

.identity-access {
  margin: 16px 0 0;
  padding: 10px 14px;
  border-radius: var(--radius-m);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 15px;
}

.identity-primary {
  margin-top: 14px;
}

.identity-subtitle {
  margin: 24px 0 0;
  font-size: 16px;
  font-weight: 700;
}

.identity-devices {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  border-top: 1px solid var(--hairline);
}

.identity-device {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
}

.identity-device-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.identity-device-name {
  font-weight: 600;
  font-size: 15px;
}

.identity-device-meta {
  color: var(--ink-3);
  font-size: 13px;
}

.account-layout {
  display: grid;
  gap: 18px;
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
}

.site-main-center > .card,
.site-main-center > section.card {
  width: 100%;
  max-width: var(--measure);
}

.account-layout .login-card {
  width: 100%;
}

/* ------------------------------------------------------------------ */
/* Footer                                                              */
/* ------------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink-3);
  font-size: 14px;
}

.site-footer-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 28px var(--gutter) 32px;
  display: grid;
  gap: 22px 40px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  align-items: start;
}

.site-footer-title {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.site-footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer-links li {
  margin: 4px 0;
}

.site-footer a {
  color: var(--ink-2);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.site-footer-facts {
  margin: 0;
}

.site-footer-facts p {
  margin: 4px 0;
}

.enamad-seal img {
  display: block;
  width: 96px;
  height: auto;
  cursor: pointer;
}

.site-footer-note {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}
