/* ==========================================================================
   Landing — "/"                                             owner: visitor
   --------------------------------------------------------------------------
   Composition: the brand lockup over one thin vermilion rule; the live
   question as the centrepiece; two calm calls to action within thumb reach;
   the privacy line. Wide screens add a hung stack of the latest notes and a
   vertical 小東京 beside a vermilion hairline.
   Builds on tokens.css / base.css / components.css (.brand, .btn, .note).
   ========================================================================== */

.page-landing {
  color: var(--c-ink);
}

.landing {
  --landing-gutter: clamp(20px, 5.2vw, 72px);
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  min-height: 100svh;
  max-width: 1480px;
  margin-inline: auto;
  padding-top: max(var(--sp-5), var(--safe-top));
  padding-bottom: max(var(--sp-5), var(--safe-bottom));
  padding-left: max(var(--landing-gutter), var(--safe-left));
  padding-right: max(var(--landing-gutter), var(--safe-right));
}

/* --- Brand row ------------------------------------------------------------ */

.landing__header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-bottom: var(--sp-4);
}

/* The recurring motif: one thin vermilion rule, drawn in on arrival. */
.landing__header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--c-vermilion);
  transform-origin: left center;
  animation: lt-draw 1100ms var(--ease-out) 120ms both;
}

.landing__brand {
  min-width: 0;
  margin: 0;
}

.landing__descriptor {
  display: none;
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--c-ink-2);
  text-align: right;
}

@media (min-width: 600px) {
  .landing__descriptor { display: block; }
}

/* --- Main column ---------------------------------------------------------- */

.landing__main {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--sp-7);
  padding-block: clamp(32px, 7vh, 88px) var(--sp-6);
}

.landing__intro {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--sp-7);
}

.landing__eyebrow {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: 0 0 var(--sp-4);
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--fs-label);
  line-height: 1.2;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--c-vermilion-ink);
}

.landing__eyebrow::before {
  content: "";
  flex: none;
  width: 28px;
  height: 1px;
  background: currentColor;
}

.landing__question {
  margin: 0;
  max-width: 15em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 1.15rem + 3.9vw, 4.5rem);
  line-height: 1.28;
  letter-spacing: 0.005em;
  color: var(--c-ink);
  overflow-wrap: break-word;
  text-wrap: balance;
}

.landing__question[data-len="m"] {
  max-width: 18em;
  font-size: clamp(1.75rem, 1.05rem + 3.1vw, 3.5rem);
}

.landing__question[data-len="l"] {
  max-width: 21em;
  font-size: clamp(1.5rem, 1rem + 2.3vw, 2.75rem);
  line-height: 1.34;
}

.landing__count {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25em 0.5em;
  min-height: 2.25rem;
  margin: var(--sp-5) 0 0;
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--c-ink-2);
}

.landing__count-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--c-ink);
  font-variant-numeric: lining-nums tabular-nums;
}

.landing__count-num.is-ticking {
  animation: lt-tick 900ms var(--ease-out);
}

/* --- Latest story (phones and tablets with room to spare) ----------------- */

.landing__latest {
  display: none;
  margin: 0;
  padding: var(--sp-4) 0 0;
  border-top: 1px solid var(--c-line);
}

.landing__latest-label {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-ink-2);
}

.landing__latest-quote {
  margin: 0;
}

.landing__latest-quote p {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--c-ink);
  /* anywhere (not break-word): one unbroken 160-char word must not widen the page. */
  overflow-wrap: anywhere;
}

.landing__latest-cite {
  margin: var(--sp-2) 0 0;
  font-size: 0.8125rem;
  color: var(--c-ink-2);
  overflow-wrap: anywhere;
}

@media (min-height: 740px) and (max-width: 959px) {
  .landing__latest:not([hidden]) { display: block; }
}

/* --- Calls to action ------------------------------------------------------ */

.landing__actions {
  display: grid;
  gap: var(--sp-3);
}

