/*
 * Every size is given as "smallest + growth * var(--f)", where --f runs from
 * 0px (compact) to 1px (full size).
 *
 * On phones --f follows the window width. From 800px up the layout switches
 * to the desktop one (pill row, two-column cards) and --f is also capped by
 * the window height, so the whole page fits on one screen without scrolling.
 */

:root {
  --bg: #000000;
  --text: #fafafa;
  --text-soft: #d4d4d4;
  --text-muted: #a3a3a3;
  --text-subtle: #8a8a8a;
  --pill-bg: #1a1a1a;
  --pill-border: #2a2a2a;
  --card-bg: #0f0f0f;
  --card-border: #262626;
  --hover-border: #3d3d3d;
  --accent: #7ce3a1;

  --font-display: 'Bricolage Grotesque', 'Helvetica Neue', sans-serif;
  --font-body: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Helvetica Neue', sans-serif;

  --screen-h: 100vh;
  --f: clamp(0px, (100vw - 390px) / 1050, 1px);
}

@supports (height: 100svh) {
  :root {
    --screen-h: 100svh;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: var(--screen-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 56px calc(20px + 44 * var(--f)) 32px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

a {
  color: var(--text);
  text-decoration: none;
}

a:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.nowrap {
  white-space: nowrap;
}

/* Centred in whatever height is left over; the footer sits below it */

.page {
  width: 100%;
  margin-block: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Logo */

.logo {
  display: block;
  width: calc(40px + 4 * var(--f));
  height: calc(40px + 4 * var(--f));
  border: 2px solid var(--text);
  border-radius: 999px;
}

/* Sub-pages: a logo that brings its own ring, and a link back home */

.logo--plain {
  border: 0;
}

.back {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 28px;
  padding: 6px 4px;
  font-size: 14px;
  color: var(--text-subtle);
  transition: color 0.2s ease;
}

.back svg {
  flex: none;
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.back:hover {
  color: var(--text);
}

.back:hover svg {
  transform: translateX(-3px);
}

/* Headline */

.headline {
  margin: 24px 0 0;
  text-align: center;
  /* one line on desktop; on phones it splits into two even lines instead of orphaning a word */
  text-wrap: balance;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: calc(38px + 18 * var(--f));
  line-height: 1.04;
  letter-spacing: -0.035em;
}

/* Social pills: finger-sized on phones, compact with a mouse (see desktop layout) */

.links {
  margin-top: 28px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px 0 12px;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  font-size: 16px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.pill__icon {
  flex: none;
  width: auto;
  height: 20px;
}

/* The YouTube mark is wider than it is tall; a touch shorter keeps it optically level with Instagram */
.pill__icon--youtube {
  height: 18px;
}

.pill:hover {
  color: #ffffff;
  background: #222222;
  border-color: var(--hover-border);
}

/* Bio */

.bio {
  margin: 16px 0 0;
  max-width: 900px;
  text-align: center;
  font-size: calc(16px + 2 * var(--f));
  line-height: 1.5;
  color: var(--text-muted);
}

.bio--narrow {
  max-width: 32em;
  text-wrap: balance;
}

/* What I'm building */

.building {
  margin-top: 40px;
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: calc(12px + 2 * var(--f));
}

.building__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.building__head h2 {
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
}

.now {
  display: flex;
  align-items: center;
  gap: 8px;
}

.now__dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
}

.cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: calc(12px + 2 * var(--f));
}

.card {
  display: flex;
  flex-direction: column;
  gap: calc(12px + 2 * var(--f));
  padding: calc(20px + 4 * var(--f));
  border-radius: calc(18px + 2 * var(--f));
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Only cards that are links react to the pointer; a "coming soon" card is a plain div */
a.card:hover {
  color: #ffffff;
  background: #131313;
  border-color: var(--hover-border);
}

.card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* as tall as the arrow, so a card without one still lines up with its neighbour */
  min-height: calc(18px + 2 * var(--f));
}

.card__role {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.card__arrow {
  flex: none;
  width: calc(18px + 2 * var(--f));
  height: calc(18px + 2 * var(--f));
  transition: transform 0.2s ease;
}

a.card:hover .card__arrow {
  transform: translate(2px, -2px);
}

.card__name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: calc(26px + 4 * var(--f));
  letter-spacing: -0.03em;
  line-height: 1;
}

.card__logo {
  flex: none;
  width: calc(30px + 4 * var(--f));
  height: calc(30px + 4 * var(--f));
  border-radius: 999px;
  border: 1px solid var(--card-border);
}

.card__desc {
  font-size: calc(15px + 1 * var(--f));
  line-height: 1.5;
  /* avoids leaving a single word alone on the last line */
  text-wrap: pretty;
  color: var(--text-muted);
}

.card__url {
  margin-top: auto;
  font-size: 14px;
  color: var(--text-soft);
}

/* Footer */

.footer {
  padding-top: 40px;
  font-size: calc(13px + 1 * var(--f));
  color: var(--text-subtle);
}

/* Desktop layout */

@media (min-width: 800px) {
  :root {
    /*
     * Measured: this layout is 521px tall at --f: 0 and grows 131px by --f: 1,
     * so capping --f at (window height - 521) / 131 keeps the page on one
     * screen. The extra 16px is breathing room. Re-measure if content changes.
     */
    --f: clamp(0px, min((100vw - 390px) / 1050, (var(--screen-h) - 537px) / 131), 1px);
  }

  body {
    padding-top: calc(28px + 28 * var(--f));
    padding-bottom: calc(20px + 8 * var(--f));
  }

  .headline {
    margin-top: calc(20px + 4 * var(--f));
    /* the headline is up to 17.3em wide: the second value keeps it on one line in narrow windows */
    font-size: min(calc(38px + 18 * var(--f)), (100vw - 130px) / 17.4);
    line-height: 1.02;
    letter-spacing: -0.04em;
  }

  .links {
    margin-top: calc(20px + 8 * var(--f));
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  .pill {
    height: calc(32px + 4 * var(--f));
    padding: 0 14px 0 10px;
    font-size: calc(15px + 1 * var(--f));
  }

  .pill__icon {
    height: calc(18px + 2 * var(--f));
  }

  .pill__icon--youtube {
    height: calc(16px + 2 * var(--f));
  }

  .bio {
    margin-top: calc(12px + 4 * var(--f));
  }

  .building {
    margin-top: calc(28px + 16 * var(--f));
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer {
    padding-top: calc(24px + 8 * var(--f));
  }
}

/* Touch screens wide enough for the desktop layout still get finger-sized pills */

@media (min-width: 800px) and (pointer: coarse) {
  .pill {
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pill,
  .card,
  .card__arrow,
  .back,
  .back svg {
    transition: none;
  }
}
