/* branchstories.app — design "Website 1.3" (frames 1a–1d home, 2a–2d support
   and the language switch). One stylesheet for every page and language; the
   pages themselves are generated by scripts/site-build.py.

   Layout uses start/end, never left/right, so Arabic mirrors by itself. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

.bw {
  --ink: #f1ece4; --mute: rgba(255,255,255,.68); --line: rgba(255,255,255,.1);
  --crim: #d12429; --crim-t: #f0575b; --bg: #070607; --card: #131114;
  --head: 'Playfair Display','Noto Serif Armenian','Noto Serif Devanagari','Noto Serif JP','Noto Serif KR','Noto Serif SC',serif;
  --body: 'Lora','Noto Serif Armenian','Noto Serif Devanagari','Noto Serif JP','Noto Serif KR','Noto Serif SC',serif;
  --ui: -apple-system,system-ui,'Noto Naskh Arabic',sans-serif;
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 17px; line-height: 1.55; text-align: start;
  /* A short page (support) still puts the footer at the bottom of the window. */
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh;
}
:root[lang=ar] .bw { --head: 'Amiri','Noto Naskh Arabic',serif; --body: 'Noto Naskh Arabic','Amiri',serif; line-height: 1.8; }
/* Han characters: each language's own serif first, or Chinese and Korean
   pages would borrow Japanese letterforms. */
:root[lang|=zh] .bw { --head: 'Playfair Display','Noto Serif SC',serif; --body: 'Lora','Noto Serif SC',serif; }
:root[lang=ko] .bw { --head: 'Playfair Display','Noto Serif KR',serif; --body: 'Lora','Noto Serif KR',serif; }
/* Headings and paragraphs carry no margin of their own: a label, its headline
   and its lead sit as one tight block, as the design canvas draws them. Space
   comes from the blocks around them (cards, grids, the pill). */
.bw h1, .bw h2, .bw h3, .bw p, .bw figure, .bw ul { margin: 0; }
.bw a:focus-visible, .bw summary:focus-visible { outline: 2px solid var(--crim-t); outline-offset: 3px; }
.bw-wrap { width: 100%; max-width: 1040px; margin-inline: auto; }

