:root {
  --tocobo-red: #c5402b;
  --tocobo-red-dark: #9d2f21;
  --tocobo-cream: #efe7d4;
  --tocobo-cream-light: #f8f5ed;
  --tocobo-powder: #ccd9dd;
  --tocobo-powder-dark: #aabdc5;
  --tocobo-ink: #3b4347;
  --tocobo-muted: rgba(59, 67, 71, 0.68);
  --tocobo-line: rgba(59, 67, 71, 0.14);
  --tocobo-panel: rgba(248, 245, 237, 0.66);
  --tocobo-shadow: 0 22px 58px rgba(59, 67, 71, 0.11);
  --box-w: 88px;
  --box-h: 392px;
  --grid-w: 156px;
  --grid-h: 312px;
  --intro-box-fill-scale-x: 12;
  --intro-box-fill-scale-y: 3.2;
  --dissolve-duration: 900ms;
  --match-frame-duration: 220ms;
  --stretch-duration: 540ms;
  --video-fit: contain;
  --video-focus-x: 50%;
  --video-focus-y: 50%;
  --video-scale: 1;
  --video-mobile-scale: 0.92;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #e8e3d6;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  color: var(--tocobo-ink);
  font-family:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

body.is-ready {
  overflow-y: auto;
}

a {
  color: inherit;
}

img,
video {
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

.media-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    linear-gradient(
      180deg,
      rgba(248, 245, 237, 0.2),
      rgba(239, 231, 212, 0.42)
    ),
    #e8e3d6;
}

.media-backdrop::before {
  position: absolute;
  inset: -10%;
  z-index: 0;
  content: "";
  background:
    linear-gradient(180deg, rgba(248, 245, 237, 0.08), rgba(239, 231, 212, 0.32)),
    url("assets/tocobo-frames/tocobo-frame-046.jpg") center / cover no-repeat;
  filter: blur(3px) saturate(1);
  opacity: 0.64;
  transform: scale(1.012);
}

.video-main,
.frame-fallback {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: var(--video-fit);
  object-position: var(--video-focus-x) var(--video-focus-y);
  transform: scale(var(--video-scale));
  transform-origin: center;
  opacity: 0;
  transition:
    opacity 260ms ease,
    filter 700ms ease,
    transform 700ms ease;
}

.video-main.is-active,
.frame-fallback.is-active {
  opacity: 1;
}

body.is-ready .video-main,
body.is-ready .frame-fallback {
  opacity: 0.88;
  filter: blur(2px) saturate(1) brightness(0.98);
  transform: scale(calc(var(--video-scale) * 1.006));
}

.intro-layer {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(
      120% 90% at 50% 32%,
      var(--tocobo-cream-light) 0%,
      var(--tocobo-cream) 62%,
      #e8e3d6 100%
    );
  opacity: 1;
  pointer-events: none;
  transition:
    opacity var(--dissolve-duration) ease,
    visibility 0s linear var(--dissolve-duration);
}

.intro-layer::after {
  position: absolute;
  inset: -20%;
  z-index: 1;
  content: "";
  background:
    linear-gradient(
      112deg,
      transparent 38%,
      rgba(255, 255, 255, 0.55) 47%,
      rgba(255, 255, 255, 0) 58%
    ),
    radial-gradient(rgba(59, 67, 71, 0.22) 0.45px, transparent 0.45px) 0 0 / 5px 5px;
  opacity: 0.05;
  mix-blend-mode: multiply;
  pointer-events: none;
  transition: opacity var(--match-frame-duration) ease;
}

.intro-layer.is-video-matched::after {
  opacity: 0;
}

.intro-layer.is-dissolved,
html.has-viewed-brochure .intro-layer {
  visibility: hidden;
  opacity: 0;
}

.stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  opacity: 1;
  transition: opacity var(--match-frame-duration) ease;
}

.intro-layer.is-video-matched .stage {
  opacity: 0;
}

.holder {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 420px;
}

.grid {
  position: relative;
  display: grid;
  width: var(--grid-w);
  height: var(--grid-h);
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(4, 1fr);
  gap: 9px;
  transform-origin: center;
  transition:
    transform var(--stretch-duration) cubic-bezier(0.72, 0, 0.16, 1),
    width 620ms cubic-bezier(0.66, 0, 0.18, 1),
    height 620ms cubic-bezier(0.66, 0, 0.18, 1),
    gap 620ms cubic-bezier(0.66, 0, 0.18, 1),
    border-radius 620ms cubic-bezier(0.66, 0, 0.18, 1);
}

