/* tabvault.ca: the app's look on the web. A soft grey canvas, white rounded cards, black accents. */

:root {
  --text: #0b0b0f;
  --muted: #6e6e78;
  --bg: #f0f0f4;
  --bg-top: #f8f8fb;
  --card: #ffffff;
  --border: #e8e8ee;
  --accent: #0b0b0f;
  --on-accent: #ffffff;
  --link: #2f6ee6;
  --green: #1fb45a;
  --shadow: 0 1px 2px rgba(20, 20, 30, 0.05), 0 8px 24px rgba(20, 20, 30, 0.07);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #f5f5f7;
    --muted: #9a9aa3;
    --bg: #050507;
    --bg-top: #121217;
    --card: #18181c;
    --border: #26262d;
    --accent: #f5f5f7;
    --on-accent: #0b0b0f;
    --link: #6b9bff;
    --green: #34d374;
    --shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 10px 28px rgba(0, 0, 0, 0.6);
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--bg-top) 0, var(--bg) 480px) var(--bg);
  color: var(--text);
  font: 17px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

main {
  flex: 1;
}

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

a:hover {
  text-decoration: underline;
}

.wrap {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header and footer */

.top {
  position: sticky;
  top: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--bg-top) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
}

.top-row,
.foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top-row {
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
}

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

.brand img {
  border-radius: 8px;
}

.brand.small {
  font-size: 15px;
}

.brand.small img {
  border-radius: 6px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

nav a {
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}

nav a[aria-current='page'],
nav a:hover {
  color: var(--text);
  text-decoration: none;
}

.foot {
  margin-top: 64px;
  padding: 28px 0 40px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

.foot-row {
  align-items: flex-start;
}

.foot p {
  margin: 6px 0 0;
}

.foot nav {
  justify-content: flex-end;
  max-width: 560px;
}

.foot nav a {
  font-size: 14px;
}

/* Home */

.hero {
  text-align: center;
  padding-top: 72px;
  padding-bottom: 48px;
}

.hero-icon {
  border-radius: 22px;
  box-shadow: var(--shadow);
}

h1 {
  font-size: clamp(34px, 7vw, 56px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 24px 0 14px;
}

.lead {
  font-size: clamp(18px, 2.6vw, 21px);
  color: var(--muted);
  max-width: 620px;
  margin: 0 auto;
}

.pill {
  display: inline-block;
  margin: 28px 0 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 15px;
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, 1fr);
  margin: 24px 0;
}

.card {
  background: var(--card);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 18px;
  margin: 0 0 6px;
}

.card p {
  margin: 0 0 8px;
}

.card p:last-child {
  margin-bottom: 0;
}

.split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  margin-top: 16px;
  padding: 28px;
}

.split p {
  color: var(--muted);
}

.langs {
  font-size: 15px;
  line-height: 1.8;
}

.more {
  font-weight: 600;
}

/* Documents */

.doc {
  max-width: 760px;
  padding-top: 40px;
}

.doc h1 {
  font-size: clamp(30px, 5vw, 42px);
  margin-top: 0;
}

.meta,
.muted {
  color: var(--muted);
}

.meta {
  font-size: 15px;
  margin-top: -6px;
}

.intro {
  font-size: 19px;
}

.doc section h2,
.spaced {
  font-size: 21px;
  margin: 36px 0 10px;
}

.doc section p {
  margin: 0 0 12px;
}

.note {
  margin-top: 40px;
}

.steps {
  margin: 20px 0;
}

.steps ol {
  margin: 8px 0;
  padding-left: 22px;
}

.steps li {
  margin: 4px 0;
}

.faq {
  margin: 12px 0;
  padding: 0;
}

.faq summary {
  cursor: pointer;
  padding: 18px 22px;
  font-weight: 600;
  list-style: none;
}

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

.faq summary::after {
  content: '+';
  float: right;
  color: var(--muted);
  font-weight: 400;
}

.faq[open] summary::after {
  content: '−';
}

.faq p {
  padding: 0 22px 18px;
  color: var(--muted);
}

/* Phones */

@media (max-width: 760px) {
  .grid,
  .grid.two,
  .split {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 48px;
  }

  .top nav {
    gap: 4px 14px;
  }

  .foot-row {
    flex-direction: column;
  }

  .foot nav {
    justify-content: flex-start;
  }
}

@media (max-width: 380px) {
  .top nav a:nth-child(3) {
    display: none;
  }
}

/* ---------- Home: the "how it works" story (website/home-demo.mjs) ---------- */

.story {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 56px;
  padding-top: 8px;
}

.chapter {
  min-height: 72vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 470px;
}

.chapter h2 {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 10px 0 14px;
}

.chapter > p {
  color: var(--muted);
  font-size: 18px;
  margin: 0;
}

.chapter > .kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kicker span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--green) 14%, transparent);
  font-size: 12px;
  letter-spacing: 0;
}

