/* Archivo, self-hosted (SIL OFL, see fonts/Archivo-OFL.txt).
   Variable weight files from Fontsource; no requests to Google. */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(../fonts/archivo-latin-ext-wght-normal.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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(../fonts/archivo-latin-wght-normal.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;
}

:root {
  --ink: #17150f;
  --muted: #8a877c;
  --bg: #fff;
  --accent: #000000; /*#17150f;*/ /*#a98ae0;*/
  /* body text size, also used to space sections consistently */
  --text: clamp(1.3rem, 1rem + 1.6vw, 2.4rem);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Archivo", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--text);
  line-height: 1.45;
  /*text-transform: lowercase;*/
  letter-spacing: 0.068em; /* 2.6px at desktop size, scales down on phones */
  text-wrap: pretty;
  color: var(--ink);
  background: var(--bg);
}

::selection {
  background: var(--accent);
  color: #fff;
}

main {
  --pad-top: clamp(0.25rem, 1vw, 1rem);
  /* same gutter left and right at every width */
  padding: var(--pad-top) clamp(0.25rem, 1.75vw, 1.0rem); /*clamp(0.5rem, 1vw, 1rem) clamp(0.75rem, 1.75vw, 1.5rem);*/
}

/* Landing screen: name and photo at the top, the welcome line at the
   bottom of the first screen, the rest of the bio right after it.
   A minimum height only, so on short screens (landscape phones, small
   windows) nothing is cut off and the page simply flows. svh = height
   with the phone's browser bars shown. */
.intro {
  display: flex;
  flex-direction: column;
}

/* welcome line: a bit more space before the bio than between paragraphs */
.intro p {
  margin-bottom: 1.6em;
}

/* Landing screen on phones and on wider screens at least 1.6x as wide as
   tall (the desktop composition itself is ~1.78x). On squarer windows it
   would leave a big gap above the welcome line, so the text flows on. */
/* Phones only when the screen is at least 0.4x as wide as tall: every
   common phone is ~0.45-0.56, and there name, photo and welcome line
   roughly fill the screen. Narrower, very tall windows would leave a big
   gap above the welcome line, so the text flows on instead. */
@media (max-width: 500px) and (min-aspect-ratio: 2/5), (min-aspect-ratio: 8/5) {
  .intro {
    min-height: calc(100vh - var(--pad-top));
    min-height: calc(100svh - var(--pad-top));
  }

  .intro p {
    margin-top: auto; /* pushes the welcome line to the bottom */
  }
}

/* Header: two-line name top left, headshot top right.
   Everything is sized in em of the name, so the photo always
   matches the name's height. */
.head {
  display: flex;
  /* the photo's bottom edge sits exactly on the baseline of SCHÜTTLER;
     flex-end + margin below is the fallback for older browsers */
  align-items: flex-end;
  align-items: last baseline;
  justify-content: space-between;
  gap: 0.22em;
  /* header is ~10.2em wide, so this keeps it inside the page at any width */
  font-size: min(10.75rem, calc((100vw - 2rem) / 10.4));
  /* in body-text units, not the name's: the name shrinks far more on
     phones than the text does, so 0.6em left almost no gap there */
  margin-bottom: calc(var(--text) * 2.1);
}

/* 3em by default; grows into any space left beside the name,
   up to --photo-max (more room allowed on narrow screens) */
.photo {
  --photo-max: 3em;
  flex: 1 0 3em;
  /* without this, flexbox's automatic minimum makes the image
     --photo-max wide even when there's no room, overflowing the page */
  min-width: 3em;
  max-width: var(--photo-max);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  /* fallback only: the h1 box extends 0.1745em below its baseline */
  margin-bottom: 0.1745em;
}

h1 {
  font-size: 1em;
  font-weight: 900;
  line-height: 1.01;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-left: -0.023em; /* the J's built-in left space, so the ink sits on the gutter */
}

/* The name is marked up as JANIK | SCHÜ | TTLER. On wider screens it
   reads as two lines (SCHÜ and TTLER joined), on phones as three
   equal-width lines (see the phone rules below). */
h1 .l1 {
  display: block;
}

p {
  text-wrap: pretty;
  margin-bottom: 0.9em;
}

b {
  font-weight: 800;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.15em;
  text-decoration-color: var(--muted);
}

a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

/* Links: a plain row of underlined words */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2em 0.9em;
  margin-top: 3.0em;
  text-transform: lowercase;
}

/* Phones (up to 500px, i.e. every phone held upright): name, then photo,
   then text, stacked. Between 500 and 640px (narrow desktop windows) the
   desktop layout applies instead: the stacked phone header would get so
   big there that it no longer fits the screen. */
@media (max-width: 500px) {
  .head {
    flex-direction: column;
    align-items: stretch;
    gap: calc(var(--text) * 1.1);
    font-size: var(--name);
  }

  .photo {
    flex: none;
    align-self: center;
    width: 80%;
    min-width: 0;
    max-width: none;
    margin: 0;
  }
}

