/* Elchi website. One stylesheet for every page.
   The site wears the app's own look: a warm paper page, white cards with a
   hairline border, ink-green text and one green accent. Dark is the same
   palette turned down. Sections below, in page order:
   tokens, base, header, buttons, hero, phone, facts, sections, hub,
   envelope, pair, platforms, questions, closing, document pages, invite
   page, not-found page, footer, small screens. */

/* ---- tokens ------------------------------------------------------------ */

:root {
  --page: #F6F5F2;
  --card: #FFFFFF;
  --fill: #F0EFEB;
  --line: #E4E2DC;
  --line-soft: #EFEDE8;
  --ink: #14201F;
  --ink-2: #3B4A47;
  --muted: #5B6866;
  --faint: #7C8885;
  --accent: #0F6B5C;
  --accent-strong: #0A5547;
  --tint: #DDEAE8;
  --on-accent: #FFFFFF;
  --warn-tint: #FBE9DD;
  --warn-ink: #9A3F10;
  --shadow: 0 18px 50px rgba(20, 32, 31, 0.10);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --wrap: 1080px;
  color-scheme: light;
}

/* Dark: chosen by the system unless the visitor picked light by hand... */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0F1514;
    --card: #171E1D;
    --fill: #212A29;
    --line: rgba(255, 255, 255, 0.09);
    --line-soft: rgba(255, 255, 255, 0.05);
    --ink: #ECEFEC;
    --ink-2: #C5CCC9;
    --muted: #98A3A0;
    --faint: #6F7A77;
    --accent: #1A9A84;
    --accent-strong: #4FBBA7;
    --tint: #183934;
    --on-accent: #FFFFFF;
    --warn-tint: #3A2418;
    --warn-ink: #F0A983;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}

/* ...or picked dark by hand. */
:root[data-theme="dark"] {
  --page: #0F1514;
  --card: #171E1D;
  --fill: #212A29;
  --line: rgba(255, 255, 255, 0.09);
  --line-soft: rgba(255, 255, 255, 0.05);
  --ink: #ECEFEC;
  --ink-2: #C5CCC9;
  --muted: #98A3A0;
  --faint: #6F7A77;
  --accent: #1A9A84;
  --accent-strong: #4FBBA7;
  --tint: #183934;
  --on-accent: #FFFFFF;
  --warn-tint: #3A2418;
  --warn-ink: #F0A983;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

/* ---- base -------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
figure,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

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

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

svg {
  display: block;
}

/* The icon set, defined once per page and reused with <use>. */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  z-index: 10;
}

.skip:focus {
  top: 12px;
}

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

/* ---- header ------------------------------------------------------------ */

.nav {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  border-radius: 8px;
  display: block;
}

.nav-links {
  display: flex;
  gap: 26px;
}

.nav-links a {
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--ink);
  text-decoration: none;
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang {
  display: flex;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 3px;
}

.lang a {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 9px;
}

.lang a:hover {
  color: var(--ink);
  text-decoration: none;
}