.cell {
  border-radius: 7px;
  background: var(--tocobo-cream);
  opacity: 0;
  transition:
    transform 420ms cubic-bezier(0.5, 1.5, 0.4, 1),
    opacity 300ms ease,
    background-color 580ms cubic-bezier(0.6, 0, 0.2, 1),
    border-radius 580ms cubic-bezier(0.6, 0, 0.2, 1);
}

.cell:nth-child(1) {
  background: var(--tocobo-red);
  transform: translateY(-280px);
  transition-delay: 0ms;
}

.cell:nth-child(2) {
  transform: translateX(300px);
  transition-delay: 40ms;
}

.cell:nth-child(3) {
  transform: translateX(-300px);
  transition-delay: 80ms;
}

.cell:nth-child(4) {
  background: var(--tocobo-red);
  transform: translateY(300px);
  transition-delay: 120ms;
}

.cell:nth-child(5) {
  background: var(--tocobo-red);
  transform: translateX(-340px);
  transition-delay: 160ms;
}

.cell:nth-child(6) {
  transform: translateX(340px);
  transition-delay: 200ms;
}

.cell:nth-child(7) {
  transform: translateY(-340px);
  transition-delay: 240ms;
}

.cell:nth-child(8) {
  background: var(--tocobo-red);
  transform: translateY(320px);
  transition-delay: 280ms;
}

.scene.grid-in .cell {
  opacity: 1;
  transform: translate(0, 0);
}

.scene.to-box .grid {
  width: var(--box-w);
  height: var(--box-h);
  gap: 0 1.5px;
  overflow: hidden;
  border-radius: 3px;
}

.scene.to-box .cell {
  border-radius: 0;
  background: var(--tocobo-powder);
  transition-delay: 0s;
}

.scene.stretch-out .grid {
  border-radius: 0;
  transform: scaleX(var(--intro-box-fill-scale-x)) scaleY(var(--intro-box-fill-scale-y));
}

.face-light {
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background:
    linear-gradient(
      100deg,
      rgba(255, 255, 255, 0.42) 0%,
      rgba(255, 255, 255, 0) 34%,
      rgba(0, 0, 0, 0) 66%,
      rgba(0, 0, 0, 0.1) 100%
    );
  opacity: 0;
  pointer-events: none;
  transition: opacity 500ms ease;
}

.scene.lit .face-light {
  opacity: 1;
}

.seam {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: rgba(46, 56, 62, 0.32);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 400ms ease 100ms;
}

.scene.lit .seam {
  opacity: 1;
}

.scene.stretch-out .seam {
  opacity: 0;
  transition-duration: calc(var(--stretch-duration) * 0.45);
}

.wordmark {
  position: absolute;
  top: 45%;
  left: 50%;
  color: var(--tocobo-red);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  opacity: 0;
  transform: translate(-50%, -46%) translateY(8px);
  transition:
    opacity 450ms ease,
    transform 550ms cubic-bezier(0.3, 1, 0.3, 1);
  white-space: nowrap;
}

.scene.lit .wordmark {
  opacity: 1;
  transform: translate(-50%, -46%) translateY(0);
}

.scene.stretch-out .wordmark {
  opacity: 0;
  transform: translate(-50%, -46%) translateY(0);
  transition-duration: calc(var(--stretch-duration) * 0.35);
}

.shadow {
  position: absolute;
  bottom: 6px;
  left: 50%;
  width: 150px;
  height: 30px;
  background:
    radial-gradient(
      ellipse at center,
      rgba(40, 46, 50, 0.4) 0%,
      rgba(40, 46, 50, 0) 70%
    );
  filter: blur(3px);
  opacity: 0;
  transform: translateX(-50%) scaleX(0.4);
  transition:
    opacity 550ms ease,
    transform 650ms cubic-bezier(0.5, 0, 0.2, 1);
}

.scene.lit .shadow {
  opacity: 1;
  transform: translateX(-50%) scaleX(1);
}

.tagline {
  color: var(--tocobo-red);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 500ms ease,
    transform 600ms cubic-bezier(0.3, 1, 0.3, 1);
}

.scene.tag-in .tagline {
  opacity: 1;
  transform: translateY(0);
}

.scene.stretch-out .tagline {
  opacity: 0;
  transform: translateY(22px);
  transition-duration: var(--stretch-duration);
}

