/* Times Table Dojo - website styles. Plain CSS, no frameworks, no CDNs. */

@font-face {
  font-family: "Fredoka";
  src: url("../fonts/Fredoka-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Fredoka";
  src: url("../fonts/Fredoka-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --red: #FF5A5F;
  --red-deep: #D9363E;
  --cream: #FFF6E5;
  --ink: #1F2A44;
  --white: #FFFFFF;
  --yellow: #FFC93C;
  --mint: #3DDC97;
  --sky: #4DA8FF;
  --grape: #9B6BFF;
  --peach: #FF9F6B;
  --pink: #FF7EB6;
  --wood: #E9B87A;
  --wood-dark: #C98E4E;
  --radius: 26px;
  --lip: 7px;
  --line: 4px;
  --max: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Fredoka", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  font-weight: 600;
  color: var(--ink);
  background-color: var(--cream);
  /* faint shoji lattice */
  background-image:
    linear-gradient(rgba(31, 42, 68, .045) 3px, transparent 3px),
    linear-gradient(90deg, rgba(31, 42, 68, .045) 3px, transparent 3px);
  background-size: 120px 170px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
main { overflow-x: clip; }
a { color: var(--ink); }
h1, h2, h3 { font-weight: 700; line-height: 1.15; margin: 0 0 .4em; }
p { margin: 0 0 1em; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--yellow); padding: 8px 16px; border: var(--line) solid var(--ink); border-radius: 999px;
}
.skip-link:focus { left: 12px; }

:focus-visible { outline: 4px solid var(--sky); outline-offset: 3px; border-radius: 12px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 246, 229, .94);
  backdrop-filter: blur(8px);
  border-bottom: var(--line) solid var(--ink);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 72px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 44px; height: 44px; border-radius: 12px; border: 3px solid var(--ink); }
.brand-name { font-size: 1.35rem; font-weight: 700; white-space: nowrap; }
.brand-name .w1 { color: var(--red); } .brand-name .w2 { color: var(--sky); } .brand-name .w3 { color: #E3A400; }
.nav { display: flex; gap: 6px; }
.nav a {
  text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 700;
  border: 3px solid transparent; transition: transform .15s;
}
.nav a:hover { border-color: var(--ink); background: var(--white); transform: translateY(-2px); }
.nav a[aria-current="page"] { background: var(--yellow); border-color: var(--ink); }

/* ---------- Outlined logo text ---------- */
.outlined {
  font-weight: 700;
  -webkit-text-stroke: 0;
  text-shadow:
    3px 0 var(--ink), -3px 0 var(--ink), 0 3px var(--ink), 0 -3px var(--ink),
    2px 2px var(--ink), -2px -2px var(--ink), 2px -2px var(--ink), -2px 2px var(--ink),
    0 7px var(--ink);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font: inherit; font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--ink);
  background: var(--yellow);
  border: var(--line) solid var(--ink); border-radius: 999px;
  padding: 14px 26px;
  box-shadow: 0 var(--lip) 0 var(--ink);
  transition: transform .15s cubic-bezier(.3, 1.6, .5, 1), box-shadow .15s;
  cursor: pointer;
}
.btn:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 calc(var(--lip) + 3px) 0 var(--ink); }
.btn:active { transform: translateY(var(--lip)); box-shadow: 0 0 0 var(--ink); }
.btn-store { background: var(--ink); color: var(--white); padding: 12px 26px 12px 22px; }
.btn-store small { display: block; font-size: .72rem; font-weight: 600; opacity: .85; line-height: 1; }
.btn-store span { display: block; font-size: 1.35rem; line-height: 1.05; }
.btn-store .store-glyph {
  width: 34px; height: 34px; border-radius: 10px; background: var(--red);
  display: grid; place-items: center; font-size: 1.1rem; border: 2px solid var(--white);
}

/* ---------- Sticker card ---------- */
.card {
  background: var(--white);
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 var(--lip) 0 var(--ink);
  padding: 24px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: radial-gradient(circle at 55% 45%, #FF787A 0%, var(--red) 40%, var(--red-deep) 100%);
  border-bottom: var(--line) solid var(--ink);
  color: var(--white);
}
.hero-art { position: relative; }
.hero-art img { width: 100%; height: auto; }
.hero-text {
  position: relative; z-index: 2;
  text-align: center; padding: 8px 20px 56px;
}
.hero-text h1 { font-size: clamp(2.2rem, 6vw, 4.2rem); margin-bottom: .2em; }
.hero-text h1 .t1 { color: var(--white); } .hero-text h1 .t2 { color: var(--yellow); }
.hero-text p.tagline { font-size: clamp(1.1rem, 2.6vw, 1.5rem); max-width: 34em; margin: 0 auto 1.2em; }
.hero-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
.pill {
  display: inline-block; background: var(--white); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 999px; padding: 4px 14px; font-weight: 700; font-size: .95rem;
}

/* floating number chips */
.chips { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.chip {
  position: absolute;
  font-weight: 700; color: var(--ink); font-size: clamp(.9rem, 1.6vw, 1.3rem);
  background: var(--yellow); border: 3px solid var(--ink); border-radius: 999px;
  padding: 4px 14px; box-shadow: 0 4px 0 var(--ink);
  animation: drift 7s ease-in-out infinite;
}
.chip:nth-child(2n) { animation-duration: 9s; animation-delay: -2s; }
.chip:nth-child(3n) { animation-duration: 8s; animation-delay: -4s; }
@keyframes drift {
  0%, 100% { transform: translateY(0) rotate(var(--r, -6deg)); }
  50% { transform: translateY(-14px) rotate(calc(var(--r, -6deg) * -1)); }
}

/* ---------- Sections ---------- */
section { padding: 72px 0; position: relative; }
.section-title { text-align: center; margin-bottom: 36px; }
.section-title h2 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); }
.section-title p { font-size: 1.15rem; max-width: 36em; margin: 0 auto; color: rgba(31, 42, 68, .85); }
.kicker {
  display: inline-block; background: var(--red); color: var(--white);
  border: 3px solid var(--ink); border-radius: 999px; padding: 2px 14px; margin-bottom: 12px;
  font-size: .9rem; letter-spacing: .04em; text-transform: uppercase;
}

