/* Crayon Pets — the landing page. A picture book on paper: one large crayon picture and one
   short line a page, in the app's colours (lib/app/theme/app_theme.dart). */

:root {
  --paper: #EFE8DA;
  --paper-light: #F7F2E7;
  --ink: #2A2A30;
  --ink-soft: #4E4A47;
  --muted: #6B6A72;
  --teal: #2F5A5E;
  --ochre: #D6A85C;
  --ochre-deep: #94661F;
  --bg: var(--paper);
  --fg: var(--ink);
  --fg-soft: var(--ink-soft);
  --faint: rgba(42, 42, 48, .16);
  --sans: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --latin: "CP Josefin", "Josefin Sans", system-ui, sans-serif;
  --tracking: .06em;
}
:lang(ja), :lang(zh-Hans), :lang(zh-Hant), :lang(ko) { --tracking: .12em; }
/* Thai and Devanagari letters join up; spacing them out would pull them apart. */
:lang(th), :lang(hi) { --tracking: 0; }

/* The page's light follows the picture in view: night falls over the rainy evening, and
   the morning comes warm. */
body[data-tone="snow"] { --bg: #EDEEEA; }
body[data-tone="night"] { --bg: #2E3546; --fg: #EFE8DA; --fg-soft: #CFC9D6; --muted: #A8A6B6; --faint: rgba(239, 232, 218, .2); }
body[data-tone="dawn"] { --bg: #F3E4D7; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-snap-type: y proximity; }
body {
  margin: 0;
  color: var(--fg);
  background-color: var(--bg);
  /* The tooth of the paper. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .29 0 0 0 0 .2 0 0 0 .16 -.02'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  font: 16px/1.7 var(--sans);
  transition: background-color 1.4s ease, color 1.4s ease;
}
a { color: inherit; }
img { max-width: 100%; }

/* The bar along the top: the name, and the languages. */
.bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
}
.mark { font: 600 12px/1 var(--latin); letter-spacing: .34em; color: var(--teal); text-decoration: none; padding: 10px 0; }
.langs { position: relative; }
.langs summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px; font-size: 13px; color: var(--muted);
}
.langs summary::-webkit-details-marker { display: none; }
.langs summary:hover, .langs[open] summary { background: rgba(47, 90, 94, .08); color: var(--teal); }
.langs svg { fill: none; stroke: currentColor; stroke-width: 1.5; }
.langs ul {
  position: absolute; right: 0; top: calc(100% + 6px); margin: 0; padding: 8px; list-style: none;
  display: grid; grid-template-columns: repeat(2, minmax(9.5em, 1fr)); gap: 2px;
  background: var(--paper-light); border-radius: 14px; box-shadow: 0 12px 34px rgba(60, 48, 30, .16);
  max-height: min(70vh, 560px); overflow: auto;
}
.langs li a { display: block; padding: 7px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 14px; }
.langs li a:hover { background: rgba(47, 90, 94, .08); }
.langs li a[aria-current] { color: var(--teal); background: rgba(47, 90, 94, .1); }

/* A word to visitors whose browser speaks another language (the English page only), at the
   foot of the window until it is followed or put away. */
.suggest {
  position: fixed; z-index: 6; bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 16px; border-radius: 999px;
  background: var(--paper-light); box-shadow: 0 8px 26px rgba(60, 48, 30, .14); font-size: 14px; white-space: nowrap;
}
.suggest[hidden] { display: none; }
.suggest a { color: var(--teal); text-decoration: none; }
.suggest button { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; }

/* A page of the book. */
.page {
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 76px 12px 64px;
  scroll-snap-align: center;
}
figure { margin: 0; display: flex; flex-direction: column; align-items: center; }
.art img { display: block; height: auto; }
/* A wide picture on a window wider than it is tall, as large as leaves room for its line (on a
   short window, such as a phone on its side, a little larger than that); a tall one otherwise. */
.scene .art img { width: min(92vw, 1080px, max(calc((100vh - 230px) * 1.5), 56vw)); }
@media (max-aspect-ratio: 1/1) {
  .scene .art img { width: min(calc(100vw - 24px), 620px, max(calc((100vh - 230px) * .8), 60vw)); }
}
figcaption { margin-top: clamp(14px, 3.4vh, 34px); text-align: center; padding: 0 12px; }
.no { display: block; font: 600 13px/1 var(--latin); letter-spacing: .3em; color: var(--ochre-deep); text-indent: .3em; }
.no::before, .rule { content: ""; display: block; width: 22px; height: 2px; background: var(--ochre); margin: 0 auto 12px; border-radius: 1px; }
body[data-tone="night"] .no { color: var(--ochre); }
.line {
  margin: 12px 0 0; font-family: var(--serif); font-weight: var(--serif-weight);
  font-size: clamp(17px, 1rem + .7vw, 26px); line-height: 1.85; letter-spacing: var(--tracking);
  color: var(--fg); text-wrap: balance; max-width: 30em;
}
/* Lines break between whole phrases: Japanese and Chinese, which have no spaces, are marked
   into phrases (.ph); Korean breaks at its spaces. */
.ph { display: inline-block; }
:lang(ko) .line, :lang(ko) .tagline, :lang(ko) .lead { word-break: keep-all; }

/* The cover: the name, a line, and the room of the title. */
.cover { flex-direction: row; gap: clamp(36px, 7vw, 120px); }
.intro { max-width: 24em; }
.intro .rule { margin: 0 0 22px; }
.cover h1 { margin: 0; font-weight: normal; }
.cover .name {
  display: block; font-family: var(--serif); font-weight: var(--serif-weight);
  font-size: clamp(30px, 1.2rem + 2.4vw, 54px); line-height: 1.3; letter-spacing: .06em; color: var(--fg);
  white-space: nowrap;
}
.cover .latin { display: block; margin-top: 14px; font: 600 12px/1 var(--latin); letter-spacing: .42em; color: var(--teal); }
.tagline {
  margin: 22px 0 30px; font-family: var(--serif); font-weight: var(--serif-weight);
  font-size: clamp(15px, .9rem + .3vw, 18px); line-height: 1.95; letter-spacing: var(--tracking); color: var(--fg-soft);
  text-wrap: balance;
}
.cover-art img { height: min(84vh, 880px); width: auto; }

/* The ways to get the app. */
.stores { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.badge img { display: block; height: 44px; width: auto; }
.badge.play img { height: 64px; margin: -10px -9px; }
.later { margin: 14px 0 0; font-size: 13px; letter-spacing: .04em; color: var(--muted); }
.soon, .store-text {
  display: inline-flex; align-items: center; gap: .55em; height: 44px; padding: 0 16px; border-radius: 9px;
  border: 1px solid var(--faint); color: var(--muted); font-size: 13px; text-decoration: none;
}
.soon b { font-weight: 600; color: var(--fg-soft); }
.store-text { color: var(--fg); }

/* The last page. */
.end .vignette { width: min(76vw, 480px); height: auto; }
.end .line { margin-top: 18px; text-align: center; }
.end .stores { justify-content: center; margin-top: 30px; }
.facts { margin: 30px 0 0; font-size: 12.5px; letter-spacing: .05em; color: var(--muted); text-align: center; }

/* The support page and the page that is not there. */
.sheet { text-align: center; }
.sheet .vignette.small { width: 200px; height: auto; margin-bottom: 20px; }
.sheet .rule { margin-bottom: 18px; }
.sheet h1.name { margin: 0; font-family: var(--serif); font-weight: var(--serif-weight); font-size: clamp(26px, 1.2rem + 1.6vw, 38px); letter-spacing: .08em; }
.lead { max-width: 30em; margin: 18px auto 30px; color: var(--fg-soft); line-height: 1.95; }
.label { margin: 0; font: 600 12px/1 var(--sans); letter-spacing: .1em; color: var(--ochre-deep); }
.mail { margin: 10px 0 0; font-size: clamp(18px, 1rem + .6vw, 22px); }
.mail a { color: var(--teal); text-underline-offset: 4px; text-decoration-thickness: 1px; }
.note { max-width: 32em; margin: 18px auto 0; font-size: 14px; color: var(--muted); }
.links { margin: 34px 0 0; font-size: 14px; color: var(--muted); }
.links a { color: var(--fg-soft); white-space: nowrap; }
.sheet .line { margin-top: 8px; }

/* The pages around the book (Android, thanks, checkout, the legal pages): a first sheet that
   leaves the next one in view, and sheets as tall as what they hold. */
.sheet.top { min-height: 0; padding-top: max(96px, 13vh); padding-bottom: 28px; }
.page.flow { min-height: 0; padding: 40px 16px 48px; scroll-snap-align: none; }
.sheet .vignette.small + .rule { margin-top: 2px; }
.sheet .lead a { color: var(--teal); text-underline-offset: 4px; text-decoration-thickness: 1px; }
.get { margin: 6px 0 0; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .6em; min-height: 52px; padding: 0 28px;
  border: 0; border-radius: 999px; background: var(--teal); color: var(--paper-light); font: 600 16px/1.2 var(--sans);
  letter-spacing: .03em; text-decoration: none; cursor: pointer;
  box-shadow: 0 2px 0 rgba(42, 42, 48, .18), inset 0 0 0 2px rgba(255, 255, 255, .08);
}
.button svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.button:hover { background: #29504f; }
.button.off { background: none; color: var(--muted); box-shadow: inset 0 0 0 1px var(--faint); cursor: default; font-weight: 500; }
.button.ghost { background: none; color: var(--teal); box-shadow: inset 0 0 0 1.5px var(--teal); min-height: 44px; padding: 0 18px; font-size: 14px; }
.sheet .facts { margin-top: 14px; }
.facts a { color: var(--fg-soft); }
.hash { max-width: 34em; margin: 10px auto 0; font-size: 12px; color: var(--muted); }
.hash code { font: 11.5px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; word-break: break-all; color: var(--fg-soft); }
.title {
  margin: 0 0 6px; text-align: center; font-family: var(--serif); font-weight: var(--serif-weight);
  font-size: clamp(21px, 1rem + 1vw, 28px); letter-spacing: var(--tracking);
}
.title::before { content: ""; display: block; width: 22px; height: 2px; background: var(--ochre); margin: 0 auto 14px; border-radius: 1px; }
.guide .note, .know + .iphone { text-align: center; }
.guide > .note { max-width: 40em; margin: 14px auto 0; }
.guide > .facts { margin-top: 26px; }
.iphone { margin: 30px 0 12px; font-size: 14px; color: var(--fg-soft); }
.sheet .stores { justify-content: center; }

/* The steps, each with its screen drawn in crayon. */
.steps {
  list-style: none; margin: 26px auto 8px; padding: 0; width: 100%; max-width: 1180px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 34px 22px;
}
.step { display: flex; flex-direction: column; align-items: center; text-align: center; }
.step .no { margin-bottom: 12px; }
.step > p { margin: 16px 0 0; max-width: 17em; font-size: 14.5px; line-height: 1.8; color: var(--fg-soft); }
.step b, .note b { color: var(--fg); font-weight: 650; }
.steps.text { max-width: 760px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.steps.text .step > p { margin-top: 0; }

.phone {
  position: relative; width: 172px; height: 300px; padding: 22px 11px 14px; border-radius: 26px;
  background: var(--paper-light); transform: rotate(-1.2deg);
  font: 11px/1.45 var(--sans); color: #34333a; text-align: left; letter-spacing: 0;
}
.step:nth-child(even) .phone { transform: rotate(1deg); }
.phone::before {
  content: ""; position: absolute; inset: 0; border: 2.5px solid var(--ink-soft); border-radius: 26px;
  filter: url(#crayon); pointer-events: none;
}
.phone::after { content: ""; position: absolute; top: 9px; left: 50%; width: 34px; height: 4px; margin-left: -17px; border-radius: 2px; background: rgba(78, 74, 71, .32); }
.phone p { margin: 0; }
.scr { position: relative; height: 100%; border-radius: 12px; overflow: hidden; background: #FBF9F4; padding: 10px; display: flex; flex-direction: column; }
.phone.dim .scr { background: rgba(42, 42, 48, .30); justify-content: center; padding: 6px; }
.m-head { color: #5b5a62; height: 22px; }
.m-head svg, .m-dialog svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.m-title { margin: 6px 0 14px; font-size: 14px; line-height: 1.3; font-weight: 600; color: #2a2a30; }
.m-file { display: flex; align-items: center; gap: 7px; padding: 7px 6px; border-radius: 8px; font-size: 10.5px; }
.m-file.faint span:last-child { flex: 1; height: 6px; border-radius: 3px; background: rgba(42, 42, 48, .1); }
.m-apk { flex: none; width: 24px; height: 28px; border-radius: 4px; background: #93b37a; color: #fff; font: 700 7.5px/28px var(--sans); text-align: center; }
.m-file.faint .m-apk { background: rgba(42, 42, 48, .1); }
.m-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 6px; border-radius: 8px; font-size: 11.5px; }
.tog { flex: none; position: relative; width: 30px; height: 17px; border-radius: 9px; background: var(--teal); }
.tog::after { content: ""; position: absolute; top: 2px; right: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; }
.m-dialog { display: flex; flex-direction: column; align-items: center; padding: 12px 8px 10px; border-radius: 16px; background: #FBF9F4; text-align: center; color: #5b5a62; }
.m-icon { width: 34px; height: 34px; border-radius: 9px; }
.m-app { margin: 6px 0 0; font-weight: 600; font-size: 11.5px; color: #2a2a30; }
.m-q { margin: 6px 0 0; font-size: 11px; color: #34333a; }
.m-more { margin: 12px 0 0; padding: 0 10px; font-size: 10.5px; color: var(--teal); }
.m-more + .m-btns { padding: 0 12px; }
.m-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; margin: 10px 0 0; font-weight: 600; font-size: 10.5px; color: var(--teal); }
.m-more + .m-btns { margin-top: 14px; }
/* What to tap: ringed in crayon. */
.hi { position: relative; }
.hi::after {
  content: ""; position: absolute; inset: -5px -7px; border: 2.5px solid var(--ochre); border-radius: 50% / 46%;
  transform: rotate(-3deg); filter: url(#crayon); pointer-events: none;
}
.m-file.hi::after, .m-switch.hi::after { inset: -3px -4px; border-radius: 14px; }
.m-more .hi::after, .m-btns .hi::after { inset: -4px -6px; }
.hi[data-n]::before {
  content: attr(data-n); position: absolute; top: 50%; left: -21px; margin-top: -7.5px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--ochre); color: #fff; font: 700 9px/15px var(--latin); text-align: center;
}

/* On a phone, each drawn screen stands beside its words. */
@media (max-width: 560px) {
  .steps:not(.text) { gap: 30px; }
  .steps:not(.text) .step { display: grid; grid-template-columns: 172px 1fr; grid-template-rows: auto 1fr; column-gap: 16px; text-align: left; }
  .steps:not(.text) .phone { grid-row: 1 / span 2; grid-column: 1; }
  .steps:not(.text) .step .no { grid-column: 2; margin: 22px 0 0; text-indent: 0; }
  .steps:not(.text) .step .no::before { margin: 0 0 10px; }
  .steps:not(.text) .step > p { grid-column: 2; margin-top: 8px; font-size: 14px; }
}

.know { max-width: 34em; margin: 18px auto 0; padding: 0; list-style: none; text-align: left; }
.know li { position: relative; padding-left: 22px; margin: 10px 0; color: var(--fg-soft); font-size: 15px; line-height: 1.85; }
.know li::before { content: ""; position: absolute; left: 4px; top: .78em; width: 7px; height: 7px; border-radius: 50%; background: var(--ochre); }

/* The checkout: what it is doing, and in mainland China the steps for Alipay and WeChat Pay. */
.co h1.name { font-size: clamp(22px, 1.1rem + 1.2vw, 32px); }
.sheet h1.name, .title { text-wrap: balance; }
:lang(ko) .sheet h1.name, :lang(ko) .title, :lang(ko) .step > p, :lang(ko) .know li { word-break: keep-all; }
.co .mor { margin-top: 34px; }
.cn { max-width: 34em; margin: 8px auto 0; text-align: left; }
.cn .title { margin-bottom: 4px; }
.cn h3 { margin: 26px 0 0; font-size: 15px; color: var(--ochre-deep); letter-spacing: .1em; }
.cn .note { margin: 8px 0 0; }
.plain { margin: 10px 0 0; padding-left: 1.4em; color: var(--fg-soft); font-size: 15px; line-height: 1.85; }
.plain li { margin: 4px 0; }
.copy-link { display: flex; gap: 8px; margin: 12px 0 0; }
.copy-link input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid var(--faint); border-radius: 10px; background: var(--paper-light); color: var(--fg-soft); font: 12px var(--sans); }
.cn .get { text-align: center; margin-top: 26px; }
[hidden] { display: none !important; }

/* The legal pages: a long read, set plainly. */
.page.doc { display: block; max-width: 46em; margin: 0 auto; padding-top: max(96px, 12vh); text-align: left; }
.doc > .rule { margin: 0 auto 18px; }
.doc h1.name, .doc .updated { text-align: center; }
.doc h1.name { margin: 0; font-family: var(--serif); font-weight: var(--serif-weight); font-size: clamp(24px, 1.1rem + 1.4vw, 34px); letter-spacing: .06em; }
.doc .updated { margin: 10px 0 26px; font-size: 13px; color: var(--muted); }
.doc h2 { margin: 2.2em 0 .5em; font: 650 17px/1.5 var(--sans); color: var(--fg); }
.doc h3 { margin: 1.6em 0 .3em; font: 650 15px/1.5 var(--sans); color: var(--fg-soft); }
.doc p, .doc li, .doc dd { font-size: 15px; line-height: 1.95; color: var(--fg-soft); }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc li { margin: 4px 0; }
.doc a { color: var(--teal); text-underline-offset: 3px; text-decoration-thickness: 1px; word-break: break-word; }
.doc dl { margin: 18px 0 0; border-top: 1px solid var(--faint); }
.doc dl > div { display: grid; grid-template-columns: 13em 1fr; gap: 6px 22px; padding: 14px 0; border-bottom: 1px solid var(--faint); }
.doc dt { font-weight: 650; font-size: 14px; color: var(--fg); }
.doc dd { margin: 0; }
.doc dd p { margin: 0 0 .5em; }
.draft { margin: 0 0 26px; padding: 12px 16px; border-radius: 12px; background: rgba(214, 168, 92, .2); color: var(--ochre-deep); font-size: 14px; font-weight: 600; }
@media (max-width: 640px) {
  .doc dl > div { grid-template-columns: 1fr; }
}

/* The foot of each page. */
/* A resting place at the very bottom too: without it the pages' snapping pulls the footer back
   out of view to the middle of the last page. */
.foot { padding: 40px 16px max(48px, env(safe-area-inset-bottom)); text-align: center; font-size: 13px; color: var(--muted); scroll-snap-align: end; }
.foot nav a { color: var(--fg-soft); white-space: nowrap; }
.foot nav { line-height: 2.1; }
svg.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.langlist { max-width: 760px; margin: 20px auto 0; line-height: 2.2; }
.langlist a { color: var(--muted); text-decoration: none; margin: 0 .4em; white-space: nowrap; }
.langlist a:hover, .langlist a[aria-current] { color: var(--teal); }
.copy { margin: 18px 0 0; font-size: 12px; }

a:focus-visible, summary:focus-visible, button:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 6px; }

/* Phones and tablets: the cover stands above its picture. */
@media (max-width: 860px) {
  .cover { flex-direction: column; gap: 26px; text-align: center; padding-top: 88px; }
  .intro { max-width: 30em; }
  .intro .rule { margin: 0 auto 18px; }
  .cover .stores { justify-content: center; }
  .tagline { margin: 16px 0 22px; }
  .cover-art img { height: auto; width: min(86vw, calc(58vh * .554)); }
}

/* Each page turns into view, gently; never under reduced motion. */
.js .page:not(.cover) figure .art, .js .page:not(.cover) figcaption,
.js .end > * { opacity: 0; transform: translateY(14px); transition: opacity 1.3s cubic-bezier(.2, .7, .2, 1), transform 1.6s cubic-bezier(.2, .7, .2, 1); }
.js .page figcaption { transition-delay: .35s; }
.js .page.in figure .art, .js .page.in figcaption, .js .end.in > * { opacity: 1; transform: none; }
@media (prefers-reduced-motion: no-preference) {
  /* The cover drifts in and out once every 24 seconds, as the title of the app does. */
  .cover-art img { animation: drift 12s ease-in-out infinite alternate; transform-origin: 50% 70%; }
  @keyframes drift { to { transform: scale(1.025); } }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-snap-type: none; }
  body { transition: none; }
  .js .page:not(.cover) figure .art, .js .page:not(.cover) figcaption, .js .end > * { opacity: 1; transform: none; transition: none; }
}
