/* The extension's own tokens, so the site and the product look like one thing.
   Checked by npm run palette in src/ui/shared.css; kept in step by hand here,
   because a static site has no build step and does not need one. */
:root {
  color-scheme: light dark;
  --surface: #fbfaf6;
  --raised: #ffffff;
  --line: #e5e1d6;
  --ink: #1a1916;
  --ink-2: #55534a;
  --ink-3: #7c7a70;
  --accent: #8a6a12;
  --accent-soft: #faf1d8;
  --gold: #e0ac3a;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --jp: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #1a1917; --raised: #232220; --line: #34322c;
    --ink: #f0eee6; --ink-2: #b6b3a7; --ink-3: #8a877c;
    --accent: #d8ac41; --accent-soft: #38300f; --gold: #e0ac3a;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--surface); color: var(--ink);
  font: 16px/1.65 var(--font); -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 0 24px; }
a { color: var(--accent); text-underline-offset: 3px; }

header { padding: 72px 0 8px; }
.mark {
  display: inline-grid; place-items: center; width: 46px; height: 46px;
  border-radius: 11px; background: var(--ink); color: var(--gold);
  font: 600 26px/1 var(--jp); margin-bottom: 26px;
}
h1 { font-size: clamp(30px, 6vw, 44px); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 16px; }
.lede { font-size: 18px; line-height: 1.6; color: var(--ink-2); margin: 0 0 30px; max-width: 34em; }

.demo {
  background: var(--raised); border: 1px solid var(--line); border-radius: 12px;
  padding: 24px 26px; margin: 0 0 34px; font-size: 17px; line-height: 2.4;
}
.w {
  font-family: var(--jp); border-bottom: 2px dotted rgba(176, 122, 40, 0.85);
  padding: 0 1px; cursor: help;
}
.w[data-read] { border-bottom: 2px solid var(--gold); }
.w rt { font-size: 0.55em; opacity: 0.75; }
.demo small { display: block; font-size: 13px; line-height: 1.6; color: var(--ink-3); margin-top: 14px; }

.cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; }
.button {
  display: inline-block; background: var(--accent); color: #fff; text-decoration: none;
  padding: 11px 20px; border-radius: 9px; font-weight: 600; font-size: 15px;
}
.button.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.fine { font-size: 13px; color: var(--ink-3); margin: 0 0 60px; }

h2 { font-size: 21px; letter-spacing: -0.01em; margin: 52px 0 12px; }
h3 { font-size: 16px; margin: 28px 0 6px; }
p { margin: 0 0 14px; max-width: 36em; }
ul { margin: 0 0 14px; padding-left: 20px; max-width: 36em; }
li { margin-bottom: 7px; }
.muted { color: var(--ink-2); }

footer {
  margin-top: 76px; padding: 26px 0 50px; border-top: 1px solid var(--line);
  font-size: 13.5px; color: var(--ink-3);
}
footer a { color: var(--ink-2); }

/* ------------------------------------------------------------ the live demo

   The same visual language as the extension, because it is the same mechanic.
   A word not yet read is dotted amber, a word read is solid gold, a word looked
   up is dashed terracotta. Three channels apart, so the state of a paragraph is
   legible at a glance rather than on inspection. */

.w {
  --mark: rgba(176, 122, 40, 0.85);
  --mark-style: dotted;
  --glow: rgba(224, 172, 58, 0.95);
  position: relative;
  font-family: var(--jp);
  border-bottom: 2px var(--mark-style) var(--mark);
  border-radius: 2px;
  padding: 0 1px;
  cursor: help;
  transition: background-color 120ms ease, border-color 200ms ease;
}
.w:hover, .w:focus-visible { background: rgba(176, 122, 40, 0.12); outline: none; }
.w:focus-visible { box-shadow: 0 0 0 2px var(--mark); }
.w rt { font-size: 0.5em; opacity: 0.72; font-weight: 400; }

.w[data-read="true"]   { --mark: var(--glow); --mark-style: solid; }
.w[data-helped="true"] { --mark: rgba(182, 92, 76, 0.95); --mark-style: dashed; }

/* Holding one fills a glow around it. Half a second of intent, visible while it
   is being spent, and called off by moving away. */
.w.holding { animation: hold 550ms linear forwards; }
@keyframes hold {
  from { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
  to   { box-shadow: 0 0 10px 3px var(--glow); }
}

/* And the moment it completes: the word turns over and comes back gold. */
.w.done {
  display: inline-block;
  animation: flip 900ms cubic-bezier(0.2, 0.7, 0.3, 1);
  transform-origin: 50% 55%;
}
@keyframes flip {
  0%   { transform: rotateX(0deg);   color: inherit; box-shadow: 0 0 10px 3px var(--glow); }
  40%  { transform: rotateX(88deg);  color: inherit; box-shadow: 0 0 16px 5px var(--glow); }
  41%  { transform: rotateX(-88deg); color: var(--glow); }
  70%  { transform: rotateX(0deg);   color: var(--glow); box-shadow: 0 0 8px 2px var(--glow); }
  100% { transform: rotateX(0deg);   color: inherit; box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .w.holding { animation: none; box-shadow: 0 0 0 2px var(--glow); }
  .w.done { display: inline; animation: fade 700ms ease-out; transform: none; }
  @keyframes fade { 0%, 60% { color: var(--glow); } 100% { color: inherit; } }
}

/* No hover on a touchscreen, so the mark is drawn heavier and a tap does the
   only thing a tap can do. */
@media (pointer: coarse) {
  .w { border-bottom-width: 2px; }
}

.card-pop {
  position: absolute; z-index: 50; min-width: 150px; max-width: 260px;
  background: var(--raised); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.14);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity 110ms ease, transform 110ms ease, visibility 110ms;
}
.card-pop[data-open="true"] { opacity: 1; visibility: visible; transform: none; }
.cp-ja { font-family: var(--jp); font-size: 21px; line-height: 1.2; }
.cp-reading { font-family: var(--jp); font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.cp-reading span { color: var(--ink-3); margin-left: 7px; font-family: var(--font); }
.cp-en { font-size: 14px; margin-top: 7px; }

/* The running count of what you have read on this page. Starts at nothing and
   says nothing, because a zero is not an achievement. */
.tally {
  display: inline-flex; align-items: baseline; gap: 7px;
  background: var(--accent-soft); border-radius: 9px; padding: 7px 13px;
  font-size: 14px; color: var(--ink-2);
  opacity: 0.55; transition: opacity 200ms ease;
}
.tally[data-live="true"] { opacity: 1; }
.tally b { font-size: 19px; color: var(--ink); font-weight: 600; }

[data-all-read="true"] .after { display: block; }
.after { display: none; font-size: 14px; color: var(--ink-2); margin-top: 12px; }
