/**
 * @info Baseline, typography and the grid
 * @path assets/css/site/base.css
 *
 * One grid for every page: twelve columns, a narrow one (1–3) for labels, a
 * wide one (4–12) for the letter. The page's title is the question, large
 * and bold; running text is the letter's size.
 */

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

  /* whatever the page scrolls to clears the sticky header */
  scroll-padding-block-start: calc(var(--space-gutter) + var(--size-logo) + 2rem);
}

body {
  background: var(--color-white);
  color: var(--color-black);
  font: 400 var(--size-ui) / 1.35 var(--font-primary);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}

/* Korean breaks between words (at spaces), not inside them */
:lang(ko) { word-break: keep-all; }

/* Arabic: its own face after Helvetica (Latin stays Helvetica), no
   tracking — it would pull the joined letters apart —, no slanted
   italic, and room for the dots above and below the line */
:lang(ar) {
  --font-primary: "Helvetica Neue", Helvetica, "Geeza Pro", "Noto Sans Arabic",
                  "Segoe UI", Tahoma, Arial, sans-serif;
  font-family: var(--font-primary);

  &, & * { letter-spacing: 0 !important; }
  & em { font-style: normal; }
  & h1 { line-height: 1.2; }
  & [data-text] { line-height: 1.5; }
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: .15em;

  &:hover { text-decoration: none; }
}

/* an address written out: only on paper (site/print.css) */
[data-url] { display: none; }

:focus-visible { outline: 2px solid var(--color-black); outline-offset: 3px; }
::selection { background: var(--color-black); color: var(--color-white); }

/*----------  The grid  ----------*/

main,
body > footer {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--space-gap);
  padding-inline: var(--space-gutter);
}

main {
  padding-block-start: var(--space-gutter);

  & > * { grid-column: 1 / -1; }

  @media (width >= 52rem) {
    & > article { grid-column: 4 / 13; }
  }
}

/*----------  The title, the text  ----------*/

main h1 {
  max-inline-size: 11em;
  padding-block-start: clamp(2rem, 8vw, 9rem);
  font-size: var(--size-huge);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.03em;
  text-wrap: balance;
  overflow-wrap: break-word;   /* last resort: a word without (-) breaks rather than overflows */
}

[data-text] {
  max-inline-size: 30em;
  margin-block-start: clamp(3rem, 9vw, 10rem);
  font-size: var(--size-text);
  line-height: 1.25;
  letter-spacing: -.01em;
  hyphens: manual;
  text-wrap: pretty;

  & p + p { margin-block-start: 1.25em; }
}