/* With JavaScript, the chapter in the middle of the screen is lit and the others wait, faded. */
.js .chapter {
  opacity: 0.25;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.js .chapter.on {
  opacity: 1;
  transform: none;
}

.story-stage {
  position: sticky;
  top: max(84px, calc(50vh - 318px));
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 12vh;
}

.story-dots {
  display: flex;
  gap: 6px;
}

.story-dots i {
  width: 7px;
  height: 7px;
  border-radius: 4px;
  background: var(--border);
  transition: width 0.3s ease, background 0.3s ease;
}

.story-dots i.on {
  width: 22px;
  background: var(--text);
}

/* The phone */

.phone {
  position: relative;
  width: 300px;
  height: 610px;
  border-radius: 46px;
  padding: 12px;
  background: #0b0b0f;
  box-shadow: 0 0 0 2px #2a2a31, 0 30px 70px rgba(10, 10, 20, 0.28);
}

.phone-island {
  position: absolute;
  z-index: 3;
  top: 22px;
  left: 50%;
  width: 92px;
  height: 26px;
  margin-left: -46px;
  border-radius: 14px;
  background: #0b0b0f;
}

.screen {
  position: absolute;
  inset: 12px;
  overflow: hidden;
  border-radius: 35px;
  padding: 60px 16px 16px;
  background: linear-gradient(180deg, var(--bg-top), var(--bg));
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 0.45s ease, transform 0.45s ease;
  font-size: 13px;
  line-height: 1.35;
}

.screen.on {
  opacity: 1;
  transform: none;
}

.screen b {
  font-weight: 700;
}

.screen small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
}

.screen svg {
  width: 18px;
  height: 18px;
}

.d-title {
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.d-sub {
  margin: 14px 0 8px;
  font-size: 15px;
  font-weight: 700;
}

.d-card {
  background: var(--card);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}

.d-big {
  display: block;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin: 2px 0 10px;
}

.d-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.d-row-text {
  flex: 1;
  min-width: 0;
}

.d-row-text b {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.d-amount {
  font-variant-numeric: tabular-nums;
}

.d-logo {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
}

/* 1. Scan */

.s-scan {
  background: #111114;
  color: #fff;
}

.d-viewfinder {
  position: relative;
  height: 330px;
  margin-top: 10px;
  display: grid;
  place-items: center;
}

.d-paper {
  width: 58%;
  padding: 18px 14px;
  border-radius: 6px;
  background: #f4f1ea;
  transform: rotate(-3deg);
  display: grid;
  gap: 9px;
}

.d-paper span {
  display: flex;
  justify-content: space-between;
}

.d-paper i {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: #c9c4b8;
}

.d-paper i.dark {
  background: #1a1a1a;
}

.d-paper > i.w50 {
  width: 50%;
  height: 8px;
  justify-self: center;
}

.d-total {
  margin-top: 6px;
}

.w15 { width: 15%; }
.w20 { width: 20%; }
.w30 { width: 30%; }
.w45 { width: 45%; }
.w55 { width: 55%; }
.w65 { width: 65%; }
.w70 { width: 70%; }

.d-corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 0 solid #fff;
}

.d-corner.tl { top: 8px; left: 8px; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 10px; }
.d-corner.tr { top: 8px; right: 8px; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 10px; }
.d-corner.bl { bottom: 8px; left: 8px; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 10px; }
.d-corner.br { bottom: 8px; right: 8px; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 10px; }

.d-sweep {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 50%;
  height: 3px;
  border-radius: 2px;
  background: var(--green);
  box-shadow: 0 0 18px var(--green);
  opacity: 0;
}

.d-saved {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  color: #0b0b0f;
}

.d-saved small {
  color: #6e6e78;
}

.d-check {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
}

.d-shutter {
  position: absolute;
  left: 50%;
  bottom: 22px;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-left: -29px;
  border-radius: 50%;
  background: #fff;
  color: #0b0b0f;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.25);
}

.screen.on .d-sweep { animation: sweep 1.3s ease-in-out 0.2s 2 both; }
.screen.on .d-paper { animation: paper-in 0.6s ease both; }
.screen.on .d-saved { animation: rise 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) 2.8s both; }
.screen.on .d-shutter { animation: press 0.35s ease 0.05s both; }

