/*
 * Grainfold's website: the app's own Midnight palette and region colours, and the system's
 * typeface, as in the app. Nothing is loaded from anywhere else: no web fonts, no analytics.
 */

:root {
  color-scheme: dark;

  /* Midnight, from GranulizerCore/Views/Theme.swift */
  --chassis: #0B0C0E;
  --surface: #121418;
  --canvas: #191B20;
  --raised: #1F2126;
  --ink: #F3F4F6;
  --ink-2: rgba(243, 244, 246, 0.72);
  --ink-3: rgba(243, 244, 246, 0.54);
  --line: rgba(255, 255, 255, 0.08);
  --accent: #E6E8EB;
  --on-accent: #0B0C0E;
  --bars: #6E737D;

  /* Regions A to D */
  --a: #5CB5AD;
  --b: #C778A3;
  --c: #D9A157;
  --d: #9C8FD6;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: clamp(16px, 4.5vw, 48px);
  --max: 1180px;
  --radius: 22px;
  --section: clamp(80px, 11vw, 140px);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background: var(--chassis);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
:focus-visible { outline: 2px solid var(--a); outline-offset: 3px; border-radius: 6px; }

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: -60px;
  background: var(--accent);
  color: var(--on-accent);
  padding: 8px 14px;
  border-radius: 8px;
  z-index: 20;
}
.skip:focus { top: 12px; }

/* The mark: bars, their fold and the grains */
.mark { width: 30px; height: 30px; flex: none; }
.mark-bars { fill: var(--ink); }
.mark-fold { fill: var(--a); }
.mark-grains { fill: var(--c); }

/* Labels: tracked capitals, like the app's section names */
.label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* ---------- Navigation ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 12, 14, 0.8);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.nav .container {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.24em;
}
.nav-links {
  display: flex;
  gap: 24px;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
  font-size: 15px;
}
.nav-links a { text-decoration: none; color: var(--ink-2); }
.nav-links a:hover { color: var(--ink); }
.nav .store-small { margin-left: 4px; }
@media (max-width: 820px) {
  .nav-links { display: none; }
  .nav .store-small { margin-left: auto; }
}

/* ---------- Buttons ---------- */

.store {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-height: 54px;
  padding: 8px 22px 9px;
  border-radius: 12px;
  background: #000;
  color: #fff;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34);
  transition: box-shadow 120ms ease-out, transform 120ms ease-out;
}
.store small { font-size: 11px; line-height: 1.1; letter-spacing: 0.02em; opacity: 0.85; }
.store strong { font-family: var(--display); font-size: 21px; line-height: 1.1; font-weight: 600; letter-spacing: -0.01em; }
.store:hover { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7); }
.store-small { min-height: 40px; padding: 5px 14px 6px; border-radius: 10px; }
.store-small small { font-size: 9px; }
.store-small strong { font-size: 15px; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 22px;
  border-radius: 12px;
  background: var(--canvas);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  transition: background 120ms ease-out;
}
.button:hover { background: var(--raised); }
.button svg { width: 18px; height: 18px; }
.button .play-icon { width: 14px; height: 14px; fill: currentColor; }

/* ---------- Hero ---------- */

.hero { padding-block: clamp(48px, 8vw, 112px) 0; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(40px, 6vw, 88px);
  align-items: center;
}
.hero h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(46px, 7.2vw, 92px);
  line-height: 0.98;
  letter-spacing: -0.035em;
  margin: 20px 0 24px;
}
.hero h1 span { display: block; color: var(--ink-3); }
.hero .lede { font-size: clamp(18px, 1.9vw, 21px); color: var(--ink-2); max-width: 32em; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 34px; }
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-3);
  font-size: 14px;
}
.facts li { display: flex; align-items: center; gap: 8px; }
.facts li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--a); }
.facts li:nth-child(2)::before { background: var(--b); }
.facts li:nth-child(3)::before { background: var(--c); }

@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { order: 2; }
}

