/* Kegler's site, in the app's own oak: warm paper by day, dark wood at night, clay for what matters. */
:root {
  --canvas: #F7F1E8;
  --surface: #EFE5D7;
  --line: #E4D6C1;
  --ink: #3A2E24;
  --muted: #75614D;
  --accent: #985030;
  --accent-wash: rgba(152, 80, 48, 0.12);
  --active: #FBF7F0;
  --bezel: #2B231C;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #1E1914;
    --surface: #2A231C;
    --line: #3A3027;
    --ink: #F1E8DB;
    --muted: #A8957F;
    --accent: #D07A52;
    --accent-wash: rgba(208, 122, 82, 0.16);
    --active: #342B22;
    --bezel: #0E0B09;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 17px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 56px;
}

.narrow { max-width: 720px; }
.narrow h2 { font-size: 24px; margin-top: 44px; }

a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* A question's whole card shows keyboard focus, in its own rounded shape. */
summary:focus { outline: none; }
details:has(summary:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The top bar: the icon and the name, back to the home page. */
.bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 40px;
}

.bar img { width: 32px; height: 32px; border-radius: 8px; }

h1 {
  font-size: clamp(36px, 6vw, 56px);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}

h2 {
  font-size: clamp(26px, 3.6vw, 34px);
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}

h3 { font-size: 17px; margin: 0 0 4px; }

.lead { font-size: 20px; color: var(--muted); max-width: 34em; margin: 0 0 24px; }
.meta { color: var(--muted); font-size: 15px; margin: 0 0 6px; }

.store {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  color: var(--muted);
  font-size: 15px;
}

/* The score sheet in the hero: a game's ten frames filling in, the total large beside them. */
.game {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  margin: 44px 0 8px;
}

.sheet {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(9, 1fr) 1.45fr;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  font-variant-numeric: tabular-nums;
}

.frame {
  border-left: 1px solid var(--line);
  text-align: center;
  padding: 6px 2px 8px;
  min-width: 0;
}

.frame:first-child { border-left: 0; }
.frame .n { display: block; font-size: 12px; color: var(--muted); }
.frame .marks { display: block; font-size: 18px; height: 28px; letter-spacing: 0.08em; }
.frame .total { display: block; font-size: 20px; font-weight: 300; height: 28px; }

.score {
  font-size: clamp(64px, 11vw, 112px);
  font-weight: 100;
  line-height: 0.8;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  /* Three digits wide from the first 0, so the sheet beside it never moves as the score grows. */
  width: 3ch;
  flex: none;
  text-align: right;
}

/* The one moment on load: each frame fills in after the one before. */
@media (prefers-reduced-motion: no-preference) {
  .frame .marks, .frame .total { opacity: 0; animation: fill 0.35s ease-out forwards; animation-delay: calc(var(--i) * 0.16s + 0.3s); }
  .frame .total { animation-delay: calc(var(--i) * 0.16s + 0.42s); }
  .frame { animation: mark 0.4s ease-out; animation-delay: calc(var(--i) * 0.16s + 0.3s); }
}

/* As a feature scrolls in, its phone is set upright like a pin on the deck and its words follow;
   the smaller features' icons drop into place one after another. Once each, and only with script. */
@media (prefers-reduced-motion: no-preference) {
  .js .feature .phone {
    opacity: 0;
    transform: translateY(48px) rotate(4deg);
    transform-origin: 50% 100%;
    transition: opacity 0.5s ease-out, transform 0.9s cubic-bezier(0.34, 1.4, 0.5, 1);
  }

  .js .feature.flip .phone { transform: translateY(48px) rotate(-4deg); }

  .js .feature .copy {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s ease-out 0.2s, transform 0.6s ease-out 0.2s;
  }

  .js .feature.in .phone, .js .feature.in .copy { opacity: 1; transform: none; }

  .js .more .icon { opacity: 0; transform: translateY(-10px) scale(0.6); }
  .js .more.in .icon { animation: drop 0.55s cubic-bezier(0.34, 1.6, 0.5, 1) forwards; animation-delay: calc(var(--i) * 90ms); }
}

