/*
 * Eva Store legal site — Cybernetic Violet tokens from the Flutter app
 * (lib/core/theme.dart). No external fonts, images, scripts or trackers.
 * Light is the default; dark follows the operating system.
 */
:root {
  color-scheme: light dark;
  --bg: #faf9fd;
  --surface: #ffffff;
  --raised: #f3eefa;
  --floating: #fdf7ff;
  --text: #1a1429;
  --muted: #64587a;
  --faint: #9a90ae;
  --line: rgba(108, 74, 182, 0.16);
  --divider: rgba(108, 74, 182, 0.28);
  --accent: #5f3dc4;
  --accent-pressed: #54309c;
  --accent-ink: #54309c;
  --accent-tint: #f3eefa;
  --lavender: #c4b5fd;
  --on-accent: #ffffff;
  --ok: #6246a8;
  --warn: #8a4b00;
  --bad: #b3261e;
  --approval-bg: #fff4e5;
  --approval-border: #b25e00;
  --approval-text: #4d2f00;
  --focus: #5f3dc4;
  --shadow: 0 1px 2px rgba(26, 20, 41, 0.05), 0 10px 28px rgba(26, 20, 41, 0.06);
  --radius: 14px;
  --max: 1120px;
  --prose: 72ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1429;
    --surface: #231b38;
    --raised: #2e244a;
    --floating: #352b52;
    --text: #f8f6fc;
    --muted: #b8afcc;
    --faint: #8f84a8;
    --line: rgba(142, 108, 230, 0.22);
    --divider: rgba(142, 108, 230, 0.42);
    --accent: #8e6ce6;
    --accent-pressed: #a993ec;
    --accent-ink: #c4b5fd;
    --accent-tint: #2e244a;
    --on-accent: #1a1429;
    --ok: #a993ec;
    --warn: #e6c27a;
    --bad: #e88a86;
    --approval-bg: #3a2a12;
    --approval-border: #e6c27a;
    --approval-text: #ffe2b3;
    --focus: #c4b5fd;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 12px 32px rgba(0, 0, 0, 0.28);
  }
}

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

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont,
    "Noto Sans", "Noto Naskh Arabic", "IBM Plex Sans Arabic", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

html[lang="ar"] body {
  font-family: "IBM Plex Sans Arabic", "Noto Naskh Arabic", "Noto Sans Arabic",
    "Segoe UI", Tahoma, system-ui, -apple-system, sans-serif;
  line-height: 1.8;
}

html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3,
html[lang="ar"] .eyebrow,
html[lang="ar"] .brand-name {
  letter-spacing: 0;
}

html[lang="ar"] .eyebrow {
  text-transform: none;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}

a:hover {
  color: var(--accent-pressed);
}

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

::selection {
  background: var(--lavender);
  color: #1a1429;
}

