/* ============================================================
   LOWLINE — Coming Soon
   Part A / Part B-4 準拠。要素を足さない。
   ロゴはグラフィティのタグ（A-8「メインフレーム＝グラフィティの LOWLINE」）を
   アルファマスクとして使い、--ink で着色する。よってロゴも経年変化する。
   ============================================================ */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

/* ---------- tokens ---------- */

:root {
  --asphalt:     #14120F;
  --asphalt-up:  #201C17;
  --sunfade:     #E6E1D6;
  --dust:        #7C7365;   /* アイコン・罫線（テキスト以外） */
  --dust-text:   #93897A;   /* テキスト用。--dust と同色相のまま明度のみ。
                               写真・逆光・経年90日のグレインを重ねた実測で AA を満たす値。 */
  --patina:      #6B7F6A;   /* 画面内 1 箇所のみ = .colophon の罫線 */
  --brass:       #A88B5C;   /* v1 では画面上に使わない */

  /* 経年変化。--age は 0（クリーン）〜 1（90 日）。既定値は必ず 0。 */
  --age: 0;
  --ink: color-mix(in oklab, var(--sunfade), var(--dust) calc(var(--age) * 14%));
  --grain-opacity: calc(var(--age) * 0.075);

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --pad-x: 24px;
  --pad-b: 28px;
  --ease: cubic-bezier(.16, .84, .3, 1);
  --ease-out: cubic-bezier(.18, .86, .28, 1);

  /* オープニングの時刻表 */
  --t-write:  .18s;   /* 明滅 → タグが書かれる（duration 1.15s、書き終わり 1.33s） */
  --t-scene: 1.26s;   /* 閃光と同時に現場が現れる */
  --t-kick:  1.30s;   /* 書き終わりの一撃 */
  --t-lede:  1.36s;
  --t-roots: 1.72s;
  --t-rule:  2.18s;
  --t-social:2.30s;
  --t-meta:  2.56s;
  --t-foot:  2.72s;
}

@supports not (color: color-mix(in oklab, red, blue)) {
  :root { --ink: var(--sunfade); }
}

/* ---------- base ---------- */

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

html, body { overflow-x: hidden; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--asphalt);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ガレージの逆光。ポインタに遅れて追従し、常にゆっくり呼吸している。 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(58vmax 58vmax at var(--mx, 16%) var(--my, 30%),
              rgba(230, 225, 214, .055), rgba(230, 225, 214, 0) 68%);
  animation: sheen 19s ease-in-out infinite;
}
@keyframes sheen {
  0%, 100% { transform: scale(1);    opacity: .68; }
  50%      { transform: scale(1.22); opacity: 1; }
}

/* タグが書き終わった瞬間の閃光。壁が一度だけ光る。app.js が .is-flash を付ける。 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(46vmax 46vmax at 26% 52%, rgba(230, 225, 214, .24), rgba(230, 225, 214, 0) 64%),
    linear-gradient(rgba(230, 225, 214, .05), rgba(230, 225, 214, .05));
}
body.is-flash::after { animation: flash .62s ease-out; }
@keyframes flash {
  0%   { opacity: 0; }
  7%   { opacity: 1; }     /* 立ち上がりは一瞬。減衰だけを見せる。 */
  100% { opacity: 0; }
}

/* ---------- scene : 現場の写真 ----------
   色処理は画像に焼き込み済み（tools/bake_photo.sh）。CSS フィルタは登場の一瞬だけ。
   ::after のスクリムがテキスト帯を完全にアスファルトへ戻すので、
   本文のコントラストは写真の有無に影響されない。 */

.scene {
  position: fixed;
  top: 0; left: 0; right: 0;
  /* 正方形の写真なので、帯の高さが幅を超えると車体が左右に切れる。100vw で頭打ちにする。 */
  height: min(52vh, 100vw);
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  translate: var(--px, 0) var(--py, 0);
}
.scene picture { display: block; width: 100%; height: 100%; }
.scene img {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 42%;
  animation: kenburns 46s ease-in-out infinite alternate;
}
@keyframes kenburns {
  from { transform: scale(1)    translate3d(0, 0, 0); }
  to   { transform: scale(1.06) translate3d(-1.2%, -1%, 0); }
}

