/* The page around the app, in the web site's design (thefile.ninja: site/src/styles/site.css): its
 * colours, type and buttons for the header, the start card, the tour's captions and controls. The app's
 * window itself is css/tfn.css and stays the app's own. Every class here starts with sh- or belongs to
 * the tour (welcome, caption, pace, spot, keycast, demo-cursor), so nothing reaches into the app.
 * The theme is html[data-theme] (js/main.js: the system's, unless ?light or ?dark, then the app's own). */

:root {
  --s-bg: #0a0c0f;
  --s-raised: #101318;
  --s-surface: #151920;
  --s-border: #252b34;
  --s-text: #e7eaee;
  --s-muted: #98a1ac;
  --s-accent: #5be33d;
  --s-accent-strong: #7cf25f;
  --s-accent-ink: #062109;
  --s-accent-soft: rgba(91, 227, 61, 0.12);
  --s-warn: #f2c14e;
  --s-warn-soft: rgba(242, 193, 78, 0.12);
  --s-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
  --s-lift: 0 20px 60px rgba(0, 0, 0, 0.55);
  --s-font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --s-head: 56px;
  --s-gap: 12px;
}

html[data-theme='light'] {
  color-scheme: light;
  --s-bg: #f6f7f8;
  --s-raised: #eef0f2;
  --s-surface: #ffffff;
  --s-border: #d9dee4;
  --s-text: #15181c;
  --s-muted: #5a636e;
  --s-accent: #1d8a2a;
  --s-accent-strong: #166e21;
  --s-accent-ink: #ffffff;
  --s-accent-soft: rgba(29, 138, 42, 0.1);
  --s-warn: #8a5a00;
  --s-warn-soft: rgba(242, 176, 40, 0.16);
  --s-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 6px 18px rgba(0, 0, 0, 0.05);
  --s-lift: 0 20px 60px rgba(0, 0, 0, 0.18);
}

html,
body {
  background: var(--s-bg);
}

/* ---------------------------------------------------------------- the header: the site's, on one line */

.sh-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--s-head);
  display: flex;
  align-items: center;
  gap: 8px 22px;
  padding: 0 max(20px, var(--s-gap));
  background: var(--s-bg);
  color: var(--s-text);
  font: 15px/1.4 var(--s-font);
  -webkit-font-smoothing: antialiased;
}

.sh-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--s-text);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.sh-brand img {
  width: 30px;
  height: 30px;
}

.sh-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 1px 9px;
  background: var(--s-accent-soft);
  color: var(--s-accent);
}

.sh-nav {
  display: flex;
  align-items: center;
  gap: 4px 20px;
  margin-left: auto;
}

