/* Landing page for arayashikii.com — the marketing/demo shell around the
 * game. Loaded AFTER style.css, which it deliberately reuses: the tile
 * visuals here (.tile / .pip / .tile-half …) are the game's own, so the
 * dominoes on this page can never drift from the dominoes in the game.
 *
 * The only things overridden below are style.css's app-shell globals
 * (html/body are locked to a non-scrolling 100%-height frame for the Mini
 * App) — this page scrolls, so it unlocks them and nothing else. */

/* ------------------------------------------------- Un-lock the app shell */

html {
  scroll-behavior: smooth;
}

html, body {
  height: auto;
  overflow-x: hidden;
  overflow-y: visible;
  -webkit-user-select: text;
  user-select: text;
  background: var(--site-bg);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

:root {
  /* Extends style.css's --tg-* palette rather than restating it, so the
   * page and the game stay one world. */
  --site-bg: #14141f;           /* a shade under the felt, so the felt reads as raised */
  --site-panel: rgba(42, 42, 62, 0.45);
  --site-line: rgba(122, 106, 74, 0.28);   /* the domino border, quietened */
  --site-gold: #d9c9a3;
  --site-dim: rgba(255, 255, 255, 0.52);
  --site-dimmer: rgba(255, 255, 255, 0.32);

  --serif: "Songti TC", "Noto Serif TC", "Source Han Serif TC", "MingLiU", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC",
          "Microsoft JhengHei", "Segoe UI", sans-serif;

  --gutter: 24px;
  --measure: 1080px;
}

body {
  font-family: var(--sans);
  color: var(--tg-text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ------------------------------------------------------------------- Nav */

#site-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(20, 20, 31, 0.72);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
}
#site-nav.is-scrolled { border-bottom-color: var(--site-line); }

#site-nav .wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 62px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  margin-right: auto;
}

/* The inlined mark takes its gold from currentColor, so it warms on hover
 * with the rest of the brand rather than sitting inert next to it. */
.brand-mark-svg {
  height: 30px;
  width: auto;
  flex: none;
  color: #a8925f;
  transition: color 0.25s ease;
}
.brand:hover .brand-mark-svg { color: var(--site-gold); }

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 9px;
}
.brand-mark {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.brand-sub {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--site-dimmer);
  text-transform: uppercase;
}

.nav-links { display: flex; gap: 26px; }
.nav-links a {
  font-size: 13px;
  color: var(--site-dim);
  text-decoration: none;
  letter-spacing: 0.08em;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.nav-links a:hover,
.nav-links a.is-active { color: var(--tg-text); border-bottom-color: var(--tg-accent); }

@media (max-width: 640px) {
  .nav-links { gap: 16px; }
  .nav-links a { font-size: 12px; }
  .brand-sub { display: none; }
}

/* --------------------------------------------------------------- Sections */

section { position: relative; }

.section-pad { padding: 104px 0; }

@media (max-width: 640px) {
  .section-pad { padding: 72px 0; }
  :root { --gutter: 18px; }
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--tg-accent);
  text-transform: uppercase;
  margin: 0 0 14px;
}

h2.section-title {
  font-family: var(--serif);
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0 0 16px;
  line-height: 1.3;
}

.section-lede {
  max-width: 62ch;
  color: var(--site-dim);
  font-size: 15px;
  margin: 0 0 52px;
}

/* --------------------------------------------------------------- 1. Cover */

#cover {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 96px 0 64px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(192, 57, 43, 0.16), transparent 62%),
    radial-gradient(80% 60% at 50% 100%, rgba(42, 42, 62, 0.8), transparent 70%),
    var(--site-bg);
  overflow: hidden;
}

.cover-inner {
  display: grid;
  gap: 56px;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
}

@media (max-width: 880px) {
  .cover-inner { grid-template-columns: minmax(0, 1fr); gap: 44px; }
}

#cover h1 {
  font-family: var(--serif);
  font-size: clamp(56px, 13vw, 116px);
  line-height: 0.95;
  letter-spacing: 0.08em;
  margin: 0 0 6px;
  font-weight: 700;
}
.cover-latin {
  font-size: clamp(13px, 2.4vw, 17px);
  letter-spacing: 0.42em;
  color: var(--site-gold);
  text-transform: uppercase;
  margin: 0 0 30px;
}
.cover-lede {
  max-width: 40ch;
  font-size: 16px;
  color: var(--site-dim);
  margin: 0 0 38px;
}