@keyframes drop { to { opacity: 1; transform: none; } }

@keyframes fill { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes mark { 0%, 100% { background: transparent; } 40% { background: var(--active); } }

/* Feature rows: what Kegler does, beside the screen that does it. */
.feature {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 56px;
  align-items: center;
  padding: 56px 0 0;
}

/* The phones take turns on each side, so on a wide screen each row tucks up under the words of
   the one before, like steps. */
@media (min-width: 721px) {
  .feature + .feature { margin-top: -150px; }
}

.feature.flip { grid-template-columns: 260px 1fr; }
.feature.flip .copy { order: 2; }
.feature .copy p { color: var(--muted); margin: 0; max-width: 30em; }

/* The app's screens in an iPhone 16 Pro: a titanium edge, a thin black bezel, the screen's own
   rounded corners, the Dynamic Island and the side buttons, all measured from the phone's width. */
.phone {
  --w: 260px;
  --frame: calc(var(--w) * 0.034);
  --screen: calc(var(--w) - 2 * var(--frame));
  --corner: calc(var(--screen) * 0.137);
  --titanium: #8F8A83;
  position: relative;
  display: block;
  width: var(--w);
  padding: var(--frame);
  border-radius: calc(var(--corner) + var(--frame));
  background: #050505;
  box-shadow:
    0 0 0 1.5px var(--titanium),
    0 0 0 2.5px #4E4A45,
    0 30px 60px -26px rgba(43, 35, 28, 0.6);
}

.phone img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--corner);
}

/* The Dynamic Island, in the middle of the screenshot's status bar. */
.phone::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(var(--frame) + var(--screen) * 0.027);
  width: calc(var(--screen) * 0.313);
  height: calc(var(--screen) * 0.092);
  translate: -50% 0;
  border-radius: 999px;
  background: #000;
  z-index: 1;
}

/* The side buttons: the action button and volume on the left, the side button on the right. */
.phone::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 17%;
  width: 3px;
  height: 4%;
  border-radius: 2px 0 0 2px;
  background: var(--titanium);
  box-shadow:
    0 calc(var(--w) * 0.16) 0 0 var(--titanium),
    0 calc(var(--w) * 0.29) 0 0 var(--titanium),
    calc(var(--w) + 5px) calc(var(--w) * 0.2) 0 0 var(--titanium);
}

/* On the entry screen, a finger sweeps the pins that fell, the way the app is used: each pin it
   crosses goes down, the 7-10 is left, and the record button counts them. Placed in parts of the
   screenshot, so it fits at any size. */
.swipe {
  --pin-hole: #F7F1E8;
  --pin-down: #DCCDB8;
  --pin-number: #9C8B78;
  --touch: rgba(58, 46, 36, 0.3);
  --touch-ring: rgba(58, 46, 36, 0.14);
  --record: #985030;
  position: absolute;
  inset: var(--frame);
  border-radius: var(--corner);
  overflow: hidden;
  pointer-events: none;
  container-type: size;
  display: none;
  /* Its own layer, so its changes are drawn apart from the screenshot under it. */
  transform: translateZ(0);
}

@media (prefers-color-scheme: dark) {
  .swipe {
    --pin-hole: #1E1914;
    --pin-down: #3A2F25;
    --pin-number: #8A7864;
    --touch: rgba(255, 248, 238, 0.45);
    --touch-ring: rgba(255, 248, 238, 0.2);
    --record: #B05C3C;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .js .swipe { display: block; }
}

.swipe .down {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 13cqw;
  /* Height given, not an aspect ratio: Safari stretches a grid by its text past the ratio. */
  height: 13cqw;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--pin-hole);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.12s;
}

.swipe .down::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--pin-down);
  transform: scale(0.8) rotate(var(--tilt)) translateY(3%);
}

.swipe .down b {
  position: relative;
  font-weight: 400;
  font-size: 3.4cqw;
  color: var(--pin-number);
  transform: rotate(var(--tilt));
}