.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
    rgba(20, 18, 15, .58) 0%,
    rgba(20, 18, 15, .34) 22%,
    rgba(20, 18, 15, .44) 48%,
    rgba(20, 18, 15, .84) 72%,
    rgba(20, 18, 15, .98) 88%,
    #14120F 100%);
}

@media (min-width: 900px) {
  .scene { left: auto; width: 60vw; height: min(70vh, 60vw); }
  .scene img { object-position: 50% 40%; }
  .scene::after {
    background:
      linear-gradient(to right,
        #14120F 0%, rgba(20, 18, 15, .70) 8%,
        rgba(20, 18, 15, .14) 32%, rgba(20, 18, 15, .26) 100%),
      linear-gradient(to bottom,
        rgba(20, 18, 15, .42) 0%, rgba(20, 18, 15, .20) 28%,
        rgba(20, 18, 15, .58) 68%, rgba(20, 18, 15, .96) 90%, #14120F 100%);
  }
}

/* 閃光と同時に、露出オーバーで飛んだ状態から現れて沈む。 */
.is-ready .scene picture {
  animation: arrive 2.5s cubic-bezier(.2, .8, .25, 1) var(--t-scene) backwards;
}
@keyframes arrive {
  0%   { opacity: 0; transform: scale(1.16); filter: brightness(2.4) saturate(1.7) blur(8px); }
  5%   { opacity: 1; transform: scale(1.15); filter: brightness(2.4) saturate(1.7) blur(7px); }
  34%  { opacity: 1; transform: scale(1.07); filter: brightness(1.18) saturate(1.12) blur(0); }
  100% { opacity: 1; transform: scale(1);    filter: none; }
}

/* フィルムグレイン。濃度は経過日数のみが決める。 */
.grain {
  position: fixed;
  inset: -10px;
  z-index: 3;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,<svg%20xmlns='http://www.w3.org/2000/svg'%20width='160'%20height='160'><filter%20id='g'%20x='0'%20y='0'%20width='100%'%20height='100%'><feTurbulence%20type='fractalNoise'%20baseFrequency='0.9'%20numOctaves='1'%20stitchTiles='stitch'%20result='t'/><feColorMatrix%20in='t'%20type='matrix'%20values='0%200%200%200%201%200%200%200%200%201%200%200%200%200%201%201%200%200%200%200'/><feComponentTransfer><feFuncA%20type='gamma'%20exponent='3'/></feComponentTransfer></filter><rect%20width='160'%20height='160'%20filter='url%28%23g%29'/></svg>");
  background-repeat: repeat;
  animation: drift 34s linear infinite;
  will-change: transform;
}
@keyframes drift {
  0%   { transform: translate3d(0, 0, 0); }
  25%  { transform: translate3d(-6px, 4px, 0); }
  50%  { transform: translate3d(4px, -5px, 0); }
  75%  { transform: translate3d(-3px, -4px, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* ---------- layout : 下寄せ ---------- */

.stage {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(40px, 10vh, 110px) var(--pad-x) calc(var(--pad-b) + env(safe-area-inset-bottom, 0px));
}

.stack { translate: var(--sx, 0) var(--sy, 0); }

@media (min-width: 900px) {
  :root { --pad-x: 64px; --pad-b: 44px; }
}

/* ---------- logo : グラフィティのタグ ---------- */

.logo {
  margin: 0 0 -1.5% 0;
  transform-origin: 8% 62%;
  translate: var(--lx, 0) var(--ly, 0);
  animation: breathe 14s ease-in-out infinite;   /* 常時。ページを止めない。 */
}
@keyframes breathe {
  0%, 100% { transform: scale(1)     rotate(0deg); }
  50%      { transform: scale(1.014) rotate(.35deg); }
}

.logo__mark {
  display: block;
  width: min(100%, 46rem, 88vh);
  aspect-ratio: 1280 / 362;
  -webkit-mask-image: url("logo-mask.png");
          mask-image: url("logo-mask.png");
  -webkit-mask-size: 100% 100%;    mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;  mask-repeat: no-repeat;
}

/* 書かれていく動き。斜めのグラデーションマスクを左から右へ通す。
   既定値は「全面表示」。JS もアニメーションも無い状態で完成形になる。 */
.logo__ink {
  display: block;
  width: 100%;
  height: 100%;
  background-color: var(--ink);
  /* マスク画像は要素の 2 倍幅。mask-position の % は「画像の X% 点を器の X% 点に合わせる」
     という比率合わせなので、幅 200% の画像では 118% → 0% で左から右へ塗られる。 */
  --stroke: linear-gradient(115deg,
            #000 0 50%, rgba(0,0,0,.45) 54%, rgba(0,0,0,0) 58%);
  -webkit-mask-image: var(--stroke);  mask-image: var(--stroke);
  -webkit-mask-size: 200% 100%;       mask-size: 200% 100%;
  -webkit-mask-repeat: no-repeat;     mask-repeat: no-repeat;
  -webkit-mask-position: 0 0;         mask-position: 0 0;
}

@keyframes write {
  0%   { opacity: 0;   -webkit-mask-position: 0 0;       mask-position: 0 0; }
  5%   { opacity: .45; -webkit-mask-position: 0 0;       mask-position: 0 0; }
  9%   { opacity: 0;   -webkit-mask-position: 0 0;       mask-position: 0 0; }
  14%  { opacity: .28; -webkit-mask-position: 0 0;       mask-position: 0 0; }
  18%  { opacity: 0;   -webkit-mask-position: 118% 0;    mask-position: 118% 0; }
  19%  { opacity: 1;   -webkit-mask-position: 118% 0;    mask-position: 118% 0;
         animation-timing-function: cubic-bezier(.38, .66, .36, 1); }
  100% { opacity: 1;   -webkit-mask-position: 0 0;       mask-position: 0 0; }
}

@keyframes land {
  0%, 18% { transform: translate3d(-3%, 2%, 0) rotate(-2deg) scale(1.09); filter: blur(6px);
            animation-timing-function: cubic-bezier(.38, .66, .36, 1); }
  62%     { transform: translate3d(.4%, -.3%, 0) rotate(.5deg) scale(1.008); filter: blur(.6px);
            animation-timing-function: cubic-bezier(.3, 1, .4, 1); }
  84%     { transform: translate3d(-.15%, 0, 0) rotate(-.18deg) scale(.997); filter: blur(0); }
  100%    { transform: none; filter: blur(0); }
}

/* ---------- type ---------- */

.lede {
  margin: .5em 0 0;
  font-family: var(--display);
  font-weight: 500;
  font-stretch: 92%;
  font-size: clamp(1.0625rem, min(4.9vw, 5.4vh), 2.375rem);
  line-height: 1.15;
  letter-spacing: .005em;
  word-spacing: .08em;
  color: var(--ink);
}
.lede .w { display: inline-block; }

.roots {
  display: flex;
  flex-direction: column;
  align-items: flex-start;      /* 文字幅に合わせる。タイプライターの steps がずれないように。 */
  gap: .28em;
  margin: 34px 0 0;
  font-size: clamp(.75rem, 3.1vw, .8125rem);
  line-height: 1.5;
  letter-spacing: .03em;
  color: var(--dust-text);
}
.roots span { white-space: nowrap; }

/* ---------- social ---------- */

.social {
  display: flex;
  gap: 4px;
  margin: 34px 0 0 -11px;   /* 44px ボックスの内側余白ぶんを戻し、左端をテキストに揃える */
  padding: 0;
  list-style: none;
}
.social li { display: flex; }

.social__mark {
  display: grid;
  place-items: center;
  width: 44px;              /* タップ領域 */
  height: 44px;
  color: var(--dust);
  transition: color .24s var(--ease), transform .24s var(--ease);
}
.social__mark svg { display: block; width: 22px; height: 22px; }

@media (hover: hover) {
  .social__mark:hover { color: var(--sunfade); transform: translateY(-3px) rotate(-4deg); }
}

/* ---------- meta ---------- */

.meta {
  display: flex;
  flex-direction: column;
  gap: .55em;
  margin: 26px 0 0;
  font-size: .6875rem;
  line-height: 1.6;
  letter-spacing: .16em;
  color: var(--dust-text);
}
@media (min-width: 720px) {
  .meta {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    font-size: .75rem;
  }
}

/* ---------- colophon ---------- */

.colophon {
  position: relative;
  margin-top: 22px;
  padding-top: 18px;
}
.colophon::before {           /* --patina はここ 1 箇所のみ */
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 1px;
  background: var(--patina);
  opacity: .55;
  transform-origin: 0 50%;
}

.motto {
  margin: 0;
  font-size: .6875rem;
  letter-spacing: .2em;
  color: var(--dust-text);
}
.legal {
  margin: 10px 0 0;
  max-width: 64ch;
  font-size: .625rem;
  line-height: 1.7;
  letter-spacing: .02em;
  color: var(--dust-text);
}
@media (min-width: 900px) {
  .roots  { margin-top: clamp(26px, 5.2vh, 46px); }
  .social { margin-top: clamp(24px, 4.8vh, 42px); }
  .meta   { margin-top: clamp(22px, 4.0vh, 36px); }
  .colophon { margin-top: clamp(18px, 3.4vh, 30px); padding-top: clamp(14px, 2.6vh, 24px); }
  .colophon { display: flex; align-items: baseline; justify-content: space-between; gap: 56px; }
  .motto { white-space: nowrap; }
  .legal { margin: 0; text-align: right; }
}

/* ---------- opening sequence ----------
   .is-ready は head 内スクリプトが初回描画前に付ける。
   JS が動かない場合はこのブロックが一切適用されず、静止した完成状態で表示される。
   fill-mode は backwards。both にすると終了後も to が残り、:hover を上書きしてしまう。 */

.is-ready [data-reveal],
.is-ready .lede .w {
  animation-fill-mode: backwards;
  animation-timing-function: var(--ease);
}

.is-ready .logo__ink { animation: write 1.15s linear var(--t-write) backwards; }
.is-ready .logo__mark { animation: land 1.15s linear var(--t-write) backwards; }

/* 書き終わりの一撃。壁が受けた衝撃。 */
.is-ready .stage { animation: kick .46s cubic-bezier(.3,.9,.3,1) var(--t-kick) backwards; }
@keyframes kick {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); }
  16%  { transform: translate3d(-9px, 5px, 0) rotate(-.22deg); }
  34%  { transform: translate3d(7px, -4px, 0) rotate(.16deg); }
  52%  { transform: translate3d(-5px, 2px, 0) rotate(-.1deg); }
  70%  { transform: translate3d(3px, -1px, 0) rotate(.05deg); }
  86%  { transform: translate3d(-1px, 1px, 0) rotate(0deg); }
  100% { transform: translate3d(0, 0, 0) rotate(0deg); }
}

/* 単語ごとに立ち上がる */
.is-ready .lede .w { animation-name: word; animation-duration: .72s; animation-delay: calc(var(--t-lede) + var(--i) * .055s); }
@keyframes word {
  from { opacity: 0; transform: translateY(.6em) skewX(-10deg); }
  to   { opacity: 1; transform: none; }
}

/* モノスペースを 1 文字ずつ打つ */
.is-ready [data-reveal="root"] {
  animation-name: type;
  animation-duration: calc(var(--n) * 26ms);
  animation-timing-function: steps(var(--n));
  animation-delay: calc(var(--t-roots) + var(--i) * .16s);
}
@keyframes type {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 -4% 0 0); }
}

.is-ready [data-reveal="social"] { animation-name: pop;  animation-duration: .72s; animation-delay: calc(var(--t-social) + var(--i) * .07s); }
@keyframes pop {
  0%   { opacity: 0; transform: translateY(16px) scale(.55) rotate(-14deg); }
  62%  { opacity: 1; transform: translateY(-4px) scale(1.09) rotate(4deg); }
  100% { opacity: 1; transform: none; }
}

.is-ready [data-reveal="meta"] { animation-name: rise; animation-duration: .8s; animation-delay: calc(var(--t-meta) + var(--i) * .08s); }
.is-ready [data-reveal="foot"] { animation-name: rise; animation-duration: .8s; animation-delay: calc(var(--t-foot) + var(--i) * .09s); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.is-ready .colophon::before {
  animation: draw .55s var(--ease-out) var(--t-rule) backwards;
}
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- a11y ---------- */

@media (prefers-reduced-motion: reduce) {
  .is-ready [data-reveal],
  .is-ready .lede .w,
  .is-ready .logo__ink,
  .is-ready .logo__mark,
  .is-ready .stage,
  .is-ready .colophon::before,
  .logo,
  .grain,
  .scene img,
  .is-ready .scene picture,
  body::before { animation: none; }
  .scene { translate: none; }
  .social__mark { transition: none; }
  body::after { display: none; }
  body.is-flash::after { animation: none; }
}

@media (prefers-contrast: more) {
  :root { --ink: var(--sunfade); }
  .grain { opacity: 0; }
}