@keyframes sweep {
  0% { top: 12%; opacity: 1; }
  50% { top: 86%; opacity: 1; }
  100% { top: 12%; opacity: 1; }
}

@keyframes paper-in {
  from { transform: rotate(-3deg) translateY(16px); opacity: 0; }
}

@keyframes press {
  50% { transform: scale(0.88); }
}

/* 2. Purchases */

.d-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  color: var(--muted);
}

.d-typed {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  font-weight: 600;
}

.d-caret {
  width: 2px;
  height: 16px;
  margin-left: -6px;
  background: var(--link);
  animation: blink 1s steps(1) infinite;
}

.d-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.d-list .d-row {
  padding: 10px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.d-price {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, #f59e0b 16%, transparent);
  color: #b45309;
  font-size: 12px;
}

.screen.on .d-typed { animation: type 0.9s steps(6) 0.3s both; }
.screen.on .d-list .d-row { animation: rise 0.45s ease calc(1.2s + var(--i) * 0.12s) both; }
.screen.on .d-price { animation: rise 0.45s ease 2s both; }

@keyframes type {
  from { width: 0; }
  to { width: 6ch; }
}

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

/* 3. Insights */

.d-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 90px;
}

.d-bars i {
  flex: 1;
  height: var(--h);
  border-radius: 6px 6px 3px 3px;
  background: var(--border);
  transform-origin: bottom;
}

.d-bars i.now {
  background: var(--text);
}

.d-cats {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.d-cats span {
  display: grid;
  grid-template-columns: 1fr auto;
  font-size: 12px;
}

.d-cats span i {
  grid-column: 1 / -1;
  order: 2;
  height: 6px;
  width: var(--w);
  margin-top: 4px;
  border-radius: 3px;
  transform-origin: left;
}

.d-review b {
  display: block;
  margin-bottom: 2px;
}

.screen.on .d-bars i { animation: grow 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) calc(0.2s + var(--i) * 0.08s) both; }
.screen.on .d-cats span i { animation: widen 0.7s ease 0.6s both; }
.screen.on .d-review { animation: rise 0.5s ease 1.4s both; }

@keyframes grow {
  from { transform: scaleY(0); }
}

@keyframes widen {
  from { transform: scaleX(0); }
}

/* 4. Ask */

.d-chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 400px;
}

.d-bubble {
  max-width: 82%;
  margin: 0;
  padding: 10px 13px;
  border-radius: 18px;
  font-size: 13px;
}

.d-bubble.me {
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
}

.d-bubble.bot {
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.d-dots {
  display: none;
}

.d-input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 8px 14px;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--muted);
}

.d-send {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
}