.swipe .hint {
  position: absolute;
  left: 0;
  right: 0;
  top: 61.85%;
  translate: 0 -50%;
  text-align: center;
  font-size: 3.2cqw;
  color: var(--pin-number);
  opacity: 0;
  transition: opacity 0.2s;
}

.swipe .hint i {
  font-style: normal;
  font-size: 2.6cqw;
  border: 1px solid var(--record);
  border-radius: 999px;
  padding: 0.3cqw 1.6cqw;
  margin-left: 1.5cqw;
}

.swipe .record {
  position: absolute;
  left: 3.8cqw;
  right: 3.8cqw;
  top: 66.55%;
  height: 5.1cqh;
  translate: 0 -50%;
  border-radius: 999px;
  background: var(--record);
  color: #fff;
  font-size: 3.6cqw;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.2s;
}

/* Moved with a transform, not left and top, and ringed with a gradient, not a shadow: Safari
   leaves trails of a shadowed element moved by layout inside a turning phone. */
.swipe .finger {
  position: absolute;
  left: 0;
  top: 0;
  width: 11.5cqw;
  height: 11.5cqw;
  border-radius: 50%;
  background: radial-gradient(circle, var(--touch) 0 60%, var(--touch-ring) 61% 100%);
  transform: translate(var(--px, 0px), var(--py, 0px)) translate(-50%, -50%);
  opacity: 0;
  will-change: transform, opacity;
  transition: transform 0.16s linear, opacity 0.2s;
}

.swipe .on { opacity: 1; }

/* Smaller things Kegler does, as a quiet list. */
.more {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px 40px;
  margin-top: 24px;
}

.more > div { display: flex; gap: 14px; }
.more p { margin: 0; color: var(--muted); font-size: 16px; }

.icon {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: var(--accent-wash);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon svg { width: 17px; height: 17px; }

section.block { padding-top: 88px; }

/* The price, said once and large. */
.price {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 40px;
  align-items: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 36px 0;
}

.price .figure { font-size: clamp(48px, 8vw, 80px); font-weight: 100; line-height: 1; letter-spacing: -0.02em; }
.price p { margin: 0; color: var(--muted); max-width: 30em; }
.price strong { color: var(--ink); font-weight: 600; }

/* Cards, tiles and questions, used by the privacy and support pages. */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 8px 0 40px;
}

.tile { background: var(--surface); border-radius: 20px; padding: 16px; }
.tile strong { display: block; margin-top: 10px; font-size: 16px; }
.tile span:not(.icon) { display: block; color: var(--muted); font-size: 14px; line-height: 1.4; margin-top: 2px; }

.card { background: var(--surface); border-radius: 20px; padding: 18px 20px; margin: 12px 0; }
.card h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.card p { margin: 0; color: var(--muted); }
.card p + p { margin-top: 8px; }

.button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  border-radius: 999px;
  padding: 13px 26px;
  margin-top: 16px;
}

details { background: var(--surface); border-radius: 20px; margin: 10px 0; padding: 0 20px; }

summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 0;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

summary::-webkit-details-marker { display: none; }
summary::after { content: "›"; color: var(--muted); transition: transform 0.2s; }
details[open] summary::after { transform: rotate(90deg); }
details[open] summary { padding-bottom: 8px; }
/* Padding, not margin: a margin on the last line would slip out under the card. */
details p { margin: 0; padding-bottom: 16px; color: var(--muted); }

footer {
  margin-top: 72px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-size: 15px;
}

footer .muted { color: var(--muted); margin-left: auto; }

@media (max-width: 720px) {
  .feature, .feature.flip { grid-template-columns: 1fr; gap: 24px; padding-top: 48px; }
  .feature.flip .copy { order: 0; }
  .phone { --w: min(260px, 72vw); margin: 0 auto; }
  .game { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
  .score { text-align: left; }
  .price { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .frame .marks { font-size: 13px; letter-spacing: 0; }
  .frame .total { font-size: 14px; }
  .frame .n { font-size: 10px; }
  footer .muted { margin-left: 0; width: 100%; }
}
