/* Avey Kay — cabin controls, letter seals, station chips */

.btn {
  --btn-face: rgba(36, 24, 16, 0.72);
  --btn-edge: rgba(243, 235, 224, 0.28);
  --btn-ink: var(--cream);
  --btn-glow: rgba(212, 184, 150, 0.35);

  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 3rem;
  padding: 0.7rem 1.35rem 0.7rem 1.15rem;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid var(--btn-edge);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(255, 240, 210, 0.08), transparent 42%),
    linear-gradient(180deg, var(--btn-face), rgba(18, 10, 6, 0.88));
  color: var(--btn-ink);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow:
    0 1px 0 rgba(255, 240, 210, 0.1) inset,
    0 -1px 0 rgba(0, 0, 0, 0.35) inset,
    0 10px 22px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
  transition:
    transform 0.22s var(--ease),
    box-shadow 0.22s var(--ease),
    border-color 0.22s var(--ease),
    color 0.22s var(--ease),
    background 0.22s var(--ease);
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    repeating-linear-gradient(
      -18deg,
      transparent,
      transparent 3px,
      rgba(255, 255, 255, 0.015) 3px,
      rgba(255, 255, 255, 0.015) 4px
    );
  opacity: 0.7;
  pointer-events: none;
}

.btn::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 1px;
  background: var(--wheat);
  box-shadow: 0 0 10px var(--btn-glow);
  transform: translateY(-50%);
  opacity: 0.85;
  transition: transform 0.22s var(--ease), opacity 0.22s var(--ease), background 0.22s var(--ease);
}

.btn .btn-label {
  padding-left: 0.85rem;
}

.btn:hover,
.btn:focus-visible {
  border-color: rgba(212, 184, 150, 0.7);
  transform: translateY(-2px);
  box-shadow:
    0 1px 0 rgba(255, 240, 210, 0.16) inset,
    0 -1px 0 rgba(0, 0, 0, 0.35) inset,
    0 14px 28px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(212, 184, 150, 0.12);
}

.btn:hover::after,
.btn:focus-visible::after {
  transform: translateY(-50%) scale(1.15);
  opacity: 1;
}

.btn:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.35) inset,
    0 4px 10px rgba(0, 0, 0, 0.25);
}

.btn:focus-visible {
  outline: 2px solid var(--wheat);
  outline-offset: 3px;
}

