/* Buttery Swing — homepage layer on top of css/styles.css (linked first):
   rotating headline word, flip-digit leaderboard + phone player,
   tee-to-green section and swaying grass. */
:root {
  --butter-deep: #c98f06;
  --ease: cubic-bezier(0.22, 0.9, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reveal-delay-2 { transition-delay: 0.24s; }

.hero {
  grid-template-columns: minmax(0, 420px) minmax(0, 700px);
  gap: 56px;
}

/* ======================= Rotating headline word (from Melt) ======================= */

.word-rotator {
  position: relative;
  display: inline-grid;
  vertical-align: bottom;
}

.word {
  grid-area: 1 / 1;
  font-style: italic;
  color: var(--butter-dark);
  opacity: 0;
  transform: translateY(0.45em) rotate(4deg);
  filter: blur(4px);
  transition: opacity 0.5s ease, transform 0.6s var(--spring), filter 0.5s ease;
}

.word.is-on { opacity: 1; transform: none; filter: none; }
.word.is-out { opacity: 0; transform: translateY(-0.45em) rotate(-4deg); filter: blur(4px); }

.word-butter {
  background: linear-gradient(100deg, var(--butter-deep) 0%, var(--butter-dark) 25%, #ffe27a 45%, var(--butter-dark) 60%, var(--butter-deep) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: 0.08em;
  animation: shimmer 5s linear infinite;
}

@keyframes shimmer { to { background-position: -250% 0; } }

.word-drip {
  position: absolute;
  left: 2%;
  bottom: -0.22em;
  width: 90%;
  height: 0.36em;
  fill: var(--butter);
  opacity: 0;
  transform-origin: top;
  transform: scaleY(0);
  transition: transform 0.9s var(--spring) 0.25s, opacity 0.3s ease 0.2s;
}

.word-rotator.is-butter .word-drip { opacity: 0.9; transform: scaleY(1); }

/* ======================= Scoreboard + phone (from Clubhouse) ======================= */

.board-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 216px;
  gap: 26px;
  align-items: center;
  margin-top: 26px;
}

.scoreboard {
  position: relative;
  padding-bottom: 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, #fffdf6, #f5f0dc);
  color: var(--ink);
  overflow: hidden;
  box-shadow:
    0 0 0 6px var(--green),
    0 0 0 7px rgba(224, 173, 22, 0.45),
    0 22px 40px -16px rgba(7, 61, 32, 0.45);
  margin: 7px;
}

.scoreboard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--green);
  border-bottom: 3px solid var(--butter);
}

.scoreboard-top h3 {
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
  font-size: 22px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--background);
}

.bolt {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f5f0dc, #9aa89e);
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.35);
}

.scoreboard-cols,
.lb-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}

.scoreboard-cols {
  padding-top: 10px;
  padding-bottom: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--green);
}

.scoreboard-cols span:last-child { text-align: right; }

.lb-row {
  position: relative;
  height: 68px;
  border-top: 1px solid rgba(11, 84, 43, 0.12);
  cursor: pointer;
  transition: background 0.4s ease;
}

.lb-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--butter-dark);
  transform: scaleY(0);
  transition: transform 0.45s var(--spring);
}

.lb-row:hover { background: rgba(255, 214, 74, 0.1); }
.lb-row.is-playing { background: linear-gradient(90deg, rgba(255, 214, 74, 0.3), rgba(255, 214, 74, 0.06)); }
.lb-row.is-playing::before { transform: scaleY(1); }
.lb-row:focus-visible { outline: 2px solid var(--butter-dark); outline-offset: -4px; }

.pos {
  display: grid;
  place-items: center;
  width: 34px;
  height: 42px;
  border-radius: 5px;
  background: var(--green);
  color: var(--background);
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 22px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}

.lb-row:first-of-type .pos { background: var(--butter); color: var(--green-dark); }