/* feature rows: text card + phone screenshot */
.feature {
  display: grid; grid-template-columns: 1fr 260px; gap: 48px; align-items: center;
  max-width: 940px; margin: 0 auto 48px;
}
.feature:nth-of-type(even) { grid-template-columns: 260px 1fr; }
.feature:nth-of-type(even) .feature-text { order: 2; }
.feature-text h3 { font-size: 2rem; display: flex; align-items: center; gap: 12px; }
.feature-text .icon {
  width: 52px; height: 52px; flex: none; border-radius: 16px; border: 3px solid var(--ink);
  display: grid; place-items: center; font-size: 1.6rem; box-shadow: 0 4px 0 var(--ink);
}
.feature-text p { font-size: 1.12rem; }
.feature-text ul { margin: 0; padding-left: 1.2em; }
.feature-text li { margin-bottom: .3em; }

/* cute phone frame */
.phone {
  width: 100%; max-width: 260px; margin: 0 auto;
  border: 6px solid var(--ink); border-radius: 44px; overflow: hidden;
  box-shadow: 0 10px 0 var(--ink), 0 22px 40px rgba(31, 42, 68, .18);
  background: var(--ink);
  transform: rotate(var(--tilt, 2deg));
  transition: transform .4s cubic-bezier(.3, 1.6, .5, 1);
}
.phone:hover { transform: rotate(0deg) scale(1.03); }
.phone img { border-radius: 38px; }

/* grid of small feature cards */
.grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px;
}
.grid .card h3 { font-size: 1.35rem; display: flex; align-items: center; gap: 10px; }
.grid .card p { margin: 0; }
.grid .emoji { font-size: 1.8rem; }
.card.tilt-l { transform: rotate(-1deg); } .card.tilt-r { transform: rotate(1deg); }