.landing__cta {
  width: 100%;
}

/* A drawn arrow (no icon font): a hairline shaft with a chevron head. */
.landing__arrow {
  position: relative;
  display: inline-block;
  flex: none;
  width: 1.15em;
  height: 1px;
  margin-left: 0.35em;
  background: currentColor;
  transition: transform var(--dur-fast) var(--ease-out);
}

.landing__arrow::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 0.42em;
  height: 0.42em;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: translate(-1px, -50%) rotate(45deg);
}

@media (hover: hover) {
  .landing__cta:hover .landing__arrow { transform: translateX(3px); }
}

.landing__inapp {
  margin: var(--sp-2) 0 0;
  padding: var(--sp-3) var(--sp-4);
  background-color: var(--c-paper);
  border-left: 2px solid var(--c-vermilion);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--c-ink);
}

/* When the camera can't open here the AR link steps back. */
.landing.is-no-camera .landing__cta--ar {
  --btn-fg: var(--c-ink-2);
  --btn-border: var(--c-line-strong);
}

/* --- Board (wide screens only) ------------------------------------------- */

.landing__board {
  display: none;
}

.landing__board-title {
  margin: 0 0 var(--sp-6);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-ink-2);
}

.landing__stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sp-3) 0 var(--sp-4);
}

.landing__card {
  position: relative;
  width: min(100%, 19rem);
}

.landing__card + .landing__card { margin-top: 6px; }

.landing__card:nth-child(1) { z-index: 3; translate: -10% 0; rotate: -1.8deg; }
.landing__card:nth-child(2) { z-index: 2; translate: 12% 0; rotate: 1.3deg; }
.landing__card:nth-child(3) { z-index: 1; translate: -2% 0; rotate: -0.6deg; }

/* Blank strip on an empty wall: string, vermilion pin, unwritten paper. */
.landing__slip {
  position: relative;
  width: 84px;
  height: 220px;
  margin-top: 52px;
  background-color: var(--c-paper);
  background-image: var(--paper-texture);
  background-size: var(--paper-tile) var(--paper-tile);
  box-shadow: var(--shadow-note);
  transform-origin: 50% -48px;
  animation: lt-sway 7s ease-in-out infinite;
}

.landing__slip::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -48px;
  width: 1px;
  height: 48px;
  background: var(--c-ink-2);
  opacity: 0.45;
}

.landing__slip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -52px;
  width: 9px;
  height: 9px;
  margin-left: -4px;
  border-radius: 50%;
  background: var(--c-vermilion);
}

.landing__tategaki {
  margin: 0;
  padding-left: var(--sp-5);
  border-left: 1px solid var(--c-vermilion);
  writing-mode: vertical-rl;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.75rem;
  line-height: 1;
  letter-spacing: 0.5em;
  color: var(--c-ink);
}

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

.landing__footer {
  padding-top: var(--sp-4);
  border-top: 1px solid var(--c-line);
}

.landing__privacy {
  margin: 0;
  max-width: 34em;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--c-ink-2);
}

/* --- Small phones (375 × 667 and shorter) -------------------------------- */

@media (max-height: 700px) and (max-width: 959px) {
  .landing {
    padding-top: max(var(--sp-4), var(--safe-top));
    padding-bottom: max(var(--sp-4), var(--safe-bottom));
  }
  .landing__main { gap: var(--sp-5); padding-block: var(--sp-5) var(--sp-4); }
  .landing__eyebrow { margin-bottom: var(--sp-3); }
  .landing__count { margin-top: var(--sp-3); }
}

@media (max-width: 359px) {
  .landing__brand .brand__name { font-size: 0.9375rem; }
}

/* --- Tablets: same single column, more air -------------------------------- */

@media (min-width: 600px) and (max-width: 959px) {
  .landing__header,
  .landing__main,
  .landing__footer { width: min(100%, 640px); margin-inline: auto; }
}

