/* Every page: the fonts, the colours and sizes (the app's design system, TorrentMagnet tokens.json), the top bar,
   the footer with its language menu, and the parts the home page and the text pages share. home.css and article.css
   add only their own parts. */

/* Inter, served from this site (SIL Open Font License) */
/* inter cyrillic-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/inter-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* inter cyrillic */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/inter-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* inter greek-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/inter-greek-ext.woff2) format('woff2');
  unicode-range: U+1F00-1FFF;
}
/* inter greek */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/inter-greek.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* inter vietnamese */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/inter-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* inter latin-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/inter-latin-ext.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* inter latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/inter-latin.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;
}
/* Arial sized like Inter, so nothing moves when Inter arrives */
@font-face { font-family: "Inter Fallback"; src: local("Arial"); size-adjust: 107.1%; ascent-override: 90.4%; descent-override: 22.5%; line-gap-override: 0%; }

:root {
  color-scheme: light;
  --brand: #0F7A55;
  --brand-deep: #0B5E41;
  --brand-dark: #35B487;
  --on-brand: #FFFFFF;
  --surface: #FFFFFF;
  --surface-dark: #111412;
  --on-surface: #191C1A;
  --on-surface-dim: #5E655F;
  --on-surface-faint: #676E68;
  --body-ink: #3F4540;
  --on-surface-dark: #ECEEEA;
  --on-surface-dim-dark: #A3A9A3;
  --black: #000000;
  --on-black: #FFFFFF;
  --chip: #F5F5F5;
  --box: #F5F5F5;
  --line: #E2E4DF;
  --nav-off: #9DA39D;
  --switch-off: #D5D8DC;
  --danger: #B3261E;
  --frame: #121514;
  --paper: #FFFFFF;
  --top-bg: rgba(255, 255, 255, 0.86);

  --space-4: 4px; --space-8: 8px; --space-12: 12px; --space-16: 16px; --space-24: 24px;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --radius-small: 12px; --radius-chip: 16px; --radius-box: 20px; --radius-pill: 28px; --radius-card: 26px;
  --shadow-card: 0 26px 60px -24px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-phone: 0 50px 90px -40px rgba(15, 122, 85, 0.55), 0 30px 60px -30px rgba(0, 0, 0, 0.5);

  --sans: Inter, "Inter Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --page: 1200px;
  --top-h: 64px;
}
/* Dark: the app's own night palette. theme.js sets data-theme before the page draws: the person's choice, or else
   the phone's setting. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #35B487; --brand-deep: #2EA078; --on-brand: #08140F; --surface: #111412; --surface-dark: #0A0C0B;
  --on-surface: #ECEEEA; --on-surface-dim: #A3A9A3; --on-surface-faint: #8A918B; --body-ink: #D4DAD6;
  --black: #FFFFFF; --on-black: #000000; --chip: #2C2C2C; --box: #1B1F1C; --line: #2C312D;
  --nav-off: #6E746E; --switch-off: #4D4D4D; --danger: #F2837B; --frame: #2B302D; --paper: #1B1F1C;
  --shadow-card: 0 26px 60px -24px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --top-bg: rgba(17, 20, 18, 0.86);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--surface); color: var(--on-surface); font: 17px/1.6 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
/* The footer stays at the bottom of the window on a short page */
body { min-height: 100svh; display: flex; flex-direction: column; }
/* width: its auto side margins would otherwise shrink it to its content, and a wide table or long word widen it */
body > main { flex: 1 0 auto; width: 100%; min-width: 0; }
img { max-width: 100%; }
a { color: var(--brand); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 6px; }
.wrap { max-width: var(--page); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter-r); }
h1, h2 { text-wrap: balance; font-weight: 900; letter-spacing: -0.04em; line-height: 1.02; margin: 0; }
/* On a phone the theme button moves from the top bar to the footer, making room for Guides */
@media (max-width: 639px) { .hide-sm { display: none !important; } }
@media (min-width: 640px) { .only-sm { display: none !important; } }

/* Top bar */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--top-bg); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: var(--space-16); height: var(--top-h); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--on-surface); text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: -0.01em; }
.brand img { border-radius: 9px; }
.top-links { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; }
.top-links { min-width: 0; }
.top-links a { color: var(--on-surface-dim); text-decoration: none; white-space: nowrap; }
/* A thumb-sized target in the 64px bar (the badge has its own) */
.top-links a:not(.badge-link) { padding: 12px 6px; }
.brand { flex-shrink: 0; }
/* A small phone: the icon is the brand, so a long word for Guides (Anleitungen, Инструкции) never runs into it */
@media (max-width: 400px) { .top-links { gap: 2px; } .brand-name { display: none; } }
.top-links a:hover { color: var(--on-surface); }
.badge-link { flex-shrink: 0; }