/* Primary — sun-warmed dash switch */
.btn-solid,
.btn-tape {
  --btn-face: #c9a87a;
  --btn-edge: #e6d2b0;
  --btn-ink: #2a221c;
  --btn-glow: rgba(255, 220, 160, 0.55);
  background:
    linear-gradient(180deg, #f0dfc2 0%, #d4b896 38%, #b89168 100%);
  letter-spacing: 0.18em;
}

.btn-solid::after,
.btn-tape::after {
  background: #2a221c;
  box-shadow: none;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent #2a221c;
  border-radius: 0;
  left: 1.05rem;
}

.btn-solid .btn-label,
.btn-tape .btn-label {
  padding-left: 1rem;
}

.btn-solid:hover,
.btn-solid:focus-visible,
.btn-tape:hover,
.btn-tape:focus-visible {
  --btn-edge: #fff1d8;
  background:
    linear-gradient(180deg, #fff0d8 0%, #e2c49a 42%, #c4a070 100%);
  color: #1c1510;
}

.btn-tape.is-playing {
  --btn-face: #b89168;
  box-shadow:
    0 1px 0 rgba(255, 240, 210, 0.12) inset,
    0 0 0 1px rgba(212, 184, 150, 0.35),
    0 0 22px rgba(212, 184, 150, 0.28);
}

.btn-tape.is-playing::after {
  width: 8px;
  height: 10px;
  border: 0;
  background:
    linear-gradient(#2a221c, #2a221c) 0 0 / 2.5px 100% no-repeat,
    linear-gradient(#2a221c, #2a221c) 100% 0 / 2.5px 100% no-repeat;
}

/* Secondary — letter / envelope seal */
.btn-letter {
  --btn-face: rgba(42, 28, 18, 0.55);
  --btn-edge: rgba(232, 213, 181, 0.4);
  border-style: dashed;
  border-width: 1.5px;
  letter-spacing: 0.16em;
}

.btn-letter::after {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #f3ebe0 0 22%, transparent 24%),
    radial-gradient(circle at 50% 50%, #a67c5d 0 62%, #8a5a3c 63%);
  box-shadow: 0 0 0 1px rgba(243, 235, 224, 0.25);
}

.btn-letter:hover,
.btn-letter:focus-visible {
  border-style: solid;
  background:
    linear-gradient(180deg, rgba(255, 240, 210, 0.12), transparent 50%),
    rgba(56, 36, 24, 0.72);
}

/* Platform / station chips — stamped tickets, not pills */
.btn-station,
.cta-row .btn:not(.btn-solid):not(.btn-tape):not(.btn-letter) {
  min-height: 2.55rem;
  padding: 0.55rem 1rem 0.55rem 0.9rem;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(243, 235, 224, 0.1), transparent 45%),
    rgba(24, 16, 10, 0.55);
}

.btn-station::after,
.cta-row .btn:not(.btn-solid):not(.btn-tape):not(.btn-letter)::after {
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--sage);
  box-shadow: 0 0 8px rgba(138, 154, 123, 0.55);
}

.btn-station:hover,
.btn-station:focus-visible,
.cta-row .btn:not(.btn-solid):not(.btn-tape):not(.btn-letter):hover,
.cta-row .btn:not(.btn-solid):not(.btn-tape):not(.btn-letter):focus-visible {
  border-color: var(--sage);
  color: #f7f0e4;
}

/* Closing row gets station treatment via class from JS */

/* Envelope open control */
.envelope-face {
  position: relative;
  border: 0;
  border-radius: 0;
  cursor: pointer;
}

.envelope-face::before {
  content: "";
  position: absolute;
  top: 0.85rem;
  right: 1rem;
  width: 1.65rem;
  height: 1.65rem;
  border: 1px dashed rgba(166, 124, 93, 0.55);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(212, 184, 150, 0.35), transparent 65%);
  transition: transform 0.28s var(--ease), background 0.28s var(--ease), border-color 0.28s var(--ease);
}

.envelope-face::after {
  content: "";
  position: absolute;
  top: 1.35rem;
  right: 1.5rem;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 1.5px solid var(--clay);
  border-bottom: 1.5px solid var(--clay);
  transform: rotate(45deg);
  transition: transform 0.28s var(--ease);
}

.envelope.is-open .envelope-face::before {
  border-style: solid;
  border-color: var(--clay);
  background: rgba(212, 184, 150, 0.35);
}

.envelope.is-open .envelope-face::after {
  transform: rotate(225deg);
  top: 1.45rem;
}

.envelope-face:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 3px;
}

/* Deck play — brass knob */
.deck-btn {
  position: relative;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 1px solid rgba(243, 235, 224, 0.35);
  background:
    radial-gradient(circle at 32% 28%, #f2e2c4 0%, #d4b896 42%, #8a6544 100%);
  box-shadow:
    0 1px 0 rgba(255, 245, 220, 0.45) inset,
    0 -2px 4px rgba(0, 0, 0, 0.35) inset,
    0 6px 14px rgba(0, 0, 0, 0.4);
  transition:
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    filter 0.2s var(--ease);
}

.deck-btn::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 1px solid rgba(42, 34, 28, 0.18);
  pointer-events: none;
}

.deck-btn:hover,
.deck-btn:focus-visible {
  filter: brightness(1.06);
  transform: scale(1.04);
  box-shadow:
    0 1px 0 rgba(255, 245, 220, 0.55) inset,
    0 -2px 4px rgba(0, 0, 0, 0.35) inset,
    0 8px 18px rgba(0, 0, 0, 0.45),
    0 0 0 3px rgba(212, 184, 150, 0.18);
}

.deck-btn:active {
  transform: scale(0.97);
}

.deck-btn:focus-visible {
  outline: 2px solid var(--wheat);
  outline-offset: 3px;
}

.deck-btn .icon-play {
  border-color: transparent transparent transparent #2a221c !important;
}

.deck-btn .icon-pause {
  background:
    linear-gradient(#2a221c, #2a221c) 0 0 / 3px 100% no-repeat,
    linear-gradient(#2a221c, #2a221c) 100% 0 / 3px 100% no-repeat !important;
}

.deck-btn.is-playing {
  background:
    radial-gradient(circle at 32% 28%, #fff0d4 0%, #e0c090 40%, #6e4a30 100%);
  box-shadow:
    0 1px 0 rgba(255, 245, 220, 0.5) inset,
    0 -2px 4px rgba(0, 0, 0, 0.35) inset,
    0 0 0 2px rgba(212, 184, 150, 0.35),
    0 0 18px rgba(212, 184, 150, 0.35);
}

/* Platform chips inside envelopes (paper context) */
.platform-row a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.2rem;
  padding: 0.4rem 0.85rem 0.4rem 0.75rem;
  border: 1.5px dashed rgba(166, 124, 93, 0.5);
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(243, 235, 224, 0.35));
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset;
  transition:
    transform 0.2s var(--ease),
    border-color 0.2s var(--ease),
    background 0.2s var(--ease);
}

.platform-row a::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--clay);
  box-shadow: 0 0 0 2px rgba(166, 124, 93, 0.2);
}

.platform-row a:hover,
.platform-row a:focus-visible {
  border-style: solid;
  border-color: var(--clay);
  background: var(--wheat);
  transform: translateY(-1px);
}

.platform-row a:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .btn::after,
  .deck-btn,
  .envelope-face::before,
  .envelope-face::after,
  .platform-row a {
    transition: none;
  }

  .btn:hover,
  .btn:focus-visible,
  .deck-btn:hover,
  .deck-btn:focus-visible {
    transform: none;
  }
}
