/* Styles for the browser chord-identification demo (try.html). Builds on the
   design tokens defined in style.css. */

/* The HTML hidden attribute must win over the flex/inline-flex display rules
   below (echo, copy-link). */
[hidden] {
  display: none !important;
}

/* ─── iOS header (Smart App Banner present) ───────────────────────
   The native banner already shows the app icon and a get/open action, so on
   iOS this page trims its header to a breadcrumb plus Source, dropping the
   duplicate logo image and "Get the app" button that otherwise clash with the
   banner. The is-ios class is set by try.js and scoped to this page. */
.is-ios .nav-logo img {
  display: none;
}

.is-ios .nav-logo::before {
  content: "←";
  font-size: 1.1rem;
  font-weight: 600;
}

.is-ios .btn-get-app {
  display: none;
}

.try-hero {
  padding: 56px 0 8px;
  text-align: center;
}

.try-hero h1 {
  max-width: 720px;
  margin: 14px auto 0;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.032em;
}

.try-hero p {
  max-width: 560px;
  margin: 14px auto 0;
  font-size: clamp(1rem, 2vw, 1.125rem);
  color: var(--text-2);
}

.try-section {
  padding: 32px 0 72px;
}

.try-card {
  max-width: 720px;
  padding: 24px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
}

/* ─── Input ───────────────────────────────────────────────────── */

.try-input-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

#notes-input {
  box-sizing: border-box;
  width: 100%;
  padding: 14px 44px 14px 16px;
  font-family: var(--mono);
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: 0.02em;
  background: var(--bg-code);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  transition: border-color 0.15s;
}

.try-input-wrap {
  position: relative;
}

.try-clear {
  position: absolute;
  top: 50%;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--text-2);
  cursor: pointer;
  background: transparent;
  border: none;
  border-radius: 50%;
  transform: translateY(-50%);
  transition:
    color 0.12s,
    background 0.12s;
}

.try-clear:hover {
  color: var(--text);
  background: rgb(255 255 255 / 8%);
}

.try-clear svg {
  width: 16px;
  height: 16px;
  fill: currentcolor;
}

#notes-input:focus {
  outline: none;
  border-color: var(--accent);
}

#notes-input::placeholder {
  color: var(--text-3);
}

.try-hint {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--text-2);
}

/* ─── Controls row ────────────────────────────────────────────── */

.try-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-end;
  margin-top: 18px;
}

.try-control {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.try-control > span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.try-key {
  display: flex;
  gap: 8px;
}

select.try-select {
  padding: 9px 30px 9px 12px;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  appearance: none;
  cursor: pointer;
  background: var(--bg-raised)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239494ae' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  border: 1px solid var(--border-mid);
  border-radius: var(--r);
}

select.try-select:focus {
  outline: none;
  border-color: var(--accent);
}

.try-segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  border-radius: var(--r);
}

.try-segmented button {
  padding: 6px 13px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  background: transparent;
  border: none;
  border-radius: 7px;
  transition: all 0.12s;
}

.try-segmented button[aria-pressed="true"] {
  color: #fff;
  background: var(--accent);
}

/* ─── Results ─────────────────────────────────────────────────── */

.try-results {
  margin-top: 20px;
}

.try-status {
  font-size: 0.92rem;
  color: var(--text-2);
}

.try-status:not(:empty) {
  margin-bottom: 4px;
}

.try-status.is-error {
  color: #ff9b8a;
}

.try-status.is-warning {
  color: #e0b873;
}

.try-echo {
  margin-bottom: 14px;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-2);
}

.try-echo-item {
  margin-right: 14px;
}

.try-echo b {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
}

.try-candidate {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 13px 16px;
  margin-bottom: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r);
}

.try-candidate.is-chosen {
  background: var(--accent-bg);
  border-color: var(--accent-border);
}

.try-rank {
  display: inline-grid;
  flex-shrink: 0;
  width: 2em;
  height: 2em;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-2);
  background: rgb(255 255 255 / 3%);
  border: 1px solid var(--border-mid);
  border-radius: 50%;
}

.try-cand-main {
  flex: 1;
  min-width: 0;
}

.try-symbol {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.try-academic-name {
  margin-top: 3px;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--text-2);
}

.try-notes {
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-2);
}

.try-notes-label {
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--text-2);
}

.try-notes-also-played-marker {
  color: #d5a469;
}

.try-tag {
  flex-shrink: 0;
  padding: 3px 9px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 100px;
}

.try-tag.tag-chosen {
  color: #7ee2a8;
  background: rgb(58 190 112 / 10%);
  border: 1px solid rgb(58 190 112 / 30%);
}

.try-tag.tag-near-tie {
  color: #e0b873;
  background: rgb(224 184 115 / 10%);
  border: 1px solid rgb(224 184 115 / 28%);
}

.try-tag.tag-unlikely {
  color: var(--text-2);
  background: rgb(255 255 255 / 4%);
  border: 1px solid var(--border-mid);
}

.try-score {
  flex-shrink: 0;
  width: 3.2em;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-2);
  text-align: right;
}

.try-feedback {
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--text-2);
  text-align: center;
}

/* ─── Results head (echo + share) ─────────────────────────────── */

.try-results-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.try-results-head .try-echo {
  flex: 1 1 auto;
  margin-bottom: 0;
}

.try-results-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

#copy-link,
#open-app {
  flex-shrink: 0;
  gap: 7px;
  font-size: 0.82rem;
}

#copy-link svg,
#open-app svg {
  width: 14px;
  height: 14px;
  fill: currentcolor;
}

/* ─── CTA ─────────────────────────────────────────────────────── */

/* Reuse the article CTA styling, constrained to the demo card width. */
.try-section .article-cta {
  max-width: 720px;
  margin-top: 28px;
  margin-right: auto;
  margin-left: auto;
}

.try-section .article-cta .store-badge {
  height: 48px;
}

@media (width <= 520px) {
  .try-hero {
    padding-top: 36px;
  }

  .try-section {
    padding-top: 24px;
  }

  .try-section .wrap {
    padding: 0 12px;
  }

  .try-card {
    padding: 16px;
    border-radius: var(--r-lg);
  }

  .try-controls,
  .try-control,
  .try-key {
    width: 100%;
  }

  .try-key > *,
  .try-control > .try-segmented {
    flex: 1;
  }

  .try-segmented button {
    flex: 1;
  }

  .try-results-head {
    align-items: flex-start;
  }

  .try-results-head .try-echo {
    flex-basis: 100%;
  }

  .try-candidate {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px 12px;
    align-items: center;
    padding: 14px;
    margin-bottom: 10px;
  }

  .try-rank {
    grid-row: 1;
    grid-column: 1;
  }

  .try-cand-main {
    display: contents;
  }

  .try-symbol {
    grid-row: 1;
    grid-column: 2;
    overflow-wrap: anywhere;
  }

  .try-academic-name {
    grid-row: 2;
    grid-column: 1 / -1;
    margin-top: 0;
  }

  .try-notes {
    grid-row: 3;
    grid-column: 1 / -1;
    margin-top: 0;
    line-height: 1.65;
  }

  .try-tag {
    grid-row: 1;
    grid-column: 3;
  }

  .try-score {
    grid-row: 4;
    grid-column: 1 / -1;
    width: auto;
    padding-top: 8px;
    font-size: 0.72rem;
    text-align: right;
    border-top: 1px solid var(--border);
  }

  .try-score::before {
    color: var(--text-3);
    content: "Score ";
  }

  .try-section .article-cta {
    border-radius: var(--r-lg);
  }
}
