/* littleorgans.com: the door and its room. */
@font-face {
  font-family: "Barlow Semi Condensed";
  font-weight: 600;
  src: url(/assets/fonts/BarlowSemiCondensed-SemiBold.woff2) format("woff2");
  font-display: swap;
}

@font-face {
  font-family: Barlow;
  font-weight: 500;
  src: url(/assets/fonts/Barlow-Medium.woff2) format("woff2");
  font-display: swap;
}

@font-face {
  font-family: Barlow;
  font-weight: 400;
  src: url(/assets/fonts/Barlow-Regular.woff2) format("woff2");
  font-display: swap;
}

:root {
  --ink: #16140f;
  --paper: #f1f1ee;
  --body: 1.125rem;
}

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

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

body {
  font: 400 var(--body) / 1.4 Barlow, sans-serif;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: 100%;
  color: inherit;
  font-weight: 500;
  text-decoration: underline 1px;
  text-underline-offset: .26em;
}

a:hover,
a:active {
  text-decoration-thickness: 2px;
}

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

/* ---------- The room: one 1440 x 900 composition, scaled whole to the screen ----------
   Every length inside is in cqw of the room, so words and picture keep their places:
   1cqw is 14.4 px at 1440. The edge is the picture's 96 px margin. The words below share it. */
main {
  width: min(100%, 160svh);
  margin-inline: auto;
  container-type: inline-size;
}

.room,
.words {
  --edge: 6.667cqw;
}

.room {
  position: relative;
  aspect-ratio: 1440 / 900;
}

.scene,
.scene img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.logo {
  position: absolute;
  top: 3.889cqw;
  left: var(--edge);
  width: auto;
  height: max(24px, 3.333cqw);
}

.door {
  position: absolute;
  top: 3.889cqw;
  right: var(--edge);
}

.line {
  margin-inline-start: -.037em; /* The first glyph's side bearing. */
  font: 600 3.194cqw / 1.04 "Barlow Semi Condensed", sans-serif;
  letter-spacing: -.005em;
}

.line span {
  display: block;
  white-space: nowrap; /* Break only between the two sentences. */
}

/* ---------- Below the room: two lines, two ideas, what comes next and the way in ---------- */
.words {
  padding: 6.667cqw var(--edge) 8.333cqw;
  font-size: max(var(--body), 1.667cqw);
  line-height: 1.45;
}

.words p {
  text-wrap: pretty; /* No word left alone on a last line. */
}

/* Narrower than a laptop, his two lines wrap: a step between them keeps each one whole. */
@media (max-width: 1023px), (max-aspect-ratio: 4 / 5) {
  .words > p + p {
    margin-block-start: 10px;
  }
}

.ideas {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3.333cqw;
  margin-block-start: 6.667cqw;
  padding: 0;
  list-style: none;
}

.ideas img {
  display: block;
  width: auto;
  height: 11.25cqw; /* As drawn, 162 px at 1440: one unit, one floor across both. */
  margin-block-end: 2.222cqw;
}

.ideas h2 {
  font: 600 1em / 1.3 "Barlow Semi Condensed", sans-serif;
}

.connect {
  margin-block-start: 6.667cqw;
}

.words .talk {
  margin-block-start: .556cqw;
}

.words .talk a {
  display: inline-flex;
  gap: .35em;
  min-height: 44px;
}

.talk svg {
  width: .8em;
  height: .8em;
  flex: none;
}

/* ---------- Portrait phones and tall screens: the words first, the picture under them ----------
   Phones turned on their side keep the wide room. index.html repeats this query on its picture. */
@media (max-width: 679px) and (max-aspect-ratio: 1 / 1), (max-aspect-ratio: 4 / 5) {
  main {
    width: 100%;
  }

  .room,
  .words {
    --edge: 24px;
  }

  .words {
    padding-block: 48px 72px;
    font-size: var(--body);
  }

  .ideas {
    grid-template-columns: 1fr;
    gap: 48px;
    margin-block-start: 56px;
  }

  .ideas img {
    /* The crew at their widest (440 x 162 as drawn) still clear both edges. */
    height: min(120px, (100cqw - 2 * var(--edge)) * 162 / 440);
    margin-block-end: 16px;
  }

  .connect {
    margin-block-start: 56px;
  }

  .words .talk {
    margin-block-start: 4px;
  }

  .room {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100svh;
    aspect-ratio: auto;
    padding-block-start: 32px;
  }

  .logo,
  .door {
    position: static;
  }

  .logo {
    align-self: flex-start;
    height: 40px;
    margin-inline-start: var(--edge);
  }

  .door {
    margin: 24px var(--edge) 0;
  }

  .line {
    /* Sized to the earlier, longer first sentence (about 12.3em); the shorter one fits with room. */
    font-size: min(2.125rem, calc((100vw - 2 * var(--edge)) / 12.4));
  }

  /* The picture always spans the width, left edge to right, and sits on the screen's bottom edge.
     index.html picks the cut that fits the screen; a screen lower than its cut scrolls. */
  .scene {
    position: relative;
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    margin-block-start: 8px;
  }

  .scene img {
    position: static;
    height: auto;
  }
}