.who {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 21px;
  color: var(--green-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.who .avatar {
  flex: none;
  width: 28px;
  height: 28px;
  font-family: "DM Sans", sans-serif;
  font-size: 8px;
  letter-spacing: 0;
  border-color: #fffdf6;
  transition: box-shadow 0.4s ease;
}

.lb-row.is-playing .who .avatar { box-shadow: 0 0 0 3px var(--butter); }

.trophy {
  flex: none;
  width: 17px;
  height: 17px;
  color: var(--butter-dark);
  animation: trophy-bob 3s ease-in-out infinite;
}

/* Split-flap digits */
.flaps { display: flex; gap: 3px; }

.flap {
  position: relative;
  width: 30px;
  height: 44px;
  perspective: 300px;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 30px;
  line-height: 44px;
  text-align: center;
  color: var(--background);
}

.flap.is-point { width: 10px; color: var(--green); }
.flap.is-point::after { content: "."; position: absolute; inset: 0; }

.flap-half {
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  overflow: hidden;
  background: #0d4a27;
  backface-visibility: hidden;
}

.flap-half span { position: absolute; left: 0; right: 0; height: 44px; }
.flap-half.top, .flap-half.flip-top { top: 0; border-radius: 5px 5px 0 0; }
.flap-half.bottom, .flap-half.flip-bottom { bottom: 0; border-radius: 0 0 5px 5px; background: #0f5530; }
.flap-half.top span, .flap-half.flip-top span { top: 0; }
.flap-half.bottom span, .flap-half.flip-bottom span { bottom: 0; }

.flap::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(0, 0, 0, 0.45);
  z-index: 3;
}

.flap-half.flip-top {
  z-index: 2;
  transform-origin: bottom;
  animation: flip-top 0.14s ease-in forwards;
}

.flap-half.flip-bottom {
  z-index: 2;
  transform-origin: top;
  transform: rotateX(90deg);
  animation: flip-bottom 0.14s ease-out 0.14s forwards;
}

@keyframes flip-top { to { transform: rotateX(-90deg); } }
@keyframes flip-bottom { to { transform: rotateX(0); } }

.lb-row.is-playing .flap:not(.is-point) .flap-half { background: var(--butter-dark); }
.lb-row.is-playing .flap:not(.is-point) .flap-half.bottom,
.lb-row.is-playing .flap:not(.is-point) .flap-half.flip-bottom { background: var(--butter); }
.lb-row.is-playing .flap:not(.is-point) { color: var(--green-dark); }

.scoreboard-foot {
  margin: 12px 14px 0;
  padding-top: 12px;
  border-top: 1px dashed rgba(11, 84, 43, 0.25);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* ---- Phone ---- */

.phone-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.phone-halo {
  position: absolute;
  top: 8%;
  left: 50%;
  width: 320px;
  height: 320px;
  margin-left: -160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 74, 0.4), transparent 65%);
  filter: blur(10px);
  animation: halo-breathe 6s ease-in-out infinite;
}

@keyframes halo-breathe {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.08); opacity: 1; }
}

.phone {
  position: relative;
  width: 100%;
  padding: 24px 8px 8px;
  border-radius: 38px;
  background: linear-gradient(145deg, #2a3a30, #0b140f 60%);
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.12),
    0 36px 60px -24px rgba(7, 61, 32, 0.6),
    0 0 0 1px rgba(0, 0, 0, 0.6);
  transform: rotate(3deg);
  transition: transform 0.8s var(--spring);
}

.phone-wrap:hover .phone { transform: rotate(0) scale(1.02); }

.phone-notch {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 56px;
  height: 9px;
  margin-left: -28px;
  border-radius: 999px;
  background: #050806;
  z-index: 4;
}

.swing-stage {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 30px;
  overflow: hidden;
  background: #0b140f;
}

.swing-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.08);
  transition: opacity 0.8s ease, transform 1.2s var(--ease);
}

.swing-slide.is-active { opacity: 1; transform: none; }

.swing-video { display: block; width: 100%; height: 100%; object-fit: cover; }

.hud { position: absolute; inset: 0; pointer-events: none; }

.scanline {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 60px;
  background: linear-gradient(180deg, transparent, rgba(255, 214, 74, 0.18) 85%, rgba(255, 214, 74, 0.7));
  border-bottom: 1px solid rgba(255, 214, 74, 0.9);
  transform: translateY(-60px);
  mix-blend-mode: screen;
}

.phone-footer { position: relative; display: flex; flex-direction: column; align-items: center; gap: 9px; }

.now-playing {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
}

.now-playing strong { color: var(--green-dark); }

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--butter-dark);
  animation: live-pulse 1.8s ease-in-out infinite;
}

.phone-dots { display: flex; gap: 7px; }

.phone-dot {
  position: relative;
  width: 24px;
  height: 4px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  cursor: pointer;
}

.phone-dot span {
  position: absolute;
  inset: 0;
  background: var(--butter-dark);
  transform-origin: left;
  transform: scaleX(0);
}

.phone-dot:hover { background: var(--butter-soft); }
.phone-dot:focus-visible { outline: 2px solid var(--butter-dark); outline-offset: 3px; }

/* ======================= Tee to green (from Melt) ======================= */

.how {
  max-width: 1080px;
  margin: 0 auto;
  padding: 50px 22px 50px;
}