/* Phones, drawn around real screenshots */
.phone {
  position: relative;
  width: min(330px, 76vw);
  margin-inline: auto;
  padding: 9px;
  border-radius: 50px;
  background: linear-gradient(160deg, #2A2D33, #141619 60%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 50px 90px -40px rgba(0, 0, 0, 0.9);
}
.phone .screen { position: relative; border-radius: 41px; overflow: hidden; background: var(--chassis); }
.phone .screen::after {
  /* The Dynamic Island */
  content: "";
  position: absolute;
  top: 2.6%;
  left: 50%;
  width: 31%;
  aspect-ratio: 126 / 37;
  border-radius: 999px;
  background: #000;
  transform: translate(-50%, -12%);
}
.hero-visual { position: relative; }
.hero-visual .phone.back {
  position: absolute;
  width: min(270px, 62vw);
  top: 9%;
  right: 58%;
  transform: rotate(-5deg);
  opacity: 0.55;
  filter: saturate(0.8);
}
@media (max-width: 920px) {
  .hero-visual .phone.back { display: none; }
}

/* ---------- The instrument strip ---------- */

.strip { margin: clamp(56px, 8vw, 104px) 0 0; }
.strip-canvas {
  position: relative;
  background: var(--canvas);
  border-radius: var(--radius);
  overflow: hidden;
}
.strip canvas { width: 100%; height: clamp(150px, 20vw, 230px); }
.strip-caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 14px;
  color: var(--ink-3);
  font-size: 14px;
}
.strip-caption .key { display: inline-flex; align-items: center; gap: 8px; }
.tag {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 18px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 800;
  color: var(--chassis);
}
.tag.a { background: var(--a); }
.tag.b { background: var(--b); }
.tag.c { background: var(--c); }
.tag.d { background: var(--d); }

/* ---------- Sections ---------- */

section { padding-top: var(--section); }
.section-head { display: grid; gap: 16px; margin-bottom: clamp(32px, 5vw, 56px); max-width: 760px; }
.section-head h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(32px, 4.6vw, 56px);
  line-height: 1.04;
  letter-spacing: -0.03em;
}
.section-head p { font-size: clamp(17px, 1.6vw, 19px); color: var(--ink-2); max-width: 38em; }

