/* PaperKeys site, in Apple's web style: SF Pro, white and #f5f5f7 sections, rounded tiles, blue pills */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --tile: #f5f5f7;
  --tile-on-alt: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --hairline: #d2d2d7;
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --link: #0066cc;
  --chip-bg: #e8f1fd;
  --nav-bg: rgb(255 255 255 / 0.72);
  --field-border: #86868b;
  --red: #e30000;
  --amber-bg: #fff4cc;
  --amber-text: #5c4300;
  --key-top: #ffffff;
  --key-bot: #f4f4f6;
  --key-border: rgb(0 0 0 / 0.12);
  --key-text: #1d1d1f;
  --window: #ffffff;
  --window-bar: #f2f2f4;
  --window-rule: rgb(0 0 0 / 0.08);
  --wallpaper:
    radial-gradient(75% 90% at 12% 8%, #b7d3ff 0%, transparent 62%),
    radial-gradient(65% 80% at 92% 18%, #f7c4de 0%, transparent 60%),
    radial-gradient(90% 85% at 55% 105%, #ffdcb4 0%, transparent 62%),
    linear-gradient(#e3e9f6, #eee8f2);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: clamp(20px, 5vw, 44px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-alt: #101011;
    --tile: #1d1d1f;
    --tile-on-alt: #1d1d1f;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --hairline: #424245;
    --link: #2997ff;
    --chip-bg: rgb(41 151 255 / 0.18);
    --nav-bg: rgb(22 22 23 / 0.72);
    --field-border: #6e6e73;
    --red: #ff453a;
    --amber-bg: rgb(255 214 10 / 0.16);
    --amber-text: #ffd60a;
    --key-top: #48484b;
    --key-bot: #3a3a3c;
    --key-border: rgb(255 255 255 / 0.1);
    --key-text: #f5f5f7;
    --window: #1e1e20;
    --window-bar: #2a2a2d;
    --window-rule: rgb(255 255 255 / 0.08);
    --wallpaper:
      radial-gradient(75% 90% at 12% 8%, #24418c 0%, transparent 62%),
      radial-gradient(65% 80% at 92% 18%, #6a2a5e 0%, transparent 60%),
      radial-gradient(90% 85% at 55% 105%, #6b4220 0%, transparent 62%),
      linear-gradient(#101528, #1a1222);
    color-scheme: dark;
  }
}

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

[hidden] { display: none !important; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.47 var(--sans);
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

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

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  text-wrap: balance;
}

p { margin: 0; }

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

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

.skip {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  background: var(--bg);
}

.skip:focus { top: 12px; }

/* ---------- Buttons and links ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.4rem;
  border: 0;
  border-radius: 980px;
  background: var(--blue);
  color: #fff;
  font: 400 1.0625rem/1 var(--sans);
  letter-spacing: -0.022em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:hover {
  background: var(--blue-hover);
  text-decoration: none;
}

.btn:active { transform: scale(0.98); }

.btn-small {
  min-height: 40px;
  padding: 0 1rem;
  font-size: 0.9375rem;
}

.btn-outline {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--link);
  color: var(--link);
}

.btn-outline:hover {
  background: var(--link);
  color: #fff;
}

/* "Learn more" style link with a chevron */
.more {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  font-size: 1.0625rem;
}

.more::after {
  content: "";
  width: 0.45em;
  height: 0.45em;
  margin-left: 0.4em;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.tag {
  display: inline-block;
  padding: 0.2em 0.55em;
  border-radius: 6px;
  background: rgb(127 127 127 / 0.14);
  color: var(--text-2);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.02em;
  vertical-align: 0.3em;
}

.fine {
  color: var(--text-2);
  font-size: 0.875rem;
  letter-spacing: -0.01em;
}

/* Keys in text are drawn as Mac keys */
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 1.7em;
  height: 1.6em;
  padding: 0 0.4em;
  margin: 0 0.06em;
  border-radius: 0.3em;
  background: linear-gradient(var(--key-top), var(--key-bot));
  box-shadow: inset 0 0 0 0.5px var(--key-border), 0 1px 1px rgb(0 0 0 / 0.1);
  color: var(--key-text);
  font: 500 0.8em/1 var(--sans);
  letter-spacing: 0;
  vertical-align: 0.1em;
  white-space: nowrap;
}

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.08);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 56px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand:hover { text-decoration: none; }

.brand-icon {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.18));
}

.nav nav { margin-left: auto; }

.nav-links {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.75rem;
  color: var(--text);
  font-size: 0.875rem;
  opacity: 0.8;
}

.nav-links a:hover {
  opacity: 1;
  text-decoration: none;
}

@media (max-width: 760px) {
  .nav nav { display: none; }
  .nav .btn { margin-left: auto; }
}

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

.hero {
  padding-top: clamp(3.5rem, 9vw, 6.5rem);
  overflow: hidden;
}

.hero-head {
  display: grid;
  justify-items: center;
  text-align: center;
}

.app-icon {
  width: clamp(96px, 12vw, 132px);
  height: auto;
  filter: drop-shadow(0 10px 24px rgb(0 0 0 / 0.16)) drop-shadow(0 2px 4px rgb(0 0 0 / 0.1));
}

.product {
  margin-top: 1.4rem;
  font-size: clamp(1.3rem, 2.2vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hero h1 {
  margin-top: 0.5rem;
  font-size: clamp(3rem, 8.4vw, 6rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.hero-sub {
  max-width: 44rem;
  margin-top: 1.25rem;
  color: var(--text-2);
  font-size: clamp(1.1875rem, 2vw, 1.5rem);
  line-height: 1.38;
  letter-spacing: -0.01em;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.75rem;
  margin-top: 2rem;
}

.hero-head .fine { margin-top: 1rem; }

/* The scene: a Mac desktop with a mail window and PaperKeys floating over it */

.scene {
  margin-top: clamp(3rem, 7vw, 5rem);
  padding: 0 var(--gutter);
}

.screen {
  position: relative;
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3.5rem) clamp(0.75rem, 4vw, 3.5rem) clamp(1.5rem, 4vw, 3rem);
  border-radius: clamp(16px, 2.4vw, 28px);
  background: var(--wallpaper);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.06), 0 30px 60px -30px rgb(0 0 0 / 0.35);
}

.mac-window {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  border-radius: 16px;
  background: var(--window);
  box-shadow:
    0 0 0 0.5px rgb(0 0 0 / 0.22),
    0 4px 10px rgb(0 0 0 / 0.08),
    0 24px 60px rgb(0 0 0 / 0.22);
  overflow: hidden;
}

.mac-bar {
  position: relative;
  display: flex;
  align-items: center;
  height: 46px;
  padding: 0 18px;
  background: var(--window-bar);
  border-bottom: 1px solid var(--window-rule);
}

.lights {
  display: flex;
  gap: 8px;
}

.lights i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow: inset 0 0 0 0.5px rgb(0 0 0 / 0.16);
}

.lights i:nth-child(2) { background: #febc2e; }
.lights i:nth-child(3) { background: #28c840; }

.mac-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 600;
}

.mac-fields {
  padding: 0 clamp(16px, 4vw, 32px);
  font-size: 0.875rem;
  line-height: 1;
}

.mac-fields p {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--window-rule);
}

.mac-fields span {
  display: inline-block;
  min-width: 4.5rem;
  color: var(--text-2);
}

.doc {
  min-height: 9.5rem;
  padding: 1.1rem clamp(16px, 4vw, 32px) clamp(5rem, 13vw, 8.5rem);
  color: var(--text);
  font-size: clamp(1.0625rem, 2vw, 1.375rem);
  line-height: 1.5;
  letter-spacing: -0.015em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  outline: none;
}

.doc:focus-visible { box-shadow: inset 0 0 0 3px var(--blue); }

.doc .placeholder { color: var(--text-2); }

.caret {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  margin: 0 1px -0.2em;
  background: var(--blue);
  animation: caret 1.05s steps(1) infinite;
}

@keyframes caret {
  50% { opacity: 0; }
}

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

/* The keyboard floats over the bottom of the window, as it does over any app */
.hero-kb {
  position: relative;
  z-index: 2;
  width: min(100%, 800px);
  margin: clamp(-7.5rem, -12vw, -4rem) auto 0;
  filter: drop-shadow(0 18px 30px rgb(0 0 0 / 0.18));
}

.ledger {
  display: grid;
  justify-items: center;
  gap: 1.25rem;
  margin-top: clamp(2rem, 4vw, 3rem);
  text-align: center;
}

.ledger dl {
  display: flex;
  justify-content: center;
  gap: clamp(2rem, 6vw, 4.5rem);
  margin: 0;
}

.ledger dt {
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 400;
}

.ledger dd {
  margin: 0.15rem 0 0;
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 600;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.ledger .saved dd { color: var(--blue); }

.ledger-note {
  max-width: 38rem;
  color: var(--text-2);
  font-size: 0.9375rem;
}

.ledger-actions {
  display: flex;
  gap: 0.6rem;
}

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

.section {
  padding: clamp(5rem, 11vw, 8.5rem) 0;
}

.section.alt { background: var(--bg-alt); }

.hero { padding-bottom: clamp(4rem, 9vw, 6.5rem); }

.section.alt .tile { background: var(--tile-on-alt); }

.section-head {
  display: grid;
  justify-items: center;
  gap: 1.1rem;
  max-width: 50rem;
  margin: 0 auto clamp(2.75rem, 6vw, 4.5rem);
  text-align: center;
}

.section-head h2 {
  font-size: clamp(2.25rem, 5.6vw, 3.5rem);
  line-height: 1.07;
  letter-spacing: -0.03em;
}

.lead {
  max-width: 42rem;
  color: var(--text-2);
  font-size: clamp(1.1875rem, 1.8vw, 1.3125rem);
  line-height: 1.42;
  letter-spacing: -0.01em;
}

.tile {
  border-radius: 28px;
  background: var(--tile);
}

h3 {
  font-size: 1.5rem;
  line-height: 1.17;
  letter-spacing: -0.02em;
}

/* Four ways */

.ways {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.way {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  padding: clamp(1.5rem, 3.5vw, 2.5rem);
}

.way h3 {
  margin-top: 1.25rem;
  font-size: clamp(1.75rem, 3vw, 2.125rem);
  letter-spacing: -0.025em;
}

.way p { color: var(--text-2); }

.figure {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: clamp(1.25rem, 3vw, 2rem);
  border-radius: 20px;
  background: var(--bg);
}

.section.alt .figure { background: var(--bg-alt); }

.figure figcaption {
  color: var(--text-2);
  font-size: 0.8125rem;
  text-align: center;
}

@media (max-width: 820px) {
  .ways { grid-template-columns: 1fr; }
}

/* The small keyboards in the figures share the demo's drawing, at their own scale */
.pk.mini { pointer-events: none; }

.pk.mini .pk-frame { --u: calc(100cqw / 300); }

.mini-board {
  aspect-ratio: auto;
  padding: calc(var(--u) * 6);
  border-radius: calc(var(--u) * 12);
}

.mini-board .pk-row { height: calc(var(--u) * 46); flex: none; padding: 0; }
.mini-board .pk-key { flex: 1 1 0; }

.mini-tap {
  width: 80%;
  margin: calc(var(--u) * 10) auto;
}

.mini-tap .pk-cap { font-size: calc(var(--u) * 20); }

.tap-dot {
  position: absolute;
  top: 42%;
  left: 50%;
  z-index: 2;
  width: calc(var(--u) * 12);
  height: calc(var(--u) * 12);
  margin: calc(var(--u) * -6);
  border: calc(var(--u) * 2) solid #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 calc(var(--u) * 6) rgb(0 113 227 / 0.2);
}

.mini-bar {
  height: calc(var(--u) * 40);
  margin: calc(var(--u) * 10) 0;
  padding: 0;
}

.mini-bar .pk-chip { animation: none; }
.mini-bar .pk-cap { font-size: calc(var(--u) * 13); }

.mini-swipe { padding: calc(var(--u) * 5); }
.mini-swipe .pk-row { height: calc(var(--u) * 30); }
.mini-swipe .pk-cap { font-size: calc(var(--u) * 12); }
.mini-swipe .pk-row:nth-child(2) { padding: 0 calc(var(--u) * 7); }
.mini-swipe .pk-row:nth-child(3) { padding: 0 calc(var(--u) * 21); }

.mini-swipe .pk-trail path {
  stroke-width: calc(var(--u) * 4);
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw-swipe 3.2s ease-in-out infinite;
}

@keyframes draw-swipe {
  0% { stroke-dashoffset: 1; opacity: 0.7; }
  45%, 75% { stroke-dashoffset: 0; opacity: 0.7; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .mini-swipe .pk-trail path { animation: none; stroke-dashoffset: 0; }
}

.mini-voice .pk-voice {
  position: relative;
  left: auto;
  bottom: auto;
  width: 100%;
  margin: calc(var(--u) * 14) 0;
  transform: none;
  animation: none;
}

.mini-voice .pk-voice-wave i { animation: wave 1.1s ease-in-out infinite alternate; }
.mini-voice .pk-voice-wave i:nth-child(3n) { animation-delay: -0.3s; }
.mini-voice .pk-voice-wave i:nth-child(3n + 1) { animation-delay: -0.7s; }
.mini-voice .pk-voice-wave i:nth-child(4n) { animation-duration: 0.8s; }
.mini-voice .pk-voice-wave i:nth-child(5n) { animation-duration: 1.4s; }

@keyframes wave {
  from { height: 14%; }
  to { height: 90%; }
}

@media (prefers-reduced-motion: reduce) {
  .mini-voice .pk-voice-wave i { animation: none; height: 45%; }
}

/* The extra keys */

.keys {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.key-tile {
  display: grid;
  align-content: start;
  gap: 0.6rem;
  padding: 2rem 1.75rem 2.1rem;
}

.key-tile h3 {
  margin-top: 0.9rem;
  font-size: 1.3125rem;
}

.key-tile p {
  color: var(--text-2);
  font-size: 1rem;
}

/* Each feature is introduced by its key, drawn as a Mac key */
.keyicon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3em;
  justify-self: start;
  min-width: 52px;
  height: 52px;
  padding: 0 0.8rem;
  border-radius: 11px;
  background: linear-gradient(var(--key-top), var(--key-bot));
  box-shadow: inset 0 0 0 0.5px var(--key-border), 0 1px 2px rgb(0 0 0 / 0.14), 0 4px 10px rgb(0 0 0 / 0.06);
  color: var(--key-text);
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: 0;
}

.section.alt .keyicon {
  --key-top: #fbfbfd;
  --key-bot: #eeeef1;
}

@media (prefers-color-scheme: dark) {
  .section.alt .keyicon {
    --key-top: #48484b;
    --key-bot: #3a3a3c;
  }
}

.keyicon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.keyicon-wide svg { width: 16px; height: 16px; }

.keyicon-round { border-radius: 50%; padding: 0; }

/* A latched modifier is ringed in the accent, as it is on the keyboard */
.keyicon.is-latched {
  box-shadow: inset 0 0 0 2px var(--blue), 0 0.5px 1px rgb(0 0 0 / 0.1);
  color: var(--blue);
}

@media (max-width: 960px) {
  .keys { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .keys { grid-template-columns: 1fr; }
}

/* Themes, on black like a product showcase */

.section.dark {
  background: #000;
  color: #f5f5f7;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --link: #2997ff;
}

.theme-stage {
  display: grid;
  place-items: center;
  gap: clamp(1.25rem, 3vw, 2rem);
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 5vw, 4rem);
  border-radius: 28px;
  background: radial-gradient(80% 90% at 50% 20%, #232326, #111113 70%);
}

.theme-kb { width: min(100%, 760px); }

.theme-field {
  width: min(100%, 30rem);
  min-height: 52px;
  padding: 0.8rem 1.1rem;
  border-radius: 14px;
  background: #2a2a2d;
  box-shadow: 0 0 0 0.5px rgb(255 255 255 / 0.1), 0 10px 30px rgb(0 0 0 / 0.35);
  color: #f5f5f7;
  font-size: 1.0625rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  outline: none;
}

.theme-field:focus-visible { box-shadow: 0 0 0 3px #2997ff; }

.theme-field .placeholder { color: #a1a1a6; }
.theme-field .caret { background: #2997ff; }

.theme-caption {
  min-height: 1.5em;
  margin-top: 1.5rem;
  color: #a1a1a6;
  font-size: 1.0625rem;
  text-align: center;
}

.theme-caption strong {
  color: #f5f5f7;
  font-weight: 600;
}

.theme-controls {
  display: grid;
  justify-items: center;
  gap: 1.75rem;
  margin-top: 2.25rem;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* The gallery mirrors the app's Appearance pane: mini keyboards, a blue ring on the chosen one */
.theme-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem 1.25rem;
  width: 100%;
  max-width: 900px;
}

.theme-gallery label {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  cursor: pointer;
}

.theme-gallery input,
.variants input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.thumb {
  position: relative;
  display: block;
  width: 100%;
  padding: 10px;
  border-radius: 14px;
  background: #1d1d1f;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.06);
  transition: box-shadow 0.15s;
}

.theme-gallery label:hover .thumb { box-shadow: 0 0 0 1px rgb(255 255 255 / 0.25); }

.theme-gallery label:has(input:checked) .thumb {
  box-shadow: 0 0 0 3px #2997ff;
}

.theme-gallery label:has(input:focus-visible) .thumb {
  outline: 3px solid #f5f5f7;
  outline-offset: 4px;
}

/* The thumbnails are spans (they sit in labels); the keyboard's container has to be a block */
.thumb .pk,
.thumb .pk-frame {
  display: block;
  pointer-events: none;
}

.thumb .pk.mini .pk-frame { --u: calc(100cqw / 210); }

.thumb .mini-board {
  padding: calc(var(--u) * 5);
  border-radius: calc(var(--u) * 10);
}

.thumb .mini-board .pk-row { height: calc(var(--u) * 34); }

/* System: Light and Dark, split on the diagonal like macOS's Auto appearance */
.thumb-split {
  position: relative;
  display: block;
}

.thumb-split > .pk + .pk {
  position: absolute;
  inset: 0;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.theme-name {
  color: #f5f5f7;
  font-size: 0.9375rem;
}

.theme-gallery label:has(input:checked) .theme-name {
  color: #2997ff;
  font-weight: 600;
}

/* Colorways, picked like macOS's accent colors */
.variants {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.25rem;
}

.variants legend {
  width: 100%;
  margin-bottom: 0.75rem;
  color: #a1a1a6;
  font-size: 0.875rem;
  text-align: center;
}

.variants label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  color: #f5f5f7;
  font-size: 0.9375rem;
  cursor: pointer;
}

.variants .dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.2);
}

.variants label:has(input:checked) .dot {
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.2), 0 0 0 2px #000, 0 0 0 4px #a1a1a6;
}

.variants label:has(input:focus-visible) .dot {
  outline: 3px solid #2997ff;
  outline-offset: 5px;
}

.section.dark .fine { color: #a1a1a6; }

@media (max-width: 760px) {
  .theme-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Privacy */

.privacy {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.privacy .tile {
  padding: 2.25rem 2rem 2.5rem;
}

.symbol {
  width: 44px;
  height: 44px;
  fill: none;
  stroke: var(--blue);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.privacy h3 {
  margin: 1.25rem 0 1rem;
  font-size: 1.5rem;
}

.privacy ul {
  display: grid;
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.privacy li {
  position: relative;
  padding-left: 1.1rem;
  color: var(--text-2);
  font-size: 1rem;
}

.privacy li::before {
  content: "";
  position: absolute;
  top: 0.62em;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

@media (max-width: 900px) {
  .privacy { grid-template-columns: 1fr; }
}

/* Pricing */

.plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: start;
}

.plan {
  display: grid;
  justify-items: start;
  gap: 1rem;
  padding: 2.25rem 2rem 2.5rem;
}

.plan-pro { box-shadow: inset 0 0 0 2px var(--blue); }

.plan h3 {
  font-size: 1.5rem;
}

.price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.5rem;
}

.amount {
  font-size: clamp(2.75rem, 5vw, 3.5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
}

.per {
  color: var(--text-2);
  font-size: 0.9375rem;
}

.plan .btn { margin: 0.25rem 0 0.5rem; }

.plan-sum {
  font-weight: 600;
}

.plan ul {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plan li {
  position: relative;
  padding-left: 1.6rem;
  color: var(--text-2);
  font-size: 1rem;
}

.plan li::before {
  content: "";
  position: absolute;
  top: 0.34em;
  left: 0.15rem;
  width: 0.65rem;
  height: 0.36rem;
  border-left: 2px solid var(--blue);
  border-bottom: 2px solid var(--blue);
  transform: rotate(-45deg);
}

.plans-note {
  margin-top: 2rem;
  text-align: center;
}

@media (max-width: 900px) {
  .plans { grid-template-columns: 1fr; }
}

/* FAQ */

.faq .section-head { margin-bottom: clamp(2rem, 5vw, 3rem); }

.faq-list {
  max-width: 52rem;
  margin: 0 auto;
  border-top: 1px solid var(--hairline);
}

.faq-list details { border-bottom: 1px solid var(--hairline); }

.faq-list summary {
  position: relative;
  display: block;
  min-height: 64px;
  padding: 1.35rem 3.5rem 1.35rem 0;
  font-size: clamp(1.125rem, 2vw, 1.3125rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  cursor: pointer;
  list-style: none;
}

.faq-list summary::-webkit-details-marker { display: none; }

/* A plus that turns into a minus */
.faq-list summary::before,
.faq-list summary::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.4rem;
  width: 16px;
  height: 2px;
  margin-top: -1px;
  border-radius: 1px;
  background: var(--text);
  transition: transform 0.2s;
}

.faq-list summary::after { transform: rotate(90deg); }

.faq-list details[open] summary::after { transform: rotate(0deg); }

.faq-list details p {
  max-width: 44rem;
  padding: 0 0 1.5rem;
  color: var(--text-2);
}

/* Closing */

.closing {
  padding: clamp(5rem, 11vw, 8rem) 0;
  border-top: 1px solid var(--hairline);
  text-align: center;
}

.closing .wrap {
  display: grid;
  justify-items: center;
}

.closing h2 {
  margin-top: 1.75rem;
  font-size: clamp(2.75rem, 7.5vw, 5rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.closing .hero-cta { margin-top: 1.75rem; }
.closing .fine { margin-top: 1rem; }

/* Legal pages: the terms and the privacy policy, set as one readable column */

.legal {
  padding: clamp(3.5rem, 8vw, 5.5rem) 0 clamp(4.5rem, 10vw, 7rem);
}

.legal-wrap { max-width: calc(46rem + 2 * var(--gutter)); }

.legal-head {
  display: grid;
  gap: 1rem;
  padding-bottom: clamp(2rem, 5vw, 2.75rem);
  border-bottom: 1px solid var(--hairline);
}

.legal-head h1 {
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  line-height: 1.07;
  letter-spacing: -0.03em;
}

.legal-summary {
  margin-top: clamp(2rem, 5vw, 2.75rem);
  padding: clamp(1.5rem, 4vw, 2rem);
  border-radius: 20px;
  background: var(--tile);
}

.legal-summary h2 {
  font-size: 1.3125rem;
  letter-spacing: -0.015em;
}

.legal-summary ul {
  display: grid;
  gap: 0.6rem;
  margin: 1rem 0 0;
  padding-left: 1.2rem;
}

/* Contents: two columns of section links where there's room */
.legal-toc {
  margin-top: clamp(2rem, 5vw, 2.75rem);
  font-size: 0.9375rem;
}

.legal-toc ol {
  columns: 2 16rem;
  column-gap: 2rem;
  margin: 0;
  padding-left: 1.4rem;
  color: var(--text-2);
}

.legal-toc li {
  break-inside: avoid;
  padding: 0.2rem 0;
}

.legal-body section {
  margin-top: clamp(2.75rem, 6vw, 3.5rem);
}

.legal-body h2 {
  font-size: clamp(1.5rem, 3vw, 1.75rem);
  line-height: 1.17;
  letter-spacing: -0.02em;
}

.legal-body h3 {
  margin-top: 1.75rem;
  font-size: 1.1875rem;
  letter-spacing: -0.015em;
}

.legal-body p,
.legal-body ul,
.legal-body dl,
.legal-body blockquote,
.legal-body .table-wrap {
  margin-top: 0.9rem;
}

.legal-body h3 + p { margin-top: 0.5rem; }

.legal-body ul {
  margin-bottom: 0;
  padding-left: 1.2rem;
}

.legal-body li + li { margin-top: 0.5rem; }

.legal strong { font-weight: 600; }

/* Company facts: label and value side by side, hairlines between */
.legal-facts {
  margin-bottom: 0;
  border-top: 1px solid var(--hairline);
}

.legal-facts div {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 0.25rem 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--hairline);
}

.legal-facts dt { color: var(--text-2); }
.legal-facts dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 520px) {
  .legal-facts div { grid-template-columns: 1fr; }
}

/* The model withdrawal form, set off like a letter to copy */
.legal-form {
  margin-right: 0;
  margin-bottom: 0;
  margin-left: 0;
  padding: 1.25rem 1.5rem;
  border-left: 3px solid var(--blue);
  border-radius: 0 14px 14px 0;
  background: var(--tile);
}

.legal-form p { margin-top: 0; }
.legal-form p + p { margin-top: 0.75rem; }

/* Tables scroll sideways on narrow screens instead of squeezing their columns */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: 14px;
}

.legal table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.42;
}

.legal th,
.legal td {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--hairline);
  text-align: left;
  vertical-align: top;
}

.legal thead th {
  border-top: 0;
  background: var(--bg-alt);
  font-weight: 600;
}

.legal tbody th { font-weight: 600; }

/* Checkout: /buy/pro and /buy/lifetime, a column as wide as the legal pages */

.buy {
  padding: clamp(2.5rem, 6vw, 4rem) 0 clamp(4.5rem, 10vw, 7rem);
}

.buy-wrap {
  display: grid;
  gap: clamp(2rem, 5vw, 2.75rem);
  max-width: calc(46rem + 2 * var(--gutter));
}

.buy-head {
  display: grid;
  justify-items: start;
  gap: 0.75rem;
}

.buy-head h1 {
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  line-height: 1.07;
  letter-spacing: -0.03em;
}

.buy-head .more { min-height: 44px; }

.buy h2 {
  font-size: 1.3125rem;
  letter-spacing: -0.015em;
}

.buy strong { font-weight: 600; }

/* Notices and headings that checkout.js moves focus to, so screen readers read them out */
.notice:focus,
.state h1:focus { outline: none; }

/* Test mode, from ?test= */
.banner {
  padding: 0.9rem 1.15rem;
  border-radius: 14px;
  background: var(--amber-bg);
  color: var(--amber-text);
  font-size: 0.9375rem;
}

.banner span { white-space: nowrap; }

/* What the API sent back: ?error= or ?soon=1 */
.notice {
  display: grid;
  justify-items: start;
  gap: 0.5rem;
  padding: 1.15rem 1.35rem 1.25rem;
  border-radius: 14px;
  background: var(--tile);
  box-shadow: inset 4px 0 0 var(--blue);
}

.notice-error { box-shadow: inset 4px 0 0 var(--red); }

.notice h2 { font-size: 1.1875rem; }

.notice .btn { margin-top: 0.5rem; }

/* The order: what's bought, what's due today and how it's billed */
.order {
  padding: clamp(1.5rem, 4vw, 2rem);
  border-radius: 20px;
}

.order-lines {
  margin: 1rem 0 0;
  border-top: 1px solid var(--hairline);
}

.order-lines div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--hairline);
}

.order-lines dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.order-total { font-weight: 600; }

.order ul {
  display: grid;
  gap: 0.5rem;
  margin: 1.1rem 0 0;
  padding-left: 1.2rem;
  color: var(--text-2);
  font-size: 0.9375rem;
}

/* The form */
.checkout {
  display: grid;
  gap: 1.5rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field label { font-weight: 600; }

.field input,
.field select {
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 0 1rem;
  border: 1px solid var(--field-border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.25 var(--sans);
  letter-spacing: -0.022em;
}

.field input:focus-visible,
.field select:focus-visible {
  border-color: var(--blue);
  border-radius: 12px;
  outline-offset: 1px;
}

.field [aria-invalid="true"] { border-color: var(--red); }

/* The select draws its own chevron, so it matches the text field */
.select { position: relative; }

.select select {
  appearance: none;
  padding-right: 2.75rem;
}

.select::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 1.15rem;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 1.5px solid var(--text-2);
  border-bottom: 1.5px solid var(--text-2);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* The cancellation and refund terms, in English and Icelandic side by side */
.refunds {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.75rem 2rem;
  padding: clamp(1.5rem, 4vw, 2rem);
  border-radius: 20px;
  background: var(--tile);
  font-size: 0.9375rem;
  line-height: 1.47;
}

.refunds h2 { font-size: 1.1875rem; }

.refunds ul {
  display: grid;
  gap: 0.6rem;
  margin: 0.85rem 0 0;
  padding-left: 1.1rem;
}

.refunds p { margin-top: 0.85rem; }

@media (max-width: 760px) {
  .refunds { grid-template-columns: 1fr; }
  .refunds > div + div { padding-top: 1.5rem; border-top: 1px solid var(--hairline); }
}

/* The terms checkbox: the whole line is the click target */
.check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
}

.check input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0.05em 0 0;
  accent-color: var(--blue);
  cursor: pointer;
}

.checkout .btn {
  width: 100%;
  min-height: 52px;
}

.btn:disabled {
  opacity: 0.42;
  cursor: default;
}

.btn:disabled:hover { background: var(--blue); }
.btn:disabled:active { transform: none; }

.checkout-hint {
  margin-top: -0.75rem;
  text-align: center;
}

/* Under the button: the cards, the currency and who's selling */
.pay {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  text-align: center;
}

.cards {
  display: flex;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cards svg {
  width: 46px;
  height: 30px;
}

.seller {
  font-style: normal;
  line-height: 1.5;
}

/* /thanks: the centred hero of the opening-soon page, with the key and next steps under it */

.thanks h1 { font-size: clamp(2.75rem, 7vw, 4.5rem); }

.state {
  display: grid;
  justify-items: center;
}

.spinner {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 0.55em;
  border: 2px solid var(--hairline);
  border-top-color: var(--blue);
  border-radius: 50%;
  vertical-align: -0.1em;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

.key-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem 1.5rem;
  width: min(100%, 40rem);
  margin-top: 2.25rem;
  padding: clamp(1.25rem, 4vw, 1.75rem);
  border-radius: 20px;
  background: var(--tile);
}

.key {
  font: 600 clamp(1rem, 4.3vw, 1.75rem)/1.25 var(--mono);
  letter-spacing: 0.02em;
  user-select: all;
  -webkit-user-select: all;
  overflow-wrap: anywhere;
}

.key-box .btn { min-width: 6.5rem; }

.key-note {
  max-width: 36rem;
  margin-top: 1rem;
  color: var(--text-2);
}

.ref {
  font-family: var(--mono);
  font-size: 0.95em;
  overflow-wrap: anywhere;
}

/* Next steps, left-aligned in a tile */
.next {
  width: min(100%, 40rem);
  margin-top: 2.5rem;
  padding: clamp(1.5rem, 4vw, 2rem);
  border-radius: 20px;
  background: var(--tile);
  text-align: left;
}

.steps {
  display: grid;
  gap: 1.1rem;
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding-left: 2.75rem;
  color: var(--text-2);
}

.steps li::before {
  content: counter(step);
  counter-increment: step;
  position: absolute;
  top: -0.05em;
  left: 0;
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: var(--chip-bg);
  color: var(--link);
  font-size: 0.9375rem;
  font-weight: 600;
}

.steps strong {
  display: block;
  color: var(--text);
}

.thanks .hero-head > .fine { margin-top: 2.5rem; }

/* Footer */

.footer {
  padding: 1.5rem 0 2.5rem;
  background: var(--bg-alt);
  color: var(--text-2);
  font-size: 0.8125rem;
  letter-spacing: -0.01em;
}

.footer-inner {
  display: grid;
  gap: 1rem;
}

.credits {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--hairline);
  line-height: 1.5;
}

/* Who sells PaperKeys, as the payment card schemes ask every shop to show */
.company {
  display: grid;
  gap: 0.25rem;
  font-style: normal;
  line-height: 1.5;
}

.company a { color: var(--text-2); }
.company a:hover { color: var(--text); }

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text-2);
}

.footer-links a:hover { color: var(--text); }

/* Copyright, then Terms and Privacy Policy split by hairlines, as on Apple's footer */
.footer-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.25rem;
}

.footer-legal ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-legal li + li::before {
  content: "";
  height: 1em;
  margin: 0 0.75rem;
  border-left: 1px solid var(--hairline);
}

.footer-legal li {
  display: inline-flex;
  align-items: center;
}

.footer-legal a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text);
}

.footer-links a[aria-current="page"],
.footer-legal a[aria-current="page"] { color: var(--text); font-weight: 600; }
