/* The page's foundation: the colors (:root), the page and its layout grid,
   plain buttons, the open and close motion of <details>, the scrollbar. */

:root {
  color-scheme: light dark;
  /* Playpen Sans draws Latin and Cyrillic; it has no Hebrew, so Hebrew falls
     through to Rubik. */
  font-family: "Playpen Sans", "Rubik", system-ui, sans-serif;
}

body {
  max-width: 1120px;
  margin: 48px auto;
  padding: 0 32px;
}

.layout {
  display: grid;
  gap: 8px;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 8px;
  font-size: 1.85rem;
  letter-spacing: -0.03em;
}

.page-title-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #2563eb18;
  color: #2563eb;
}

.page-title-icon svg {
  width: 24px;
  height: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

button {
  font: inherit;
  padding: 10px 18px;
  cursor: pointer;
}

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

audio {
  width: 100%;
  margin-top: 16px;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    column-gap: 36px;
    align-items: center;
  }
}

@media (max-width: 760px) {
  body {
    max-width: 720px;
    margin: 64px auto;
    padding: 0 20px;
  }
}

@media (max-width: 620px) {
  body {
    margin-top: 24px;
  }
}

/* Flat learning-studio visual system */
:root {
  color-scheme: light;
  --page-bg: #fdfaf4;
  --surface: #fffefa;
  --surface-soft: #fbf9f5;
  --surface-raised: #fffefa;
  --text: #302c28;
  --muted: #70675e;
  --border: #bcb1a4;
  --line: #423c36;
  --brand: #5f806c;
  --brand-strong: #4b6a57;
  --brand-soft: #fbf9f5;
  --title-wash: #eef5f7;
  --accent: #5f806c;
  /* Something waits for you: the orange dot of the app icon. */
  --signal: #d66b48;
  --sage: #fbf9f5;
  --sky: #fbf9f5;
  --butter: #fbf9f5;
  --shadow-sm: none;
  --shadow-lg: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page-bg);
  /* A phone's browser flashes blue over anything tapped; the buttons show a press themselves. */
  -webkit-tap-highlight-color: transparent;
}

body {
  position: relative;
  max-width: 1200px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 26px 32px 24px;
  color: var(--text);
  background: var(--page-bg);
}

.topbar {
  align-items: center;
  margin-bottom: 28px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 15px 12px 16px 11px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.layout {
  gap: 24px;
}

.practice .page-title {
  margin-bottom: 0;
  font-size: clamp(1.9rem, 4vw, 2.65rem);
}

.page-title-icon {
  width: 48px;
  height: 48px;
  border: 1.5px solid var(--line);
  border-radius: 15px 11px 14px 10px;
  background: var(--butter);
  color: var(--brand-strong);
  box-shadow: none;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
    column-gap: 28px;
    align-items: stretch;
  }
}

@media (max-width: 760px) {
  body {
    margin: 0 auto;
    padding: 18px 18px 56px;
  }

  .topbar {
    align-items: stretch;
    margin-bottom: 18px;
  }
}

/* Disclosure motion: an unhurried damped spring (one soft ~4% overshoot that
   settles without a snap back). No scaling, so text stays crisp. */
:root {
  interpolate-size: allow-keywords;
  --ease-spring: linear(
    0,
    0.031,
    0.107,
    0.211,
    0.328,
    0.446,
    0.559,
    0.662,
    0.751,
    0.827,
    0.889,
    0.937,
    0.974,
    1.001,
    1.019,
    1.03,
    1.036,
    1.038,
    1.038,
    1.035,
    1.031,
    1.027,
    1.022,
    1.018,
    1.014,
    1.01,
    1.007,
    1.005,
    1.003,
    1.001,
    1,
    0.999,
    0.999,
    0.999,
    0.999,
    0.999,
    1
  );
}

.details-motion {
  block-size: 0;
  opacity: 0;
  overflow: clip;
  transform: translateY(-8px);
  transition:
    block-size 650ms var(--ease-spring),
    opacity 260ms ease-out,
    transform 650ms var(--ease-spring);
  will-change: block-size, opacity, transform;
}

details[open].details-expanded > .details-motion {
  block-size: auto;
  opacity: 1;
  transform: none;
}

.details-motion-inner {
  min-block-size: 0;
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .details-motion {
    transition-duration: 0.01ms;
    transform: none;
  }
}

.topbar {
  z-index: 10;
}

/* The bar stays on one row, also on a phone: a long account name is cut
   short instead of pushing the settings under the tabs. */
.topbar {
  flex-wrap: nowrap;
}

/* On a phone the panel spans the bar, with the page's own margins on both
   sides, and each label sits above its list, which takes the full width: a
   long option (a tester's address) can no longer push the lists past the
   panel's edge. */
@media (max-width: 620px) {
  .topbar {
    position: relative;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* A thin, quiet scrollbar with reserved room, so content never jumps when it appears. */
html {
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #d8cfc4 transparent;
}
