/* Hiraku help and privacy pages. Colors and the flap card follow the app's
   Views/Theme.swift and Views/FlapCounter.swift, in the hiraku repo. No web fonts: iPhones and
   Macs set this in New York, the same serif the app uses. */

:root {
  color-scheme: dark;
  --night: #0e1a33;
  --crease: #091227;
  --flap-upper: #1c2b4e;
  --flap-lower: #16233f;
  --star: #f2efe8;
  --mist: #93a0ba;
  --titanium: #c9b79a;
  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --numerals: ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--night);
  color: var(--star);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
}

.page {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem;
}

/* Header */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--star);
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
}

.brand img {
  width: 2rem;
  height: 2rem;
  border-radius: 22.5%;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  font-size: 1rem;
}

.site-nav a {
  color: var(--mist);
  text-decoration: none;
}

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

/* The counter: five split-flap cards, the ones card flipping once on load. */

.counter {
  --h: min(7.5rem, calc((100vw - 4.5rem) / 3.5));
  --w: calc(var(--h) * 0.7);
  --pin: max(3px, calc(var(--w) * 0.05));
  display: flex;
  gap: 6px;
  margin: 3rem 0 2.25rem;
}

.card {
  position: relative;
  flex: none;
  width: var(--w);
  height: var(--h);
  perspective: calc(var(--h) * 4);
}

.half {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1;
  height: 50%;
  overflow: hidden;
}

.half.top {
  top: 0;
  background: var(--flap-upper);
  border-radius: calc(var(--w) * 0.16) calc(var(--w) * 0.16) 0 0;
  transform-origin: 50% 100%;
}

.half.bottom {
  bottom: 0;
  background: var(--flap-lower);
  border-radius: 0 0 calc(var(--w) * 0.16) calc(var(--w) * 0.16);
  transform-origin: 50% 0;
}

.half span {
  display: block;
  height: var(--h);
  color: var(--star);
  font-family: var(--numerals);
  font-size: calc(var(--h) * 0.84);
  font-stretch: condensed;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: var(--h);
  text-align: center;
}

.half.bottom span {
  transform: translateY(-50%);
}

.card.dim .half span {
  color: rgb(242 239 232 / 0.26);
}

/* The crease across each card, and a titanium pin at each end of it. */
.card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  z-index: 3;
  height: max(1.5px, calc(var(--h) * 0.014));
  background: var(--night);
  transform: translateY(-50%);
}

.card::before {
  content: "";
  position: absolute;
  top: 50%;
  left: calc(var(--pin) * 0.4);
  z-index: 4;
  width: var(--pin);
  height: calc(var(--pin) * 2.2);
  border-radius: 999px;
  background: var(--titanium);
  box-shadow: calc(var(--w) - var(--pin) * 1.8) 0 0 var(--titanium);
  transform: translateY(-50%);
}

.leaf {
  z-index: 2;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.leaf.out {
  animation: fall 0.26s cubic-bezier(0.55, 0, 1, 0.45) 0.9s both;
}

.leaf.in {
  animation: land 0.32s cubic-bezier(0, 0.55, 0.45, 1) 1.16s both;
}

@keyframes fall {
  from { transform: rotateX(0deg); filter: brightness(1); }
  to { transform: rotateX(-90deg); filter: brightness(0.55); }
}

@keyframes land {
  from { transform: rotateX(90deg); filter: brightness(0.65); }
  to { transform: rotateX(0deg); filter: brightness(1); }
}

@media (prefers-reduced-motion: reduce) {
  .leaf.out {
    animation: none;
    visibility: hidden;
  }

  .leaf.in {
    animation: none;
  }
}

/* Text */

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 1.25rem + 3.2vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.12;
  text-wrap: balance;
}

.page-title {
  margin-top: 3rem;
}

h2 {
  margin: 3.5rem 0 0.75rem;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
}

/* The privacy policy is many short sections, so they sit closer together. */
.policy h2 {
  margin-top: 2.5rem;
}

h3 {
  margin: 2rem 0 0.25rem;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
}

p,
ol {
  max-width: 34em;
  margin: 0 0 1rem;
}

.lead {
  color: var(--mist);
  font-size: 1.25rem;
  line-height: 1.5;
}

ol {
  padding-left: 1.4em;
}

li {
  margin-bottom: 0.4rem;
  padding-left: 0.2em;
}

li::marker {
  color: var(--titanium);
  font-weight: 600;
}

a {
  color: var(--titanium);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--star);
}

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

.updated {
  color: var(--mist);
  font-size: 1rem;
}

/* Footer, set off by a hinge: the crease with a titanium pin at each end. */

.hinge {
  position: relative;
  height: 2px;
  margin-top: 4.5rem;
  background: var(--crease);
}

.hinge::before,
.hinge::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 5px;
  height: 11px;
  border-radius: 999px;
  background: var(--titanium);
  transform: translateY(-50%);
}

.hinge::before {
  left: 0;
}

.hinge::after {
  right: 0;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1.5rem;
  color: var(--mist);
  font-size: 1rem;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--mist);
}

.site-footer a:hover {
  color: var(--star);
}
