/* The home page tells the family's story: the hero, then one chapter each
   (Pip asks, Tempo plays, Octave answers), then the sign-up. Each chapter is
   framed in its character's colour, taken from their drawing. */

/* Chapters */
.gc-story { display: grid; }
/* Each chapter is its character's room: a pale wash of their colour, framed
   all round in it, and the character drawn large. The four sides of the frame
   are four background layers, so it can draw itself around the box. */
.gc-chapter { position: relative; max-width: 1320px; width: 100%; margin: 24px auto 0; padding: 72px 5%; background: var(--chapter-tint); box-sizing: border-box; }
.gc-chapter::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(var(--chapter-color), var(--chapter-color)) top left / 100% 4px no-repeat,
    linear-gradient(var(--chapter-color), var(--chapter-color)) top right / 4px 100% no-repeat,
    linear-gradient(var(--chapter-color), var(--chapter-color)) bottom right / 100% 4px no-repeat,
    linear-gradient(var(--chapter-color), var(--chapter-color)) bottom left / 4px 100% no-repeat;
}
.gc-chapter--pip { --chapter-color: var(--gc-pip); --chapter-tint: #fdeef2; }
.gc-chapter--tempo { --chapter-color: var(--gc-tempo); --chapter-tint: #fff2e8; }
.gc-chapter--octave { --chapter-color: var(--gc-octave); --chapter-tint: #e8f4f4; }
.gc-chapter-label span { background: #fff; }
.gc-chapter-label { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 18px !important; }
.gc-chapter-label span { display: inline-grid; place-items: center; min-width: 34px; height: 24px; padding: 0 6px; border: 1px solid var(--gc-ink); letter-spacing: .08em; }
.good-company .gc-chapter h2 { font-size: clamp(36px, 4vw, 56px); letter-spacing: -.04em; max-width: 14ch; }
.gc-chapter-lead { font-size: 18px; margin-top: 20px !important; max-width: 520px; }

/* 01 · Pip asks, to learn: three cards that turn over in place */
.gc-chapter--pip { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); grid-template-areas: "art copy" "cards cards" "next next"; gap: 24px 7%; align-items: center; }
.gc-chapter--pip .gc-chapter-art { grid-area: art; }
.gc-chapter--pip .gc-chapter-copy { grid-area: copy; }
.gc-chapter-art img { width: 100%; max-width: 400px; height: auto; margin-inline: auto; transition: transform .25s; }
.gc-person[data-curious=true] .gc-chapter-art img { transform: rotate(-6deg); }
.gc-flashcards { grid-area: cards; list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.gc-flashcards > li { min-width: 0; }
.gc-flashcard { display: grid; height: 100%; perspective: 1400px; cursor: pointer; }
.gc-flashcard-face { grid-area: 1 / 1; display: flex; flex-direction: column; gap: 12px; min-height: 240px; padding: 22px 22px 18px; border: 1px solid var(--gc-ink); background: #fff; }
.gc-flashcard-back { background: var(--gc-ink); color: #f4f4f2; }
.gc-flashcard-kicker { font-size: 12px !important; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.gc-flashcard-question { font-size: 21px; font-weight: 500; letter-spacing: -.02em; line-height: 1.3; }
.gc-flashcard-answer { font-size: 16px; line-height: 1.6; }
.gc-flashcard-back .gc-name { text-decoration-thickness: 2px; }
.gc-flashcard-turn { margin-top: auto; align-self: flex-start; padding: 6px 0; border: 0; background: none; color: inherit; font: 500 14px/1.4 'Manrope', sans-serif; text-decoration: underline; text-underline-offset: 5px; cursor: pointer; }
.gc-flashcard-turn:focus-visible { outline: 3px solid #2453c6; outline-offset: 4px; }
.gc-flashcard-back .gc-flashcard-turn:focus-visible { outline-color: #9ec2e6; }
/* With the script, the two sides share one place and the card turns over. */
.gc-flashcards.is-ready .gc-flashcard-face { backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .6s cubic-bezier(.2, .7, .2, 1), box-shadow .2s; }
.gc-flashcards.is-ready .gc-flashcard-back { transform: rotateY(180deg); }
.gc-flashcards.is-ready .gc-flashcard.is-flipped .gc-flashcard-front { transform: rotateY(-180deg); }
.gc-flashcards.is-ready .gc-flashcard.is-flipped .gc-flashcard-back { transform: rotateY(0); }
.gc-flashcards.is-ready .gc-flashcard:hover .gc-flashcard-front { box-shadow: 6px 6px 0 var(--gc-pip); }
.gc-flashcards:not(.is-ready) .gc-flashcard-face { grid-area: auto; }
.gc-flashcards:not(.is-ready) .gc-flashcard-turn { display: none; }
.gc-chapter--pip .gc-chapter-next { grid-area: next; margin-top: 0 !important; }

/* 02 · Tempo plays: the whole Ode to Joy, centred like a stage. The keyboard
   sits in the middle, Tempo at its left and changing pose with every note. */
.gc-chapter--tempo .gc-chapter-head { margin-bottom: 34px; }
.gc-chapter--tempo .gc-instrument-tabs { margin-top: 0; }
.gc-tempo-panel { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 26px; min-height: 0; padding: 40px 0 34px; text-align: center; }
.gc-tempo-panel .gc-instrument-info { max-width: 640px; }
.gc-tempo-panel .gc-instrument-info h3 { margin-bottom: 12px; }
.gc-tempo-panel .gc-instrument-info p { max-width: none; }
.gc-tempo-panel .gc-piano-demo { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 720px) minmax(0, 1fr); gap: 0 24px; align-items: end; padding-top: 0; }
.gc-tempo-panel .gc-piano-demo .lp-demo { grid-column: 2; min-width: 0; }
.gc-tempo-panel .gc-piano-demo .lp-keyboard { height: 230px; border-width: 12px 5px 6px; background: var(--gc-ink); }
.gc-tempo-panel .gc-player-companion { grid-column: 1; grid-row: 1; justify-self: end; position: relative; inset: auto; width: 100%; max-width: 230px; height: auto; aspect-ratio: 1312 / 1199; margin-bottom: 38px; }
.gc-chapter--tempo .gc-instrument-tabs { border-bottom-color: rgba(23, 24, 25, .5); }
.gc-chapter--tempo .gc-instrument-panel { border-bottom-color: rgba(23, 24, 25, .15); }
.gc-tempo-panel .lp-keyboard button.lp-white-key.is-next { background: #cfe0f0; box-shadow: inset 0 -8px #385f87; }
.gc-tempo-panel .lp-keyboard button.lp-white-key.is-next.is-playing { background: #f78336; }
.gc-tempo-actions { display: flex; justify-content: center; }
.gc-tempo-actions .gc-button { margin-top: 0; }

/* Without room beside the keyboard, Tempo sits above it, still centred. */
@media (max-width: 1100px) {
  .gc-tempo-panel .gc-piano-demo { grid-template-columns: minmax(0, 720px); justify-content: center; }
  .gc-tempo-panel .gc-piano-demo .lp-demo { grid-column: 1; }
  .gc-tempo-panel .gc-player-companion { justify-self: center; max-width: 200px; margin: 0 auto 8px; }
}

/* 03 · Octave answers */
.gc-chapter--octave { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 9%; align-items: start; }
.gc-chapter--octave .gc-chapter-art { margin-top: 34px; }
.gc-chapter--octave .gc-chapter-art img { max-width: 360px; margin: 0; }
/* The questions as a list, the chosen answer in one card. The cards share one
   grid cell, so the card is as tall as the longest answer and never grows. */
.gc-answers { display: grid; gap: 22px; }
.gc-answers-list { display: grid; border-top: 1px solid rgba(23, 24, 25, .2); }
.gc-answers-list button { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; padding: 14px 14px 14px 16px; border: 0; border-bottom: 1px solid rgba(23, 24, 25, .2); background: none; color: var(--gc-ink); font: 500 17px/1.4 'Manrope', sans-serif; text-align: left; cursor: pointer; transition: background-color .15s; }
.gc-answers-list button::after { content: '→'; flex-shrink: 0; opacity: 0; transform: translateX(-6px); transition: opacity .15s, transform .15s; }
.gc-answers-list button:hover { background: rgba(255, 255, 255, .55); }
.gc-answers-list button[aria-selected=true] { background: #fff; font-weight: 700; }
.gc-answers-list button[aria-selected=true]::after { opacity: 1; transform: none; }
.gc-answers-list button:focus-visible { outline: 3px solid #2453c6; outline-offset: -3px; }
.gc-answers-cards { display: grid; gap: 14px; }
.gc-answer { display: flex; flex-direction: column; gap: 10px; padding: 22px 24px 24px; border: 1px solid var(--gc-ink); background: #fff; }
.gc-answer:focus-visible { outline: 3px solid #2453c6; outline-offset: 4px; }
.gc-answer-kicker { font-size: 12px !important; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.good-company .gc-answer h3 { font-size: 21px; font-weight: 500; letter-spacing: -.02em; line-height: 1.3; }
.gc-answer p:not(.gc-answer-kicker) { font-size: 16px; line-height: 1.65; }
.gc-answer a { color: inherit; text-underline-offset: 4px; }
/* Without the script the list does nothing: every answer follows its question. */
.gc-answers:not(.is-ready) .gc-answers-list { display: none; }
.gc-answers.is-ready .gc-answer { grid-area: 1 / 1; visibility: hidden; }
.gc-answers.is-ready .gc-answer.is-current { visibility: visible; }
@media (prefers-reduced-motion: no-preference) {
  .gc-answers.is-ready .gc-answer.is-current > * { animation: gc-answer-in .25s ease-out both; }
}
@keyframes gc-answer-in { from { opacity: 0; transform: translateY(6px); } }

/* Sign-up: the three faces, ready */
.gc-notify-faces { display: flex; margin: 26px 0 14px; }
.gc-face { width: 76px; height: 76px; object-fit: contain; background: #fff; border-radius: 50%; border: 3px solid var(--face-color); padding: 6px; margin-right: -12px; }
.gc-face--pip { --face-color: var(--gc-pip); }
.gc-face--tempo { --face-color: var(--gc-tempo); }
.gc-face--octave { --face-color: var(--gc-octave); }

/* Entrance: the frame draws itself clockwise around the chapter, from the top
   left corner, then the chapter settles. Without the script or with reduced
   motion, the frame is simply there. */
.gc-story.reveal-enabled .gc-chapter::before { background-size: 0 4px, 4px 0, 0 4px, 4px 0; }
.gc-story.reveal-enabled .gc-chapter.is-visible::before { animation: gc-frame-draw 1.6s linear forwards; }
.gc-story.reveal-enabled .gc-chapter > * { opacity: 0; transform: translateY(12px); }
.gc-story.reveal-enabled .gc-chapter.is-visible > * { animation: gc-row-enter .55s ease-out both; animation-delay: .15s; }
.gc-story.reveal-enabled .gc-chapter.is-visible > *:nth-child(2) { animation-delay: .3s; }
.gc-story.reveal-enabled .gc-chapter.is-visible > *:nth-child(n+3) { animation-delay: .45s; }
@keyframes gc-row-enter { to { opacity: 1; transform: translateY(0); } }
@keyframes gc-frame-draw {
  0% { background-size: 0 4px, 4px 0, 0 4px, 4px 0; }
  25% { background-size: 100% 4px, 4px 0, 0 4px, 4px 0; }
  50% { background-size: 100% 4px, 4px 100%, 0 4px, 4px 0; }
  75% { background-size: 100% 4px, 4px 100%, 100% 4px, 4px 0; }
  100% { background-size: 100% 4px, 4px 100%, 100% 4px, 4px 100%; }
}

@media (max-width: 900px) {
  .gc-chapter--octave { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .gc-chapter--pip { grid-template-columns: minmax(0, 1fr); grid-template-areas: "art" "copy" "cards" "next"; }
  .gc-chapter--pip .gc-chapter-art img { max-width: 260px; }
  /* Pip's cards fold like an accordion, as in Octave's list: the question on one
     line, its answer opening underneath (flashcards.js, "folded"). */
  .gc-flashcards { grid-template-columns: minmax(0, 1fr); gap: 0; border-top: 1px solid rgba(23, 24, 25, .2); }
  .gc-flashcard { perspective: none; }
  .gc-flashcard-face { min-height: 0; }
  .gc-flashcards.is-ready .gc-flashcard .gc-flashcard-face, .gc-flashcards.is-ready .gc-flashcard.is-flipped .gc-flashcard-face { grid-area: auto; transform: none; backface-visibility: visible; -webkit-backface-visibility: visible; transition: none; }
  .gc-flashcards.is-ready .gc-flashcard:hover .gc-flashcard-front { box-shadow: none; }
  .gc-flashcard-front { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px 10px 12px; border: 0; border-bottom: 1px solid rgba(23, 24, 25, .2); background: none; }
  .gc-flashcard.is-flipped .gc-flashcard-front { background: #fff; }
  .gc-flashcard-front .gc-flashcard-kicker { display: none; }
  .gc-flashcard-question { font-size: 16px; line-height: 1.35; }
  .gc-flashcard.is-flipped .gc-flashcard-question { font-weight: 700; }
  .gc-flashcard-front .gc-flashcard-turn { flex-shrink: 0; margin: 0; padding: 4px 10px; font-size: 0; text-decoration: none; }
  .gc-flashcard-front .gc-flashcard-turn span { display: none; }
  .gc-flashcard-front .gc-flashcard-turn::after { content: '+'; font-size: 24px; line-height: 1; }
  .gc-flashcard.is-flipped .gc-flashcard-front .gc-flashcard-turn::after { content: '−'; }
  .gc-flashcards.is-ready .gc-flashcard-back { display: none; }
  .gc-flashcards.is-ready .gc-flashcard.is-flipped .gc-flashcard-back { display: flex; }
  .gc-flashcard-back { gap: 6px; padding: 12px 12px 16px; border: 0; }
  .gc-flashcard-answer { font-size: 15px; line-height: 1.55; }
  .gc-flashcards.is-ready .gc-flashcard-back .gc-flashcard-turn { display: none; }
  .gc-tempo-panel .gc-piano-demo .lp-keyboard { height: 200px; }
}
@media (max-width: 730px) {
  .gc-chapter { padding: 48px 6%; }
  .good-company .gc-chapter h2 { font-size: 34px; }
  .gc-chapter-lead { font-size: 16px; }
  .gc-tempo-panel .gc-piano-demo .lp-keyboard { height: 168px; border-width: 9px 3px 4px; }
  .gc-tempo-panel .gc-player-companion { max-width: 160px; }
  .gc-chapter { margin-top: 16px; }
  .gc-chapter--octave .gc-chapter-art img { max-width: 240px; }
  .gc-chapter--pip .gc-chapter-art img { max-width: 150px; }
  .gc-face { width: 64px; height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .gc-chapter-art img, .gc-flashcards.is-ready .gc-flashcard-face { transition: none; }
}

/* The headline is a full sentence now: a little smaller, with room to breathe. */
.gc-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.good-company .gc-hero h1 { font-size: clamp(42px, 4.4vw, 64px); }
.gc-hero h1 > span { display: block; text-wrap: balance; }
/* On a computer the hero fills the window under the header (127 px), its
   content centred in it, and Pip's chapter only shows once you scroll. It is
   as wide as the header's content, so the headline lines up with the logo.
   The headline and the button grow; the drawing reaches past its column. */
@media (min-width: 901px) {
  .gc-hero { width: min(90%, 1188px); max-width: none; min-height: calc(100svh - 127px); padding: 2svh 0 4svh; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); align-content: center; gap: 2%; }
  .good-company .gc-hero h1 { font-size: clamp(48px, min(5vw, 10svh), 72px); }
  .gc-hero-copy > p { font-size: 20px; margin: 30px 0 34px; }
  .gc-hero .gc-button { min-height: 56px; padding: 16px 28px; font-size: 17px; }
  .gc-jam { padding-top: 0; margin: 0 -12% 0 -2%; }
}
.gc-notify-home { margin-top: 24px; }
@media (max-width: 730px) {
  .good-company .gc-hero h1 { font-size: clamp(36px, 9.5vw, 48px); }
  .gc-hero { grid-template-columns: minmax(0, 1fr); }
}

/* Tempo's chapter points guitar players to the free tuner, at the end of the instrument tabs. */
.gc-tuner-hint { margin-left: auto; align-self: center; font-size: 14px; color: inherit; text-underline-offset: 5px; }
.gc-tuner-hint span { display: inline-block; transition: transform .2s; }
.gc-tuner-hint:hover span { transform: translateX(3px); }
@media (max-width: 730px) { .gc-instrument-tabs { flex-wrap: wrap; } .gc-tuner-hint { flex-basis: 100%; margin: 0 0 14px; } }
@media (prefers-reduced-motion: reduce) { .gc-tuner-hint span { transition: none; } }