.sh-nav a:not(.sh-btn),
.sh-nav button {
  color: var(--s-muted);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sh-nav a:not(.sh-btn):hover,
.sh-nav button:hover {
  color: var(--s-text);
}

/* ---------------------------------------------------------------- buttons, as the site's */

.sh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 600 15px/1.3 var(--s-font);
  border-radius: 8px;
  padding: 10px 18px;
  border: 1px solid var(--s-border);
  background: var(--s-surface);
  color: var(--s-text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.sh-btn:hover {
  border-color: var(--s-muted);
  color: var(--s-text);
}

.sh-btn.primary {
  background: var(--s-accent);
  border-color: var(--s-accent);
  color: var(--s-accent-ink);
}

.sh-btn.primary:hover {
  background: var(--s-accent-strong);
  border-color: var(--s-accent-strong);
  color: var(--s-accent-ink);
}

.sh-btn.small {
  padding: 6px 14px;
  font-size: 14px;
}

.sh-link {
  color: var(--s-accent);
  text-underline-offset: 3px;
}

.sh-link:hover {
  color: var(--s-accent-strong);
}

.sh-top :focus-visible,
.welcome :focus-visible,
.caption :focus-visible {
  outline: 2px solid var(--s-accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- the app as a window on the page */

.tfn {
  inset: var(--s-head) var(--s-gap) var(--s-gap);
  border: 1px solid var(--s-border);
  border-radius: 10px;
  box-shadow: var(--s-lift);
}

/* Full screen (the window's □): the app alone, as before. */
:root:fullscreen .sh-top {
  display: none;
}

:root:fullscreen .tfn {
  inset: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

@media (max-width: 760px) {
  :root {
    --s-head: 52px;
    --s-gap: 0px;
  }

  .sh-top {
    padding: 0 14px;
    border-bottom: 1px solid var(--s-border);
  }

  .sh-nav .wide {
    display: none;
  }

  .tfn {
    inset: var(--s-head) 0 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

/* ---------------------------------------------------------------- the start card */

.welcome {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: grid;
  overflow-y: auto;
  padding: 24px 16px;
  background: color-mix(in srgb, var(--s-bg) 62%, transparent);
  backdrop-filter: blur(3px);
  color: var(--s-text);
  font: 15px/1.55 var(--s-font);
  -webkit-font-smoothing: antialiased;
}

.wc-card {
  margin: auto;
  width: min(720px, 100%);
  background: var(--s-surface);
  border: 1px solid var(--s-border);
  border-radius: 14px;
  box-shadow: var(--s-lift);
  padding: 28px 30px 24px;
}

.wc-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.wc-head img {
  flex: none;
  width: 48px;
  height: 48px;
}

.wc-card h1 {
  margin: 2px 0 6px;
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.wc-lead {
  margin: 0;
  color: var(--s-muted);
  font-size: 16px;
}

.wc-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 18px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--s-warn-soft);
  color: var(--s-text);
  font-size: 14px;
}

.wc-note .i {
  margin-top: 3px;
  color: var(--s-warn);
}

.wc-choices {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}

.wc-choice {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  font: inherit;
  color: var(--s-text);
  background: var(--s-raised);
  border: 1px solid var(--s-border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
}

.wc-choice:hover {
  border-color: var(--s-muted);
}

.wc-choice b {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 16px;
}

.wc-choice span {
  color: var(--s-muted);
  font-size: 14px;
  line-height: 1.5;
}

.wc-choice.primary {
  background: var(--s-accent-soft);
  border-color: var(--s-accent);
}

.wc-choice.primary b .i {
  color: var(--s-accent);
}

.wc-choice.primary:hover {
  border-color: var(--s-accent-strong);
}

.wc-sub {
  margin: 22px 0 10px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--s-muted);
}

.wc-tours {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wc-tour {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 500 14px/1.3 var(--s-font);
  color: var(--s-text);
  background: none;
  border: 1px solid var(--s-border);
  border-radius: 999px;
  padding: 6px 13px 6px 10px;
  cursor: pointer;
}

.wc-tour:hover {
  border-color: var(--s-accent);
}

.wc-tour .i {
  color: var(--s-accent);
}

.wc-tour small {
  color: var(--s-muted);
  font-size: 13px;
}

.wc-pace {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 20px;
}

.wc-label {
  color: var(--s-muted);
  font-size: 14px;
  padding-top: 4px;
  white-space: nowrap;
}

.wc-pace .pace-set {
  display: grid;
  gap: 8px;
}

.wc-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  align-items: center;
  justify-content: space-between;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--s-border);
}

.wc-foot p {
  flex: 1 1 280px;
  margin: 0;
  color: var(--s-muted);
  font-size: 13px;
}

.wc-cta {
  display: flex;
  gap: 18px;
  align-items: center;
}

@media (max-width: 760px) {
  .wc-card {
    padding: 22px 18px 20px;
  }

  .wc-head img {
    width: 40px;
    height: 40px;
  }

  .wc-choices {
    grid-template-columns: 1fr;
  }

  .wc-pace {
    flex-direction: column;
    gap: 8px;
  }
}

/* ---------------------------------------------------------------- the pace (start card and captions) */

.pace-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.pace-row .pc {
  padding: 3px 10px;
  border: 1px solid var(--s-border);
  border-radius: 999px;
  cursor: pointer;
  color: var(--s-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.pace-row .pc:hover {
  border-color: var(--s-muted);
  color: var(--s-text);
}

.pace-row .pc.on {
  background: var(--s-accent);
  border-color: var(--s-accent);
  color: var(--s-accent-ink);
  font-weight: 600;
}

.pace-wait {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--s-text);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.pace-wait input {
  accent-color: var(--s-accent);
  margin: 0;
}

/* ---------------------------------------------------------------- a tour: captions, keys, the pointer, the spotlight */

.demo-cursor {
  position: fixed;
  z-index: 5000;
  width: 22px;
  height: 22px;
  pointer-events: none;
  transition: transform 0.55s cubic-bezier(0.3, 0.1, 0.2, 1);
  left: 0;
  top: 0;
  filter: drop-shadow(0 2px 3px rgb(0 0 0 / 0.6));
}

.demo-cursor.click::after {
  content: '';
  position: absolute;
  left: -10px;
  top: -10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--s-accent);
  animation: ripple 0.45s ease-out forwards;
}

@keyframes ripple {
  from {
    transform: scale(0.3);
    opacity: 1;
  }
  to {
    transform: scale(1.4);
    opacity: 0;
  }
}

.keycast {
  position: fixed;
  z-index: 5001;
  left: 50%;
  bottom: 104px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  pointer-events: none;
}

.keycast .kc {
  background: rgb(16 19 24 / 0.94);
  color: #fff;
  border: 1px solid #3a424e;
  border-bottom-width: 3px;
  border-radius: 8px;
  padding: 6px 13px;
  font: 600 18px var(--s-font);
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.5);
  animation: pop 0.15s ease-out;
}

@keyframes pop {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
}

.caption {
  position: fixed;
  z-index: 5002;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  width: min(880px, calc(100vw - 40px));
  background: color-mix(in srgb, var(--s-surface) 95%, transparent);
  backdrop-filter: blur(8px);
  color: var(--s-text);
  border: 1px solid var(--s-border);
  border-radius: 12px;
  box-shadow: var(--s-lift);
  padding: 12px 14px 14px 18px;
  font: 16px/1.5 var(--s-font);
  -webkit-font-smoothing: antialiased;
  display: flex;
  gap: 14px;
  align-items: center;
}

.caption.top {
  top: calc(var(--s-head) + 64px);
  bottom: auto !important;
}

:root:fullscreen .caption.top {
  top: 64px;
}

.caption .cap-text {
  flex: 1;
  min-width: 0;
}

.caption .cap-text b {
  color: var(--s-accent);
  font-weight: 650;
}

.caption .cap-text kbd {
  font: 600 13px var(--s-font);
  border: 1px solid var(--s-border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 6px;
  background: var(--s-raised);
  color: var(--s-text);
}

.caption .cap-btns {
  display: flex;
  gap: 2px;
  align-items: center;
}

.caption .cb {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--s-muted);
  cursor: pointer;
}

.caption .cb:hover {
  background: var(--s-raised);
  color: var(--s-text);
}

.caption .cap-step {
  font-size: 13px;
  color: var(--s-muted);
  white-space: nowrap;
  margin-right: 4px;
  font-variant-numeric: tabular-nums;
}

.caption .cap-intro {
  display: block;
  font-size: 12px;
  font-weight: 650;
  color: var(--s-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.caption .cap-text b.cap-title {
  display: block;
  font-size: 19px;
  font-weight: 650;
  color: var(--s-text);
}

.caption .cap-prog {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 5px;
  height: 3px;
  background: var(--s-raised);
  border-radius: 2px;
  overflow: hidden;
}

.caption .cap-prog i {
  display: block;
  height: 100%;
  background: var(--s-accent);
}

.caption .cb.speed {
  width: auto;
  min-width: 36px;
  padding: 0 7px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.caption .cb.speed.on {
  background: var(--s-raised);
  color: var(--s-text);
}

.caption .cb.go {
  width: auto;
  padding: 0 8px 0 12px;
  gap: 2px;
  display: flex;
  align-items: center;
  background: var(--s-accent);
  color: var(--s-accent-ink);
  font-size: 14px;
  font-weight: 650;
  animation: nudge 1.6s ease-in-out infinite;
}

.caption .cb.go:hover {
  background: var(--s-accent-strong);
  color: var(--s-accent-ink);
}

@keyframes nudge {
  50% {
    box-shadow: 0 0 0 4px var(--s-accent-soft);
  }
}

.caption .cap-pop {
  position: absolute;
  right: 8px;
  bottom: calc(100% + 8px);
  background: var(--s-surface);
  border: 1px solid var(--s-border);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: var(--s-lift);
  font-size: 14px;
  display: grid;
  gap: 10px;
}

.caption .cap-pop b {
  font-size: 12px;
  color: var(--s-muted);
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.spot {
  position: fixed;
  z-index: 4999;
  pointer-events: none;
  border: 2px solid var(--s-accent);
  border-radius: 8px;
  box-shadow: 0 0 0 4000px rgb(0 0 0 / 0.3);
  transition: all 0.4s ease;
}

@media (max-width: 760px) {
  .caption {
    font-size: 14px;
    bottom: 12px;
    padding: 10px 10px 12px 14px;
  }

  .caption .cap-step {
    display: none;
  }
}
