/* ==========================================================================
   Digital wall — "/wall"                                    owner: visitor
   --------------------------------------------------------------------------
   A sticky bar (brand ⇄ live question, count), a generous hero with the
   question, then every story as tanzaku paper on a masonry of CSS columns,
   newest first. On phones the single column hangs notes slightly left and
   right, like strips on a cord. Builds on tokens.css / base.css /
   components.css (.note + --enter/--leave/--highlight, .btn, .fab-add).
   ========================================================================== */

.page-wall {
  --wall-max: 1800px;
  --wall-gutter: clamp(16px, 4.6vw, 72px);
  --pad-l: max(var(--wall-gutter), var(--safe-left));
  --pad-r: max(var(--wall-gutter), var(--safe-right));
  --col-gap: clamp(16px, 2.2vw, 36px);
  --bar-h: 56px;
  color: var(--c-ink);
}

@media (min-width: 720px) {
  .page-wall { --bar-h: 64px; }
}

/* Projector and very large screens: scale the whole page up a step
   (notes are sized in em, so they scale with it). */
@media (min-width: 1600px) and (min-height: 820px) {
  :root { font-size: 112.5%; }
}

@media (min-width: 2400px) {
  :root { font-size: 137.5%; }
}

/* --- Skip link ------------------------------------------------------------ */

.wall-skip {
  position: absolute;
  left: var(--pad-l);
  top: 0;
  z-index: 60;
  padding: 10px 16px;
  border-radius: var(--radius-s);
  background: var(--c-ink);
  color: var(--c-paper);
  font-weight: 500;
  text-decoration: none;
  transform: translateY(-120%);
  transition: transform var(--dur-fast) var(--ease-out);
}

.wall-skip:hover { color: var(--c-paper); }

.wall-skip:focus,
.wall-skip:focus-visible {
  transform: translateY(calc(8px + var(--safe-top)));
}

/* --- Sticky bar ----------------------------------------------------------- */

.wall-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding-top: var(--safe-top);
  background-color: var(--c-cream);
  border-bottom: 1px solid var(--c-line);
}

/* Vermilion hairline drawn across once the hero question scrolls away. */
.wall-bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--c-vermilion);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--dur-slow) var(--ease-out);
}

.wall-bar.is-condensed::after { transform: scaleX(1); }

.wall-bar__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--bar-h);
  max-width: var(--wall-max);
  margin-inline: auto;
  padding-left: var(--pad-l);
  padding-right: var(--pad-r);
}

.wall-bar__home {
  flex: none;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin-left: -10px;
  border-radius: var(--radius-s);
}

.wall-bar__home .brand__mark {
  height: 30px;
}

.wall-bar__slot {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  align-items: center;
}

.wall-bar__slot > * {
  grid-area: 1 / 1;
  min-width: 0;
  margin: 0;
  transition:
    opacity var(--dur) var(--ease-out),
    transform var(--dur) var(--ease-out);
}

.wall-bar__name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.wall-bar__name .brand__name {
  font-size: 1rem;
  color: var(--c-ink);
}

.wall-bar__jp {
  margin-left: 0.6em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.3em;
  color: var(--c-vermilion-ink);
}

