/* Norijoa — one stylesheet for every page. No external fonts.
   Every animation sits inside @media (prefers-reduced-motion: no-preference);
   newer features sit inside @supports, so older browsers get a plain, complete page. */

:root {
  color-scheme: light dark;

  --bg: #fbf6ee;
  --bg-glass: rgb(251 246 238 / 0.82);
  --surface: #fffcf7;
  --border: #e6d8c4;
  --text: #2a211c;
  --muted: #65574d;
  --accent: #ad4318;
  --tile: #e0673a;
  --heart: #cf6c43;
  --tile-tint: #f7e0cf;
  --shadow: rgb(84 52 28 / 0.14);

  /* One soft color per product (tint = background, ink = drawing); all ≥ 4.5:1. */
  --emoy-tint: #fbe6d6;
  --emoy-ink: #b0461c;
  --ventori-tint: #e3ebd9;
  --ventori-ink: #4f6b3d;
  --jamnori-tint: #efe2ef;
  --jamnori-ink: #7b4a86;

  /* Warm backdrop behind the hero. */
  --warm-1: #f6d2b499;
  --warm-2: #f3e2bf99;
  --warm-3: #efd3cb88;
  --grain: url("/grain.svg");
  --grain-opacity: 0.4;

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --font-display: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Arial Rounded MT",
    var(--font-body);
  --font-ko: "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", var(--font-body);

  --radius: 1.25rem;
  --gutter: 1.25rem;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1612;
    --bg-glass: rgb(27 22 18 / 0.82);
    --surface: #261f1a;
    --border: #3d3129;
    --text: #f4ebdf;
    --muted: #c4b5a7;
    --accent: #f4a273;
    --tile-tint: #3a2820;
    --shadow: rgb(0 0 0 / 0.4);

    --emoy-tint: #3a2820;
    --emoy-ink: #f4a273;
    --ventori-tint: #263020;
    --ventori-ink: #b5cf9e;
    --jamnori-tint: #30243a;
    --jamnori-ink: #dcb3e4;

    --warm-1: #5a311d80;
    --warm-2: #4a3a1e70;
    --warm-3: #4a263070;
    --grain: url("/grain-dark.svg");
    --grain-opacity: 0.28;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

/* Calm backdrop for every page: a soft warm glow at the top and a faint paper grain. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 24rem at 85% -4rem, var(--warm-1), transparent 70%),
    radial-gradient(40rem 20rem at 0% 0%, var(--warm-2), transparent 70%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--grain);
  background-size: 240px 240px;
  opacity: var(--grain-opacity);
}

:lang(ko) {
  font-family: var(--font-ko);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- Layout ---------- */

.wrap {
  width: 100%;
  max-width: 42rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* The header is the same width on every page, so the logo stays put between pages. */
.site-header .wrap,
.home .wrap {
  max-width: 62rem;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 0.875rem;
  border-radius: 0.5rem;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 0.75rem;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header {
    background: var(--bg-glass);
    -webkit-backdrop-filter: saturate(1.3) blur(14px);
    backdrop-filter: saturate(1.3) blur(14px);
  }
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-block: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.mark {
  display: block;
  flex: none;
  width: 2rem;
  height: 2rem;
  view-transition-name: brand-mark;
}

.mark-heart {
  fill: var(--heart);
}

.site-nav ul {
  display: flex;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Keep the sticky header to one row on phones. */
@media (max-width: 26rem) {
  .site-header .wrap {
    gap: 0.5rem 1rem;
    padding-block: 0.75rem;
  }

  .brand {
    gap: 0.5rem;
    font-size: 1.125rem;
  }

  .mark {
    width: 1.75rem;
    height: 1.75rem;
  }

  .site-nav ul {
    gap: 1rem;
  }
}

/* ---------- Home: hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
}

.hero-grid {
  display: grid;
  gap: 2rem;
  align-items: start; /* top-aligned, so the name tiles appearing never nudge the toy box */
  padding-block: 3rem 2.5rem;
}

@media (min-width: 52rem) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
    gap: 3rem;
    padding-block: 4.5rem 3.5rem;
  }
}

.lockup {
  display: flex;
  align-items: center;
  gap: 0.25em;
  font-size: clamp(3rem, 14vw, 4.75rem);
}

.hero-mark {
  display: block;
  flex: none;
  width: 1.05em;
  height: 1.05em;
  overflow: visible;
}

.hero h1 {
  font-size: 1em;
  line-height: 1;
  letter-spacing: -0.025em;
}

.meaning {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 1.125rem;
}

.meaning [lang="ko"] {
  color: var(--text);
  font-weight: 600;
}

.meaning-hint {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Keep the hint's line reserved (invisible) until play.js shows it, so nothing shifts. */
.meaning-hint[hidden] {
  display: block;
  visibility: hidden;
}

.intro {
  margin-top: 1.5rem;
  max-width: 28ch;
  font-size: clamp(1.375rem, 5vw, 1.75rem);
  line-height: 1.35;
  font-weight: 500;
}

/* Name story tiles (built by play.js; without it, the sentence above stays as text). */
.tile {
  display: inline-grid;
  vertical-align: baseline;
  margin: -0.25rem 0;
  padding: 0;
  border: 0;
  border-radius: 0.625rem;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
  perspective: 16rem;
}

.tile:focus-visible {
  outline-offset: -2px;
  border-radius: 0.625rem;
}

/* Each side is a whole tile face: the Korean word on one, its meaning on the other. */
.tile > span {
  grid-area: 1 / 1;
  padding: 0.125rem 0.625rem;
  border: 1.5px solid var(--border);
  border-radius: 0.625rem;
  background: var(--surface);
  box-shadow: 0 2px 0 var(--border);
  text-align: center;
}

.tile > .tile-back {
  background: var(--tile-tint);
  color: var(--accent);
  visibility: hidden;
}

.tile[aria-pressed="true"] .tile-front {
  visibility: hidden;
}

.tile[aria-pressed="true"] .tile-back {
  visibility: visible;
}

.meaning-rest::after {
  content: "\2665\FE0E";
  content: "\2665\FE0E" / "";
  display: inline-block;
  margin-left: 0.3em;
  color: var(--heart);
  transform: scale(0);
}

/* The heart only exists once play.js has made the tiles. */
.meaning:not(:has(.tile)) .meaning-rest::after {
  content: none;
}

.meaning.is-joined .meaning-rest {
  color: var(--text);
}

.meaning.is-joined .meaning-rest::after {
  transform: scale(1);
}

/* Toy box: a static, composed pile. play.js turns it into a little physics tray. */
.toybox {
  position: relative;
  height: 15rem;
  overflow: hidden;
  border: 1.5px solid var(--border);
  border-radius: 1.75rem;
  background: var(--bg-glass);
  box-shadow: inset 0 2px 0 var(--surface), inset 0 -10px 24px -18px var(--shadow);
}

@media (min-width: 52rem) {
  .toybox {
    height: 21rem;
  }
}

.toys {
  position: absolute;
  inset: 0.75rem;
}

.toy {
  position: absolute;
  display: block;
  border-radius: 999px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.toybox.is-live .toy {
  top: 0;
  left: 0;
  bottom: auto;
  cursor: grab;
  will-change: transform;
}

.toybox.is-live .toy:active {
  cursor: grabbing;
}

.toy-n     { left: 4%;  bottom: 0;    width: 34px; height: 100px; background: var(--text); }
.toy-big   { left: 17%; bottom: 0;    width: 66px; height: 66px;  background: var(--tile); }
.toy-flat  { left: 39%; bottom: 0;    width: 100px; height: 34px; background: var(--ventori-ink); }
.toy-sage  { left: 69%; bottom: 0;    width: 46px; height: 46px;  background: var(--ventori-tint); border: 2px solid var(--ventori-ink); }
.toy-small { left: 86%; bottom: 0;    width: 28px; height: 74px;  background: var(--accent); }
.toy-heart { left: 20%; bottom: 66px; width: 48px; height: 44px;  border-radius: 0; fill: var(--heart); overflow: visible; }
.toy-mid   { left: 43%; bottom: 34px; width: 50px; height: 50px;  background: var(--emoy-tint); border: 2px solid var(--emoy-ink); }
.toy-plum  { left: 58%; bottom: 34px; width: 40px; height: 40px;  background: var(--jamnori-ink); }
.toy-tiny  { left: 70%; bottom: 46px; width: 30px; height: 30px;  background: var(--heart); }

.shake {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 1;
  min-height: 2.25rem;
  padding: 0.25rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

.shake[hidden] {
  display: none;
}

/* ---------- Home: sections ---------- */

.section {
  padding-block: 2.5rem;
  scroll-margin-top: 5rem;
}

.section h2 {
  font-size: 1.625rem;
  letter-spacing: -0.01em;
}

/* Bento: EMOY (live) gets the big tile. One column on phones. */
.products {
  display: grid;
  gap: 1rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
  grid-template-areas: "emoy" "ventori" "jamnori";
}

@media (min-width: 46rem) {
  .products {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    grid-template-areas:
      "emoy ventori"
      "emoy jamnori";
  }
}

.product-emoy    { grid-area: emoy; }
.product-ventori { grid-area: ventori; }
.product-jamnori { grid-area: jamnori; }

.product {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

/* Soft shadow on its own layer, so hover only changes opacity. */
.product::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  box-shadow: 0 14px 30px -12px var(--shadow);
  opacity: 0;
}

.product:hover::after,
.product:focus-within::after {
  opacity: 1;
}

.product-body {
  padding: 1.25rem 1.5rem 1.375rem;
}

.product h3 {
  font-size: 1.375rem;
  letter-spacing: -0.01em;
}

.product-emoy h3 {
  font-size: 1.75rem;
}

.product p {
  margin-top: 0.375rem;
}

.product .status {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
}

.status::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border: 2px solid var(--muted);
  border-radius: 50%;
  transform: translateY(-0.0625rem);
}

.status-live {
  color: var(--text);
}

.status-live::before {
  border-color: var(--tile);
  background: var(--tile);
}

.product .product-link {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: 1.25rem;
  font-weight: 600;
}

/* EMOY's store badges, matching emoy.app: both exactly 182x54, side by side, stacking when the
   tile is too narrow. google-play.svg is Google's badge, unmodified; app-store-wide.svg is Apple's,
   widened to Google's proportions from Apple's own paths (the file says how). Both ask for clear
   space of a quarter of the height (13.5px), which the 0.875rem gap and the margins around the row
   give them. */
.store-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
  margin-top: 1.25rem;
}

.store-link {
  display: inline-flex;
  border-radius: 0.5rem;
}

.store-link img {
  display: block;
  height: 54px;
  width: auto;
}

/* Product illustrations: decorative, CSS only. Their resting state is the finished picture. */
.product-art {
  position: relative;
  overflow: hidden;
  margin: 0.5rem 0.5rem 0;
  border-radius: calc(var(--radius) - 0.5rem);
  height: 6.5rem;
}

.art-emoy {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex: 1;
  min-height: 17rem;
  height: auto;
  padding: 1.5rem 1.5rem 0;
  background: var(--emoy-tint);
}

/* A real EMOY screen (light or dark to match the visitor), peeking up from the bottom of the tile. */
.art-emoy picture {
  display: block;
  width: min(100%, 18rem);
}

.emoy-shot {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  box-shadow: 0 16px 32px -14px var(--shadow);
  transform: rotate(-2deg) translateY(0.25rem);
}

.art-ventori {
  background: var(--ventori-tint);
}

.tag-peg {
  position: absolute;
  top: 0.875rem;
  left: 50%;
  width: 0.75rem;
  height: 0.75rem;
  margin-left: -0.375rem;
  border-radius: 50%;
  background: var(--ventori-ink);
}

.tag-swing {
  position: absolute;
  top: 1.25rem;
  left: 50%;
  width: 4.5rem;
  margin-left: -2.25rem;
  transform-origin: 50% 0;
}

.tag-string {
  display: block;
  width: 2px;
  height: 1.25rem;
  margin-inline: auto;
  background: var(--ventori-ink);
}

.tag-flip {
  display: grid;
  transform-style: preserve-3d;
}

.tag-face {
  grid-area: 1 / 1;
  display: grid;
  place-items: center;
  height: 2.5rem;
  border-radius: 0.5rem 0.5rem 0.875rem 0.875rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.tag-out {
  border: 2px solid var(--muted);
  background: var(--surface);
  color: var(--muted);
  visibility: hidden;
}

.tag-in {
  border: 2px solid var(--ventori-ink);
  background: var(--ventori-ink);
  color: var(--ventori-tint);
}

.art-jamnori {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  background:
    repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px 0.75rem) 0 50% / 100% calc(4 * 0.75rem + 1px) no-repeat,
    var(--jamnori-tint);
}

.note {
  width: 2rem;
  height: 2.75rem;
  fill: var(--jamnori-ink);
}

.note-2 { fill: var(--heart); translate: 0 -0.5rem; }
.note-3 { fill: var(--ventori-ink); translate: 0 0.25rem; }

/* ---------- Contact ---------- */

.contact {
  margin-top: 1rem;
  font-style: normal;
}

.contact p + p {
  margin-top: 0.25rem;
}

.contact .email {
  font-size: 1.25rem;
  font-weight: 600;
}

.contact .contact-note {
  margin-top: 0.75rem;
  color: var(--muted);
}

/* ---------- Plain pages (about, privacy, terms, 404) ---------- */

.page {
  padding-block: 3rem 3.5rem;
}

.page h1 {
  font-size: clamp(2.25rem, 10vw, 3rem);
  letter-spacing: -0.02em;
}

.page .lead {
  margin-top: 1rem;
  font-size: 1.1875rem;
}

.points {
  display: grid;
  gap: 0.875rem;
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
}

.points li {
  padding-left: 1rem;
  border-left: 3px solid var(--border);
}

.page .meta {
  margin-top: 2rem;
  color: var(--muted);
}

.page .meta + .meta {
  margin-top: 0.25rem;
}

.page .home-link {
  margin-top: 1.5rem;
  font-weight: 600;
}

.page h2 {
  margin-top: 2.25rem;
  font-size: 1.25rem;
}

.page h2 + p,
.page h2 + .points,
.page h2 + .facts {
  margin-top: 0.75rem;
}

.page .lead + p {
  margin-top: 1rem;
}

.facts {
  display: grid;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
}

.facts div {
  display: grid;
  grid-template-columns: minmax(8rem, 11rem) minmax(0, 1fr);
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  min-width: 0;
}

/* 404: the mark, with its heart looking around for the page. */
.lost-mark {
  display: block;
  width: 5rem;
  height: 5rem;
  margin-bottom: 1.25rem;
  overflow: visible;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9375rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.625rem;
  padding-block: 1.75rem 2.25rem;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--accent);
}

.site-footer a[aria-current="page"] {
  color: var(--text);
}

.sep {
  opacity: 0.6;
}

.footer-legal {
  flex-basis: 100%;
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
}

/* On narrow screens the footer wraps; drop the dots so none dangle at a line end. */
@media (max-width: 26rem) {
  .site-footer .wrap {
    gap: 0.375rem 1.125rem;
  }

  .sep {
    display: none;
  }
}

/* ==========================================================================
   Motion. Nothing below runs when the visitor asks for reduced motion.
   ========================================================================== */

@property --glow-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@property --glow-a {
  syntax: "<color>";
  inherits: false;
  initial-value: transparent;
}

@property --glow-b {
  syntax: "<color>";
  inherits: false;
  initial-value: transparent;
}

/* Warm backdrop behind the home hero (static unless motion is welcome). */
.hero::before {
  --glow-a: var(--warm-1);
  --glow-b: var(--warm-2);
  content: "";
  position: absolute;
  inset: -6rem 0 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(34rem 22rem at 80% 30%, var(--glow-a), transparent 70%),
    radial-gradient(30rem 20rem at 10% 80%, var(--glow-b), transparent 70%),
    conic-gradient(from var(--glow-angle) at 60% 50%, transparent, var(--warm-3) 25%, transparent 50%, var(--warm-3) 75%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent);
  mask-image: linear-gradient(to bottom, #000 70%, transparent);
}

@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation-duration: 250ms;
  }

  /* Header: the mark wiggles on hover and focus. */
  .brand:hover .mark,
  .brand:focus-visible .mark {
    animation: wiggle 500ms ease-in-out;
  }

  .mark {
    transform-origin: 50% 80%;
  }

  /* Squish and lift. */
  .shake,
  .tile,
  .site-nav a {
    transition: transform 220ms var(--spring);
  }

  .shake:hover,
  .tile:hover,
  .site-nav a:hover {
    transform: translateY(-2px);
  }

  .shake:active,
  .site-nav a:active {
    transform: scale(0.95);
    transition-duration: 100ms;
  }

  /* Bento tiles lift (and tilt a little, via play.js) on hover and focus. */
  .product {
    transform: perspective(60rem) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)) translateY(var(--lift, 0));
    transition: transform 300ms ease-out;
  }

  .product::after {
    transition: opacity 300ms ease-out;
  }

  .product:hover,
  .product:focus-within {
    --lift: -4px;
  }

  /* Living logo: draw the two strokes, then the heart pops in with one beat. */
  .hero-mark .stroke {
    stroke-dasharray: 1 2;
    animation: draw 700ms ease-out both;
  }

  .hero-mark .stroke-j {
    animation-delay: 280ms;
  }

  .hero-mark .mark-heart {
    transform-box: fill-box;
    transform-origin: 50% 60%;
    animation: beat 600ms var(--spring) 950ms both;
  }

  /* Name story tiles flip vertically, both faces turning together like one card.
     Smooth ease-in-out (no overshoot), so the flip never wobbles past flat. */
  @supports ((-webkit-backface-visibility: hidden) or (backface-visibility: hidden)) {
    .tile > span {
      -webkit-backface-visibility: hidden;
      backface-visibility: hidden;
      transition: transform 550ms cubic-bezier(0.45, 0.05, 0.25, 1);
    }

    /* Both faces stay rendered; backface-visibility decides which one shows. (As specific as the
       no-3D fallback above, which hides the outgoing face instantly.) */
    .tile[aria-pressed] .tile-front,
    .tile[aria-pressed] .tile-back {
      visibility: visible;
    }

    .tile-back {
      transform: rotateX(-180deg);
    }

    .tile[aria-pressed="true"] .tile-front {
      transform: rotateX(180deg);
    }

    .tile[aria-pressed="true"] .tile-back {
      transform: rotateX(0deg);
    }
  }

  .meaning-rest {
    transition: color 400ms ease-out;
  }

  .meaning-rest::after {
    transition: transform 500ms var(--spring) 150ms;
  }

  /* Warm backdrop drifts very slowly (paused by play.js while off-screen). */
  .hero::before {
    animation: glow 48s linear infinite;
  }

  .hero.is-offscreen::before {
    animation-play-state: paused;
  }

  /* EMOY: the screenshot straightens up a little when the tile is hovered or focused. */
  .emoy-shot {
    transition: transform 450ms var(--spring);
  }

  .product-emoy:hover .emoy-shot,
  .product-emoy:focus-within .emoy-shot {
    transform: rotate(0deg) translateY(-0.25rem);
  }

  /* Ventori: the tag swings and flips from out to in. */
  .tag-swing {
    animation: swing 5s ease-in-out infinite alternate;
  }

  .tag-flip {
    animation: flip 9s ease-in-out infinite both;
  }

  .tag-out {
    visibility: visible;
  }

  .tag-in {
    transform: rotateY(180deg);
  }

  /* JamNori: notes bob. */
  .note {
    animation: bob 3.6s ease-in-out infinite;
  }

  .note-2 { animation-delay: -1.2s; }
  .note-3 { animation-delay: -2.4s; }

  /* 404: the heart looks around. */
  .lost-mark .mark-heart {
    transform-box: fill-box;
    transform-origin: 50% 100%;
    animation: look 7s ease-in-out infinite;
  }
}

