/* ─── twl-chapter-reader-options.css ─────────────────────────────────────── */
/* Reader settings drawer (ปรับแต่งการอ่าน) — Figma node 703:738325 */

.chapter-reader-drawer-settings {
  position: fixed;
  top: 50%;
  right: 80px;
  z-index: 1000;
  width: min(620px, calc(100vw - 32px));
  max-height: min(785px, calc(100vh - 48px));
  padding: 24px;
  overflow: hidden;
  transform: translateY(-50%);
  border: 1px solid var(--chapter-border-soft);
  border-radius: 24px;
  background-color: var(--chapter-surface);
  box-shadow: var(--twl-elevation-sm);
  box-sizing: border-box;
}

.chapter-reader-drawer-settings .header-setting {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 0;
  padding: 0 40px 0 32px;
  font-family: var(--Title-Page-font-family, "DB HelvethaicaMon X", sans-serif);
  font-size: 24px;
  font-weight: 700;
  line-height: 29px;
  text-align: center;
}

.chapter-reader-drawer-settings .reader-setting-back {
  position: absolute;
  left: 0;
  display: inline-flex;
  align-items: center;
  font-size: 24px;
  text-decoration: none;
}

.chapter-reader-drawer-settings .chapter-reader-drawer-top {
  margin-bottom: 16px;
}

.chapter-reader-drawer-settings .setting-content {
  width: 572px;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
  box-sizing: border-box;
}

.chapter-reader-drawer-settings .reader-setting-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.chapter-reader-drawer-settings .reader-setting-heading {
  margin: 0;
  font-family: var(--Heading-font-family, "DB HelvethaicaMon X", sans-serif);
  font-size: 20px;
  font-weight: 500;
  line-height: 24px;
  color: var(--chapter-text);
}

.chapter-reader-drawer-settings .reader-setting-options {
  display: grid;
  grid-template-columns: repeat(4, 125px);
  column-gap: 24px;
  row-gap: 24px;
  width: 572px;
  max-width: 100%;
}

.chapter-reader-drawer-settings .reader-setting-options--three {
  grid-template-columns: repeat(3, 125px);
}

.chapter-reader-drawer-settings .reader-setting-option {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 125px;
  min-width: 0;
  max-width: 125px;
  box-sizing: border-box;
}

.chapter-reader-drawer-settings .reader-setting-option--compact {
  gap: 0;
}

.chapter-reader-drawer-settings .reader-setting-radio {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 21px;
  width: 100%;
  max-width: 125px;
}