.cta-row { display: flex; flex-wrap: wrap; gap: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 13px 30px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--tg-accent); color: #fff; }
.btn-primary:hover { background: #d0473a; }
.btn-ghost { background: transparent; color: var(--tg-text); border-color: var(--site-line); }
.btn-ghost:hover { border-color: var(--site-gold); color: var(--site-gold); }

/* The cover's tile arrangement: 至尊 laid over a fanned hand, angled like
 * tiles resting on a table rather than a flat product shot. */
.cover-art {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
}
.cover-fan { display: flex; transform: rotate(-7deg); }
.cover-fan .tile { margin-left: -14px; box-shadow: inset 0 0 0 1px var(--tg-domino-border), 0 12px 28px rgba(0, 0, 0, 0.55); }
.cover-fan .tile:first-child { margin-left: 0; }

.cover-fan .tile {
  animation: tile-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
@keyframes tile-rise {
  from { opacity: 0; transform: translateY(22px) rotate(6deg); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cover-fan .tile { animation: none; }
}

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--site-dimmer);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.scroll-hint::after {
  content: "";
  width: 1px;
  height: 34px;
  background: linear-gradient(var(--site-dimmer), transparent);
}
@media (max-width: 880px) { .scroll-hint { display: none; } }

/* Once the cover stacks, the fan is no longer sharing the row with the
 * headline and has to fit the full column width — !important because
 * site.js sets --tile-w inline per tile. */
@media (max-width: 880px) {
  .cover-art { min-height: 0; }
  .cover-fan .tile { --tile-w: 54px !important; }
  .cover-fan .tile { margin-left: -10px; }
  .cover-fan .tile:first-child { margin-left: 0; }
}

/* --------------------------------------------------------- 2. How to play */

#howto { background: var(--site-bg); }

.rule-block { margin-bottom: 76px; }
.rule-block:last-child { margin-bottom: 0; }

h3.rule-title {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.06em;
  margin: 0 0 8px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
h3.rule-title .rule-num {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--tg-accent);
  font-family: var(--sans);
}
.rule-body {
  max-width: 64ch;
  color: var(--site-dim);
  font-size: 14.5px;
  margin: 0 0 26px;
}
.rule-body strong { color: var(--tg-text); font-weight: 600; }

/* A labelled row of real tiles. */
.tile-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 20px;
}

.tile-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}
.tile-item .tile-group { display: flex; gap: 5px; }
.tile-caption {
  font-size: 12px;
  color: var(--site-dim);
  text-align: center;
  line-height: 1.45;
  letter-spacing: 0.04em;
}
.tile-caption b { display: block; color: var(--tg-text); font-weight: 600; font-size: 13px; }
.tile-caption em { font-style: normal; color: var(--site-dimmer); font-size: 11px; }

/* Combination cards — each shows the tiles that form one legal play. */
.combo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 16px;
}
.combo-card {
  border: 1px solid var(--site-line);
  border-radius: 14px;
  padding: 22px 20px 20px;
  background: var(--site-panel);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.combo-card .tile-group { display: flex; gap: 5px; min-height: 76px; align-items: center; }
.combo-name {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.05em;
  margin: 0;
}
.combo-desc { font-size: 12.5px; color: var(--site-dim); margin: 6px 0 0; line-height: 1.6; }

/* 至尊 gets its own treatment — it's the game's signature rule. */
.supreme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.supreme-card {
  border: 1px solid rgba(217, 201, 163, 0.34);
  border-radius: 14px;
  padding: 24px 22px;
  background:
    linear-gradient(140deg, rgba(217, 201, 163, 0.09), transparent 60%),
    var(--site-panel);
  display: flex;
  align-items: center;
  gap: 20px;
}
.supreme-card .tile-group { display: flex; gap: 5px; flex-shrink: 0; }
.supreme-card h4 {
  font-family: var(--serif);
  font-size: 18px;
  margin: 0 0 5px;
  color: var(--site-gold);
  letter-spacing: 0.06em;
}
.supreme-card p { margin: 0; font-size: 12.5px; color: var(--site-dim); line-height: 1.6; }

/* Plain rule list for the flow-of-play items that need no illustration. */
.rule-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: 2px;
  border: 1px solid var(--site-line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--site-line);
}
.rule-list li {
  background: var(--site-bg);
  padding: 22px 22px 24px;
}
.rule-list dt {
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.05em;
  margin-bottom: 7px;
}
.rule-list dd { margin: 0; font-size: 13px; color: var(--site-dim); line-height: 1.65; }