/* Short text lines up to 640px: hyphenation and one link per line once
   the row (~22em) no longer fits (~600px) */
@media (max-width: 640px) {
  /* short lines on phones: hyphenate long words instead of leaving
     big gaps; only words of 8+ letters, at least 3 on each side */
  p {
    -webkit-hyphens: auto;
    hyphens: auto;
    hyphenate-limit-chars: 8 3 3;
  }

  /* never split names, link text, or already-hyphenated words */
  p a,
  .keep {
    -webkit-hyphens: manual;
    hyphens: manual;
  }

  .links {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* EXPERIMENT (landing-scale): the proportions from the 50px-welcome-line
   screenshot, made to scale. Everything is sized from one unit, --name
   (the name's font size): the photo is 4.57 units square, ~1 unit sits
   between photo and welcome line, the welcome line is 0.42 units with
   0.7 units below it. The whole composition is ~12.3 units wide and
   ~6.9 units tall, so --name is whichever of width or height runs out
   first; on wide screens that means extra side space, on taller ones
   extra space above the welcome line. */
@media (min-width: 501px) {
  .intro {
    /* only the height and a fixed 1rem here: the width-dependent top
       padding made the size drift while the window was narrowed */
    --name: min(calc((100vw - 2rem) / 12.3),
                calc((100vh - 1rem) / 6.9));
    --name: min(calc((100vw - 2rem) / 12.3),
                calc((100svh - 1rem) / 6.9));
  }

  .head {
    font-size: var(--name);
    /* photo at a fixed distance beside the name (the 16:9 proportion),
       not pinned to the right edge: on ultrawide screens the extra width
       goes to the right of the photo instead of between the two.
       name 6.957 + gap 0.76 + photo 4.57 = 12.29 units, within the 12.3 */
    justify-content: flex-start;
    gap: 0.76em;
    margin-bottom: 0.98em;
  }

  .photo {
    flex: none;
    width: 4.57em;
    min-width: 4.57em;
    max-width: none;
  }

  .intro p {
    margin-bottom: calc(var(--name) * 0.7);
  }
}

/* fixed top padding on wider screens: 1vw made the composition drift up
   and down while the window was being narrowed */
@media (min-width: 501px) {
  main {
    --pad-top: 1rem;
  }
}

/* Phones (from exp/name-block): the name in three equal-width lines
   across the full width, the photo below, the welcome line at the bottom
   of the first screen. */
@media (max-width: 500px) {
  .intro {
    /* the three-line block is 3.567em wide */
    --name: calc((100vw - 2 * clamp(0.25rem, 1.75vw, 1rem)) / 3.58);
  }

  /* All three lines exactly the same width. Measured ink widths (em, no
     letter-spacing): JANIK 3.443, SCHÜ 3.049, TTLER 3.567. TTLER sets the
     width; the others spread the difference over the gaps between their
     letters. Each line is shifted left by its first letter's side bearing
     (J, T 0.023em; S 0.043em); margin-right cancels the spacing after the
     last letter. Kerning off so every browser measures the same. */
  h1 {
    margin-left: 0;
    font-kerning: none;
    /* the trailing spacing is invisible but could widen the page */
    overflow-x: clip;
    overflow-clip-margin: 0.05em;
  }

  h1 span {
    display: block;
  }

  h1 .l1 { letter-spacing: 0.031em;  margin: 0 -0.031em 0 -0.023em; }  /* JANIK */
  h1 .l2 { letter-spacing: 0.1727em; margin: 0 -0.1727em 0 -0.043em; } /* SCHÜ */
  h1 .l3 { letter-spacing: 0;        margin: 0 0 0 -0.023em; }         /* TTLER */
}

/* Welcome line: the same size as on exp/name-block, computed from that
   branch's name size so it matches exactly whatever this page's own name
   size is. Desktop: a third (0.32) of name-block's name; phones: a
   quarter of its full-width three-line name. Never below the body text. */
.intro {
  --hey-size: max(var(--text), calc(0.32 * min(calc((100vw - 2rem) / 7.6),
                max(5rem, calc((100vh - 1rem) / 4.8)))));
  --hey-size: max(var(--text), calc(0.32 * min(calc((100vw - 2rem) / 7.6),
                max(5rem, calc((100svh - 1rem) / 4.8)))));
}

@media (max-width: 500px) {
  .intro {
    --hey-size: max(var(--text),
                    calc(0.25 * (100vw - 2 * clamp(0.25rem, 1.75vw, 1rem)) / 3.58));
  }
}

.intro p {
  font-size: var(--hey-size);
}

/* Phones: a bit more room below the footer links */
@media (max-width: 500px) {
  main {
    padding-bottom: calc(var(--pad-top) + 30px);
  }
}
