:root {
  --green: #1f3b2d;
  --cream: #efe7d6;
  --gold: #b9ae92;
  /* ロゴの文字サイズ。ダイヤルの大きさもここから決める */
  /* 低い画面では、ヒーローの名前以外の要素（約 260px）を差し引いた高さに収まる大きさまで下げる */
  --word: clamp(125px, min(40.5vw, (100svh - 260px) * 1.25), 574px);
  /* ダイヤルの直径＝FATHER の大文字の高さ（文字サイズの0.735倍）÷ 黄金比の5乗 */
  --dial: calc(var(--word) * 0.735 / 11.09);
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --gutter: clamp(20px, 5vw, 64px);
  --sans-ja: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  /* 帆布の織り目（横糸の影・縦糸の光）と、糸のざらつき */
  --weave:
    repeating-linear-gradient(0deg, rgb(0 0 0 / 4.5%) 0 0.8px, transparent 0.8px 3px),
    repeating-linear-gradient(90deg, rgb(255 255 255 / 6%) 0 0.8px, transparent 0.8px 3px);
  /* 深緑の地では白い縦糸が目立つので、光を弱めて影を少し強くする */
  --weave-dark:
    repeating-linear-gradient(0deg, rgb(0 0 0 / 9%) 0 0.8px, transparent 0.8px 3px),
    repeating-linear-gradient(90deg, rgb(255 255 255 / 2.5%) 0 0.8px, transparent 0.8px 3px);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background-color: var(--cream);
  background-image: var(--grain), var(--weave);
  color: var(--green);
  font-family: var(--sans-ja);
  -webkit-font-smoothing: antialiased;
}

/* 深緑の面がスクロールに遅れて下へずれた分で、ページの高さが伸びないようにする */
main {
  overflow: clip;
}

/* 1 画面目。スクロールしても画面に留まり、下から深緑の面が重なってくる */
.hero {
  position: sticky;
  user-select: none;
  -webkit-user-select: none;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100svh;
  padding: 40px var(--gutter) 56px;
  overflow: hidden;
}

.place {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.18em;
}

.wordmark {
  margin: auto 0;
  font-family: "League Gothic", "Arial Narrow", sans-serif;
  font-weight: 400;
  font-size: var(--word);
  line-height: 0.8;
  letter-spacing: -0.01em;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}

/* 代わりの書体は幅が広く、はみ出して切れて見えるので、名前の書体が届くまで隠す */
.js:not(.ready) .wordmark {
  opacity: 0;
}

.wordmark span {
  display: inline-block;
}

/* 線の右端にアイコンを乗せる。線はアイコンの手前で止める */
.rule {
  position: relative;
  flex: none;
  height: 2px;
}

.rule::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: calc(100% - var(--dial) - 6px);
  height: 2px;
  background: var(--green);
  transform-origin: left;
}

/* JS が動く時は、左端が垂れた紐（app.js が形を描く）に置き換える */
.cord {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: calc(100% - var(--dial) - 6px);
  height: 2px;
  overflow: visible;
  transform-origin: left;
}

.cord path {
  fill: none;
  stroke: var(--green);
  stroke-width: 2;
}

.js .cord {
  display: block;
}