/* ---- hero ---- */
.bw-hero { position: relative; isolation: isolate; overflow: hidden;
  /* One screen tall at most: TikTok and Instagram open links in a short
     in-app browser, and the App Store pill must show without scrolling. */
  min-height: 620px; min-height: min(620px, 100svh);
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  text-align: center; padding: 110px 24px 40px; }
.bw-hero-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 40% 0; z-index: -2; }
.bw-hero::after { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to bottom, rgba(7,6,7,.4), rgba(7,6,7,.1) 32%, rgba(7,6,7,.86) 70%, #070607); }
.bw-mark { font-family: 'Playfair Display',serif; font-weight: 700; font-size: 22px; line-height: 1.2; color: #fff; text-decoration: none; }
.bw-h1 { font-family: var(--head); font-weight: 700; font-size: 40px; line-height: 1.12; color: #fff; max-width: 100%; text-wrap: balance; overflow-wrap: break-word; }
.bw-sub { font-style: italic; font-size: 17px; color: rgba(255,255,255,.84); max-width: 34ch; text-wrap: balance; }
.bw-pill { display: inline-flex; align-items: center; justify-content: center; gap: 10px; margin-top: 28px; max-width: 100%;
  min-height: 54px; padding: 12px 26px; border-radius: 16px; background: #fff; color: #000;
  font: 600 17px/1.25 var(--ui); text-decoration: none; text-align: center; transition: opacity .15s ease; }
.bw-pill:hover { opacity: .9; }
.bw-apple { flex-shrink: 0; margin-top: -2px; }

/* ---- sections ---- */
.bw-sec { padding: 56px 24px; border-top: 1px solid var(--line); }
.bw-eyebrow { font-family: var(--body); font-size: 12px; line-height: 1.4; letter-spacing: .28em; text-transform: uppercase; color: var(--crim-t); }
.bw-h2 { font-family: var(--head); font-weight: 700; font-size: 30px; line-height: 1.18; color: #fff; text-wrap: balance; overflow-wrap: break-word; }
.bw-lead { color: var(--mute); max-width: 46ch; }

.bw-cards { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); gap: 20px; margin-top: 28px; }
.bw-card { display: flex; flex-direction: column; border-radius: 22px; overflow: hidden; background: var(--card); border: 1px solid var(--line); }
.bw-card img, .bw-seal { display: block; width: 100%; height: auto; aspect-ratio: 768/536; object-fit: cover; }
.bw-seal { display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 55%, rgba(150,16,20,.38), #0b0a0c 72%); border-bottom: 1px solid var(--line); }
.bw-card-body { display: flex; flex-direction: column; flex: 1; padding: 20px 20px 18px; }
.bw-card h3 { font-family: var(--head); font-weight: 600; font-size: 25px; line-height: 1.2; color: #fff; overflow-wrap: break-word; }
.bw-card p { flex: 1; margin-top: 8px; color: var(--mute); font-size: 16px; }
.bw-meta { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font: 600 14px/1.3 var(--ui); color: var(--crim-t); }
.bw-meta-mute { color: var(--mute); }

.bw-feats { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); margin-top: 24px; }
.bw-feat { padding: 22px 0; border-top: 1px solid var(--line); }
.bw-feat h3 { font-family: var(--head); font-weight: 600; font-size: 22px; line-height: 1.25; color: #fff; }
.bw-feat p { margin-top: 6px; color: var(--mute); font-size: 16px; }
.bw-feats-after { margin-top: 8px; }
.bw-feats-after .bw-feat:first-child { border-top: 0; }
.bw-note { padding-top: 20px; border-top: 1px solid var(--line); font-style: italic; font-size: 15px; color: var(--mute); }

.bw-worlds { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); margin-top: 24px; margin-inline: -24px; }
.bw-world { position: relative; height: 150px; overflow: hidden; }
.bw-world img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.bw-world figcaption { position: absolute; inset-inline: 0; bottom: 0; padding: 30px 24px 12px;
  background: linear-gradient(to top, rgba(0,0,0,.88), transparent);
  font-family: var(--head); font-weight: 600; font-size: 19px; line-height: 1.25; color: #fff; }

/* closing band: the same App Store pill, offered again */
.bw-cta { display: flex; flex-direction: column; align-items: center; text-align: center;
  background: radial-gradient(circle at 50% 100%, rgba(150,16,20,.3), rgba(7,6,7,0) 70%); }
.bw-cta .bw-lead { margin-inline: auto; }

/* ---- footer ---- */
.bw-foot { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 28px 24px 34px;
  border-top: 1px solid var(--line); text-align: center; font: 400 14px/1.4 var(--ui); color: rgba(255,255,255,.68); }
.bw-foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 24px; }
.bw-foot nav a { display: inline-flex; align-items: center; min-height: 44px; color: rgba(255,255,255,.68); text-decoration: none; }
.bw-foot nav a:hover { color: #fff; }

/* ---- header: wordmark at the start, language switch at the end ---- */
.bw-head { position: absolute; top: 0; inset-inline: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-block: 12px; padding-inline: 24px 16px; }
/* The switch is not positioned itself, so its panel hangs from the header. */
.bw-lang summary { list-style: none; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 14px;
  border: 1px solid rgba(255,255,255,.2); border-radius: 999px; background: rgba(7,6,7,.45);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: #fff; font: 400 15px/1.4 var(--ui); cursor: pointer; }
.bw-lang summary::-webkit-details-marker { display: none; }
.bw-lang summary::after { content: ""; width: 7px; height: 7px; margin-top: -4px;
  border-inline-end: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.bw-lang[open] summary::after { margin-top: 4px; transform: rotate(-135deg); }
.bw-lang ul { list-style: none; position: absolute; top: 100%; inset-inline: 16px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; padding: 8px;
  border: 1px solid rgba(255,255,255,.14); border-radius: 18px; background: var(--card); text-align: start;
  box-shadow: 0 20px 50px rgba(0,0,0,.65); }
.bw-lang li a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 8px 12px; border-radius: 10px;
  font-family: 'Lora','Noto Serif Armenian','Noto Serif Devanagari','Noto Serif JP','Noto Serif KR','Noto Serif SC','Noto Naskh Arabic',serif;
  font-size: 16px; line-height: 1.3; color: #f1ece4; text-decoration: none; }
.bw-lang li a:hover { background: rgba(255,255,255,.06); }
.bw-lang li a[aria-current] { background: rgba(209,36,41,.18); color: #fff; font-weight: 600; }
.bw-lang li a[aria-current]::after { content: "\2713"; color: var(--crim-t); font-family: var(--ui); }
.bw-globe { flex-shrink: 0; }

/* ---- support page ---- */
.bw-top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: 12px; padding-inline: 24px 16px; border-bottom: 1px solid var(--line); }
.bw-page { flex: 1; padding: 40px 24px 56px; }
.bw-h1s { font-family: var(--head); font-weight: 700; font-size: 38px; line-height: 1.15; color: #fff; }
.bw-contact { margin-top: 24px; padding: 22px 20px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); }
.bw-contact h2 { font-family: var(--head); font-weight: 600; font-size: 22px; line-height: 1.25; color: #fff; }
.bw-contact p { margin-top: 8px; color: var(--mute); font-size: 16px; }
.bw-contact .bw-small { margin-top: 14px; font-size: 14.5px; }
.bw-mail { display: inline-block; margin-top: 14px; font: 600 17px/1.3 var(--ui); color: var(--crim-t);
  text-decoration: underline; text-underline-offset: 4px; overflow-wrap: anywhere; }
.bw .bw-h2-faq { margin-top: 44px; font-size: 26px; }
.bw-faq { margin-top: 16px; border-top: 1px solid var(--line); }
.bw-faq details { border-bottom: 1px solid var(--line); }
.bw-faq summary { list-style: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; min-height: 44px; padding: 18px 0;
  font-family: var(--head); font-weight: 600; font-size: 19px; line-height: 1.3; color: #fff; cursor: pointer; }
.bw-faq summary::-webkit-details-marker { display: none; }
.bw-faq summary::after { content: "+"; flex-shrink: 0; font: 400 24px/1 var(--ui); color: var(--crim-t); }
.bw-faq details[open] summary::after { content: "\2013"; }
.bw-faq p { margin: -4px 0 20px; color: var(--mute); font-size: 16px; max-width: 60ch; }

/* ---- scripts with no italics or capitals; scripts that stand taller ---- */
:root:is([lang=ar],[lang=ja],[lang=ko],[lang|=zh],[lang=hi]) .bw-eyebrow { letter-spacing: 0; text-transform: none; font-size: 15px; }
:root:is([lang=ar],[lang=ja],[lang=ko],[lang|=zh],[lang=hi]) :is(.bw-sub, .bw-note) { font-style: normal; }
:root:is([lang=ar],[lang=hi]) :is(.bw-h1, .bw-h1s) { line-height: 1.35; }
/* Armenian letters carry long tails below the line, so a headline needs more
   room between its lines and above the text that follows it. */
:root[lang=hy] .bw-h1 { line-height: 1.24; }
:root[lang=hy] :is(.bw-h2, .bw-h1s) { line-height: 1.3; }
:root[lang=hy] :is(.bw-sub, .bw-lead) { margin-top: 12px; }
/* Korean breaks between words, never inside one. Japanese and Chinese
   headlines come in phrases (site-build.py) that stay whole when they fit. */
:root[lang=ko] .bw { word-break: keep-all; overflow-wrap: break-word; }
.bw-phrase { display: inline-block; max-width: 100%; }
:root:is([lang=ar],[lang=hi]) :is(.bw-h2, .bw-card h3, .bw-feat h3, .bw-contact h2, .bw-faq summary) { line-height: 1.4; }

/* ---- desktop ---- */
@media (min-width: 900px) {
  .bw-hero { min-height: 720px; min-height: min(720px, 100svh); padding: 130px 48px 64px; }
  /* The real video is a tall picture: on a wide hero this crop keeps the raven
     and the bleeding branch above the headline. */
  .bw-hero-media { object-position: 50% 20%; }
  .bw-mark { font-size: 24px; }
  .bw-h1 { font-size: 68px; }
  .bw-sub { font-size: 21px; max-width: 44ch; }
  .bw-sec { padding: 88px 48px; }
  .bw-h2 { font-size: 40px; }
  .bw-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin-top: 40px; }
  .bw-feats { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 64px; margin-top: 36px; }
  .bw-worlds { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 36px; margin-inline: 0; }
  .bw-world { height: 380px; border-radius: 18px; }
  .bw-world figcaption { padding: 40px 24px 22px; text-align: center; font-size: 22px; }
  .bw-foot { flex-direction: row; justify-content: flex-end; gap: 28px; padding: 22px 40px; text-align: start; }
  .bw-pub { order: -1; margin-inline-end: auto; }

  .bw-head, .bw-top { padding-block: 22px; padding-inline: 40px; }
  .bw-lang ul { top: calc(100% - 6px); inset-inline-start: auto; inset-inline-end: 40px; width: 440px;
    grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bw-feats-after { margin-top: 20px; }
  /* Two columns: neither blurb of the first row carries a rule above it. */
  .bw-feats-after .bw-feat:nth-child(-n+2) { border-top: 0; }

  /* Support: one readable column in the middle. */
  .bw-page { padding: 72px 48px 96px; }
  .bw-page .bw-wrap { max-width: 720px; }
  .bw-h1s { font-size: 52px; }
  .bw .bw-h2-faq { margin-top: 56px; font-size: 32px; }
}

/* ---- wide screens: the hero video stops growing ----
   The video is a small, tall file (720 px of real detail). Stretched across a
   wide window it turns soft, so past the width of the page's content column
   (1040 px) it keeps that width, centered, and its sides fade into the black. */
@media (min-width: 1041px) {
  .bw-hero-media { width: 1040px; margin-inline: auto;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent); }
}