/* --- Wide screens (laptop, iPad landscape, projector) --------------------- */

@media (min-width: 960px) {
  .landing__main {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    grid-template-rows: auto auto;
    grid-template-areas:
      "intro board"
      "actions board";
    align-content: center;
    column-gap: clamp(48px, 6vw, 128px);
    row-gap: var(--sp-7);
  }

  .landing__intro { grid-area: intro; gap: 0; }
  .landing__actions {
    grid-area: actions;
    grid-template-columns: repeat(2, max-content);
    justify-content: start;
    align-items: center;
    align-self: start;
  }
  .landing__inapp { grid-column: 1 / -1; max-width: 34em; }
  .landing__cta { width: auto; padding-inline: var(--sp-6); }

  .landing__board {
    grid-area: board;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    align-self: center;
    gap: clamp(24px, 3vw, 56px);
  }

  .landing__count { margin-top: var(--sp-6); }
}

@media (min-width: 960px) and (max-height: 620px) {
  .landing__board { display: none; }
  .landing__main { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "actions"; }
}

/* Projector / large displays */
@media (min-width: 1600px) and (min-height: 860px) {
  .landing { --landing-gutter: 96px; }
  .landing__brand .brand__mark { height: 3rem; }
  .landing__brand .brand__name { font-size: 1.375rem; }
  .landing__brand .brand__jp { font-size: 0.875rem; }
  .landing__descriptor,
  .landing__eyebrow,
  .landing__board-title { font-size: 0.875rem; }
  .landing__count { font-size: 1.125rem; }
  .landing__count-num { font-size: 2.25rem; }
  .landing__cta { min-height: 56px; font-size: 1.125rem; }
  .landing__card { width: 22rem; font-size: 1.125rem; }
  .landing__tategaki { font-size: 2.25rem; }
  .landing__privacy { font-size: 0.9375rem; }
}

/* --- Entrance: brand, then the question, then the invitations ------------- */

.landing__brand,
.landing__descriptor {
  animation: lt-rise var(--dur-slow) var(--ease-out) both;
}

/* The question waits for live data so it never flashes a stale value.
   landing.js adds .is-revealed; the delayed CSS animation is a fallback. */
.landing__live {
  animation: lt-rise 700ms var(--ease-out) 2400ms both;
}

.landing__live.is-revealed {
  animation: lt-rise-now 800ms var(--ease-out) 0ms both;
}

.landing__latest { animation: lt-fade var(--dur-slow) var(--ease-out) 900ms both; }
.landing__actions { animation: lt-rise var(--dur-slow) var(--ease-out) 480ms both; }
.landing__board { animation: lt-fade 1000ms var(--ease-out) 640ms both; }
.landing__footer { animation: lt-fade var(--dur-slow) var(--ease-out) 760ms both; }

@keyframes lt-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes lt-rise-now {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes lt-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lt-fade-now {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lt-draw {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes lt-tick {
  0% { color: var(--c-vermilion-ink); }
  100% { color: var(--c-ink); }
}

@keyframes lt-sway {
  0%, 100% { transform: rotate(-1.2deg); }
  50% { transform: rotate(1.2deg); }
}

/* --- Reduced motion: opacity only, no drawing, no sway -------------------- */
/* base.css collapses every animation to 1 ms here; the question keeps its
   short wait for live data (opacity only), so it is re-stated with !important. */

@media (prefers-reduced-motion: reduce) {
  .landing__header::after,
  .landing__slip,
  .landing__count-num.is-ticking { animation: none; }

  .landing__arrow { transition: none; }

  .landing__live {
    animation: lt-fade var(--dur-fast) linear both !important;
    animation-delay: 2400ms !important;
    animation-duration: var(--dur-fast) !important;
  }

  .landing__live.is-revealed {
    animation: lt-fade-now var(--dur-fast) linear both !important;
    animation-delay: 0ms !important;
    animation-duration: var(--dur-fast) !important;
  }
}