/* ------------------------------------------------------------- 3. The game */

#play {
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(192, 57, 43, 0.1), transparent 60%),
    var(--tg-table);
  border-top: 1px solid var(--site-line);
  border-bottom: 1px solid var(--site-line);
}

.play-inner { display: flex; flex-direction: column; align-items: center; text-align: center; }
.play-inner .section-lede { margin-bottom: 40px; }

/* A device frame so the Mini App's 375x812 layout reads as intentional
 * rather than as a narrow column stranded on a wide page. Scaled to fit by
 * site.js on small screens — the game's own metrics assume ~375px. */
/* The scaler holds the layout box (its height is set by site.js to the
 * phone's *scaled* height); the phone itself is taken out of flow and
 * scaled about its top centre, so shrinking it never reflows the page. */
.phone-scaler {
  position: relative;
  width: 100%;
  max-width: 397px;   /* 375 viewport + 11px bezel each side */
}
.phone {
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: -198.5px;
  width: 375px;
  height: 812px;
  border-radius: 44px;
  padding: 11px;
  background: #08080e;
  box-shadow:
    0 0 0 1px rgba(217, 201, 163, 0.2),
    0 40px 90px rgba(0, 0, 0, 0.65);
  transform-origin: top center;
}
/* No notch: the game draws its own scoreboard along the top of its
 * viewport and has no safe-area inset to dodge one, so a decorative notch
 * would sit on top of the scores. */
.phone iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 34px;
  display: block;
  background: var(--tg-table);
}

.play-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 40px;
}
.play-note { font-size: 12px; color: var(--site-dimmer); margin: 18px 0 0; }

/* ---------------------------------------------------------- 4. Download */

#download { background: var(--site-bg); }

.dl-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 56px;
  align-items: center;
}
@media (max-width: 880px) { .dl-inner { grid-template-columns: minmax(0, 1fr); gap: 40px; } }

.dl-card {
  border: 1px solid var(--site-line);
  border-radius: 18px;
  padding: 32px;
  background: var(--site-panel);
}
.dl-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--site-line);
}
.dl-row:last-of-type { border-bottom: 0; padding-bottom: 4px; }
.dl-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--site-line);
}
.dl-icon svg { width: 22px; height: 22px; fill: var(--tg-text); }
.dl-meta { flex: 1; min-width: 0; }
.dl-meta b { display: block; font-size: 14.5px; font-weight: 600; letter-spacing: 0.04em; }
.dl-meta span { font-size: 12px; color: var(--site-dim); }

.pill {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid currentColor;
}
.pill-beta { color: var(--site-gold); }
.pill-soon { color: var(--site-dimmer); }

.dl-cta { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 12px; }
.btn.is-placeholder { position: relative; }

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

#site-footer {
  border-top: 1px solid var(--site-line);
  padding: 44px 0;
  background: var(--site-bg);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--site-dimmer);
}
.footer-inner a { color: var(--site-dim); text-decoration: none; }
.footer-inner a:hover { color: var(--tg-text); }

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.footer-logo {
  display: block;
  width: 208px;
  height: auto;
}
.footer-copy { color: var(--site-dimmer); }

@media (max-width: 640px) {
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .footer-logo { width: 176px; }
}

/* -------------------------------------------------------- Scroll reveal */

/* Progressive enhancement: .reveal is a no-op until site.js marks the
 * document, so the page is fully readable with JS off / broken / still
 * loading. Hiding content by default would risk a permanently blank page
 * if the observer never delivers. */
.js-reveal .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.js-reveal .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js-reveal .reveal { opacity: 1; transform: none; transition: none; }
}