/* Scroll-driven reveals and a reading-progress line (no JS involved). */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .home .section h2,
    .home .product,
    .home .contact {
      animation: rise ease-out both;
      animation-timeline: view();
      animation-range: entry 0% cover 30%;
    }

    /* The last block can't scroll far up the page, so it finishes as soon as it's in view. */
    .home .contact {
      animation-range: entry 0% entry 100%;
    }

    .site-header::after {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      height: 3px;
      background: var(--accent);
      transform-origin: 0 50%;
      transform: scaleX(0);
      animation: progress linear both;
      animation-timeline: scroll(root);
    }
  }
}

@keyframes wiggle {
  25% { transform: rotate(-9deg); }
  55% { transform: rotate(6deg); }
  80% { transform: rotate(-2deg); }
}

@keyframes draw {
  from { stroke-dashoffset: 1.05; opacity: 0; }
  10% { opacity: 1; }
  to { stroke-dashoffset: 0; opacity: 1; }
}

@keyframes beat {
  0% { transform: scale(0); }
  55% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

@keyframes glow {
  0% { --glow-angle: 0deg; --glow-a: var(--warm-1); --glow-b: var(--warm-2); }
  50% { --glow-a: var(--warm-3); --glow-b: var(--warm-1); }
  100% { --glow-angle: 360deg; --glow-a: var(--warm-1); --glow-b: var(--warm-2); }
}

@keyframes swing {
  from { transform: rotate(-5deg); }
  to { transform: rotate(5deg); }
}

@keyframes flip {
  0%, 35% { transform: rotateY(0deg); }
  45%, 90% { transform: rotateY(180deg); }
  100% { transform: rotateY(360deg); }
}

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-0.5rem) rotate(4deg); }
}

@keyframes look {
  0%, 18%, 92%, 100% { transform: none; }
  26%, 42% { transform: translateX(-36px) rotate(-14deg); }
  52%, 70% { transform: translateX(36px) rotate(14deg); }
  78% { transform: translateY(-14px); }
}

@keyframes rise {
  from { opacity: 0; translate: 0 1.5rem; }
}

@keyframes progress {
  to { transform: scaleX(1); }
}