.lang a[aria-current="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

.theme-toggle .icon {
  width: 18px;
  height: 18px;
}

/* The button shows the theme it switches to. */
.theme-toggle .to-light {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .to-light {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle .to-dark {
    display: none;
  }
}

:root[data-theme="dark"] .theme-toggle .to-light {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .to-dark {
  display: none;
}

/* ---- buttons ----------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

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

:root[data-theme="dark"] .btn-primary:hover {
  background: var(--accent);
  filter: brightness(1.1);
}

.btn-quiet {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink);
}

.btn-quiet:hover {
  border-color: var(--accent);
}

/* ---- hero -------------------------------------------------------------- */

.hero {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 56px 24px 64px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 56px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.5rem, 5.6vw, 4rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 700;
  max-width: 13ch;
}

.hero-lede {
  margin-top: 22px;
  color: var(--muted);
  font-size: 19px;
  max-width: 44ch;
}

.hero-actions {
  margin-top: 30px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-note {
  margin-top: 16px;
  color: var(--faint);
  font-size: 14px;
}

/* ---- phone: the app's Today screen, drawn in HTML ---------------------- */

.phone {
  justify-self: center;
  width: 300px;
  padding: 10px;
  border-radius: 44px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.phone-screen {
  border-radius: 34px;
  background: var(--page);
  border: 1px solid var(--line);
  overflow: hidden;
  font-size: 13px;
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  min-height: 520px;
}

.phone-body {
  padding: 26px 18px 18px;
  flex: 1;
}

.ph-greet {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.ph-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.ph-head {
  margin: 20px 0 10px;
  font-size: 14.5px;
  font-weight: 600;
}

.ph-apps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
}

.ph-tile {
  width: 50px;
  height: 50px;
  margin: 0 auto 5px;
  border-radius: 15px;
  background: var(--tint);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ph-tile-more {
  background: none;
  border: 1.5px solid var(--faint);
  color: var(--muted);
}

.ph-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
}

.ph-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.ph-row + .ph-row {
  border-top: 1px solid var(--line-soft);
}

.ph-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--tint);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.ph-dot .icon {
  width: 16px;
  height: 16px;
}

.ph-dot-warn {
  background: var(--warn-tint);
  color: var(--warn-ink);
}

.ph-row-text {
  flex: 1;
  min-width: 0;
}

.ph-row-title {
  font-weight: 600;
  font-size: 12.5px;
}

.ph-row-sub {
  color: var(--muted);
  font-size: 11px;
}

.ph-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ph-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 8px 0 12px;
  text-align: center;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
}

.ph-tabs .icon {
  width: 22px;
  height: 22px;
  margin: 0 auto 2px;
}

.ph-tab-on {
  color: var(--accent);
  font-weight: 600;
}

/* ---- facts ------------------------------------------------------------- */

.facts {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.fact {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  color: var(--muted);
  font-size: 15.5px;
}

.fact strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
  margin-bottom: 4px;
}

/* The same strip inside a section: the section already has the side padding. */
.section .facts {
  margin-top: 26px;
  padding: 0;
}

/* ---- sections ---------------------------------------------------------- */

.section {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 96px 24px 0;
}

.section h2 {
  font-size: clamp(1.75rem, 3.4vw, 2.375rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  font-weight: 700;
  max-width: 18ch;
}

.section-text {
  margin-top: 14px;
  color: var(--muted);
  max-width: 52ch;
}

/* A heading column beside the thing it describes. */
.split {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 56px;
  align-items: start;
}

/* The same, with the thing on the left. In the page the heading still
   comes first, so on a phone it is read first. */
.split-flip {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
}

.split-flip > :last-child {
  order: -1;
}

/* ---- hub: the app's own list of mini apps ------------------------------ */

.hub-label {
  margin: 20px 4px 8px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hub-label:first-child {
  margin-top: 0;
}

.hub-soon {
  color: var(--faint);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.hub-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.hub-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
}

.hub-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--tint);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.hub-text {
  flex: 1;
  min-width: 0;
}

.hub-title {
  font-weight: 600;
  font-size: 16px;
}

.hub-sub {
  color: var(--muted);
  font-size: 14px;
}

.pill {
  flex: none;
  background: var(--tint);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
}

/* ---- envelope: what the relay sees ------------------------------------- */

.envelope {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
}

.env-caption {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
}

.env-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 6px 0;
  font-size: 15px;
}

.env-key {
  width: 52px;
  color: var(--faint);
  font-size: 13px;
}

.env-value {
  font-family: var(--mono);
  font-size: 14px;
}

.env-hidden {
  color: var(--muted);
}

.env-body {
  margin: 14px 0;
  padding: 14px 16px;
  background: var(--fill);
  border-radius: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow: hidden;
}

.env-foot {
  color: var(--muted);
  font-size: 14px;
}

.points {
  margin-top: 26px;
  display: grid;
  gap: 20px;
}

.points h3 {
  font-size: 17px;
  font-weight: 600;
}

.points p {
  color: var(--muted);
  font-size: 15.5px;
  margin-top: 2px;
  max-width: 50ch;
}

/* ---- pair: backup and move --------------------------------------------- */

.pair {
  margin-top: 36px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.pair-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
}

.pair-item .hub-icon {
  margin-bottom: 16px;
}

.pair-item h3 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.pair-item p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15.5px;
}

.pair-note {
  color: var(--ink-2);
}

/* ---- platforms --------------------------------------------------------- */

.platforms {
  margin-top: 30px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  max-width: 640px;
}

.platforms li {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 14px 18px;
}

.platforms li + li {
  border-top: 1px solid var(--line-soft);
}

.platform-name {
  font-weight: 600;
  width: 96px;
  flex: none;
}

.platform-store {
  color: var(--muted);
  flex: 1;
  font-size: 15.5px;
}

.platform-state {
  color: var(--faint);
  font-size: 14px;
}

.platforms-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14.5px;
  max-width: 62ch;
}

/* ---- questions --------------------------------------------------------- */

.faq {
  margin-top: 30px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  max-width: 760px;
}

.faq details + details {
  border-top: 1px solid var(--line-soft);
}

.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 48px 16px 20px;
  font-weight: 600;
  position: relative;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

.faq details[open] summary::after {
  content: "\2212";
}

.faq details p {
  padding: 0 20px 18px;
  color: var(--muted);
  font-size: 15.5px;
  max-width: 64ch;
}

/* ---- closing line ------------------------------------------------------ */

.closing {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 96px 24px 0;
}

.closing p {
  font-size: clamp(1.5rem, 3vw, 2.125rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 700;
  max-width: 22ch;
}

/* ---- document pages: privacy policy and terms -------------------------- */

.doc {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px 0;
  font-size: 16px;
}

.doc h1 {
  font-size: clamp(1.875rem, 4vw, 2.625rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 700;
}

.doc-meta {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14.5px;
}

.doc-meta strong {
  color: var(--ink-2);
  font-weight: 600;
}

.doc h2 {
  margin-top: 40px;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 700;
}

.doc p {
  margin-top: 12px;
  color: var(--ink-2);
}

.doc strong {
  color: var(--ink);
}

/* ---- invite page: /add/ ------------------------------------------------ */

.add {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 24px 0;
  text-align: center;
}

.add h1 {
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.add-intro {
  margin-top: 12px;
  color: var(--muted);
}

.add-code {
  margin: 22px 0 6px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 12px;
  text-align: left;
  word-break: break-all;
  max-height: 120px;
  overflow: auto;
}

.add-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* ---- not-found page ---------------------------------------------------- */

.notfound {
  max-width: 560px;
  margin: 0 auto;
  padding: 72px 24px 0;
}

.notfound h1 {
  font-size: clamp(1.875rem, 5vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.notfound p {
  margin-top: 12px;
  color: var(--muted);
}

.notfound ul {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- footer ------------------------------------------------------------ */

.footer {
  max-width: var(--wrap);
  margin: 96px auto 0;
  padding: 26px 24px 40px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 14.5px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-brand img {
  border-radius: 5px;
}

.footer-links {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--ink);
}

/* ---- small screens ----------------------------------------------------- */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 44px;
    padding-top: 36px;
  }

  .split,
  .split-flip {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .split-flip > :last-child {
    order: 0;
  }

  .section,
  .closing {
    padding-top: 72px;
  }
}

@media (max-width: 680px) {
  .nav {
    padding: 14px 16px;
  }

  .nav-links {
    display: none;
  }

  .wrap,
  .hero,
  .facts,
  .section,
  .closing,
  .doc,
  .add,
  .notfound,
  .footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .facts,
  .pair {
    grid-template-columns: 1fr;
  }

  .facts {
    gap: 18px;
  }

  .hero-lede {
    font-size: 17.5px;
  }

  .platforms li {
    flex-wrap: wrap;
    gap: 2px 14px;
  }

  .platform-store {
    flex: 1 1 100%;
    order: 3;
  }

  .platform-state {
    margin-left: auto;
  }

  .footer {
    margin-top: 72px;
  }
}