.shell {
  position: relative;
  z-index: 2;
  width: min(100%, 620px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(42px, env(safe-area-inset-top)) 18px max(34px, env(safe-area-inset-bottom));
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition:
    opacity 680ms ease,
    transform 680ms cubic-bezier(0.22, 1, 0.36, 1);
}

body.is-ready .shell,
html.has-viewed-brochure .shell {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.hero {
  padding: 8px 4px 26px;
  text-align: center;
}

.eyebrow {
  margin: 0;
  color: var(--tocobo-red-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand {
  margin: 10px 0 0;
  color: var(--tocobo-red);
  font-size: clamp(3.4rem, 14vw, 5.8rem);
  font-weight: 800;
  line-height: 0.88;
  letter-spacing: 0.02em;
}

.red-line {
  width: 68px;
  height: 2px;
  margin: 22px auto 24px;
  background: var(--tocobo-red);
}

h2 {
  margin: 0;
  color: var(--tocobo-ink);
  font-size: 1.24rem;
  font-weight: 750;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-copy {
  max-width: 360px;
  margin: 13px auto 0;
  color: var(--tocobo-muted);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.45;
}

.language-panel {
  padding: 16px;
  border: 1px solid rgba(204, 217, 221, 0.32);
  border-radius: 8px;
  background: var(--tocobo-panel);
  box-shadow: 0 12px 34px rgba(59, 67, 71, 0.07);
  backdrop-filter: blur(2px);
}

.language-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.language-card {
  position: relative;
  display: grid;
  min-height: 78px;
  align-items: center;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 13px;
  overflow: hidden;
  border: 1px solid var(--tocobo-line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(248, 245, 237, 0.9), rgba(204, 217, 221, 0.58)),
    rgba(248, 245, 237, 0.72);
  box-shadow: 0 10px 24px rgba(59, 67, 71, 0.075);
  text-decoration: none;
  animation: card-in 420ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
  animation-delay: calc(var(--stagger-index, 0) * 38ms);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease,
    background 150ms ease;
}

.language-card:focus-visible,
.language-card:hover {
  border-color: rgba(197, 64, 43, 0.48);
  background:
    linear-gradient(135deg, rgba(248, 245, 237, 0.94), rgba(204, 217, 221, 0.68)),
    rgba(248, 245, 237, 0.82);
  box-shadow: 0 16px 34px rgba(59, 67, 71, 0.13);
  outline: none;
  transform: translateY(-1px);
}

.language-card.is-detected {
  border-color: rgba(197, 64, 43, 0.52);
  box-shadow: 0 12px 30px rgba(197, 64, 43, 0.16);
}

.language-flag {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(59, 67, 71, 0.14);
  border-radius: 50%;
  background: var(--tocobo-cream-light);
  box-shadow:
    inset 0 0 0 2px rgba(248, 245, 237, 0.72),
    0 8px 18px rgba(59, 67, 71, 0.09);
}

.language-flag img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.language-text {
  display: block;
  min-width: 0;
}

.language-card.is-rtl {
  direction: rtl;
}

.language-card.is-rtl .language-text {
  text-align: right;
}

.detected-badge {
  position: absolute;
  top: 9px;
  right: 10px;
  color: var(--tocobo-red);
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.language-native {
  display: block;
  min-width: 0;
  color: var(--tocobo-ink);
  font-size: clamp(0.98rem, 4vw, 1.08rem);
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.language-english {
  display: block;
  margin-top: 7px;
  color: var(--tocobo-muted);
  font-size: 0.73rem;
  font-weight: 750;
  line-height: 1.2;
  text-transform: uppercase;
}

.viewer-shell {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(100%, 780px);
  min-height: 100vh;
  margin: 0 auto;
  align-content: center;
  padding: 24px;
  text-align: center;
}

.viewer-card {
  padding: 34px 24px;
  border: 1px solid rgba(204, 217, 221, 0.42);
  border-radius: 8px;
  background: rgba(248, 245, 237, 0.84);
  box-shadow: var(--tocobo-shadow);
  backdrop-filter: blur(18px);
}

.viewer-card h1 {
  margin: 10px 0 12px;
  color: var(--tocobo-red);
  font-size: clamp(2.2rem, 10vw, 4.8rem);
  line-height: 0.9;
}

.viewer-card p {
  margin: 0;
  color: var(--tocobo-muted);
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.55;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  :root {
    --video-scale: var(--video-mobile-scale);
  }
}

@media (max-width: 430px) {
  .shell {
    padding: 30px 12px 72px;
  }

  .hero {
    padding-bottom: 20px;
  }

  .language-panel {
    padding: 10px;
  }

  .language-grid {
    gap: 8px;
  }

  .language-card {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    min-height: 74px;
    padding: 12px 10px;
  }

  .language-flag {
    width: 34px;
    height: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .intro-layer {
    display: none;
  }

  body {
    overflow-y: auto;
  }

  body.is-loading .shell {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