.wall-bar__question {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1.3;
  color: var(--c-ink);
  text-wrap: balance;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.wall-bar.is-condensed .wall-bar__name {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.wall-bar.is-condensed .wall-bar__question {
  opacity: 1;
  transform: none;
}

.wall-bar__count {
  flex: none;
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1;
  color: var(--c-ink-2);
  white-space: nowrap;
  font-variant-numeric: lining-nums tabular-nums;
}

.wall-bar__count b {
  margin-right: 0.05em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--c-ink);
}

.wall-bar__ar {
  display: none;
}

@media (max-width: 419px) {
  .wall-bar__jp { display: none; }
}

@media (min-width: 720px) {
  /* The bar carries the AR link from here up; the hero copy would repeat it. */
  .wall-hero__meta .wall-hero__ar { display: none; }
  .wall-bar__name .brand__name { font-size: 1.0625rem; }
  .wall-bar__question { font-size: 1.0625rem; -webkit-line-clamp: 1; }
  .wall-bar__count { padding-right: var(--sp-5); border-right: 1px solid var(--c-line); }
  .wall-bar__ar {
    display: inline-flex;
    flex: none;
    align-items: center;
    min-height: 44px;
    font-size: var(--fs-small);
    font-weight: 500;
    letter-spacing: var(--tracking-ui);
    color: var(--c-ink);
    text-decoration: none;
  }
  .wall-bar__ar:hover { color: var(--c-vermilion-ink); }
}

/* --- Drawn arrow ---------------------------------------------------------- */

.wall-arrow {
  position: relative;
  display: inline-block;
  flex: none;
  width: 1.1em;
  height: 1px;
  margin-left: 0.6em;
  background: currentColor;
  transition: transform var(--dur-fast) var(--ease-out);
}

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

@media (hover: hover) {
  a:hover > .wall-arrow { transform: translateX(3px); }
}

/* --- Hero ----------------------------------------------------------------- */

.wall-hero {
  max-width: var(--wall-max);
  margin-inline: auto;
  padding: clamp(40px, 8vw, 120px) var(--pad-r) clamp(32px, 5vw, 72px) var(--pad-l);
}

.wall-hero__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);
}

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

.wall-hero__question {
  margin: 0;
  max-width: 19em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 1.05rem + 3.2vw, 4rem);
  line-height: 1.28;
  letter-spacing: 0.005em;
  color: var(--c-ink);
  overflow-wrap: break-word;
  text-wrap: balance;
  /* Waits for live data so a stale question never flashes (fallback: 2.4 s). */
  animation: wall-rise 700ms var(--ease-out) 2400ms both;
}

.wall-hero__question.is-revealed {
  animation: wall-rise-now 760ms var(--ease-out) 0ms both;
}

.wall-hero__question[data-len="m"] {
  max-width: 22em;
  font-size: clamp(1.5rem, 1rem + 2.5vw, 3.25rem);
}

.wall-hero__question[data-len="l"] {
  max-width: 26em;
  font-size: clamp(1.375rem, 0.95rem + 1.9vw, 2.625rem);
  line-height: 1.34;
}

.wall-hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-6);
  margin-top: clamp(24px, 4vw, 48px);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--c-line);
}

.wall-hero__count {
  display: flex;
  align-items: baseline;
  gap: 0.45em;
  min-height: 2.5rem;
  margin: 0;
  font-size: 0.9375rem;
  color: var(--c-ink-2);
  font-variant-numeric: lining-nums tabular-nums;
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
}

.wall-hero__count[data-ready="true"] { opacity: 1; }

.wall-hero__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.5rem);
  line-height: 1;
  color: var(--c-ink);
}

.wall-hero__num.is-ticking { animation: wall-tick 900ms var(--ease-out); }

.wall-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.9375rem;
  font-weight: 500;
}

.wall-link--quiet { color: var(--c-ink-2); }

.wall-paused {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-5) 0 0;
  padding: var(--sp-3) var(--sp-4);
  background-color: var(--c-paper);
  border: 1px solid var(--c-line);
  border-left: 2px solid var(--c-vermilion);
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--c-ink);
}

.wall-paused__mark {
  flex: none;
  width: 8px;
  height: 8px;
  border: 1px solid var(--c-vermilion);
  border-radius: 50%;
}

/* --- Board: CSS-column masonry ------------------------------------------- */

.wall-board {
  max-width: var(--wall-max);
  margin-inline: auto;
  padding: var(--sp-2) var(--pad-r) var(--sp-8) var(--pad-l);
}

.wall-board:focus { outline: none; }

.wall-list {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
  column-width: 15rem;
  column-gap: var(--col-gap);
}

/* Each strip hangs from a string ~0.8em above the paper: leave room on top. */
.wall-item {
  display: block;
  margin: 0;
  padding: 14px 0 calc(var(--col-gap) * 0.6);
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  break-inside: avoid;
}

/* Phones: a single column hung alternately left and right. */
@media (max-width: 559px) {
  .wall-item[data-side="l"] { padding-right: 9%; }
  .wall-item[data-side="r"] { padding-left: 9%; }
}

