/******************************************
              VARIABLES
**************************************** */

:root {
  --bg: #121212;
  --text: #ffffff;
  --muted: #bdbdc7;
  --keycap-bg-top: #ffffff38;
  --keycap-bg-bottom: #99999938;
  --ring: rgba(255,255,255,0.9);
  --red: #de0000;
  --red-hover: #AE0000;
  --text-red: #f00;
  --input-bg: #080808;
  --slider-track-top: #ffffff38;
  --slider-track-bottom: #99999938;
  --panel: transparent;
  --border: rgba(255,255,255,0.2);
  --focus-border: 1px solid var(--muted);
}

/******************************************
        RESET, GLOBAL, & UTIL
**************************************** */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%;}

@font-face { font-family: 'Montecatini Pro'; font-weight: 400; font-style: normal; src: url('assets/webfonts/MontecatiniPro-Normale.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Montecatini Pro'; font-weight: 600; font-style: normal; src: url('assets/webfonts/MontecatiniPro-NormaleSemibold.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Montecatini Pro'; font-weight: 700; font-style: normal; src: url('assets/webfonts/MontecatiniPro-NormaleBold.woff2') format('woff2'); font-display: swap; }

body {
  margin: 0;
  font-family: 'Montecatini Pro', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.hidden { display: none !important; }

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: var(--focus-border)
}

button:focus-visible {
  outline-offset: 4px;
}

/******************************************
                PAGE STYLES
**************************************** */

.container {
  display: flex; flex-direction: column;
  max-width: 920px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 24px 0;
  text-align: center;

  @media (min-width: 600px) {
    padding-top: 40px;
  }
}

h1 {
  margin: 0 0 24px;
  font-size: 48px;
  font-weight: 600;

  @media (min-width: 600px) {
    font-size: 60px;
  }
}

.palo-switcher {
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 0px;
  margin: 0;
  
  @media (min-width: 800px) {
    display: flex; flex-direction: row; align-items: flex-start; justify-content: center; gap: 16px;
    margin: 32px 0 12px;
  }
}
  .palo-item {
    display: inline-flex; align-items: center; flex-direction: column; gap: 0px;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;

    /* Semantic yet hidden radio buttons */
    input[type="radio"] {
      display: none;
    }

    /* Unselected palo */
    input[type="radio"] + .label {
      opacity: 0.6;
      transition: all 0.15s ease;

      &:hover { opacity: 0.8; }
    }

    /* Selected palo */
    input[type="radio"]:checked + .label {
      opacity: 1;
      color: var(--text-red);
      text-shadow: 0 0 2px var(--text-red);
    }
  }

    .label { font-size: 40px; line-height: 51px; }

    .keycap {
      display: inline-flex; align-items: center; justify-content: center;
      position: relative;
      padding: 4px 8px;
      font-size: 15px;
      letter-spacing: 0.3px;
      text-transform: uppercase;
      color: #e6e6e6;
      border-radius: 4px;
      border: solid 1px transparent;
      background: linear-gradient(180deg, #454545, #313131);
      background-clip: padding-box;

      @media (any-pointer: coarse) { display: none !important; }

      &::after {
        content: "";
        position: absolute;
        top: 0; bottom: 0; left: 0; right: 0;
        z-index: -1;
        margin: -1px;
        border-radius: inherit;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(192, 192, 192, 0.6));
        pointer-events: none;
      }
      &.space { margin: 8px auto 0; }
    }

  .sep {
    font-size: 40px;
    opacity: 0.4;
    display: none;

    @media (min-width: 800px) { display: block; }
  }

.transport {
  margin: 20px 0 0;

  @media (min-width: 800px) { margin: 40px 0 20px; }
}

.transport-inner { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; }

  .big-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    position: relative;
    width: 120px;
    height: 120px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #fff, #000), var(--red);
    background-blend-mode: overlay, normal;
    box-shadow: inset 0.5px 1px 1px 0 rgba(255,255,255,0.6);

    &::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: linear-gradient(135deg, #cccccc00, #00000022);
      background-blend-mode: overlay;
      opacity: 0;
      transition: all 0.1s ease;
      clip-path: inset(0 0 0 0 round 50%);
    }

    &:hover {
      &::before {
        opacity: 1;
      }
    }

    &:active {
      transform: scale(0.99);
      background: linear-gradient(315deg, #0001, #0004), var(--red);
      box-shadow: inset -0.5px -1px 1px 0 rgba(255,255,255,0.1);
    }

    @media (min-width: 800px) {
      width: 200px;
      height: 200px;
    }

    .play-icon,
    .pause-icon {
      transform: scale(0.6);
      opacity: 0.85;

      @media (min-width: 800px) {
        transform: scale(1.0);
      }
    }

    .play-icon {
      position: relative;
      left: 5px;
    }

    /* First-beat visual pulse using a lightweight ring (no box-shadow animation) */
    &::after {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: 50%;
      border: 30px solid rgba(222,0,0,0);
      transform: scale(1);
      opacity: 0;
      pointer-events: none;
      transform-origin: 50% 50%;
      z-index: -1;
    }
    &.flash::after { animation: beatPulse 180ms cubic-bezier(.25, .46, .45, .94) both; }
  }

  @keyframes beatPulse {
    0% {
      border-color: rgba(222,0,0,0.9);
      transform: scale(1);
      opacity: 1;
    }
    100% {
      border-color: rgba(222,0,0,0);
      transform: scale(1.7);
      opacity: 0;
    }
  }

.tempo {
  width: 100%;
  max-width: 600px;
  margin: 20px auto 10px;

  @media (min-width: 800px) { margin-top: 40px; }
}

.tempo-display {
  text-align: center;
  font-size: 40px;
  margin-bottom: 18px;
  font-weight: 400;

  @media (min-width: 800px) { font-size: 50px; }

  input#tempoText {
    width: 100px;
    text-align: right;
    font: inherit;
    font-weight: 700;
    color: inherit;
    background: var(--input-bg);
    border: 1px solid transparent;
    padding: 0 4px;

    &:hover {
      border: 1px solid var(--border);
    }
  }
  .tempo-sizer {
    position: absolute;
    left: -9999px;
    top: -9999px;
    visibility: hidden;
    white-space: pre;
    font: inherit;
    font-weight: 700;
  }
}

.tempo-slider { position: relative; }

#tempo {
  width: 100%;
  height: 6px;
  appearance: none;
  background: linear-gradient(180deg, var(--slider-track-bottom), var(--slider-track-top));
  border-radius: 12px;
}

#tempo::-webkit-slider-thumb {
  display: block;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0,0,0,0.2);
  margin-top: 0px;
  cursor: pointer;
}

.tempo-ends { display: flex; justify-content: space-between; margin-top: 8px; font-size: 20px; }

button {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

button:disabled { opacity: 0.5; cursor: not-allowed; }

.selectors-card {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #15151a;
}
.card-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.card-title { font-weight: 600; }
.card-sub { color: var(--muted); font-size: 12px; }

.selectors {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 16px;
  margin: 10px 0 6px;
}

.selector-row { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 10px; }
.selector-row label { color: var(--muted); }

select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #1d1d23;
  color: var(--text);
}

footer { margin-top: 10px; color: var(--muted); }

.byline {
  margin-top: auto;
  color: var(--text);
  opacity: 0.6;
  padding: 60px 0px 12px;

  .byline-link {
    text-decoration: none;
    color: inherit;
    letter-spacing: 0.01em;

    &:hover { text-decoration: underline; }
  }
}