/* Dimmet's website. One page, one typeface, the app's own colours.
   The colour values are the ones in Dimmet/Design/Theme.swift. */

@font-face {
  font-family: "Literata";
  src: url("fonts/literata.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --page: #EDE9F5;       /* Evening Mist */
  --surface: #E4DFEE;
  --raised: #D9D3E4;
  --ink: #151C2B;        /* Midnight */
  --ink-soft: #4B5669;
  --accent: #76534E;
  --hairline: rgb(21 28 43 / 0.16);
  --glow-light: #CDB0AA; /* Afterglow, as the mark's disc shades it */
  --glow-shade: #A996A0;
  --frame: #151C2B;
  --frame-edge: #4B5669;

  --badge-gold: #775C12;
  --badge-rose: #8E3564;
  --badge-blue: #35587A;
  --badge-sage: #3D6444;
  --badge-violet: #63468A;

  --gutter: clamp(1.25rem, 5vw, 4rem);
  --phone: clamp(14rem, 25vw, 18.75rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #151C2B;
    --surface: #222A3B;
    --raised: #343F55;
    --ink: #EDE9F5;
    --ink-soft: #B0BACD;
    --accent: #C5AAA2;
    --hairline: rgb(237 233 245 / 0.18);
    --frame: #0D121C;
    --frame-edge: #46516B;

    --badge-gold: #DCC583;
    --badge-rose: #EC9CC4;
    --badge-blue: #93B8E0;
    --badge-sage: #A6C7A4;
    --badge-violet: #C3A9E0;
  }
}

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

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Literata", Georgia, "Times New Roman", serif;
  font-size: 1.1875rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

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

ul {
  padding: 0;
  list-style: none;
}

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

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

a {
  color: inherit;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}

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

.defs {
  position: absolute;
}

.wrap {
  display: block;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Masthead */

.masthead {
  padding-block: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-decoration: none;
}

.brand-mark {
  width: 2.1rem;
  height: 2.1rem;
}

/* Hero: the mark itself, at the size of the page. The disc of the evening
   sky sits behind the phone and the turning page sweeps up across it. */

.hero {
  position: relative;
  overflow: clip;
}

.hero-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--phone);
  column-gap: clamp(2rem, 7vw, 7rem);
  align-items: start;
  padding-top: clamp(1.5rem, 5vw, 4.5rem);
  padding-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.hero-words {
  max-width: 31rem;
  padding-top: clamp(0rem, 2.5vw, 2.5rem);
}

h1 {
  font-size: clamp(2.9rem, 7.4vw, 5.5rem);
  font-weight: 650;
  line-height: 1.02;
  letter-spacing: -0.018em;
  text-wrap: balance;
}

.lede {
  margin-top: 1.5rem;
  max-width: 24rem;
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  line-height: 1.45;
  color: var(--ink-soft);
}

.soon {
  margin-top: 2rem;
  text-wrap: balance;
  font-weight: 600;
  color: var(--accent);
}

.scene {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  height: clamp(15rem, 37vw, 29rem);
}

.disc {
  position: absolute;
  top: -30%;
  left: 47%;
  width: clamp(15rem, 37vw, 29rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--glow-light), var(--glow-shade));
  animation: settle 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

/* The one moving thing on the page: the disc comes to rest behind the fold. */
@keyframes settle {
  from {
    transform: translateY(-2.5rem);
    opacity: 0.4;
  }
}

.sweep {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.sweep-gap {
  fill: none;
  stroke: var(--page);
  stroke-width: 16px;
  vector-effect: non-scaling-stroke;
}

.sweep-page {
  fill: var(--ink);
}

/* A phone: the capture, a bezel, and the island the capture leaves out. */

.phone {
  position: relative;
  width: var(--phone);
  aspect-ratio: 402 / 874;
  border-radius: 15.4% / 7.1%;
  overflow: hidden; /* rounds the capture's corners; the bezel is a shadow, outside */
  background: var(--frame);
  box-shadow:
    0 0 0 0.5rem var(--frame),
    0 0 0 calc(0.5rem + 1.5px) var(--frame-edge),
    0 2rem 2.75rem -2rem rgb(13 18 28 / 0.5);
}

.phone img {
  width: 100%;
  height: 100%;
}

.phone::after {
  content: "";
  position: absolute;
  top: 1.55%;
  left: 38.4%;
  width: 23.2%;
  height: 4.2%;
  border-radius: 999px;
  background: #000;
}

/* The promise, on the page that has just turned. */

.promise {
  margin-top: -1px; /* no hairline of page colour between the sweep and the band */
  padding-block: clamp(1.5rem, 4vw, 3rem) clamp(3rem, 7vw, 5.5rem);
  background: var(--ink);
  color: var(--page);
  font-size: clamp(1.6rem, 4.2vw, 3.1rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

/* Spreads: a heading in the wide margin, the text beside it. */

.spread {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  column-gap: clamp(2rem, 7vw, 7rem);
  row-gap: 2rem;
  align-items: start;
  padding-block: clamp(4.5rem, 10vw, 9rem);
}

.spread + .spread {
  border-top: 1px solid var(--hairline);
}

h2 {
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  font-weight: 550;
  line-height: 1.1;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.spread-body,
.spread-lead {
  display: grid;
  row-gap: 1.75rem;
}

.spread-body {
  max-width: 34rem;
}

.spread-body > p:first-child {
  margin-top: 0.5rem;
}

.aside {
  color: var(--ink-soft);
  font-size: 1rem;
}

/* A leaf from the journal. */

.leaf {
  padding: clamp(1.5rem, 3vw, 2.25rem);
  border-radius: 0.375rem;
  background: var(--surface);
}

.leaf figcaption {
  color: var(--ink-soft);
  font-size: 1rem;
}

.leaf blockquote {
  margin-top: 0.75rem;
  font-size: clamp(1.3rem, 2.2vw, 1.6rem);
  line-height: 1.5;
}

/* Ritual: the words on the left, the drawer on the right. */

.spread-pictured {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.spread-pictured .spread-lead {
  max-width: 30rem;
}

.phone-small {
  --phone: clamp(13rem, 22vw, 16.5rem);
  margin-inline: 0.6rem clamp(0.6rem, 4vw, 4rem);
}

.stamps {
  border-top: 1px solid var(--hairline);
}

.stamps > div {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  column-gap: 1rem;
  padding-block: 0.7rem;
  border-bottom: 1px solid var(--hairline);
}

.stamps dt {
  font-weight: 600;
}

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

/* Privacy */

.badges {
  display: flex;
  gap: 0.6rem;
}

.badge {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  color: var(--page);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
}

.badge-gold { background: var(--badge-gold); }
.badge-rose { background: var(--badge-rose); }
.badge-blue { background: var(--badge-blue); }
.badge-sage { background: var(--badge-sage); }
.badge-violet { background: var(--badge-violet); }

.promises {
  display: grid;
  row-gap: 1.25rem;
  margin-top: 0.5rem;
}

.promises strong {
  font-weight: 600;
}

/* Closing: a title page. */

.closing {
  display: grid;
  justify-items: center;
  row-gap: 1rem;
  padding-block: clamp(4.5rem, 11vw, 9rem);
  border-top: 1px solid var(--hairline);
  text-align: center;
}

.closing-mark {
  width: 6rem;
  height: 6rem;
  margin-bottom: 0.75rem;
}

.closing p {
  color: var(--ink-soft);
}

.colophon {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 2rem 3rem;
  border-top: 1px solid var(--hairline);
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

/* Narrow screens: one column, the phone under the words. */

@media (max-width: 46rem) {
  :root {
    --phone: min(64vw, 17rem);
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 3rem;
    justify-items: start;
  }

  .hero-grid .phone {
    justify-self: center;
  }

  .scene {
    height: 22rem;
  }

  .disc {
    top: -38%;
    left: 30%;
    width: 19rem;
  }

  .spread,
  .spread-pictured {
    grid-template-columns: minmax(0, 1fr);
  }

  .phone-small {
    --phone: min(64vw, 17rem);
    justify-self: center;
    margin: 1.5rem 0 0;
  }

  .stamps > div {
    grid-template-columns: 7.5rem minmax(0, 1fr);
  }
}

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