/* Khata website: the scrapbook look of the app (cream paper, ink outlines, hard yellow shadows).
   Mobile-first: the base rules are for small screens, and "min-width" queries add room for bigger ones.
   The first screen (the hero) is sized from the screen HEIGHT as well as the width, so the headline, the
   text and the buttons are always in view without scrolling. */

@font-face { font-family: "Caveat Brush"; src: url("/fonts/caveat-brush.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Patrick Hand"; src: url("/fonts/patrick-hand.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Kalam"; font-weight: 700; src: url("/fonts/kalam-bold.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Atma"; font-weight: 700; src: url("/fonts/atma-bold.woff2") format("woff2"); font-display: swap; }

:root {
  color-scheme: light dark;
  --ink: #1a1a1a;
  --on-sun: #1a1a1a;
  --paper: #fffbea;
  --kraft: #efe6c4;
  --card: #ffffff;
  --sun: #ffd93d;
  --chili: #b02a33;
  --coral: #ff6b6b;
  --tape: #fff1a8;
  --muted: #5c5640;
  --dot: #e2d8a8;
  --shadow: #ffd93d;
  --page: #ffffff;
  --page-ink: #1a1a1a;
  --note-a: #fff3b8;
  --note-b: #ffdcd8;
  --note-c: #d9f2dc;
  --note-d: #d9ecff;
  --note-e: #eadfff;
  --note-f: #ffe5cc;
  --hand: "Patrick Hand", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  --brush: "Caveat Brush", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  --kalam: "Kalam", "Patrick Hand", "Segoe Print", cursive;
  --bn: "Atma", "Patrick Hand", sans-serif;
  --gutter: clamp(1rem, 4.5vw, 2rem);
  --maxw: 71rem;
  --header-h: 3.75rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f5eeda;
    --paper: #17150f;
    --kraft: #1f1d15;
    --card: #24211a;
    --chili: #ffa59c;
    --coral: #ff8a80;
    --tape: #6b5a1c;
    --muted: #d2c9a8;
    --dot: #353222;
    --shadow: #000000;
    --note-a: #3a3317;
    --note-b: #3b2523;
    --note-c: #1f3324;
    --note-d: #1f3045;
    --note-e: #2f2745;
    --note-f: #3d2e1e;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 1rem); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 0;
  overflow-x: clip; /* a safety net: nothing may ever scroll sideways */
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 1.3px, transparent 1.4px);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: var(--hand);
  font-size: 1.15rem;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--chili); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { text-decoration-style: wavy; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.85em; background: var(--note-a); padding: 0.1em 0.4em; border-radius: 6px; border: 1.5px solid var(--ink); overflow-wrap: anywhere; }
em { font-style: normal; }
em[lang="bn"] { font-family: var(--bn); font-weight: 700; color: var(--chili); }
:focus-visible { outline: 3px dashed var(--chili); outline-offset: 3px; border-radius: 6px; }

.wrap {
  width: 100%;
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.narrow { max-width: 49rem; }
.center { text-align: center; justify-content: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 100; background: var(--sun); color: var(--on-sun); padding: 0.5rem 1rem; border: 2.5px solid var(--ink); border-radius: 10px; font-family: var(--kalam); }
.skip:focus { top: 1rem; }

h1, h2, h3 { margin: 0 0 0.6rem; font-weight: 400; line-height: 1.1; }
h1, h2 { font-family: var(--brush); letter-spacing: 0.01em; }
h2 { font-size: clamp(1.9rem, 7vw, 3.2rem); }
h3 { font-family: var(--kalam); font-weight: 700; font-size: 1.3rem; line-height: 1.25; }
.bn { font-family: var(--bn); font-weight: 700; color: var(--chili); }
.fine { font-size: 1rem; color: var(--muted); margin: 0.5rem 0 0; }
.kicker { margin: 0 0 0.9rem; }
.section-lead { font-size: 1.2rem; max-width: 56ch; margin: 0 0 2rem; color: var(--muted); }

.scribble { background: linear-gradient(transparent 62%, var(--sun) 62% 90%, transparent 90%); padding: 0 0.1em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.tape-label {
  display: inline-block; max-width: 100%; padding: 0.2rem 0.8rem; background: var(--tape); border: 2px dashed var(--ink);
  font-family: var(--kalam); font-weight: 700; font-size: 0.9rem; transform: rotate(-2deg); color: var(--ink);
}

/* ---------- buttons (touch-friendly: at least 44 px tall) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 2.8rem; padding: 0.55rem 1.2rem; border: 2.5px solid var(--ink); border-radius: 14px;
  font-family: var(--kalam); font-weight: 700; font-size: 1.05rem; line-height: 1.2; text-decoration: none;
  box-shadow: 4px 4px 0 var(--ink); transition: transform 0.12s ease, box-shadow 0.12s ease;
  cursor: pointer; text-align: center;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn-primary { background: var(--sun); color: var(--on-sun); }
.btn-ghost { background: var(--card); color: var(--ink); }
.btn-small { min-height: 2.4rem; padding: 0.3rem 1rem; font-size: 1rem; box-shadow: 3px 3px 0 var(--ink); }
.cta-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.7rem; margin: 0 0 0.8rem; }
@media (hover: hover) {
  .btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); text-decoration: none; }
}
@media (min-width: 30rem) {
  .cta-row { display: flex; flex-wrap: wrap; gap: 1rem; }
}

/* ---------- header: a menu button on small screens, inline links from 48rem ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--paper); background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(6px); border-bottom: 2.5px solid var(--ink); padding-top: env(safe-area-inset-top); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: var(--header-h); padding-block: 0.35rem; }
.brand { display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; text-decoration: none; color: var(--ink); }
.brand img { flex: none; }
.brand-name { font-family: var(--brush); font-size: 1.9rem; line-height: 1; }
.brand .bn { font-size: 1.3rem; }
.nav-toggle { flex: none; display: inline-grid; place-items: center; width: 2.9rem; height: 2.9rem; border: 2.5px solid var(--ink); border-radius: 12px; background: var(--card); box-shadow: 3px 3px 0 var(--ink); cursor: pointer; padding: 0; }
.bars, .bars::before, .bars::after { display: block; width: 22px; height: 3px; background: var(--ink); border-radius: 2px; content: ""; position: relative; margin: auto; }
.bars::before { position: absolute; top: -7px; left: 0; }
.bars::after { position: absolute; top: 7px; left: 0; }
.nav {
  display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 0.2rem;
  padding: 0.8rem max(var(--gutter), env(safe-area-inset-right)) 1.2rem max(var(--gutter), env(safe-area-inset-left));
  background: var(--paper); border-bottom: 2.5px solid var(--ink); max-height: calc(100svh - var(--header-h)); overflow-y: auto;
}
.nav.open { display: flex; }
.nav a:not(.btn) { color: var(--ink); text-decoration: none; font-family: var(--kalam); font-weight: 700; font-size: 1.15rem; padding: 0.6rem 0.2rem; }
.nav a:not(.btn):hover { text-decoration: underline wavy var(--coral); }
.nav .btn { margin-top: 0.5rem; }
@media (min-width: 48rem) {
  .nav-toggle { display: none; }
  .nav { display: flex; position: static; flex-direction: row; align-items: center; gap: 1.4rem; padding: 0; background: none; border: 0; max-height: none; overflow: visible; }
  .nav a:not(.btn) { font-size: 1.05rem; padding: 0; }
  .nav .btn { margin-top: 0; }
  .brand-name { font-size: 2rem; }
}
@media (max-width: 26rem) { .brand .bn { display: none; } }

/* ---------- hero: always fits the first screen ----------
   Sizes use min(<width-based>, <height-based>): on a short screen (a laptop, a zoomed page, a small phone)
   the height limit wins and everything shrinks to stay in view. */
.hero {
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100svh - var(--header-h));
  display: grid; align-items: center;
  padding-block: clamp(0.6rem, 2.6svh, 3rem);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(1rem, 3.5svh, 2.5rem); align-items: center; }
.hero-copy { min-width: 0; }
.hero .kicker { margin-bottom: clamp(0.5rem, 1.7svh, 1rem); }
.hero h1 {
  font-size: clamp(1.8rem, 9.4vw, 3rem);
  font-size: clamp(1.8rem, min(9.4vw, 7.2svh), 3rem);
  line-height: 1.04; margin-bottom: clamp(0.5rem, 1.7svh, 1rem);
}
.lead { margin: 0 0 clamp(0.75rem, 2.4svh, 1.4rem); max-width: 44ch; font-size: clamp(1.02rem, 4.3vw, 1.3rem); line-height: 1.38; }
.hero .lead { font-size: clamp(1.02rem, min(4.3vw, 3.2svh), 1.4rem); }
.lead strong { background: linear-gradient(transparent 58%, var(--sun) 58% 92%, transparent 92%); padding: 0 0.15em; }
.hero .btn { min-height: clamp(2.5rem, 6.4svh, 3rem); padding-block: clamp(0.3rem, 1.2svh, 0.6rem); }
.hero .fine { font-size: clamp(0.88rem, 2.4svh, 1.02rem); margin-top: clamp(0.2rem, 0.8svh, 0.5rem); }
.hero-art { min-width: 0; max-width: 34rem; width: 100%; margin-inline: auto; }
.hero-art svg { display: block; width: 100%; max-height: min(42svh, 24rem); overflow: visible; }

/* the illustration */
.svg-shadow { fill: var(--sun); stroke: var(--ink); stroke-width: 4; }
.svg-window { fill: var(--card); stroke: var(--ink); stroke-width: 4; }
.svg-frame { fill: none; stroke: var(--ink); stroke-width: 4; }
.svg-bar { fill: var(--sun); stroke: var(--ink); stroke-width: 4; }
.svg-dot1 { fill: var(--coral); stroke: var(--ink); stroke-width: 2.5; }
.svg-dot2 { fill: #fff; stroke: var(--ink); stroke-width: 2.5; }
.svg-dot3 { fill: var(--ink); }
.svg-tabs { fill: var(--note-a); stroke: var(--ink); stroke-width: 3; }
.svg-tab-on { fill: var(--sun); stroke: var(--ink); stroke-width: 3; }
.svg-ribbon { fill: var(--card); stroke: var(--ink); stroke-width: 3; }
.svg-chip { fill: var(--paper); stroke: var(--muted); stroke-width: 2; }
.svg-chip-on { fill: var(--sun); stroke: var(--ink); stroke-width: 2.5; }
.svg-desk { fill: var(--kraft); stroke: var(--ink); stroke-width: 3; }
.svg-page { fill: var(--page); stroke: var(--ink); stroke-width: 3; }
.svg-brush { font-family: var(--brush); }
.svg-hand { font-family: var(--hand); }
.svg-title { font-size: 20px; fill: var(--on-sun); }
.svg-small { font-size: 17px; fill: var(--ink); }
.svg-h { font-size: 36px; fill: var(--page-ink); }
.svg-squiggle { fill: none; stroke: var(--coral); stroke-width: 4; stroke-linecap: round; }
.svg-line { fill: #d9cf9f; }
.svg-pent { fill: var(--sun); stroke: #1a1a1a; stroke-width: 3.5; stroke-linejoin: round; }
.svg-heart { fill: var(--coral); stroke: #1a1a1a; stroke-width: 3.5; stroke-linejoin: round; }
.svg-tape { fill: var(--tape); stroke: var(--ink); stroke-width: 2; stroke-dasharray: 7 5; }
.svg-sticker { fill: var(--coral); stroke: #1a1a1a; stroke-width: 4; }
.svg-bn { font-family: var(--bn); font-weight: 700; font-size: 52px; fill: #1a1a1a; }
.float { animation: float 7s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-0.6deg); } 50% { transform: translateY(-8px) rotate(0.6deg); } }

@media (min-width: 56rem) {
  .hero-grid { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 4rem); }
  .hero h1 { font-size: clamp(2.2rem, 5vw, 4.3rem); font-size: clamp(2.2rem, min(5vw, 7.6svh), 4.3rem); }
  .hero .lead { font-size: clamp(1.1rem, min(1.7vw, 3.3svh), 1.45rem); max-width: 40ch; }
  .hero-art { max-width: none; }
  .hero-art svg { max-height: min(66svh, 34rem); }
}

/* a phone held sideways is very short: keep only the essentials in view */
@media (max-height: 30rem) and (orientation: landscape) {
  :root { --header-h: 3rem; }
  .brand img { width: 30px; height: auto; }
  .bar { min-height: var(--header-h); padding-block: 0.15rem; }
  .hero { padding-block: 0.4rem; }
  .hero-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem; }
  .hero .kicker, .hero .fine { display: none; }
  .hero h1 { font-size: clamp(1.4rem, 8.5svh, 2.2rem); }
  .hero .lead { font-size: clamp(0.95rem, 4.2svh, 1.15rem); line-height: 1.3; }
  .hero .cta-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0; }
  .hero .btn { min-height: 2.4rem; }
  .hero-art svg { max-height: 62svh; }
}

/* ---------- sections ---------- */
.section { padding-block: clamp(2.5rem, 8vw, 6rem); }
.section-kraft { background-color: var(--kraft); background-image: radial-gradient(var(--dot) 1.3px, transparent 1.4px); background-size: 24px 24px; border-block: 2.5px solid var(--ink); }

.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 2rem 1.75rem; padding-top: 0.6rem; }
.note {
  position: relative; min-width: 0; padding: 1.5rem 1.3rem 1.3rem; background: var(--note-a); color: var(--ink);
  border: 2.5px solid var(--ink); border-radius: 6px 16px 8px 14px; box-shadow: 5px 5px 0 var(--shadow);
  transition: transform 0.18s ease;
}
.note::before {
  content: ""; position: absolute; top: -13px; left: 50%; width: 84px; height: 24px; margin-left: -42px;
  background: var(--tape); border: 2px dashed var(--ink); transform: rotate(-3deg);
}
.note p { margin: 0; color: var(--ink); }
.note-a { background: var(--note-a); }
.note-b { background: var(--note-b); }
.note-c { background: var(--note-c); }
.note-d { background: var(--note-d); }
.note-e { background: var(--note-e); }
.note-f { background: var(--note-f); }
@media (min-width: 40rem) {
  .note { box-shadow: 6px 6px 0 var(--shadow); }
  .note-a { transform: rotate(-1.2deg); }
  .note-b { transform: rotate(1deg); }
  .note-c { transform: rotate(-0.8deg); }
  .note-d { transform: rotate(1.2deg); }
  .note-e { transform: rotate(-1deg); }
  .note-f { transform: rotate(0.8deg); }
}
@media (hover: hover) and (min-width: 40rem) { .note:hover { transform: rotate(0deg) translateY(-4px); } }
.ico { width: 2.7rem; height: 2.7rem; margin-bottom: 0.5rem; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- downloads ---------- */
.downloads { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 2rem 1.5rem; margin-bottom: 1.5rem; padding-top: 0.6rem; }
.dl { position: relative; min-width: 0; display: flex; flex-direction: column; gap: 0.5rem; padding: 1.3rem; background: var(--card); border: 2.5px solid var(--ink); border-radius: 8px 16px 10px 14px; box-shadow: 5px 5px 0 var(--shadow); }
.dl h3 { margin: 0; font-size: 1.5rem; }
.dl .desc { margin: 0; color: var(--muted); }
.dl-links { display: grid; gap: 0.6rem; margin-top: 0.4rem; }
.dl-links .btn { white-space: normal; }
.dl .meta { margin: 0.2rem 0 0; font-size: 1rem; color: var(--muted); }
.dl.is-current { background: var(--note-a); }
.dl.is-current::before {
  content: "For your system"; position: absolute; top: -15px; left: 16px; padding: 0.05rem 0.7rem;
  background: var(--sun); color: var(--on-sun); border: 2.5px solid var(--ink); border-radius: 9px; font-family: var(--kalam); font-weight: 700; font-size: 0.9rem;
}

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 1rem; margin-top: 1.5rem; }
.faq details { background: var(--card); border: 2.5px solid var(--ink); border-radius: 10px 16px 10px 14px; box-shadow: 4px 4px 0 var(--shadow); padding: 0.1rem 1rem; }
.faq summary { cursor: pointer; list-style: none; padding: 0.8rem 2rem 0.8rem 0; position: relative; font-family: var(--kalam); font-weight: 700; font-size: 1.1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 0.2rem; top: 0.5rem; font-size: 1.8rem; line-height: 1; color: var(--chili); transition: transform 0.2s ease; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 1rem; color: var(--ink); }

/* ---------- call to action band ---------- */
.band { background: var(--sun); color: var(--on-sun); border-block: 3px solid var(--ink); padding-block: clamp(2.2rem, 6vw, 4rem); }
.band-inner { text-align: center; }
.band h2 { color: var(--on-sun); }
.band .cta-row { justify-content: center; }
.band .btn { border-color: #1a1a1a; box-shadow: 4px 4px 0 #1a1a1a; }
.band .btn-primary { background: #1a1a1a; color: var(--sun); }
.band .btn-ghost { background: #fffbea; color: #1a1a1a; }

/* ---------- footer ---------- */
.site-footer { padding-block: 2.2rem calc(1.6rem + env(safe-area-inset-bottom)); }
.foot { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.6rem; align-items: start; }
.foot-brand { display: flex; align-items: center; gap: 0.5rem; font-size: 1.3rem; margin: 0 0 0.5rem; }
.foot-links { display: grid; gap: 0.3rem; justify-items: start; }
.foot-links a { color: var(--ink); font-family: var(--kalam); font-weight: 700; font-size: 1rem; padding-block: 0.15rem; }
.privacy { margin-top: 1.6rem; }
@media (min-width: 48rem) { .foot { grid-template-columns: 1.4fr 1fr; gap: 2rem; } }

/* ---------- 404 ---------- */
.lost { min-height: 70svh; display: grid; place-items: center; text-align: center; padding: 2rem 1rem; }
.lost h1 { font-size: clamp(4rem, 16vw, 9rem); margin: 0; }

/* ---------- roomier on big screens: everything is in rem, so scaling the root scales the page ---------- */
@media (min-width: 48rem) { body { font-size: 1.25rem; } }
@media (min-width: 112.5rem) { html { font-size: 112.5%; } }
@media (min-width: 150rem) { html { font-size: 137.5%; } }
@media (min-width: 200rem) { html { font-size: 175%; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .float { animation: none; }
  .btn, .note { transition: none; }
}
@media print {
  .site-header, .band, .hero-art { display: none; }
  body { background: #fff; color: #000; }
}
