/*
 * Hani und Radin Studio
 *
 * One idea: a Berlin night sky where the stars spell words. The sky is the only
 * spectacle; everything on top of it stays quiet, readable and set in one face,
 * Fira Sans, drawn by the Berlin typographer Erik Spiekermann.
 *
 * Colour: the background is Berliner Blau (Prussian blue, first made in Berlin in
 * 1706) at night. Coral is Mitlesen's accent, so the app and its studio match.
 * Contrast on --night: --starlight 15.2:1, --ink-soft 12.9:1, --haze 8.8:1, --coral 6.9:1.
 */

/* ---- Fonts (self-hosted: no request leaves this site) --------------------- */

@font-face {
  font-family: "Fira Sans";
  src: url("/fonts/fira-sans-300.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fira Sans";
  src: url("/fonts/fira-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fira Sans";
  src: url("/fonts/fira-sans-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* Only the sky draws with these two: heavy letters make dense constellations. */
@font-face {
  font-family: "Fira Sans";
  src: url("/fonts/fira-sans-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazirmatn Words";
  src: url("/fonts/vazirmatn-words-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+FB50-FDFF, U+FE70-FEFF;
}

/* ---- Tokens -------------------------------------------------------------- */

:root {
  --night: #071a2c;
  --night-deep: #051321;
  --night-raised: #0c2438;
  --starlight: #f4eee3;
  --ink-soft: #d5dee7;
  --haze: #a8bacb;
  --coral: #ff7a6e;
  --rule: rgb(168 186 203 / 0.2);

  --font: "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* A classic typographic scale: 14 16 18 21 24 36 48 60 72. */
  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.125rem;
  --step-2: 1.3125rem;
  --step-3: 1.5rem;
  --step-4: 2.25rem;
  --step-5: 3rem;
  --step-6: 3.75rem;
  --step-7: 4.5rem;

  --gutter: clamp(1rem, 5vw, 3.5rem);
  --wide: 72rem;
  --measure: 36rem;
  --section-space: clamp(5rem, 12vw, 9rem);

  color-scheme: dark;
}

/* ---- Base ---------------------------------------------------------------- */

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

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font);
  font-size: var(--step-1);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
p,
dl,
dd,
ul,
figure {
  margin: 0;
}

h1,
h2 {
  color: var(--starlight);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.08;
  text-wrap: balance;
}

p,
li,
dd {
  text-wrap: pretty;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--starlight);
  text-decoration-line: underline;
  text-decoration-color: var(--coral);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}

a:hover {
  color: #fff;
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
  border-radius: 3px;
}

::selection {
  background: rgb(255 122 110 / 0.35);
  color: #fff;
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  padding: 0.5rem 0.875rem;
  background: var(--starlight);
  color: var(--night);
  font-size: var(--step--1);
  font-weight: 500;
  border-radius: 6px;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* ---- The sky ------------------------------------------------------------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  opacity: 0;
  transition: opacity 1.6s ease;
  pointer-events: none;
}

.sky-ready .sky {
  opacity: 1;
}

/* No WebGL, or the GPU gave up: a still sky in CSS. */
.no-webgl .sky {
  display: none;
}

.no-webgl body {
  background:
    radial-gradient(ellipse 70% 45% at 62% 58%, rgb(58 86 120 / 0.35), transparent 70%),
    radial-gradient(ellipse 120% 80% at 50% 110%, var(--night-raised), transparent 60%),
    var(--night-deep);
  background-attachment: fixed;
}

@media (prefers-reduced-motion: reduce) {
  .sky {
    transition: none;
  }
}

/* ---- Header -------------------------------------------------------------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  width: 100%;
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin-inline: auto;
  padding: clamp(1.25rem, 3vw, 2rem) var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--starlight);
  font-size: var(--step-0);
  font-weight: 500;
  letter-spacing: 0.005em;
  text-decoration: none;
}

.brand-mark {
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem clamp(1rem, 2.5vw, 2rem);
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  padding-block: 0.375rem;
  color: var(--haze);
  font-size: var(--step-0);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--starlight);
}

.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--coral);
  text-underline-offset: 0.4em;
}

/* On the home page the header floats over the sky and the name lives in the h1. */
.home .site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
}

.home .brand-name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- Layout -------------------------------------------------------------- */

main {
  flex: 1;
}

.wrap {
  width: 100%;
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.lead {
  color: var(--ink-soft);
  font-size: var(--step-2);
  font-weight: 300;
  line-height: 1.5;
  max-width: var(--measure);
}

/* ---- Home: hero ---------------------------------------------------------- */

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-content: end;
  min-height: 100vh;
  min-height: 100svh;
  padding-top: 7rem;
  padding-bottom: clamp(2.5rem, 8vh, 5.5rem);
}

/* A soft pool of night behind the text, so it stays legible over the galaxy.
   It fades out on every side, so it never shows an edge while scrolling. */
.hero::before {
  content: "";
  position: absolute;
  inset: 35% 0 -20%;
  z-index: -1;
  background: radial-gradient(ellipse 65% 55% at 25% 62%, rgb(5 19 33 / 0.82), rgb(5 19 33 / 0.5) 45%, rgb(5 19 33 / 0) 75%);
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(var(--step-5), 7vw, var(--step-7));
  max-width: 11em;
  margin-bottom: 1.25rem;
}

.hero .lead {
  margin-bottom: 1.75rem;
}

.hero-link {
  font-size: var(--step-1);
}

.sky-caption {
  position: absolute;
  top: calc(var(--word-bottom, 46svh) + 1.5rem);
  left: var(--gutter);
  right: var(--gutter);
  color: var(--haze);
  font-size: var(--step-0);
  text-align: center;
  text-shadow: 0 0 0.75rem var(--night-deep), 0 0 0.25rem var(--night-deep);
  opacity: 0;
  transform: translateY(0.35rem);
  transition: opacity 0.7s ease, transform 0.7s ease;
  pointer-events: none;
}

.sky-caption.is-visible {
  opacity: 1;
  transform: none;
}

.no-webgl .sky-caption {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .sky-caption {
    transition: none;
    transform: none;
  }
}

/* ---- Home: sections ------------------------------------------------------ */

.section {
  padding-block: var(--section-space);
}

.section h2 {
  font-size: clamp(var(--step-4), 5vw, var(--step-6));
  margin-bottom: 1.5rem;
}

.mitlesen {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2.5rem, 7vw, 6rem);
  align-items: center;
}

.phone {
  justify-self: center;
  width: min(100%, 17.5rem);
  padding: 0.5rem;
  border: 1px solid rgb(244 238 227 / 0.16);
  border-radius: 2.5rem;
  background: var(--night-raised);
  box-shadow: 0 2.5rem 5rem -2rem rgb(0 0 0 / 0.6);
}

.phone img {
  width: 100%;
  border-radius: 2rem;
}

.mitlesen .lead {
  margin-bottom: 2.5rem;
}

.features {
  display: grid;
  gap: 1.75rem 2.5rem;
  margin-bottom: 2.75rem;
}

.features dt {
  color: var(--starlight);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.features dd {
  color: var(--haze);
  font-size: var(--step-0);
  line-height: 1.55;
  max-width: 24rem;
}

.store-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.store-badge {
  display: inline-block;
  border-radius: 9px;
  line-height: 0;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.store-badge svg {
  width: 10.5rem;
  height: auto;
}

.store-badge:hover {
  transform: translateY(-1px);
}

.mitlesen-web {
  color: var(--haze);
  font-size: var(--step-0);
}

.about {
  display: grid;
  gap: 1.5rem clamp(2.5rem, 7vw, 6rem);
}

.about-body {
  display: grid;
  gap: 1.25rem;
  max-width: var(--measure);
}

.facts {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: var(--step-0);
}

.facts div {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 1rem;
}

.facts dt {
  color: var(--haze);
}

.facts dd {
  color: var(--ink-soft);
}

.contact-block p {
  max-width: 40rem;
}

.email {
  display: inline-block;
  margin-block: 0.75rem 1.5rem;
  color: var(--starlight);
  font-size: clamp(var(--step-2), 3.4vw, var(--step-4));
  font-weight: 300;
  letter-spacing: -0.015em;
  line-height: 1.2;
  overflow-wrap: break-word;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

@media (min-width: 48rem) {
  .features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 60rem) {
  .mitlesen {
    grid-template-columns: minmax(15rem, 19rem) minmax(0, 1fr);
  }

  .phone {
    width: 100%;
  }

  .about {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
  }
}

/* ---- Inner pages --------------------------------------------------------- */

.page-main {
  padding-block: clamp(2.5rem, 7vw, 5rem) var(--section-space);
}

.page-intro {
  max-width: 44rem;
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

.page-intro h1 {
  font-size: clamp(var(--step-4), 6vw, var(--step-6));
  margin-bottom: 1.25rem;
}

.page-intro .meta {
  margin-top: 1rem;
}

.prose {
  max-width: 42rem;
}

.prose h2 {
  font-size: var(--step-3);
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-top: 3rem;
  margin-bottom: 0.875rem;
}

.prose h2:first-child {
  margin-top: 0;
}

.prose p,
.prose ul,
.prose address {
  margin-bottom: 1rem;
}

.prose ul {
  padding-left: 1.25rem;
}

.prose li + li {
  margin-top: 0.375rem;
}

.prose li::marker {
  color: var(--coral);
}

address {
  font-style: normal;
}

.meta {
  color: var(--haze);
  font-size: var(--step-0);
}

.help-list {
  display: grid;
  gap: 0;
  margin-block: 0.5rem 1rem;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.help-list li {
  display: grid;
  gap: 0.25rem;
  padding-block: 1.125rem;
  border-bottom: 1px solid var(--rule);
}

/* The help list is a ruled list, not a bulleted one: undo the prose list indent. */
.prose .help-list {
  padding-left: 0;
}

.prose .help-list li + li {
  margin-top: 0;
}

.help-list strong {
  color: var(--starlight);
  font-weight: 500;
}

.help-list span {
  color: var(--haze);
  font-size: var(--step-0);
}

/* ---- Footer -------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--rule);
  background: rgb(5 19 33 / 0.6);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-block: 2rem 2.5rem;
  color: var(--haze);
  font-size: var(--step--1);
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding: 0;
  list-style: none;
}

.site-footer a {
  color: var(--haze);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--starlight);
  text-decoration: underline;
  text-decoration-color: var(--coral);
}

/* ---- Small screens ------------------------------------------------------- */

@media (max-width: 40rem) {
  body {
    font-size: var(--step-0);
  }

  .lead {
    font-size: var(--step-1);
  }

  .site-nav a {
    font-size: var(--step--1);
  }

  .facts div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}
