/* What every page of talavo.app shares: the type, the colours, the logo, the
   App Store button, the top bar of the plain pages and the footer. The home
   page adds neko.css (the hero) and lower.css (its text sections), the plain
   pages add page.css. The markup of the top bar and the footer comes from
   i18n/chrome.py. */

@font-face {
  font-family: "DM Sans";
  src: url("/fonts/dm-sans-latin.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
  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: "DM Sans";
  src: url("/fonts/dm-sans-latin-ext.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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;
}

:root {
  --ink: #0a0a0a;
  --mint: #7FFFD4;
  --paper: #f8f6f0;
  --page: var(--mint);
  --shade: rgba(10, 10, 10, 0.16);   /* the one flat shadow tone */
  --measure: 44rem;                  /* the width of a column of text */
}
/* The page is neutral and carries mint as its accent (data-theme="paper" and
   data-accent="mintcta" on the root element): a mint App Store button with an
   ink outline. */
html[data-theme="paper"] { --page: var(--paper); }
html[data-accent="mintcta"]:not([data-theme="mint"]) .cta,
html[data-accent="mintcta"]:not([data-theme="mint"]) .l-cta {
  --shade: var(--ink);
  border: 2px solid var(--ink);
  background: var(--mint);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { background: var(--page); -webkit-text-size-adjust: 100%; }
body {
  position: relative;
  margin: 0;
  color: var(--ink);
  font: 500 17px/1.45 "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
p, h1, h2, h3 { margin: 0; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* DM Sans has Latin letters only. A language in another script is set in
   the system font from end to end, its Latin words too, or one line would mix
   two faces of different weight. The tight tracking is cut for DM Sans and
   goes with it (Arabic letters have to stay joined, Cyrillic and Greek ones
   would touch), and the system fonts are heavier, so the text is one step
   lighter. The name stays as it is drawn everywhere. */
:lang(ar), :lang(he), :lang(hi), :lang(ja), :lang(ko), :lang(zh), :lang(ru), :lang(uk), :lang(bg), :lang(sr), :lang(el) {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0 !important;
}
html:is(:lang(ar), :lang(he), :lang(hi), :lang(ja), :lang(ko), :lang(zh), :lang(ru), :lang(uk), :lang(bg), :lang(sr), :lang(el)) body,
div:is(:lang(ar), :lang(he), :lang(hi), :lang(ja), :lang(ko), :lang(zh), :lang(ru), :lang(uk), :lang(bg), :lang(sr), :lang(el))[lang] { font-weight: 400; }
.brand-text > :first-child { font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: -0.035em !important; }
/* Korean breaks between words, not inside them. Japanese keeps a long mark
   or a small kana off the start of a line. These scripts have no italics:
   what is stressed is set heavier instead of slanted by the browser, where a
   slanted word leans into the next one. */
:lang(ko) { word-break: keep-all; }
:lang(ja) { line-break: strict; }
:is(:lang(ja), :lang(ko), :lang(zh), :lang(hi), :lang(ar), :lang(he)) :is(em, i) { font-style: normal; font-weight: 700; }
/* The system fonts for Japanese, Chinese and Korean stop at a bold or a
   semibold, their Latin letters go on to a black. A heading or a bold word that asks
   for more than bold would mix the two in one line ("iPhone" twice as heavy
   as the signs beside it), so bold is as heavy as these languages get. */
:is(:lang(ja), :lang(zh), :lang(ko)) :is(h1, h2, h3, h4, summary, strong, b, th, dt, .doc-mark, .doc-tag, .doc-pager a, .doc-title p) { font-weight: 700 !important; }

/* ------------------------------------------------------------------ logo */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 23px;
  letter-spacing: -0.035em;
  text-decoration: none;
}
.brand svg { display: block; }
/* Every page but the mint one carries the app icon, with the descriptor under
   the name. */
.brand-text { display: grid; line-height: 1.08; }
.brand .brand-tile, .brand .brand-sub { display: none; }
html:not([data-theme="mint"]) .brand { gap: 11px; }
html:not([data-theme="mint"]) .brand .brand-wave { display: none; }
html:not([data-theme="mint"]) .brand .brand-tile { display: block; }
html:not([data-theme="mint"]) .brand .brand-sub { display: block; margin-top: 3px; font-size: 13px; font-weight: 500; letter-spacing: 0; }

/* ---------------------------------------------------------------- button */

.l-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 26px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.012em;
  text-align: center;
  text-decoration: none;
  box-shadow: 4px 5px 0 var(--shade);
}
.l-cta:hover { transform: translate(-1px, -1px); box-shadow: 5px 6px 0 var(--shade); }
.l-cta:active { transform: translate(2px, 3px); box-shadow: 2px 2px 0 var(--shade); }

/* --------------------------------------------------------------- top bar
   The plain pages: the logo on one side, the button on the other. */

.l-top {
  --lp: clamp(20px, 3.2vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  /* As wide as the column of text under it (page.css), in the middle of the
     window. The rule under it still runs from edge to edge. */
  padding: clamp(14px, 2vw, 26px) max(var(--lp), calc((100% - var(--measure)) / 2));
}
.l-top .l-cta { flex: none; min-height: 44px; padding: 0 18px; font-size: 15px; white-space: nowrap; }
/* Phones: no room for the line under the name, and a smaller icon. */
@media (max-width: 640px) {
  .l-top { gap: 12px; }
  .l-top .brand { font-size: 20px; }
  .l-top .brand .brand-tile { width: 30px; height: 30px; }
  html:not([data-theme="mint"]) .l-top .brand { gap: 8px; }
  html:not([data-theme="mint"]) .l-top .brand .brand-sub { display: none; }
  .l-top .l-cta { padding: 0 13px; font-size: 14px; }
}
@media (max-width: 359px) {
  .l-top .brand-text { display: none; }
}

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

.lfoot {
  --lp: clamp(20px, 3.2vw, 56px);
  position: relative;
  /* Above the scene: whatever leaves the phone goes behind this part, never over it. */
  z-index: 8;
  padding: clamp(36px, 5vw, 64px) var(--lp) clamp(28px, 3vw, 40px);
  border-top: 2px solid var(--ink);
  background: var(--page);
  font-size: 14.5px;
  line-height: 1.35;
}
/* The cat, asleep on the footer rule. On the home page an empty box that the
   scene draws into, on every other page a picture of one of the four cats. */
.lfoot { --catw: clamp(64px, 7.5vw, 116px); }
.l-cat { position: absolute; pointer-events: none; }
/* The cat ends in a straight cut at the bottom of its box, drawn or as a
   picture. The box stands on the rule (bottom: 100% is the lower edge of the
   rule, the margin lifts it by the rule's two pixels), so the cat lies on the
   line and not through it. */
.lfoot .l-cat { inset-inline-end: var(--lp); bottom: 100%; width: var(--catw); height: auto; aspect-ratio: 3 / 2; margin-bottom: 2px; }
.lfoot h2, .lfoot ul { margin: 0; }
.lfoot ul { padding: 0; list-style: none; }
.lfoot a { text-decoration: none; }
.lfoot a:hover { text-decoration: underline; }
.lfoot h2 { margin-bottom: 6.5px; font-size: 14.5px; font-weight: 800; letter-spacing: -0.01em; }
/* The space between two links belongs to the links, so the whole row can be
   tapped and not only the letters. */
.lfoot li a { display: inline-block; padding: 3.5px 0; font-weight: 500; }
/* A word longer than its column (German and Russian have them on a small
   phone) is divided, never laid over the next column. Outside English it is
   divided the way the language does it. */
.l-links a { max-width: 100%; overflow-wrap: anywhere; }
.l-links a:not(:lang(en)) { -webkit-hyphens: auto; hyphens: auto; -webkit-hyphenate-limit-before: 5; -webkit-hyphenate-limit-after: 5; hyphenate-limit-chars: 10 5 5; }
.l-links {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, auto));
  justify-content: space-between;
  gap: 28px 24px;
}
/* The last row, under a rule: the four marks, the contact address and the
   language list, which stays folded until it is asked for. */
.l-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px clamp(20px, 3vw, 40px);
  margin-top: clamp(24px, 3vw, 40px);
  padding-top: clamp(16px, 2vw, 24px);
  border-top: 1.5px solid var(--ink);
}
.l-mail { font-weight: 500; }
.l-lang { position: relative; margin-inline-start: auto; }
.l-lang summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.l-lang summary::-webkit-details-marker { display: none; }
.l-lang svg { display: block; flex: none; }
.l-lang[open] .l-chev { transform: rotate(180deg); }
/* The list opens upwards, it is at the foot of the page. */
.l-lang ul {
  position: absolute;
  inset-inline-end: 0;
  bottom: calc(100% + 4px);
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, max-content);
  gap: 0 22px;
  max-height: 70vh;
  overflow: auto;
  padding: 12px 18px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--page);
  box-shadow: 4px 5px 0 var(--shade);
}
.l-copy { margin-top: clamp(24px, 3vw, 36px); font-weight: 500; }