/* What it is */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
}
.about-grid .prose { display: grid; gap: 18px; color: var(--ink-2); font-size: 18px; max-width: 36em; }
.about-grid .prose strong { color: var(--ink); font-weight: 600; }
.numbers { display: grid; gap: 0; margin: 0; }
.numbers div { display: grid; grid-template-columns: 9.5em 1fr; gap: 16px; padding-block: 16px; border-top: 1px solid var(--line); }
.numbers div:last-child { border-bottom: 1px solid var(--line); }
.numbers dt { font-family: var(--mono); font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.numbers dd { margin: 0; color: var(--ink-2); font-size: 15px; }
@media (max-width: 820px) {
  .about-grid { grid-template-columns: 1fr; }
  .numbers div { grid-template-columns: 8.5em 1fr; }
}

/* Uses */
.uses {
  display: grid;
  /* Three over two on a wide screen, so no card is left on its own */
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.uses li { grid-column: span 2; }
.uses li:nth-child(n + 4) { grid-column: span 3; }
@media (max-width: 1000px) {
  .uses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .uses li, .uses li:nth-child(n + 4) { grid-column: auto; }
  .uses li:last-child { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .uses { grid-template-columns: 1fr; }
}
.uses li {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 24px;
  border-radius: 18px;
  background: var(--surface);
}
.uses h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.uses p { color: var(--ink-2); font-size: 16px; }
.uses .label { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.uses .label::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--a); }
.uses li:nth-child(4n + 2) .label::before { background: var(--b); }
.uses li:nth-child(4n + 3) .label::before { background: var(--c); }
.uses li:nth-child(4n + 4) .label::before { background: var(--d); }

/* How it works: a real sequence */
.steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 26px 22px 26px 0;
  border-top: 1px solid var(--line);
}
.steps li::before {
  content: counter(step);
  font-family: var(--display);
  font-weight: 800;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.steps h3 { font-size: 18px; font-weight: 700; }
.steps p { color: var(--ink-2); font-size: 15.5px; }
@media (max-width: 1000px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
}
@media (max-width: 560px) {
  .steps { grid-template-columns: 1fr; }
  .steps li { grid-template-columns: 56px 1fr; column-gap: 8px; padding-right: 0; }
  .steps li::before { grid-row: span 2; font-size: 32px; }
}

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 0 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.features li { display: grid; gap: 6px; align-content: start; padding-block: 22px; border-top: 1px solid var(--line); }
.features h3 { font-size: 17px; font-weight: 650; display: flex; align-items: center; gap: 10px; }
.features h3 svg { width: 20px; height: 20px; color: var(--ink-2); flex: none; }
.features p { color: var(--ink-2); font-size: 15.5px; }

/* Screens */
.screens {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(16px, 2.4vw, 32px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.screens figure, .wide-screens figure { margin: 0; display: grid; gap: 14px; align-content: start; }
.screens .phone { width: 100%; padding: 6px; border-radius: 34px; }
.screens .phone .screen { border-radius: 28px; }
figcaption { color: var(--ink-2); font-size: 15px; }
figcaption strong { color: var(--ink); font-weight: 600; display: block; }
@media (max-width: 900px) {
  /* A row to swipe through on a phone */
  .screens {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: min(62vw, 240px);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 12px;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    scrollbar-width: none;
  }
  .screens::-webkit-scrollbar { display: none; }
  .screens li { scroll-snap-align: center; }
}
.wide-screens {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(16px, 2.4vw, 32px);
  margin-top: clamp(28px, 4vw, 48px);
}
.landscape, .tablet {
  padding: 7px;
  border-radius: 30px;
  background: linear-gradient(160deg, #2A2D33, #141619 60%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 40px 80px -40px rgba(0, 0, 0, 0.9);
}
.landscape img { border-radius: 24px; }
.tablet { border-radius: 26px; padding: 10px; }
.tablet img { border-radius: 16px; }
@media (max-width: 820px) {
  .wide-screens { grid-template-columns: 1fr; }
}

/* Videos: the tour wide, the short clips tall, all one height on a wide screen */
.videos {
  --video-height: 320px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 24px);
}
.video { margin: 0; display: grid; gap: 12px; align-content: start; }
.video.wide { grid-column: 1 / -1; }
.video .frame {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 9 / 16;
  border-radius: 18px;
  background:
    radial-gradient(120% 70% at 50% 110%, rgba(92, 181, 173, 0.16), transparent 60%),
    var(--canvas);
  overflow: hidden;
}
.video.wide .frame {
  aspect-ratio: 16 / 9;
  background: radial-gradient(90% 90% at 50% 120%, rgba(199, 120, 163, 0.16), transparent 60%), var(--canvas);
}
@media (min-width: 1000px) {
  .videos { display: flex; align-items: flex-start; }
  .video { flex: 0 0 calc(var(--video-height) * 9 / 16); }
  .video.wide { flex: 1 1 0; }
  .video .frame, .video.wide .frame { height: var(--video-height); aspect-ratio: auto; }
}
.video .play {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(243, 244, 246, 0.1);
  box-shadow: inset 0 0 0 1px rgba(243, 244, 246, 0.2);
}
.video .play svg { width: 22px; height: 22px; margin-left: 3px; fill: var(--ink); }
.video .soon {
  position: absolute;
  left: 14px;
  bottom: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}
@media (max-width: 560px) {
  .video .play { width: 48px; height: 48px; }
  .video .play svg { width: 18px; height: 18px; }
  .video:not(.wide) .soon { display: none; }
}

/* Follow */
.follow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px 48px;
  align-items: center;
  padding: clamp(28px, 4vw, 48px);
  border-radius: var(--radius);
  background: var(--surface);
}
.follow h2 { font-family: var(--display); font-weight: 800; font-size: clamp(26px, 3.4vw, 40px); letter-spacing: -0.025em; line-height: 1.1; }
.follow p { color: var(--ink-2); margin-top: 10px; max-width: 34em; }
.socials { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 0; list-style: none; }
.socials .button svg { width: 20px; height: 20px; }
@media (max-width: 560px) {
  .socials { display: grid; grid-template-columns: 1fr; }
  .socials .button { width: 100%; justify-content: center; }
}
@media (max-width: 820px) {
  .follow { grid-template-columns: 1fr; }
}

/* Closing call to action */
.closing { text-align: center; padding-block: var(--section) 0; }
.closing .app-icon {
  width: 112px;
  height: 112px;
  margin: 0 auto 28px;
  border-radius: 25px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 30px 60px -24px rgba(92, 181, 173, 0.35);
}
.closing .wordmark {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(34px, 7vw, 76px);
  letter-spacing: 0.2em;
  margin-right: -0.2em;
  line-height: 1;
}
.closing p { color: var(--ink-2); font-size: 19px; margin: 18px auto 32px; max-width: 30em; }
.closing .actions { justify-content: center; margin-top: 0; }

/* Footer */
footer { margin-top: var(--section); border-top: 1px solid var(--line); padding-block: 36px calc(36px + env(safe-area-inset-bottom, 0px)); color: var(--ink-3); font-size: 14px; }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px 32px; align-items: center; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; padding: 0; list-style: none; }
.footer-links a { text-decoration: none; color: var(--ink-2); }
.footer-links a:hover { color: var(--ink); }
.legal { margin-top: 18px; font-size: 12.5px; max-width: 70em; }

/* A page of text, e.g. the privacy policy */
.document { padding-block: clamp(48px, 7vw, 96px) 0; }
.document article { max-width: 44em; display: grid; gap: 18px; color: var(--ink-2); }
.document h1 { font-family: var(--display); font-weight: 800; font-size: clamp(36px, 5vw, 56px); letter-spacing: -0.03em; line-height: 1.04; color: var(--ink); }
.document h2 { font-size: 21px; color: var(--ink); margin-top: 18px; }
.document ul { margin: 0; padding-left: 1.2em; display: grid; gap: 10px; }
.document strong { color: var(--ink); font-weight: 600; }
.document a { color: var(--a); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