.wall-item.is-leaving { pointer-events: none; }

/* --- Loading -------------------------------------------------------------- */

.wall-loading {
  display: grid;
  justify-items: center;
  gap: var(--sp-4);
  padding: clamp(48px, 10vw, 120px) 0;
  text-align: center;
  color: var(--c-ink-2);
}

.wall-loading__line {
  width: 72px;
  height: 1px;
  background: var(--c-vermilion);
  transform-origin: left center;
  animation: wall-loading 1800ms var(--ease-out) infinite;
}

.wall-loading__text {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-lead);
}

.wall-loading__slow {
  margin: 0;
  max-width: 26em;
  font-size: var(--fs-small);
  animation: wall-fade 400ms linear 10s both;
}

/* --- Empty ---------------------------------------------------------------- */

.wall-empty {
  display: grid;
  justify-items: center;
  gap: var(--sp-5);
  padding: clamp(16px, 4vw, 48px) 0 clamp(48px, 8vw, 112px);
  text-align: center;
}

.wall-empty.is-entering { animation: wall-fade var(--dur-slow) var(--ease-out) both; }

.wall-empty__slip {
  position: relative;
  width: 72px;
  height: 188px;
  margin-top: 56px;
  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% -52px;
  animation: wall-sway 7s ease-in-out infinite;
}

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

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

.wall-empty__text {
  margin: 0;
  max-width: 16em;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.25rem, 1rem + 1.1vw, 1.875rem);
  line-height: 1.45;
  color: var(--c-ink);
  text-wrap: balance;
}

/* --- Add button ----------------------------------------------------------- */

.is-sheet-open .fab-add {
  visibility: hidden;
}

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

.wall-footer {
  display: grid;
  gap: var(--sp-3);
  max-width: var(--wall-max);
  margin-inline: auto;
  padding: var(--sp-6) var(--pad-r) calc(var(--fab-clearance) + var(--sp-4)) var(--pad-l);
  font-size: var(--fs-small);
  color: var(--c-ink-2);
}

.wall-footer::before {
  content: "";
  display: block;
  height: 1px;
  margin-bottom: var(--sp-3);
  background: linear-gradient(to right, var(--c-vermilion) 0 48px, var(--c-line) 48px);
}

.wall-footer__privacy { margin: 0; max-width: 34em; line-height: 1.6; }

.wall-footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--sp-5);
}

.wall-footer__brand {
  margin: var(--sp-2) 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--c-ink);
}

.wall-footer__brand [lang="ja"] {
  margin-left: 0.5em;
  font-size: 0.875em;
  letter-spacing: 0.3em;
  color: var(--c-vermilion-ink);
}

@media (min-width: 720px) {
  .wall-footer {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .wall-footer::before { grid-column: 1 / -1; }
  .wall-footer__brand { grid-column: 1 / -1; }
}

/* --- Keyframes ------------------------------------------------------------ */

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

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

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

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

@keyframes wall-tick {
  from { color: var(--c-vermilion-ink); }
  to { color: var(--c-ink); }
}

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

@keyframes wall-loading {
  0% { transform: scaleX(0); transform-origin: left center; }
  50% { transform: scaleX(1); transform-origin: left center; }
  50.1% { transform: scaleX(1); transform-origin: right center; }
  100% { transform: scaleX(0); transform-origin: right center; }
}

/* --- Reduced motion ------------------------------------------------------- */
/* base.css collapses every animation to 1 ms here. Two timed reveals must keep
   their delay (opacity only), so they are re-stated with !important. */

@media (prefers-reduced-motion: reduce) {
  .wall-bar__question,
  .wall-bar.is-condensed .wall-bar__name { transform: none; }

  .wall-empty__slip,
  .wall-hero__num.is-ticking { animation: none; }

  .wall-loading__line { animation: none; opacity: 0.6; }

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

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

  .wall-loading__slow {
    animation: wall-fade var(--dur-fast) linear both !important;
    animation-delay: 10s !important;
    animation-duration: var(--dur-fast) !important;
  }
}
