/* Colours, type and curves from @phu/theme (packages/theme/src/index.ts). Fonts are subset to
   Latin and Vietnamese. */
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('/fonts/Nunito-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}

:root {
  --paper: #fffaf2;
  --ink: #1c1a18;
  --ink-secondary: #3e3933;
  --pencil: #6b655e;
  --red-pen: #d42a24;
  --red-deep: #b3221d;
  --chalkboard: #2f6b56;
  --chalk-white: #eef6f0;
  --line: rgba(28, 26, 24, 0.1);
  --shadow: 0 1px 2px rgba(30, 20, 10, 0.06), 0 10px 28px rgba(30, 20, 10, 0.1);
  /* Bubbles and stamps pop on the theme's spring; hover colours settle. */
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --settle: cubic-bezier(0.32, 0.72, 0, 1);
  --weight-normal: 400;
  --weight-semibold: 600;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12201b;
    --ink: #eef6f0;
    --ink-secondary: #c9d6cf;
    --pencil: #93a39b;
    --red-pen: #e2453e;
    --red-deep: #ff6a62;
    --line: rgba(238, 246, 240, 0.14);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font:
    var(--weight-normal) 17px/1.6 'Inter',
    system-ui,
    -apple-system,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  max-width: 600px;
  margin: 0 auto;
  padding: 72px max(20px, env(safe-area-inset-left)) max(48px, env(safe-area-inset-bottom));
}

main.home {
  max-width: 960px;
}

h1,
h2 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

[id] {
  scroll-margin-top: 24px;
}

a {
  color: inherit;
  text-decoration-color: var(--red-pen);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color 150ms ease-out;
}

@media (hover: hover) and (pointer: fine) {
  a:hover {
    color: var(--red-pen);
  }
}

/* The homepage. */
.hero {
  display: grid;
  gap: 40px;
  align-items: center;
}

.icon {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.kicker {
  margin: 28px 0 4px;
  font-size: 12.5px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red-pen);
}

h1 {
  margin: 0;
  font:
    800 56px/1.05 'Nunito',
    system-ui,
    sans-serif;
  letter-spacing: -0.015em;
}

.lead {
  margin: 20px 0 0;
  max-width: 34ch;
  font-size: 20px;
  line-height: 1.5;
  color: var(--ink-secondary);
}

/* Phú's line, drawn as his speech bubble: the tail points up at him. */
.bubble {
  position: relative;
  display: inline-block;
  margin: 32px 0 0;
  padding: 12px 18px;
  border-radius: 18px;
  background: var(--chalkboard);
  color: var(--chalk-white);
  font:
    800 19px/1.3 'Nunito',
    system-ui,
    sans-serif;
  transform-origin: 30px 0;
  animation: pop 320ms var(--spring) 200ms both;
}

.bubble::before {
  content: '';
  position: absolute;
  left: 22px;
  top: -8px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 9px solid var(--chalkboard);
  pointer-events: none;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Details cropped from the app's screens, shown at their own size so nothing is stretched. */
.shot {
  display: block;
  width: 100%;
  max-width: 390px;
  height: auto;
  border-radius: 22px;
  box-shadow:
    0 0 0 1px var(--line),
    var(--shadow);
  user-select: none;
  -webkit-user-drag: none;
}

.feature {
  display: grid;
  gap: 24px;
  align-items: center;
  margin-top: 72px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}

.feature h2 {
  margin: 0 0 10px;
  font:
    800 26px/1.25 'Nunito',
    system-ui,
    sans-serif;
  letter-spacing: -0.005em;
}

.feature p {
  margin: 0;
  max-width: 44ch;
  color: var(--ink-secondary);
}

@media (min-width: 820px) {
  .hero,
  .feature {
    grid-template-columns: 1fr 390px;
  }

  .feature {
    gap: 56px;
  }

  .hero-shot {
    justify-self: end;
  }

  .feature .shot {
    justify-self: end;
  }
}

.soon {
  margin: 72px 0 0;
  font-weight: var(--weight-semibold);
}

footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.55;
  color: var(--pencil);
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 20px;
  margin-bottom: 8px;
}

/* Footer links keep a 44 px touch target without moving the text. */
footer nav a {
  display: inline-block;
  padding: 12px 0;
}

footer p {
  margin: 4px 0;
}

/* The privacy page. */
.doc h1 {
  font-size: 40px;
}

.doc .updated {
  margin: 12px 0 0;
  color: var(--pencil);
  font-size: 15px;
}

.doc h2 {
  margin: 40px 0 8px;
  font:
    800 22px/1.3 'Nunito',
    system-ui,
    sans-serif;
}

.doc p,
.doc li {
  color: var(--ink-secondary);
}

.doc ul {
  padding-left: 22px;
}

.doc li {
  margin: 6px 0;
}

.doc .lang {
  margin: 28px 0 0;
  font-size: 15px;
}

.doc hr {
  margin: 64px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.back {
  display: inline-block;
  margin-bottom: 20px;
  padding: 12px 0;
  font-size: 15px;
  color: var(--pencil);
}

@media (prefers-reduced-motion: reduce) {
  .bubble {
    animation: none;
  }

  a {
    transition: none;
  }
}