/* coloured section bands */
.band-yellow { background: #FFE7A3; border-top: var(--line) solid var(--ink); border-bottom: var(--line) solid var(--ink); }
.band-mint { background: #C9F5E1; border-top: var(--line) solid var(--ink); border-bottom: var(--line) solid var(--ink); }
.band-sky { background: #D4E9FF; border-top: var(--line) solid var(--ink); border-bottom: var(--line) solid var(--ink); }

/* ---------- Board break ---------- */
.board-break { position: relative; width: min(440px, 90%); aspect-ratio: 440 / 200; margin: 0 auto 28px; }
.board-half {
  position: absolute; inset: 0;
  background: linear-gradient(var(--wood), var(--wood-dark));
  border: var(--line) solid var(--ink); border-radius: 18px;
  display: grid; place-items: center;
  transition: transform .5s cubic-bezier(.3, 1.6, .5, 1);
}
.board-half.left { clip-path: polygon(0 0, 66% 0, 60% 22%, 70% 44%, 61% 66%, 69% 84%, 64% 100%, 0 100%); }
.board-half.right { clip-path: polygon(66% 0, 100% 0, 100% 100%, 64% 100%, 69% 84%, 61% 66%, 70% 44%, 60% 22%); }
.board-half span { font-size: clamp(2.2rem, 7vw, 3.6rem); color: var(--white); margin-right: 30%; }
.board-burst {
  position: absolute; right: -6%; top: -30%;
  font-size: clamp(2rem, 6vw, 3rem); color: var(--yellow);
  transform: scale(0) rotate(-20deg); transition: transform .45s cubic-bezier(.3, 1.8, .5, 1) .15s;
}
.board-break.snapped .left { transform: translate(-6%, 4%) rotate(-7deg); }
.board-break.snapped .right { transform: translate(14%, -6%) rotate(12deg); }
.board-break.snapped .board-burst { transform: scale(1) rotate(-8deg); }
.board-break:hover .left { transform: translate(-6%, 4%) rotate(-7deg); }
.board-break:hover .right { transform: translate(14%, -6%) rotate(12deg); }
.board-break:hover .board-burst { transform: scale(1) rotate(-8deg); }

/* ---------- Belts ---------- */
.belts { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin-top: 24px; }
.belts img { width: clamp(64px, 11vw, 110px); animation: bob 2.4s ease-in-out infinite; }
.belts img:nth-child(2) { animation-delay: -.3s; } .belts img:nth-child(3) { animation-delay: -.6s; }
.belts img:nth-child(4) { animation-delay: -.9s; } .belts img:nth-child(5) { animation-delay: -1.2s; }
.belts img:nth-child(6) { animation-delay: -1.5s; } .belts img:nth-child(7) { animation-delay: -1.8s; }
.belts img:nth-child(8) { animation-delay: -2.1s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.mascot-bob { animation: bob 2.8s ease-in-out infinite; }

/* ---------- Price / privacy highlights ---------- */
.ticks { list-style: none; padding: 0; margin: 0; }
.ticks li { padding-left: 38px; position: relative; margin-bottom: 12px; font-size: 1.1rem; }
.ticks li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 50%; background: var(--mint); border: 3px solid var(--ink);
  display: grid; place-items: center; font-size: .8rem; line-height: 1;
}
.free-tables { display: flex; gap: 10px; justify-content: center; margin: 16px 0 6px; flex-wrap: wrap; }
.free-tables .t {
  width: 54px; height: 54px; display: grid; place-items: center; font-size: 1.5rem; font-weight: 700;
  border: var(--line) solid var(--ink); border-radius: 18px; box-shadow: 0 5px 0 var(--ink);
}

/* ---------- FAQ / text pages ---------- */
.page-hero { text-align: center; padding: 48px 0 24px; }
.page-hero img { width: 150px; margin: 0 auto 8px; }
.page-hero h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); }
.faq { display: grid; gap: 20px; max-width: 860px; margin: 0 auto; }
.faq details { padding: 0; }
.faq summary {
  list-style: none; cursor: pointer; padding: 20px 24px; font-size: 1.2rem; font-weight: 700;
  display: flex; align-items: center; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; margin-left: auto; font-size: 1.6rem; transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .answer { padding: 0 24px 22px; font-size: 1.06rem; }
.faq .answer p:last-child, .faq .answer ul:last-child, .faq .answer ol:last-child { margin-bottom: 0; }
.faq summary .emoji { font-size: 1.5rem; }
.prose { max-width: 820px; margin: 0 auto; }
.prose .card { margin-bottom: 22px; }
.prose h2 { font-size: 1.5rem; }
.contact-card { text-align: center; max-width: 640px; margin: 40px auto 0; background: #FFE7A3; }
.contact-card .email { font-size: clamp(1.2rem, 4vw, 1.6rem); font-weight: 700; word-break: break-all; }

/* ---------- Footer (tatami) ---------- */
.site-footer {
  margin-top: 40px;
  background:
    repeating-linear-gradient(90deg, rgba(120, 120, 60, .25) 0 2px, transparent 2px 9px),
    #CFC47A;
  border-top: 10px solid #3A4A2E;
  padding: 36px 0 28px;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: center; }
.site-footer nav a { margin-right: 16px; font-weight: 700; }
.site-footer small { display: block; opacity: .85; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .6s, transform .6s cubic-bezier(.3, 1.4, .5, 1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .feature, .feature:nth-of-type(even) { grid-template-columns: 1fr; gap: 24px; }
  .feature:nth-of-type(even) .feature-text { order: 0; }
  .nav a { padding: 6px 10px; font-size: .95rem; }
  .brand-name { display: none; }
  section { padding: 52px 0; }
  .hide-sm, .chips { display: none; }
  .phone { max-width: 210px; }
  .belts { max-width: 340px; margin-left: auto; margin-right: auto; }
  .belts img { width: 22%; }
  .board-break { width: 72%; margin-right: 22%; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Store slides (App Store screenshots) ---------- */
.slide {
  width: 100%; max-width: 300px; margin: 0 auto;
  border: 5px solid var(--ink); border-radius: 30px; overflow: hidden;
  box-shadow: 0 9px 0 var(--ink), 0 22px 40px rgba(31, 42, 68, .18);
  transform: rotate(var(--tilt, 2deg));
  transition: transform .4s cubic-bezier(.3, 1.6, .5, 1);
  background: var(--ink);
}
.slide:hover { transform: rotate(0deg) scale(1.03); }
.slide img { width: 100%; height: auto; }
.slide-wide { max-width: 900px; margin-top: 8px; border-radius: 26px; }
.slide-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; align-items: start; }
.slide-row figure { margin: 0; }
.slide-row figcaption { margin-top: 26px; font-size: 1.02rem; padding: 16px 20px; }
@media (max-width: 760px) {
  .slide { max-width: 250px; }
  .slide-row {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 78%;
    overflow-x: auto; scroll-snap-type: x mandatory; padding: 12px 6px 24px; margin: 0 -14px;
  }
  .slide-row figure { scroll-snap-align: center; }
  .slide-row .slide { max-width: 230px; }
  .slide.slide-wide { max-width: 100%; border-radius: 18px; }
}