.chapter-reader-drawer-settings .reader-setting-radio label {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-family: var(--Body-font-family, "Bai Jamjuree", sans-serif);
  font-size: 14px;
  font-weight: 500;
  line-height: 21px;
  color: var(--chapter-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-reader-drawer-settings input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 1px solid var(--chapter-border, #cacbce);
  border-radius: 50%;
  background-color: var(--Base-bg-base, #ffffff);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background-color 0.2s;
}

.chapter-reader-drawer-settings input[type="radio"]::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: transparent;
  transition: background-color 0.2s;
}

.chapter-reader-drawer-settings input[type="radio"]:checked {
  border-color: var(--chapter-brand-strong, #e85d45);
  background-color: var(--chapter-brand-strong, #e85d45);
}

.chapter-reader-drawer-settings input[type="radio"]:checked::before {
  background-color: var(--Base-on-color, #ffffff);
}

.chapter-reader-drawer-settings .exam-theme,
.chapter-reader-drawer-settings .exam-text {
  margin: 0;
  width: 100%;
  max-width: 125px;
  box-sizing: border-box;
}

.chapter-reader-drawer-settings .exam-theme span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  word-break: break-word;
  line-height: 1.25;
}

.chapter-reader-drawer-settings .exam-text {
  aspect-ratio: 125 / 80;
  height: 80px;
  min-height: 80px;
  max-height: 80px;
  padding: 8px 10px;
  border: 1px solid var(--Border-Neutral-subtle, #e4e5e7);
  border-radius: 8px;
  background-color: var(--Background-Neutral-tertiary, #f2f2f3);
  color: var(--chapter-text, #070708);
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  overflow: hidden;
  text-align: left;
  font-weight: 500;
  line-height: 1.3;
}

.chapter-reader-drawer-settings .exam-text span {
  display: block;
  width: 100%;
  overflow: hidden;
  word-break: break-word;
  line-height: inherit;
}

.chapter-reader-drawer-settings .exam-text--med {
  font-family: MNPaethai-Med, 'MN Paethai', sans-serif;
  font-size: 22px;
  line-height: 1.2;
}

.chapter-reader-drawer-settings .exam-text--robo {
  font-family: cs_prajad, sans-serif;
  font-size: 18px;
  line-height: 1.35;
}

.chapter-reader-drawer-settings .exam-text--serif {
  font-family: TFUthongT, serif;
  font-size: 18px;
  line-height: 1.35;
}

.chapter-reader-drawer-settings .exam-text--script {
  font-family: sukhumvitligh-th, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

@media (max-width: 767px) {
  .chapter-reader-drawer-settings {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
    transform: none;
    box-shadow: var(--twl-elevation-sm, 0 4px 20px rgba(7, 7, 8, 0.1));
  }

  .chapter-reader-drawer-settings .setting-content {
    width: 100%;
  }

  .chapter-reader-drawer-settings .header-setting {
    justify-content: center;
    padding-left: 40px;
    padding-right: 16px;
  }

  .chapter-reader-drawer-settings .reader-setting-options,
  .chapter-reader-drawer-settings .reader-setting-options--three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
    row-gap: 16px;
    width: 100%;
  }

  .chapter-reader-drawer-settings .reader-setting-option {
    width: 100%;
    max-width: none;
  }

  .chapter-reader-drawer-settings .reader-setting-radio {
    max-width: none;
  }

  .chapter-reader-drawer-settings .exam-theme,
  .chapter-reader-drawer-settings .exam-text {
    width: 100%;
    max-width: none;
  }
}

/* Reader theme previews keep content-theme behavior separate from UI chrome. */
.chapter-reader .exam-theme {
  aspect-ratio: 125 / 104;
  height: 104px;
  border-radius: 8px;
  border: solid 1px var(--chapter-border-soft);
  padding: 16px;
  font-family: 'MN Paethai', sans-serif;
  font-size: 20px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  width: 125px;
  box-sizing: border-box;
}

.chapter-reader .exam-theme--night,
.chapter-reader .exam-theme--cover {
  background-color: var(--Static-Base-black, #070708);
  color: var(--Text-Static-white, #ffffff);
}

.chapter-reader .exam-theme--soft {
  background-color: var(--tunwalai-200, #fff3f0);
  color: var(--Text-Neutral-primary, #070708);
}

.chapter-reader .exam-text {
  aspect-ratio: 125 / 80;
  height: 80px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--chapter-border-soft, #e4e5e7);
  background-color: var(--Background-Neutral-tertiary, #f2f2f3);
  color: var(--chapter-text);
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  width: 125px;
  box-sizing: border-box;
  overflow: hidden;
  text-align: left;
}

.mt-12 {
  margin-top: 12px;
}

.cur-pointer {
  cursor: pointer;
}

/* Legacy typography classes for compatibility */
.ch-med-20 {
  font-family: var(--Action-font-family, "DB HelvethaicaMon X", sans-serif);
  font-size: 20px;
  font-weight: 500;
}

.ch-med-16 {
  font-family: var(--Action-font-family, "DB HelvethaicaMon X", sans-serif);
  font-size: 16px;
  font-weight: 500;
}

.ch-bd-32 {
  font-family: var(--Title-Page-font-family, "DB HelvethaicaMon X", sans-serif);
  font-size: 32px;
  font-weight: 700;
}

.ch-mn-24 {
  font-family: var(--chapter-content-font);
  font-size: 24px;
}

.ch-bd-24 {
  font-family: var(--Title-Page-font-family, "DB HelvethaicaMon X", sans-serif);
  font-size: 24px;
  font-weight: 700;
}

.ch-bd-28 {
  font-family: var(--Title-Page-font-family, "DB HelvethaicaMon X", sans-serif);
  font-size: var(--Title-Page-font-size-md, 28px);
  font-weight: 700;
}

/* Mobile sticky menus widgets layout */
.chapter-xs-menu {
  right: 0px;
  text-align: center;
  margin-top: 84px;
  position: fixed;
  z-index: 15;
  background-color: var(--chapter-surface);
  border: 1px solid var(--chapter-border-soft);
  box-shadow: var(--twl-elevation-xs);
  border-radius: 8px 0 0 8px;
}

.chapter-xs-menu a,
.chapter-xs-menu .ch-med-16,
.icon-toggle-xs a {
  color: var(--chapter-text);
}

.chapter-xs-menu > a,
.chapter-xs-menu__close a {
  align-items: center;
  display: flex;
  font-size: var(--Title-Page-font-size-md, 28px);
  justify-content: center;
  min-height: 56px;
  text-decoration: none;
}

.chapter-xs-menu__close {
  font-size: var(--Title-Page-font-size-md, 28px);
  margin-top: 10px;
}

.chapter-toggle-xs {
  width: 48px;
  height: 56px;
}

.chapter-toggle-menu-xs {
  width: 88px;
  height: 230px;
}

.icon-toggle-xs {
  width: 40px;
  height: 40px;
  margin: 8px auto 4px;
  padding: 5px;
  backdrop-filter: blur(20px);
  border: solid 1px var(--chapter-border-soft);
  background-color: var(--chapter-surface);
  border-radius: 20px;
  font-size: 28px;
}

/* Cover Image theme — chapter content paper + drawer preview only */
.chapter-reader-paper.chapter-theme.theme-background,
.chapter-reader-drawer-settings .exam-theme.theme-background {
  background-image: linear-gradient(to bottom, rgba(7, 7, 8, 0.6) 0%, rgba(7, 7, 8, 0.6) 100%), var(--chapter-cover-url, none);
  background-size: cover;
  background-position: center;
}