.wrap {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: -5rem;
  z-index: 100;
  padding: 0.8rem 1rem;
  border-radius: 0 0 8px 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-block-end: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding-block: 0.7rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.brand-name {
  font-size: 1.05rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
  margin-inline-start: auto;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.site-nav a:hover {
  background: var(--raised);
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  background: var(--accent-tint);
  color: var(--accent-ink);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--divider);
  border-radius: 999px;
  color: var(--accent-ink);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.lang-switch:hover {
  background: var(--accent-tint);
}

/* Page head */
.page-head {
  max-width: var(--prose);
  padding-block: clamp(2rem, 5vw, 3.75rem) 0.5rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent-ink);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0.2rem 0 1rem;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.lede {
  max-width: 65ch;
  margin: 0;
  color: var(--muted);
  font-size: 1.12rem;
}

.meta {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.3rem 1rem;
  margin-block: 1.5rem 0;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.92rem;
}

.meta dt {
  color: var(--text);
  font-weight: 700;
}

.meta dd {
  margin: 0;
  color: var(--muted);
}

/* Draft / approval */
.draft-banner {
  max-width: var(--prose);
  margin-block: 1.5rem 2rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--approval-border);
  border-radius: var(--radius);
  background: var(--approval-bg);
  color: var(--approval-text);
}

.draft-banner p {
  margin: 0;
}

.draft-banner strong {
  font-weight: 750;
}

.approval {
  display: inline;
  padding: 0.05em 0.35em;
  border: 1px solid var(--approval-border);
  border-radius: 4px;
  background: var(--approval-bg);
  color: var(--approval-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;
  font-size: 0.78em;
  font-weight: 750;
  letter-spacing: 0.02em;
  line-height: 1.5;
  overflow-wrap: anywhere;
  unicode-bidi: isolate;
}

/* Layout */
.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  padding-block-end: 4rem;
}

@media (min-width: 980px) {
  .page-grid {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
  }

  .toc {
    position: sticky;
    top: 5.5rem;
  }
}

.toc {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.toc h2 {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

html[lang="ar"] .toc h2 {
  letter-spacing: 0;
  text-transform: none;
}

.toc ol {
  display: grid;
  gap: 0.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc a {
  display: block;
  padding: 0.35rem 0.4rem;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.45;
}

.toc a:hover {
  background: var(--raised);
  color: var(--text);
}

/* Prose */
.prose {
  max-width: var(--prose);
}

.prose section {
  margin-block: 2.5rem;
  scroll-margin-top: 6.5rem;
}

.prose section:first-child {
  margin-block-start: 0;
}

.prose h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  line-height: 1.25;
  letter-spacing: -0.018em;
}

.prose h3 {
  margin: 1.6rem 0 0.45rem;
  font-size: 1.1rem;
  line-height: 1.35;
}

.prose p {
  margin-block: 0.75rem;
}

.prose ul,
.prose ol {
  margin-block: 0.75rem;
  padding-inline-start: 1.45rem;
}

.prose li {
  margin-block: 0.4rem;
}

.prose li > ul,
.prose li > ol {
  margin-block: 0.25rem;
}

.prose strong {
  font-weight: 750;
}

.prose code {
  padding: 0.1em 0.3em;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--raised);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

.note {
  margin-block: 1.25rem;
  padding: 1rem 1.2rem;
  border-inline-start: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--raised);
}

.note p:first-child,
.note ul:first-child,
.note ol:first-child {
  margin-block-start: 0;
}

.note p:last-child,
.note ul:last-child,
.note ol:last-child {
  margin-block-end: 0;
}

.note--warn {
  border-inline-start-color: var(--approval-border);
  background: var(--approval-bg);
  color: var(--approval-text);
}

.note--warn a {
  color: inherit;
}

.note--info {
  border-inline-start-color: var(--accent);
}

.note h3 {
  margin-block-start: 0;
}

/* Tables */
.table-wrap {
  margin-block: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 0.95rem;
}

caption {
  padding: 0.9rem 1rem 0.35rem;
  color: var(--text);
  font-weight: 700;
  text-align: start;
}

th,
td {
  padding: 0.75rem 1rem;
  border-block-end: 1px solid var(--line);
  text-align: start;
  vertical-align: top;
}

th {
  background: var(--raised);
  color: var(--text);
  font-weight: 700;
}

tbody tr:last-child td {
  border-block-end: 0;
}

/* Home */
.hero {
  display: grid;
  gap: 2rem;
  padding-block: clamp(2.5rem, 6vw, 5rem) 1.5rem;
}

@media (min-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    align-items: center;
  }
}

.hero h1 {
  max-width: 15ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block: 1.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.7rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
}

.button:hover {
  background: var(--accent-pressed);
  color: var(--on-accent);
}

.button--ghost {
  background: transparent;
  border-color: var(--divider);
  color: var(--accent-ink);
}

.button--ghost:hover {
  background: var(--accent-tint);
  color: var(--accent-ink);
}

.hero-art {
  display: flex;
  justify-content: center;
}

.hero-art img {
  width: min(100%, 320px);
  filter: drop-shadow(0 18px 40px rgba(95, 61, 196, 0.22));
}

@media (prefers-color-scheme: dark) {
  .hero-art img {
    filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.4));
  }
}

.section-head {
  max-width: var(--prose);
  margin-block: 2rem 1rem;
}

.section-head h2 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: -0.02em;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-block: 1.25rem 2.5rem;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.card p {
  flex: 1;
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.97rem;
}

.card a {
  font-weight: 700;
}

.fact-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.7rem 1.5rem;
  margin: 1rem 0 2.5rem;
  padding: 0;
  list-style: none;
}

.fact-list li {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr);
  gap: 0.6rem;
  align-items: start;
  padding: 0.75rem 0;
  border-block-end: 1px solid var(--line);
}

.fact-list .mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent-ink);
  font-size: 0.85rem;
  font-weight: 800;
}

/* Footer */
.site-footer {
  margin-block-start: 3rem;
  padding-block: 2.5rem 1.5rem;
  border-block-start: 1px solid var(--line);
  background: var(--surface);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}

.footer-brand {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.footer-brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.footer-brand p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer h2 {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

html[lang="ar"] .site-footer h2 {
  letter-spacing: 0;
  text-transform: none;
}

.site-footer ul {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
}

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

.fine {
  margin-block: 1.5rem 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.fine p {
  margin: 0.2rem 0;
}

/* Small screens */
@media (max-width: 720px) {
  .header-inner {
    align-items: flex-start;
  }

  .site-nav {
    order: 3;
    width: 100%;
    margin-inline-start: 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-block-end: 0.25rem;
  }

  .site-nav a {
    white-space: nowrap;
  }

  .lang-switch {
    margin-inline-start: auto;
  }

  .meta {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .meta dt {
    margin-block-start: 0.5rem;
  }

  .meta dt:first-child {
    margin-block-start: 0;
  }
}

@media print {
  :root {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #ffffff;
    --raised: #f5f5f5;
    --text: #111111;
    --muted: #444444;
    --line: #cccccc;
    --divider: #999999;
    --accent: #333333;
    --accent-ink: #111111;
    --accent-tint: #f0f0f0;
    --on-accent: #ffffff;
    --approval-bg: #fff8e6;
    --approval-border: #7a4a00;
    --approval-text: #3d2500;
    --shadow: none;
  }

  .site-header,
  .toc,
  .site-footer,
  .skip-link,
  .hero-actions {
    display: none !important;
  }

  body {
    font-size: 11pt;
  }

  .wrap {
    width: 100%;
  }

  .page-grid {
    display: block;
    padding: 0;
  }

  .prose {
    max-width: none;
  }

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

  a[href^="https://"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #444444;
  }

  .draft-banner {
    border: 1px solid #7a4a00;
  }

  section {
    break-inside: avoid;
  }
}