/* 垂れる左端の押せる範囲。引っ張られた時の垂れ（最大 36px）まで含める */
.cord-hit {
  display: none;
  position: absolute;
  top: -16px;
  left: -12px;
  width: 96px;
  height: 60px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.cord-hit:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.js .cord-hit {
  display: block;
}

.js .rule::before {
  display: none;
}

.dial {
  position: absolute;
  top: calc(1px - var(--dial) / 2);
  left: calc(100% - var(--dial));
  width: var(--dial);
  height: var(--dial);
  color: var(--green);
}

/* 2 画面目。深緑の帆布に生成りの文字で、色を反転させる */
.signup-area {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  padding: 72px var(--gutter) 0;
  background-color: var(--green);
  background-image: var(--grain), var(--weave-dark);
  color: var(--cream);
}

.bottom {
  margin: auto 0;
}

.soon {
  margin: 0;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.soon.typing::after {
  content: "_";
  animation: blink 1s steps(1) infinite;
}

.tagline {
  margin: 28px 0 32px;
  font-size: clamp(24px, 2.8vw, 40px);
  font-weight: 700;
  line-height: 1.5;
}

/* 狭い画面だけ「札幌から、」で改行する */
.narrow-break {
  display: none;
}

/* 扱う物を値札のような枠で並べる */
.items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.items li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 16px;
  border: 1.5px solid var(--cream);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.items span {
  font-family: var(--sans-ja);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  opacity: 0.7;
}

.items-note {
  margin: 16px 0 48px;
  font-size: 15px;
  line-height: 1.8;
  opacity: 0.85;
}

/* 入力欄の右に「準備ができたら…」を添える */
.signup {
  display: grid;
  grid-template-columns: min(440px, 100%) auto;
  align-items: center;
  column-gap: 24px;
}

.lead {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  opacity: 0.7;
}

.row {
  display: flex;
}

.signup input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border: 1.5px solid var(--cream);
  border-right: 0;
  border-radius: 0;
  background: transparent;
  color: var(--cream);
  font-family: var(--mono);
  font-size: 16px;
}

.signup input::placeholder {
  color: var(--gold);
  opacity: 1;
}

.signup input:focus-visible,
.signup button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.signup button {
  flex: none;
  padding: 0 24px;
  border: 1.5px solid var(--cream);
  border-radius: 0;
  background: var(--cream);
  color: var(--green);
  font-family: var(--sans-ja);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

.signup button:disabled {
  opacity: 0.6;
  cursor: default;
}

/* 送信結果は入力欄と添え書きの下に、横幅いっぱいで出す */
.status {
  grid-column: 1 / -1;
  min-height: 1.7em;
  margin: 10px 0 0;
  font-size: 16px;
}

.trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 48px 0 28px;
  font-family: var(--mono);
  font-size: 12px;
}

.footer a {
  color: var(--cream);
  opacity: 0.7;
}

.footer small {
  font-size: inherit;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

/* スマホ: 名前を線のすぐ上に寄せ、上は生地だけを見せる */
@media (max-width: 480px) {
  /* 小さい画面では 1 段大きく（黄金比の 4 乗）しないと、ダイヤルの穴が潰れる */
  :root {
    --dial: calc(var(--word) * 0.735 / 6.854);
  }

  .hero {
    padding-top: 24px;
    padding-bottom: 40px;
  }

  .place {
    font-size: 11px;
  }

  .cord-hit {
    width: 64px;
  }

  .wordmark {
    margin: auto 0 24px;
  }

  .signup-area {
    padding-top: 56px;
  }

  .soon {
    font-size: 18px;
  }

  .tagline {
    margin: 20px 0;
  }

  .narrow-break {
    display: inline;
  }

  .items {
    gap: 8px;
  }

  .items li {
    padding: 8px 12px;
    font-size: 12px;
  }

  .items span {
    font-size: 11px;
  }

  .items-note {
    margin: 12px 0 32px;
  }

  .signup {
    grid-template-columns: 100%;
  }

  .lead {
    margin-top: 10px;
  }

  .signup button {
    padding: 0 18px;
  }
}

/* 開いた時の動き: 名前がせり上がる → 線が引かれ、アイコンが転がって右端で止まる。
   「Coming soon.」は見えた時に打つ（app.js） */
@media (prefers-reduced-motion: no-preference) {
  .wordmark span {
    animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.1, 1) backwards;
    animation-delay: calc(var(--i) * 70ms + 0.2s);
  }

  .rule::before,
  .cord {
    animation: draw 1.2s cubic-bezier(0.6, 0, 0.2, 1) 1s backwards;
  }

  .dial {
    animation: roll 1.2s cubic-bezier(0.6, 0, 0.2, 1) 1s backwards;
  }

  /* 名前のフォントが届くまでは動き出す前の姿で止めておく（index.html の head で ready を付ける） */
  .js:not(.ready) .wordmark span,
  .js:not(.ready) .cord,
  .js:not(.ready) .dial {
    animation-play-state: paused;
  }
}

@keyframes rise {
  from {
    transform: translateY(105%);
  }
}

@keyframes draw {
  from {
    transform: scaleX(0);
  }
}

@keyframes roll {
  from {
    left: 0;
    transform: rotate(-720deg);
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* アクセスの計測に同意するかを聞く、画面の上の帯（consent.js が出す）。出ている間は、帯の高さ（--consent-height）の分だけ上を空ける */
html {
  scroll-padding-top: var(--consent-height, 0px);
}

.consent {
  position: fixed;
  z-index: 10;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 20px 12px;
  background: var(--green);
  color: var(--cream);
  font-family: var(--sans-ja);
  line-height: 1.25;
}

.consent-text {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
}

.consent-text p {
  margin: 0;
  font-size: 14px;
}

.consent-text a {
  color: var(--cream);
  font-size: 13px;
  opacity: 0.8;
}

.consent-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  flex: 1 1 280px;
  max-width: 360px;
}

.consent-choice {
  padding: 6px 16px;
  border: 1.5px solid var(--cream);
  border-radius: 0;
  background: transparent;
  color: var(--cream);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.consent-choice:hover {
  background: rgb(239 231 214 / 12%);
}

.consent-choice:focus-visible,
.consent-text a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* 登録できた時に出す札。紐で画面の上から吊り下がり、受付の日付のスタンプが押してある（app.js が開く） */
.thanks {
  --stamp: #a5452f;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: clamp(40px, 22svh, 200px) 20px 40px;
  overflow: hidden auto;
  border: 0;
  background: transparent;
  color: var(--green);
}

.thanks::backdrop {
  background: rgb(14 29 22 / 55%);
}

.thanks-tag {
  position: relative;
  width: 240px;
  margin: 0 auto;
  transform: rotate(-4deg);
  transform-origin: 50% 37px;
}

/* 紐は札の穴から、画面の上の端の先まで伸ばす */
.thanks-tag::before {
  content: "";
  position: absolute;
  bottom: calc(100% - 37px);
  left: calc(50% - 1px);
  width: 2px;
  height: 100svh;
  background: var(--cream);
}

.thanks-card {
  position: relative;
  padding: 64px 20px 28px;
  background-color: var(--cream);
  background-image: var(--grain), var(--weave);
  box-shadow: 0 18px 40px rgb(0 0 0 / 28%);
  text-align: center;
}

/* 札の穴 */
.thanks-card::before {
  content: "";
  position: absolute;
  top: 28px;
  left: calc(50% - 9px);
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--green);
  border-radius: 50%;
}

.thanks-big {
  margin: 0;
  font-family: "League Gothic", "Arial Narrow", sans-serif;
  font-size: 64px;
  line-height: 1.2;
}

.thanks-place {
  margin: 0 0 20px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
}

.thanks-title {
  margin: 0;
  padding-top: 18px;
  border-top: 1px dashed var(--green);
  font-size: 16px;
  font-weight: 700;
}

.thanks-note {
  margin: 6px 0 20px;
  font-size: 13px;
  line-height: 1.6;
}

.thanks-close {
  padding: 8px 26px;
  border: 1.5px solid var(--green);
  border-radius: 0;
  background: transparent;
  color: var(--green);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.thanks-close:hover {
  background: rgb(31 59 45 / 8%);
}

.thanks-close:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

/* 受付の日付のスタンプ。札の右下の端にかかるように押す */
.thanks-stamp {
  position: absolute;
  right: -24px;
  bottom: -14px;
  display: grid;
  place-content: center;
  width: 108px;
  height: 108px;
  margin: 0;
  border: 2.5px solid var(--stamp);
  border-radius: 50%;
  color: var(--stamp);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  line-height: 1.3;
  text-align: center;
  transform: rotate(12deg);
  opacity: 0.92;
}

.thanks-stamp-day {
  font-family: "League Gothic", "Arial Narrow", sans-serif;
  font-size: 30px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.1;
}

/* 札はぶらんと揺れながら落ちてきて、止まったところへスタンプをドンと押す。押された勢いで札が少し沈む */
@media (prefers-reduced-motion: no-preference) {
  .thanks[open]::backdrop {
    animation: fade-in 0.3s ease-out;
  }

  .thanks[open] .thanks-tag {
    animation: drop 1.1s cubic-bezier(0.3, 0.6, 0.4, 1) backwards;
  }

  .thanks[open] .thanks-card {
    animation: thud 0.32s ease-out 1.38s;
  }

  .thanks[open] .thanks-stamp {
    animation: stamp 0.26s cubic-bezier(0.6, 0, 0.9, 0.5) 1.2s backwards;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes drop {
  0% {
    transform: translateY(-110svh) rotate(-14deg);
  }
  45% {
    transform: translateY(14px) rotate(7deg);
  }
  62% {
    transform: translateY(-4px) rotate(-9deg);
  }
  78% {
    transform: translateY(0) rotate(1deg);
  }
  90% {
    transform: rotate(-6deg);
  }
  100% {
    transform: rotate(-4deg);
  }
}

@keyframes stamp {
  0% {
    opacity: 0;
    transform: translate(40px, -60px) scale(2.6) rotate(30deg);
  }
  70% {
    opacity: 0.92;
    transform: scale(0.9) rotate(12deg);
  }
  100% {
    transform: scale(1) rotate(12deg);
  }
}

@keyframes thud {
  30% {
    transform: translateY(5px) scale(0.985);
  }
}
