/* Tanren website: shared styles.
   Palette: Ember & Iron, the app's tokens (Tanren ADR-0056). Light by default, dark with the system setting.
   Headings use Barlow Condensed Bold (the app's display family, SIL OFL, self-hosted, Latin only);
   body text uses the system font. No external requests. Logical properties throughout for right-to-left. */

@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/BarlowCondensed-Bold.woff") format("woff");
}

:root {
  color-scheme: light dark;
  --bg: #F6F3EF;
  --surface: #FFFFFF;
  --surface-muted: #F0EBE5;
  --line: #E5DFD8;
  --line-strong: #877C73;
  --text: #17100C;
  --text-secondary: #5E544C;
  --accent: #EE501C;
  --on-accent: #17100C;
  --accent-text: #B53B0A;
  --accent-soft: #FDE8DC;
  --accent-strong: #8A2E0A;
  --display: "Barlow Condensed", "Avenir Next Condensed", "Arial Narrow", system-ui, sans-serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --radius: 16px;
  --radius-small: 10px;
  --gutter: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #110D0B;
    --surface: #1B1613;
    --surface-muted: #27201C;
    --line: #332B26;
    --line-strong: #7D7068;
    --text: #FAF0E2;
    --text-secondary: #B5A99E;
    --accent: #FF7A26;
    --on-accent: #17100C;
    --accent-text: #FF7A26;
    --accent-soft: #3D2014;
    --accent-strong: #FFB98F;
  }
}

/* Scripts the display face doesn't cover use the system font for headings too. */
:lang(ru), :lang(ar), :lang(ja), :lang(zh-Hans) {
  --display: var(--sans);
}
:lang(ja) {
  --sans: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
}
:lang(zh-Hans) {
  --sans: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
:lang(ar) {
  --sans: system-ui, -apple-system, "SF Arabic", "Geeza Pro", "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

:lang(ja) body, :lang(zh-Hans) body { line-height: 1.8; }
:lang(ja), :lang(zh-Hans) { line-break: strict; }
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3 { word-break: auto-phrase; }
:lang(ar) body { line-height: 1.8; }

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

a { color: var(--accent-text); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  inset-inline-start: 12px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-small);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

main:focus { outline: none; }

/* Layout */
.container {
  width: 100%;
  max-width: 1040px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container.narrow { max-width: 760px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 8px 20px;
  flex-wrap: wrap;
  min-height: 64px;
  padding-block: 10px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-family: "Barlow Condensed", "Avenir Next Condensed", "Arial Narrow", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 0.01em;
  margin-inline-end: auto;
}
.brand img { width: 32px; height: 32px; border-radius: 8px; }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  display: inline-block;
  padding-block: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); }
.site-nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }

/* Language menu (no script needed; script.js only closes it on Escape or an outside click) */
.lang-menu { position: relative; }
.lang-menu summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  list-style: none;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary::after {
  content: "";
  width: 7px; height: 7px;
  border-inline-end: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  margin-inline-start: 4px;
}
.lang-menu[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.globe { color: var(--text-secondary); flex: none; }
.lang-list {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  min-width: 210px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  box-shadow: 0 12px 32px rgba(23, 16, 12, 0.16);
}
.lang-list a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}
.lang-list a:hover { background: var(--surface-muted); }
.lang-list a[aria-current="true"] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }

