@font-face {
  font-family: 'Golos Text';
  src: url('/assets/golos-text.woff2') format('woff2');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f7f6ee;
  --ink: #171915;
  --shade: #1c211a;
  --rule: #cecec2;
  --inset: clamp(1.25rem, 5vw, 5rem);
  font-family: 'Golos Text', Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body, p, h1, h2 { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
html { scroll-padding-top: clamp(4.5rem, 9vh, 6rem); }
::selection { color: var(--paper); background: var(--shade); }
.wrap { width: min(calc(100% - 2 * var(--inset)), 94rem); margin-inline: auto; }

.masthead { position: sticky; top: 0; z-index: 3; background: var(--paper); }
.masthead-inner {
  display: flex; align-items: center; gap: clamp(1rem, 4vw, 4rem);
  min-height: clamp(4.2rem, 8.2vh, 5.5rem); border-bottom: 1px solid var(--rule);
}
.wordmark { font-weight: 640; font-size: clamp(1.08rem, 1.55vw, 1.5rem); letter-spacing: -.06em; white-space: nowrap; }
.place { color: #595c50; font-size: .85rem; }
nav { display: flex; align-items: center; gap: clamp(1rem, 2.8vw, 2.7rem); margin-inline-start: auto; font-size: .95rem; }
.schedule, .book { display: inline-flex; align-items: center; min-height: 44px; }
.schedule:hover, .wordmark:hover { text-decoration: underline; text-underline-offset: .24em; }
.book { justify-content: center; gap: .8rem; padding: .5rem 1.3rem; border-radius: 99px; color: var(--paper); background: var(--shade); }
.book:hover { background: #394132; }
.masthead .book:focus-visible, .try-lesson:focus-visible { outline-color: var(--ink); }
.book span { font-family: Arial, sans-serif; font-size: 1.16em; }

.study { position: relative; padding-top: clamp(2rem, 4.7vh, 4.6rem); }
.intro { position: relative; display: flex; justify-content: space-between; align-items: end; gap: 2rem; z-index: 1; pointer-events: none; }
h1 { font-size: clamp(6.3rem, 12.4vw, 11.5rem); font-weight: 460; letter-spacing: -.087em; line-height: .94; }
h1 span { display: block; margin: 0 0 .42em .16em; font-size: clamp(1.25rem, 1.95vw, 2.2rem); line-height: 1; font-weight: 450; letter-spacing: -.055em; }
.description { max-width: 22rem; width: 27%; margin: 0 2% .45em 0; font-size: clamp(.98rem, 1.27vw, 1.2rem); line-height: 1.45; letter-spacing: -.023em; text-wrap: pretty; }
.experiment { position: relative; }
.instrument {
  width: min(92%, 82rem); height: clamp(17rem, 29vw, 29rem); position: relative; margin: .25rem auto 0;
  -webkit-tap-highlight-color: transparent;
}
.instrument.is-ready { cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.instrument.is-dragging { cursor: grabbing; }
.instrument canvas, .still { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.instrument canvas { opacity: 0; }
.still { object-fit: contain; mix-blend-mode: multiply; }
.instrument.is-ready canvas { opacity: 1; }
.instrument.is-ready .still { visibility: hidden; }
.gesture {
  position: absolute; left: calc(47% + var(--handle-shift, 0%)); top: 56%; transform: translate(-50%, -50%);
  display: flex; gap: .7rem; align-items: center; min-height: 38px; padding: .45rem .98rem;
  background: var(--paper); border: 1px solid #cbcbbc; border-radius: 99px;
  color: var(--ink); font-size: .86rem; font-weight: 500; pointer-events: none;
}
.gesture[hidden] { display: none; }
.gesture-arrow { width: 1.5rem; height: 1px; background: currentColor; position: relative; }
.gesture-arrow::after { content: ""; position: absolute; width: 6px; height: 6px; right: 0; top: -2.5px; border-top: 1px solid; border-right: 1px solid; transform: rotate(45deg); }
.instrument.is-dragging .gesture { opacity: .74; }
.keyboard-help { position: absolute; inset: auto 0 .4rem; text-align: center; font-size: .84rem; }

.after-study {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: .32rem 1rem; padding-block: .35rem clamp(1.25rem, 3vh, 2rem);
}
.after-study > span { color: #595c50; font-size: .875rem; }
.try-lesson {
  display: inline-flex; min-height: 44px; align-items: center; justify-content: center;
  padding: .65rem 1.05rem; gap: .7rem; border: 1px solid var(--shade); border-radius: 2rem;
  font-size: clamp(.875rem, 1.22vw, 1.04rem); font-weight: 500; line-height: 1.3;
  letter-spacing: -.02em;
}
.try-lesson:hover { background: var(--shade); color: var(--paper); }
.lesson-followup {
  display: inline-flex; gap: .5rem; align-items: center; min-height: 44px;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .26em;
  font-size: clamp(.875rem, 1.2vw, 1rem); font-weight: 500;
}
.lesson-followup:hover { text-decoration-thickness: 2px; }
.try-lesson span, .lesson-followup span { flex: none; font-family: Arial, sans-serif; }
.reformer-class {
  display: flex; align-items: center; justify-content: space-between; gap: .25rem 2rem;
  border-top: 1px solid #4f5549; padding-block: 1rem 1.5rem;
}
.reformer-class p { max-width: 31rem; color: #d9ddcf; line-height: 1.45; }

@media (min-width: 701px) and (min-height: 650px) {
  main { min-height: calc(100svh - clamp(4.2rem, 8.2vh, 5.5rem)); display: flex; flex-direction: column; }
  .study { flex: 1; display: flex; flex-direction: column; }
  .experiment { flex: 1; display: grid; align-content: center; }
}
@media (max-width: 700px) {
  .after-study { flex-direction: column; }
  .after-study > span { font-size: .8rem; }
  .reformer-class { align-items: flex-start; flex-direction: column; }
  .place { display: none; }
  .masthead-inner { min-height: 4rem; gap: .7rem; }
  nav { font-size: .83rem; gap: .85rem; }
  .book { min-height: 40px; gap: .25rem; padding: .45rem .84rem; }
  .intro { display: block; }
  h1 { font-size: clamp(4rem, 17vw, 7.5rem); }
  h1 span { font-size: 1.15rem; margin-left: .12em; }
  .description { width: auto; max-width: 27rem; margin: 1.3rem 0 0; font-size: 1rem; }
  .keyboard-help { position: static; margin-bottom: .75rem; }
}
@media (max-width: 360px) {
  :root { --inset: .85rem; }
  .try-lesson { padding-inline: .63rem; gap: .3rem; }
  .wordmark { font-size: .94rem; }
  nav { gap: .5rem; font-size: .76rem; }
  .book { padding-inline: .65rem; }
  .book span { display: none; }
}
@media (max-width: 700px) and (min-height: 620px) {
  main { display: flex; flex-direction: column; min-height: calc(100svh - 4rem); }
  .study { flex: 1; display: flex; flex-direction: column; padding-top: clamp(2.2rem, 5.4svh, 3.9rem); }
  .experiment { flex: 1; display: grid; align-content: center; }
}

.reformer-navigation { display: none; }
h1:has(.reformer-pretitle) { text-transform: lowercase; }
.reformer-pretitle { text-transform: none; }
.reformer-views:not([hidden]) {
  display: flex;
  width: fit-content;
  gap: 1.35rem;
  margin: 0 auto .65rem;
  border-bottom: 1px solid var(--rule);
}
.reformer-views button {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 .1rem;
  background: none;
  border: 0;
  color: #5e6156;
  font-size: .9rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.reformer-views button[aria-pressed="true"] { font-weight: 600; color: var(--ink); }
.reformer-views button[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px;
  border-bottom: 2px solid;
}
.reformer-experiment .keyboard-help { position: static; margin: 0 0 .5rem; }
@media (max-width: 700px), (max-width: 940px) and (max-height: 500px) {
  .study:has(.reformer-navigation) { padding-top: .35rem; }
  .reformer-navigation {
    display: flex;
    justify-content: space-between;
    margin: 0 0 .45rem;
    color: #505449;
    font-size: .83rem;
  }
  .reformer-navigation a { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; }
  .reformer-navigation a:hover { text-decoration: underline; text-underline-offset: .2em; }
  h1:has(.reformer-pretitle) { text-transform: none; }
  .reformer-pretitle { display: none; }
  .reformer-experiment {
    flex: none;
    display: block;
    margin: .8rem 0 1rem;
  }
  .reformer-views:not([hidden]) { width: 100%; margin: 0 0 .35rem; }
  .reformer-experiment .instrument {
    width: 100%;
    height: auto;
    aspect-ratio: 2.25;
    max-height: 19rem;
    margin: .5rem 0 .15rem;
    overflow: hidden;
  }
  .reformer-experiment .instrument .gesture { display: none; }
  .carriage-control:not([hidden]) {
    position: relative;
    display: block;
    width: 100%;
    height: 54px;
    padding: 0;
    background: none;
    border: 0;
    color: var(--ink);
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    cursor: grab;
  }
  .carriage-control.is-dragging { cursor: grabbing; }
  .carriage-track {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    pointer-events: none;
  }
  .carriage-track::before {
    content: "";
    width: 100%;
    border-top: 1px solid var(--rule);
  }
  .carriage-track::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    height: 7px;
    border-inline: 1px solid #696b5e;
  }
  .carriage-thumb {
    position: absolute;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 54px;
    height: 42px;
    background: var(--shade);
    color: var(--paper);
    border-radius: 14px;
    box-shadow: inset 0 -3px 0 #11150e;
  }
  .carriage-thumb .gesture-arrow { width: 19px; }
  .carriage-cue {
    position: absolute;
    left: 64px;
    top: 50%;
    transform: translateY(-50%);
    padding: .15rem .45rem;
    background: var(--paper);
    color: #4e5246;
    font-size: .85rem;
    pointer-events: none;
  }
  .carriage-control.in-motion .carriage-cue { visibility: hidden; }
  .reformer-experiment .keyboard-help { position: static; margin: .5rem 0 0; }
}
@media (min-width: 520px) and (max-width: 940px) and (max-height: 500px) {
  .study:has(.reformer-experiment) { padding-top: 0; }
  .reformer-navigation { margin-bottom: 0; }
  .study:has(.reformer-experiment) .intro {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 1rem;
  }
  .study:has(.reformer-experiment) h1 { font-size: clamp(2.75rem, 7.6vw, 4.6rem); }
  .study:has(.reformer-experiment) h1 span { font-size: 1rem; }
  .study:has(.reformer-experiment) .description {
    width: auto;
    margin: 0;
    font-size: .88rem;
  }
  .reformer-experiment {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(13rem, .55fr);
    column-gap: clamp(1.5rem, 5vw, 3rem);
    align-items: center;
  }
  .reformer-experiment .instrument {
    grid-column: 1;
    grid-row: 1 / 4;
    aspect-ratio: 2.5;
  }
  .reformer-experiment .reformer-views, .reformer-experiment .carriage-control,
  .reformer-experiment .keyboard-help { grid-column: 2; }
  .reformer-experiment .reformer-views { align-self: end; gap: .7rem; }
  .reformer-experiment .reformer-views button { white-space: nowrap; }
  .reformer-experiment .carriage-control { align-self: start; }
}