.screen.on .d-bubble.me { animation: rise 0.4s ease 0.3s both; }
.screen.on .d-dots {
  display: flex;
  position: absolute;
  top: 170px;
  left: 16px;
  transform-origin: left center;
  gap: 4px;
  align-self: flex-start;
  margin: 0;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
  animation: dots-life 2.4s linear both;
}
.screen.on .d-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: bob 0.9s ease-in-out infinite;
}
.screen.on .d-dots i:nth-child(2) { animation-delay: 0.15s; }
.screen.on .d-dots i:nth-child(3) { animation-delay: 0.3s; }
.screen.on .d-bubble.bot { animation: rise 0.45s ease 2.3s both; }

@keyframes dots-life {
  0%, 35% { opacity: 0; transform: scale(0.6); }
  42%, 92% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: scale(0.6); }
}

@keyframes bob {
  50% { transform: translateY(-3px); }
}

/* 5. Budget and reminders */

.d-track {
  height: 7px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}

.d-track i {
  display: block;
  width: 72%;
  height: 100%;
  border-radius: 4px;
  background: var(--text);
  transform-origin: left;
}

.d-of {
  margin-top: 6px;
}

.d-due {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.d-dot {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.d-dot.warn,
.d-pill.warn {
  background: color-mix(in srgb, #f59e0b 18%, transparent);
  color: #c47a06;
}

.d-dot.ok,
.d-pill.ok {
  background: color-mix(in srgb, var(--green) 16%, transparent);
  color: var(--green);
}

.d-due .d-row-text b {
  white-space: normal;
}

.d-pill {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.d-notify {
  position: absolute;
  top: 48px;
  left: 10px;
  right: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  opacity: 0;
}

.screen.on .d-track i { animation: widen 1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.3s both; }
.screen.on .d-due .d-row { animation: rise 0.45s ease 0.9s both; }
.screen.on .d-due .d-row + .d-row { animation-delay: 1.05s; }
.screen.on .d-notify { animation: drop 3.4s ease 1.8s both; }

@keyframes drop {
  0% { opacity: 0; transform: translateY(-24px); }
  12%, 82% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-24px); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
}

/* Reduce Motion: no movement, every screen shows how it ends. */
@media (prefers-reduced-motion: reduce) {
  .js .chapter,
  .screen {
    transition: opacity 0.2s ease;
    transform: none;
  }
  .screen *,
  .screen.on * {
    animation: none !important;
  }
  .d-notify {
    opacity: 1;
  }
  .d-sweep,
  .screen.on .d-dots {
    display: none;
  }
}

/* Phones: the same demo, smaller, stays at the top; the chapters scroll up below it and the one
   just under it is the one playing. The scale is set by the page script to fit the screen. */
.phone-fit {
  display: contents;
}

@media (max-width: 760px) {
  .story {
    grid-template-columns: 1fr;
    gap: 0;
    padding-bottom: 30vh;
  }
  .story-stage {
    order: -1;
    top: 60px;
    z-index: 1;
    margin: 0 -16px;
    padding: 10px 0 14px;
    gap: 8px;
    background: linear-gradient(180deg, var(--bg) 0, var(--bg) calc(100% - 14px), transparent);
  }
  .phone-fit {
    display: block;
    width: calc(300px * var(--phone-scale, 0.5));
    height: calc(610px * var(--phone-scale, 0.5));
  }
  .phone-fit .phone {
    transform: scale(var(--phone-scale, 0.5));
    transform-origin: top left;
  }
  .chapter {
    min-height: 48vh;
    max-width: none;
    justify-content: flex-start;
    padding: 18px 0 8px;
  }
  .js .chapter {
    opacity: 0.3;
    transform: translateY(16px);
  }
  .js .chapter.on {
    opacity: 1;
    transform: none;
  }
  .chapter h2 {
    font-size: 26px;
    margin: 8px 0 10px;
  }
  .chapter > p {
    font-size: 16.5px;
  }
}