/* Home */
.hero { padding-block: 72px 56px; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px;
  align-items: center;
}
.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-text);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.hero h1 {
  margin: 0 0 20px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.04;
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.lede {
  margin: 0 0 28px;
  max-width: 36em;
  color: var(--text-secondary);
  font-size: 1.2rem;
}
.hero-art img {
  display: block;
  width: 176px;
  height: 176px;
  border-radius: 40px;
  box-shadow: 0 24px 48px rgba(242, 58, 27, 0.22);
}
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary.is-soon {
  cursor: default;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: var(--accent);
}
.btn-ghost { border-color: var(--line-strong); color: var(--text); background: transparent; }
.btn-ghost:hover { background: var(--surface-muted); }
.fineprint { margin: 18px 0 0; color: var(--text-secondary); font-size: 0.95rem; }

.features, .links { padding-block: 56px; border-top: 1px solid var(--line); }
.features h2, .links h2 {
  margin: 0 0 28px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.1;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 16px;
}
.feature {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.feature h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  line-height: 1.3;
}
.feature h3::before {
  content: "";
  display: block;
  width: 28px;
  height: 4px;
  margin-bottom: 14px;
  border-radius: 2px;
  background: var(--accent);
}
.feature p { margin: 0; color: var(--text-secondary); }
.languages-line { margin: 28px 0 0; color: var(--text-secondary); }

.link-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.link-cards a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.link-cards a:hover { border-color: var(--accent); }
.link-cards strong { color: var(--accent-text); font-size: 1.05rem; }
.link-cards span { color: var(--text-secondary); font-size: 0.95rem; }

/* Documents (privacy, terms, support, delete account) */
.doc { padding-block: 48px 72px; }
.doc h1 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.2rem, 5vw, 3rem);
  line-height: 1.08;
}
.doc .updated { margin: 0 0 32px; color: var(--text-secondary); font-size: 0.95rem; }
.doc h2 {
  margin: 44px 0 12px;
  font-size: 1.35rem;
  line-height: 1.3;
  scroll-margin-top: 88px;
}
.doc h3 {
  margin: 32px 0 8px;
  font-size: 1.1rem;
  line-height: 1.35;
  scroll-margin-top: 88px;
}
.doc p, .doc li { color: var(--text); }
.doc ul, .doc ol { padding-inline-start: 1.4em; margin: 10px 0 18px; }
.doc li { margin-bottom: 8px; }
.doc li::marker { color: var(--accent-text); }

.callout {
  margin: 0 0 28px;
  padding: 18px 22px;
  background: var(--accent-soft);
  border-inline-start: 4px solid var(--accent);
  border-radius: var(--radius-small);
}
.callout p, .callout li { color: var(--text); }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }

.table-wrap { overflow-x: auto; margin: 14px 0 20px; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.97rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
}
.data-table th, .data-table td {
  padding: 12px 14px;
  text-align: start;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.data-table thead th {
  background: var(--surface-muted);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.data-table tbody th { font-weight: 600; min-width: 8em; }
.data-table thead th:first-child { width: 20%; }
.data-table thead th:nth-child(3) { width: 32%; }
.data-table tr:last-child > * { border-bottom: 0; }

/* On narrow screens the tables become stacked cards, so the page never scrolls sideways. */
@media (max-width: 640px) {
  .data-table, .data-table tbody, .data-table tr, .data-table th, .data-table td { display: block; width: 100%; }
  .data-table { border: 0; background: transparent; }
  .data-table thead { display: none; }
  .data-table tr {
    margin-bottom: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
  }
  .data-table th, .data-table td { border-bottom: 0; padding: 10px 14px; }
  .data-table tbody th { padding-bottom: 0; color: var(--accent-text); }
  .data-table td + td { border-top: 1px dashed var(--line); }
}

.contact-card {
  margin: 0 0 32px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.contact-card h2 { margin-top: 0; }
.contact-email { font-size: 1.25rem; font-weight: 600; margin: 0 0 8px; }

.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  list-style: none;
  padding: 0;
}
.lang-grid a {
  display: block;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  text-decoration: none;
}

/* Footer */
.site-footer {
  padding-block: 40px 48px;
  border-top: 1px solid var(--line);
  color: var(--text-secondary);
  font-size: 0.95rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px 40px;
  align-items: start;
}
.footer-brand {
  margin: 0;
  color: var(--text);
  font-family: "Barlow Condensed", "Avenir Next Condensed", "Arial Narrow", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
}
.footer-tagline { margin: 4px 0 0; }
.footer-links, .footer-langs ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-footer a {
  display: inline-block;
  padding-block: 6px;
  color: var(--text-secondary);
}
.site-footer a:hover, .site-footer a[aria-current] { color: var(--text); }
.footer-langs {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.footer-langs a { text-decoration: none; }
.copyright { margin: 20px 0 0; font-size: 0.9rem; }

@media (max-width: 720px) {
  :root { --gutter: 16px; }
  .hero { padding-block: 40px 40px; }
  .hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .hero-art { order: -1; }
  .hero-art img { width: 96px; height: 96px; border-radius: 22px; }
  .footer-grid { grid-template-columns: 1fr; }
  .site-nav { order: 3; width: 100%; }
  .site-nav ul { gap: 0 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media print {
  .site-header, .site-footer, .skip-link { display: none; }
  body { background: #fff; color: #000; }
}
