/* ---------------------------------------------------------------
   /lessons — booking page for direct lessons (Cal.com embed).

   One job: get a visitor from "maybe" to a booked time. Order on
   the page follows the questions people have before they book:
   what is it and who is it with (hero + host card), what does it
   cost (offers), when (calendar), what happens after (steps),
   anything else (FAQ). Trust sits next to the first booking action,
   price and cancellation terms sit next to the calendar.

   Follows the design language in style.css: paper ground, soft
   cards, Rot for actions, Gold for small marks only.
   --------------------------------------------------------------- */

main.lessons {
  max-width: none;
  padding: 0 0 calc(var(--space) * 3);
}

/* --- Hero ---------------------------------------------------------- */

.lessons-hero {
  padding-top: 56px;
}

.lessons-hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 48px;
  align-items: center;
}

.lessons-hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  margin: 14px 0 18px;
}

.lessons-hero h1 em {
  font-weight: 400;
  color: var(--accent);
}

.lessons-lead {
  max-width: 46ch;
  font-size: 1.12rem;
  color: var(--ink-soft);
}

.lessons-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 28px;
  padding: 0;
  list-style: none;
}

.lessons-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.lessons-actions small {
  color: var(--ink-soft);
  font-size: 0.88rem;
}

/* Host card: the trust that has to be there before the first click. */
.lessons-host {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 22px;
  align-items: center;
}

.lessons-host img {
  width: 112px;
  height: 140px;
  object-fit: cover;
  border-radius: 14px;
  background: var(--surface-2);
}

.lessons-host h2 {
  font-size: 1.35rem;
  margin: 0 0 6px;
}

.lessons-host p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.lessons-host .host-quote {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  font-size: 1.1rem;
}