.how-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.how-head h2 { font-size: clamp(34px, 4.4vw, 54px); }

.flight {
  position: relative;
  height: 220px;
  margin: 20px 0 -40px;
}

.flight-arc {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.flight-arc path {
  fill: none;
  stroke: var(--butter-dark);
  stroke-width: 2.5;
  stroke-dasharray: 2 10;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  opacity: 0.7;
}

.flight-tee, .flight-flag {
  position: absolute;
  filter: drop-shadow(0 10px 14px rgba(11, 84, 43, 0.2));
}

.flight-tee  { left: 2%;  width: 96px; bottom: -14px; }

.flight-flag {
  right: 2%;
  width: 104px;
  bottom: -22px;
  transform-origin: 40% 90%;
  animation: flag-wave 3s ease-in-out infinite;
}

@keyframes flag-wave {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(2.5deg); }
}

.flight-ball {
  position: absolute;
  left: 0;
  top: 0;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #e9ece8 60%, #c9cfc9);
  box-shadow: 0 4px 10px rgba(7, 61, 32, 0.25);
  opacity: 0;
}

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 70px;
}

.step {
  position: relative;
  padding: 30px 26px 28px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(11, 84, 43, 0.1);
  box-shadow: 0 10px 22px rgba(11, 84, 43, 0.06);
  overflow: hidden;
  transition: transform 0.7s var(--ease), opacity 0.7s ease, box-shadow 0.4s ease;
}

.step::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--butter), var(--butter-dark));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease);
}

.step:hover { transform: translateY(-6px) rotate(-0.6deg); box-shadow: 0 22px 40px -12px rgba(11, 84, 43, 0.25); }
.step:hover::after { transform: scaleX(1); }

.step-num {
  position: absolute;
  top: 12px;
  right: 20px;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 64px;
  line-height: 1;
  color: var(--butter-soft);
  -webkit-text-stroke: 1.5px rgba(224, 173, 22, 0.5);
}

.step-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--butter);
  box-shadow: inset 0 -3px 0 rgba(201, 143, 6, 0.35);
  transition: transform 0.5s var(--spring);
}

.step:hover .step-icon { transform: rotate(-10deg) scale(1.08); }

.step-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--green-dark);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.step h3 {
  margin-top: 20px;
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
  font-size: 28px;
  color: var(--green-dark);
}

.step p { margin-top: 6px; font-size: 15px; color: var(--muted); line-height: 1.6; }

/* ======================= Grass (from Clubhouse) ======================= */

.site-footer { padding-bottom: 20px; }

.turf {
  position: relative;
  height: 110px;
  overflow: hidden;
  background: linear-gradient(180deg, transparent 72%, var(--green) 72%);
}

.grass {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  display: block;
}

.grass-back  { height: 104px; bottom: 6px; }
.grass-front { height: 84px; }

.grass path {
  transform-box: fill-box;
  transform-origin: bottom center;
  animation: sway var(--t, 4s) ease-in-out infinite alternate;
  animation-delay: var(--d, 0s);
}

.grass-back path  { fill: #6c8749; opacity: 0.55; }
.grass-front path { fill: var(--green); }

@keyframes sway {
  from { transform: rotate(-4deg); }
  to { transform: rotate(4deg); }
}

/* ======================= Responsive ======================= */

@media (max-width: 960px) {
  .hero { grid-template-columns: minmax(0, 660px); }
  /* Centred headline: keep each rotating word centred in its slot */
  .word-rotator { justify-items: center; }
  .steps { grid-template-columns: minmax(0, 520px); justify-content: center; }
}

@media (max-width: 640px) {
  .board-grid { grid-template-columns: minmax(0, 1fr); gap: 34px; }
  .phone-wrap { width: 220px; margin: 0 auto; }
  .flight { height: 150px; }
  .flight-tee { width: 64px; }
  .flight-flag { width: 70px; }
}

@media (max-width: 480px) {
  .scoreboard-cols, .lb-row { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; padding: 0 10px; }
  .lb-row { height: 60px; }
  .pos { width: 30px; height: 38px; font-size: 19px; }
  .who { font-size: 17px; gap: 6px; }
  .who .avatar { width: 24px; height: 24px; font-size: 7px; }
  .flap { width: 25px; height: 38px; font-size: 25px; line-height: 38px; }
  .flap.is-point { width: 8px; }
  .flap-half span { height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  .word, .word-drip, .step, .phone, .swing-slide { transition: none; }
  .word-butter, .phone-halo, .grass path, .flight-flag, .trophy { animation: none; }
  .flight-ball, .scanline { display: none; }
}