/* The four marks of the places where talavo is. */
.l-social { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.lfoot .l-social a { display: block; min-width: 0; padding: 0; border-radius: 8px; }
.l-social svg { display: block; }
.l-social a:hover { transform: translateY(-1px); }

@media (max-width: 1023px) {
  .l-links { grid-template-columns: repeat(3, minmax(0, 1fr)); justify-content: stretch; }
}
/* Fingers: taller rows, and no link narrower than a fingertip. */
@media (max-width: 899px), (pointer: coarse) {
  .lfoot h2 { margin-bottom: 2px; }
  .lfoot li a { min-width: 44px; padding: 8px 0; }
}
@media (max-width: 560px) {
  .l-lang { margin-inline-start: 0; }
  .l-lang ul { inset-inline: 0 auto; grid-template-columns: repeat(2, max-content); }
  .l-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* The smallest phones: two lists side by side leave 128 pixels each. A little
   less between them and a slightly smaller letter, and the longest word of a
   link fits (15 letters in Bulgarian) where the language has no rules to
   divide it by. */
@media (max-width: 359px) {
  .l-links { column-gap: 16px; }
  .l-links li a { font-size: 14px; }
}

/* ------------------------------------------- the footer of the plain pages
   A plain page is one column (page.css), and its footer keeps to it: three
   lists side by side, two on a phone. The home page has no top bar of this
   kind and keeps its footer from edge to edge. */
.l-top ~ .lfoot { padding-inline: max(var(--lp), calc((100% - var(--measure)) / 2)); }
.l-top ~ .lfoot .l-cat { inset-inline-end: max(var(--lp), calc((100% - var(--measure)) / 2)); }
.l-top ~ .lfoot .l-links { grid-template-columns: repeat(3, minmax(0, 1fr)); justify-content: stretch; }
@media (max-width: 560px) {
  .l-top ~ .lfoot .l-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* A heading that takes two lines (Russian has one) must not push its list
   below the list beside it: the headings of a row share one track, the lists
   the next. The space between two rows of lists moves from the grid to the
   lists for that. */
@supports (grid-template-rows: subgrid) {
  .l-top ~ .lfoot .l-links { row-gap: 0; margin-bottom: -28px; }
  .l-top ~ .lfoot .l-links > * { display: grid; grid-template-rows: subgrid; grid-row: span 2; margin-bottom: 28px; }
  .l-top ~ .lfoot .l-links > * > h2 { align-self: start; }
}