.lessons-stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.lessons-stats div + div {
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.lessons-stats dt {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.1;
}

.lessons-stats dd {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

/* --- The calendar ---------------------------------------------------- */

.booking {
  padding: 0;
  overflow: hidden;
}

.booking-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
}

/* Small switch at the top of the calendar, in the style of the header
   menu: the current lesson type on a soft pill, the other one plain. */
.cal-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.cal-switch:empty {
  display: none;
}

.cal-switch-btn {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.cal-switch-btn b {
  font-weight: 600;
}

.cal-switch-btn span {
  font-size: 0.82rem;
}

.cal-switch-btn:hover {
  color: var(--ink);
}

.cal-switch-btn[aria-pressed="true"] {
  background: var(--surface-2);
  color: var(--ink);
}

/* --- Lesson type: two cards right above the calendar --------------- */

.offers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.offer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "label price"
    "title price"
    "text  text"
    "pick  pick";
  align-items: start;
  column-gap: 16px;
  width: 100%;
  margin: 0;
  padding: 24px 26px;
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.offer .label { grid-area: label; }

.offer h3 {
  grid-area: title;
  font-size: 1.35rem;
  margin: 4px 0 0;
}

.offer-price {
  grid-area: price;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  margin: 0;
  text-align: right;
}

.offer-price b {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 600;
  line-height: 1;
}

.offer-price span {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.offer p {
  grid-area: text;
  margin: 12px 0 16px;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.offer:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

.offer[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  box-shadow: 0 0 0 1px var(--accent);
}

.offer-badge {
  position: absolute;
  top: -11px;
  left: 22px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--deep);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.offer-pick {
  grid-area: pick;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.offer-pick::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-sizing: border-box;
}

.offer[aria-pressed="true"] .offer-pick {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.offer[aria-pressed="true"] .offer-pick::before {
  border: 0;
  background: no-repeat center / 12px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"), rgba(255, 255, 255, 0.22);
}

/* Returning visitors: the trial is still there, but quieter. */
.offer.is-had:not([aria-pressed="true"]) {
  opacity: 0.62;
}

.offer.is-had .offer-badge {
  background: var(--surface-2);
  color: var(--ink-soft);
}

.booking-tz {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.booking-tz b {
  color: var(--ink);
  font-weight: 600;
}

.booking-cal {
  min-height: 560px;
  padding: 8px;
}

.booking-cal > div {
  width: 100%;
  min-height: 540px;
  overflow: auto;
}

/* Shown until a Cal.com username is set in js/lessons.js, and to anyone
   without JavaScript: book through italki instead. */
.booking-fallback {
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: 40px 28px;
  text-align: center;
}

.booking-fallback p {
  max-width: 44ch;
  margin: 0 auto 18px;
  color: var(--ink-soft);
}

.booking-fallback h3 {
  font-size: 1.4rem;
  margin: 0 0 8px;
}

/* Terms right under the calendar: price, payment, cancelling. */
.booking-terms {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.booking-terms li {
  display: flex;
  gap: 12px;
  padding: 18px 24px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.booking-terms li + li {
  border-left: 1px solid var(--line);
}

.booking-terms svg {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: var(--accent);
}

.booking-terms strong {
  display: block;
  color: var(--ink);
}

/* --- After booking ---------------------------------------------------- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
}

.steps h3 {
  font-size: 1.2rem;
  margin: 0 0 8px;
}

.steps p {
  margin: 0;
  font-size: 0.96rem;
  color: var(--ink-soft);
}

/* --- FAQ ---------------------------------------------------------------- */

.faq {
  padding: 6px 28px;
}

/* Wide screens: the questions in two columns, so the box fills the width */
@media (min-width: 900px) {
  .faq {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 48px;
    align-items: start;
  }

  .faq.faq details + details {
    border-top: 0;
  }

  .faq.faq details {
    border-bottom: 1px solid var(--line);
  }

  .faq.faq details:nth-last-child(-n+2) {
    border-bottom: 0;
  }
}

.faq details + details {
  border-top: 1px solid var(--line);
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  flex: none;
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--accent);
  transition: transform 0.2s ease;
}

.faq details[open] summary::after {
  transform: rotate(45deg);
}

.faq details p {
  margin: -4px 0 18px;
  color: var(--ink-soft);
}

.lessons-legal {
  margin-top: 28px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* --- Small screens ------------------------------------------------------- */

@media (max-width: 720px) {
  .offers {
    grid-template-columns: 1fr;
    gap: 22px;
  }
}

@media (max-width: 920px) {
  .lessons-hero-grid,
  .steps {
    grid-template-columns: 1fr;
  }

  .lessons-hero-grid {
    gap: 32px;
  }


  .booking-terms {
    grid-template-columns: 1fr;
  }

  .booking-terms li + li {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 600px) {
  .lessons-hero {
    padding-top: 36px;
  }

  .lessons-host {
    grid-template-columns: 84px 1fr;
    gap: 16px;
  }

  .lessons-host img {
    width: 84px;
    height: 105px;
  }

  .booking-head {
    padding: 12px 14px;
  }

  .cal-switch {
    display: flex;
    width: 100%;
  }

  .cal-switch-btn {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 6px 8px;
    border-radius: 16px;
    line-height: 1.3;
  }

  .cal-switch {
    border-radius: 20px;
  }

  .booking-tz {
    width: 100%;
    text-align: center;
  }

  .cal-switch-btn span {
    max-width: 100%;
    font-size: 0.76rem;
    white-space: nowrap;
  }

  .offer {
    padding: 22px 20px 20px;
  }

  .booking-cal {
    padding: 0;
  }

  .faq {
    padding: 4px 20px;
  }
}

/* Japanese: Fraunces has no kana, so the italic accent in the heading
   would fall back to a slanted system font. Keep it upright. */
.lessons-hero h1 em:lang(ja) {
  font-style: normal;
}

/* --- /legal (特定商取引法に基づく表記) — shares this stylesheet ---------- */

main.legal {
  max-width: 760px;
}

main.legal h1 {
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  margin: 0 0 28px;
}

.legal-table {
  padding: 4px 28px;
}

.legal-table dl {
  margin: 0;
}

.legal-table dl > div {
  display: grid;
  grid-template-columns: 13em 1fr;
  gap: 4px 24px;
  padding: 16px 0;
}

.legal-table dl > div + div {
  border-top: 1px solid var(--line);
}

.legal-table dt {
  font-weight: 600;
}

.legal-table dd {
  margin: 0;
  color: var(--ink-soft);
}

.legal-en {
  margin-top: 56px;
}

.legal-en h2 {
  font-size: 1.5rem;
  margin: 0 0 8px;
}

.legal-en > p {
  color: var(--ink-soft);
}

@media (max-width: 600px) {
  .legal-table {
    padding: 4px 20px;
  }

  .legal-table dl > div {
    grid-template-columns: 1fr;
  }
}

/* =================================================================
   Density pass (v4): the booking page on phones.
   Before, the calendar started almost two screens down and the page
   was six screens long. The lesson cards become two compact rows, the
   description of the chosen one sits under them, and the secondary
   blocks (host card, terms, steps) shrink to what they need.
   ================================================================= */

.lessons-hero {
  padding-top: 40px;
}

.offers-note {
  display: none;
}

@media (max-width: 720px) {
  .offers {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 10px;
  }

  .offer {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "pick title price"
      "pick label price";
    align-items: center;
    column-gap: 12px;
    padding: 12px 16px;
  }

  .offer p {
    display: none;
  }

  .offer h3 {
    font-size: 1.1rem;
    margin: 0;
  }

  .offer .label {
    font-size: 0.72rem;
  }

  .offer-price b {
    font-size: 1.35rem;
  }

  .offer-price span {
    font-size: 0.74rem;
  }

  /* The pick mark alone: an empty ring, or a red tick when chosen. */
  .offer-pick,
  .offer[aria-pressed="true"] .offer-pick {
    gap: 0;
    padding: 0;
    border: 0;
    background: none;
    font-size: 0;
    color: var(--ink-soft);
  }

  .offer-pick::before {
    width: 22px;
    height: 22px;
  }

  .offer[aria-pressed="true"] .offer-pick::before {
    background-color: var(--accent);
    background-size: 13px;
  }

  .offer-badge {
    top: -9px;
    left: auto;
    right: 14px;
    font-size: 0.62rem;
  }

  .offers-note {
    display: block;
    margin: 0 2px 14px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--ink-soft);
  }

  /* The cards sit right on top of the calendar here, so the small
     switch inside it would say the same thing twice. */
  .cal-switch {
    display: none;
  }
}

@media (max-width: 600px) {
  .lessons-hero {
    padding-top: 22px;
  }

  .lessons-hero-grid {
    gap: 20px;
  }

  .lessons-hero h1 {
    font-size: 1.85rem;
    margin: 6px 0 10px;
  }

  .lessons-lead {
    font-size: 1rem;
  }

  .lessons-facts {
    gap: 6px;
    margin: 14px 0 16px;
  }

  /* Host: one small row. The quote is on the podcast pages already. */
  .lessons-host {
    grid-template-columns: 56px 1fr;
    gap: 6px 12px;
    padding: 14px 16px;
  }

  .lessons-host img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-position: 50% 20%;
  }

  .lessons-host h2 {
    font-size: 1.1rem;
    margin: 0 0 2px;
  }

  .lessons-host p {
    font-size: 0.86rem;
    line-height: 1.5;
  }

  .lessons-host .host-quote {
    display: none;
  }

  .lessons-stats {
    padding-top: 10px;
    margin-top: 6px;
  }

  .lessons-stats dt {
    font-size: 1.15rem;
  }

  .lessons-stats dd {
    font-size: 0.74rem;
    line-height: 1.35;
  }

  /* "Book a lesson": the intro line repeats the cards and the terms. */
  #book .section-head p {
    display: none;
  }

  /* Terms: three icons with their titles in one row; the details are in
     the FAQ just below. */
  .booking-terms {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .booking-terms li {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 6px;
    font-size: 0;
    text-align: center;
  }

  .booking-terms li + li {
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .booking-terms strong {
    font-size: 0.76rem;
    line-height: 1.3;
  }

  /* Steps: one list in one card instead of three cards. */
  .steps {
    gap: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .steps li.card {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    column-gap: 12px;
    padding: 14px 16px;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }

  .steps li + li.card {
    border-top: 1px solid var(--line);
  }

  .steps li::before {
    grid-row: 1 / span 2;
    width: 28px;
    height: 28px;
    margin: 0;
    font-size: 0.9rem;
  }

  .steps h3 {
    font-size: 1rem;
    margin: 0 0 2px;
  }

  .steps p {
    font-size: 0.88rem;
    line-height: 1.5;
  }

  .faq summary {
    padding: 13px 0;
  }

  .lessons-legal {
    margin-top: 16px;
  }
}

@media (max-width: 600px) {
  /* The lesson cards are less than a screen away: no jump button needed. */
  .lessons-actions {
    display: none;
  }

  .lessons-facts {
    margin-bottom: 4px;
  }

  .booking-terms li {
    padding: 12px 4px;
  }

  .booking-terms strong:lang(ja) {
    font-size: 0.7rem;
    word-break: keep-all;
    overflow-wrap: anywhere;
  }
}
