/*
 * delvia.simak.ai — one stylesheet for every page and every locale.
 *
 * Tokens are the app's canonical design-system values, so the site and the
 * product read as one thing. Externalized (rather than inlined per page) so
 * the Caddy vhost can serve the static handle under a strict CSP without
 * 'unsafe-inline'.
 */

/* IBM Plex Sans — self-hosted, not the Google Fonts CDN: a health app that
   advertises privacy shouldn't hand visitor IPs to a font CDN. unicode-range
   means a Russian reader never downloads the Arabic face. */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-sans-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-sans-latin-ext-600-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-sans-cyrillic-400-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-sans-cyrillic-600-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

/* Canonical design-system tokens — light, then dark. Components only ever
   reference these, never a raw hex. */
:root {
  --canvas: #fafbfc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --border: #e2e8f0;
  --t1: #0f172a;
  --t2: #475569;
  --t3: #94a3b8;
  --primary: #0f766e;
  --primary-pressed: #115e59;
  --primary-tint: #f0fdfa;
  --success: #16a34a;
  --danger: #dc2626;
  --danger-tint: #fef2f2;
  --on-primary: #ffffff;

  --measure: 44rem;
  --radius: 12px;
  --font: 'IBM Plex Sans', -apple-system, 'Segoe UI', Roboto, sans-serif;
}

:root:lang(ar),
[dir='rtl'] {
  --font: 'IBM Plex Sans Arabic', 'IBM Plex Sans', -apple-system, 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0b1220;
    --surface: #111a2c;
    --surface-alt: #1a2436;
    --border: #253248;
    --t1: #f1f5f9;
    --t2: #94a3b8;
    --t3: #64748b;
    --primary: #2dd4bf;
    --primary-pressed: #14b8a6;
    --primary-tint: #0f2e2b;
    --success: #4ade80;
    --danger: #f87171;
    --danger-tint: #2d1416;
    --on-primary: #0b1220;
  }
}

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

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

body {
  background: var(--canvas);
  color: var(--t1);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
}

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

.skip {
  position: absolute;
  inset-inline-start: -9999px;
}
.skip:focus {
  inset-inline-start: 1rem;
  top: 1rem;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
}

/* ---------------------------------------------------------------- chrome */

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.site-head {
  border-bottom: 1px solid var(--border);
  padding-block: 1rem;
}

.site-head .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--t1);
  font-weight: 600;
  margin-inline-end: auto;
}

.brand img {
  width: 28px;
  height: 28px;
}

.langs {
  display: flex;
  gap: 0.15rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.langs a {
  color: var(--t2);
  text-decoration: none;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.langs a:hover {
  background: var(--surface-alt);
  color: var(--t1);
}

.langs a[aria-current='true'] {
  background: var(--primary-tint);
  color: var(--primary);
  font-weight: 600;
}

main {
  flex: 1;
  padding-block: 2.5rem 4rem;
}

.site-foot {
  border-top: 1px solid var(--border);
  padding-block: 1.5rem 2.5rem;
  color: var(--t3);
  font-size: 0.85rem;
}

.site-foot .wrap {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.site-foot nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-foot a {
  color: var(--t2);
}

.disclaimer {
  color: var(--t3);
}

/* ------------------------------------------------------------ long prose */

.prose h1 {
  font-size: 1.7rem;
  line-height: 1.25;
  margin-bottom: 0.4rem;
  text-wrap: balance;
}

.prose .meta {
  color: var(--t3);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.prose h2 {
  font-size: 1.15rem;
  margin: 2.2rem 0 0.6rem;
}

.prose p,
.prose ul,
.prose ol {
  color: var(--t2);
  margin-bottom: 0.9rem;
}

.prose ul,
.prose ol {
  padding-inline-start: 1.3rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

.prose strong {
  color: var(--t1);
}

/* Tables can be wider than the measure — scroll them, never the page. */
.table-scroll {
  overflow-x: auto;
  margin-bottom: 1rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 34rem;
}

.prose th,
.prose td {
  text-align: start;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--t2);
}

.prose th {
  color: var(--t1);
}

.card {
  background: var(--primary-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 1rem 0;
}

.card p:last-child {
  margin-bottom: 0;
}

.translation-note {
  color: var(--t3);
  font-size: 0.85rem;
  border-inline-start: 3px solid var(--border);
  padding-inline-start: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ---------------------------------------------------------------- forms */

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
}

input[type='email'],
input[type='password'] {
  font: inherit;
  font-size: 1rem;
  color: var(--t1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  width: 100%;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-weight: 400;
  color: var(--t2);
  line-height: 1.5;
}

.consent input {
  margin-top: 0.3rem;
  accent-color: var(--primary);
}

.btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.7rem 1.2rem;
  background: var(--primary);
  color: var(--on-primary);
}

.btn:hover {
  background: var(--primary-pressed);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: default;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  filter: brightness(0.92);
}

.notice {
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 1rem 0;
  border: 1px solid var(--border);
}

.notice-error {
  background: var(--danger-tint);
  border-color: var(--danger);
  color: var(--danger);
}

.notice-success {
  background: var(--primary-tint);
  border-color: var(--success);
  color: var(--success);
}

[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------- landing */

.hero {
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 1.1rem;
}

.hero img {
  width: 88px;
  height: 88px;
}

.hero h1 {
  font-size: 2rem;
  line-height: 1.2;
  text-wrap: balance;
}

.hero p {
  color: var(--t2);
  max-width: 32rem;
}

.pill {
  display: inline-block;
  background: var(--primary-tint);
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.facts {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  margin-top: 2.5rem;
  padding: 0;
  list-style: none;
}

.facts li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  color: var(--t2);
  font-size: 0.95rem;
}

.facts strong {
  display: block;
  color: var(--t1);
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