/* The official Google Play badge: it carries its own transparent margin, and keeps its shape in a narrow bar */
.badge-sm, .badge { display: block; width: auto; max-width: none; aspect-ratio: 646 / 250; }
.badge-sm { height: 52px; margin: -8px -10px; }
.badge { height: 84px; }
@media (max-width: 640px) { .badge { height: 72px; } }

/* Light / dark switch */
.theme-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--chip); color: var(--on-surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.theme-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-btn .moon { fill: currentColor; stroke: none; }
.theme-btn .sun, :root[data-theme="dark"] .theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: block; }

/* Pictures of the app follow the page's light or dark look */
.only-dark, :root[data-theme="dark"] .only-light { display: none !important; }
:root[data-theme="dark"] .only-dark { display: block !important; }

/* Questions and answers, on the home page and in guides */
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 16px; padding: 18px 0; font-size: 18px; font-weight: 600; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--brand); font-weight: 400; font-size: 24px; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 18px; color: var(--on-surface-dim); }

/* The closing: the app's icon, one line and the Play badge. Ends the home page; on a guide or About it is a band
   edge to edge above the footer (article.css) */
.end { text-align: center; padding-top: 48px; padding-bottom: 96px; }
.end-icon { display: block; margin: 0 auto 22px; border-radius: 20px; box-shadow: 0 18px 36px -16px rgba(15, 122, 85, 0.55); }
.end h2 { margin: 0 auto 18px; font-size: clamp(34px, 4.6vw, 56px); }
.end .badge { display: inline-block; vertical-align: middle; }
/* The QR beside a Play badge: only on a computer (a wide screen with a mouse), where the badge can't install */
.qr { display: none; }
@media (min-width: 900px) and (hover: hover) {
  .qr { display: inline-flex; align-items: center; gap: 12px; vertical-align: middle; text-align: start; }
  .end .qr { margin-inline-start: 20px; }
}
.qr img { width: 76px; height: 76px; padding: 6px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.qr small { max-width: 13ch; font-size: 13px; line-height: 1.35; color: var(--on-surface-dim); }

/* Footer */
.foot { border-top: 1px solid var(--line); font-size: 14px; color: var(--on-surface-dim); }
.foot a { color: var(--on-surface-dim); text-decoration: none; }
.foot a:hover { color: var(--on-surface); }
.foot-cols { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 32px 24px; padding: 48px 0 32px; }
.foot-app .brand { font-size: 17px; color: var(--on-surface); }
.foot-app .brand img { border-radius: 7px; }
.foot-app p { margin: 10px 0 6px; }
.foot nav { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.foot nav a { padding: 4px 0; }
.foot h2 { margin: 0 0 4px; font-size: 13px; font-weight: 600; letter-spacing: 0; line-height: 1.4; color: var(--on-surface); }
.foot-end { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; border-top: 1px solid var(--line); padding: 20px 0 32px; }
.foot-end small { font-size: 13px; color: var(--on-surface-faint); }
@media (max-width: 720px) {
  .foot-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot-app { grid-column: 1 / -1; }
}

/* The footer's language menu: a globe and the current language; the list opens upward. */
.lang-menu { position: relative; margin-inline-start: auto; }
.lang-menu summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--on-surface); font-size: 14px; }
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-135deg) translate(-1px, -1px); margin-inline-start: 2px; }
.lang-menu svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.lang-menu ul { position: absolute; inset-inline-end: 0; bottom: calc(100% + 8px); z-index: 20; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  display: grid; grid-template-columns: repeat(2, minmax(130px, 1fr)); max-height: min(60vh, 520px); overflow-y: auto; width: max-content; max-width: calc(100vw - 32px); }
.lang-menu li a, .lang-menu li b { display: block; padding: 7px 12px; border-radius: 8px; font-size: 14px; color: var(--on-surface); text-decoration: none; white-space: nowrap; }
.lang-menu li a:hover { background: var(--line); }
.lang-menu li b { font-weight: 600; color: var(--brand); }

/* Japanese and Chinese: break headings between phrases, never before 、。 */
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3, :lang(zh) h1, :lang(zh) h2 { word-break: auto-phrase; line-break: strict; }
:lang(ja), :lang(zh) { line-break: strict; }
/* Tight headings suit Inter's letters only: Arabic, Persian and Hebrew letters join, and Hindi, Tamil, Chinese,
   Japanese and Korean come from the phone's own fonts. Spaced out of a tighter rule, they'd break or crowd. */
html:is(:lang(ar), :lang(fa), :lang(he), :lang(hi), :lang(ta), :lang(zh), :lang(ja), :lang(ko)) :is(h1, h2, h3) { letter-spacing: 0; }

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