.library-page { background: #f7f4ea; color: #102018; }
.library-page .site-header { background: rgba(247,244,234,.96); }
.library-back-link { color: white !important; text-decoration: none !important; }

.library-hero { min-height: 690px; padding: 125px clamp(24px, 6vw, 90px) 75px; display: grid; grid-template-columns: .9fr 1.1fr; align-items: center; gap: clamp(45px, 7vw, 110px); background: #e8e4d8; }
.library-hero h1 { margin: 20px 0 23px; font-size: clamp(55px, 7.2vw, 104px); line-height: .93; letter-spacing: -.055em; }
.library-hero h1 em { color: var(--orange); font-weight: 400; }
.library-hero > div > p { max-width: 680px; color: #425248; font-size: 21px; line-height: 1.7; }
.library-jump-grid { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid #a8aa9f; border-left: 1px solid #a8aa9f; }
.library-jump-grid a { min-height: 205px; padding: 28px; display: flex; flex-direction: column; justify-content: flex-end; color: #102018; text-decoration: none; border-right: 1px solid #a8aa9f; border-bottom: 1px solid #a8aa9f; transition: background .2s, color .2s; }
.library-jump-grid a:hover { background: var(--forest); color: white; }
.library-jump-grid span { margin-bottom: auto; color: var(--orange-text); font-size: 13px; font-weight: 900; letter-spacing: .12em; }
.library-jump-grid a:hover span { color: #f2b17c; }
.library-jump-grid strong { font: 700 27px/1.2 Georgia, serif; }
.library-jump-grid small { margin-top: 7px; font-size: 15px; line-height: 1.4; opacity: .78; }

.library-section { padding: 90px clamp(24px, 6vw, 90px) 105px; border-top: 1px solid var(--line); }
.library-section-heading { margin-bottom: 45px; display: grid; grid-template-columns: 1fr minmax(300px, 560px); gap: 45px; align-items: end; }
.library-section-heading > div { display: flex; align-items: center; gap: 18px; }
.library-section-heading h2 { margin: 0; font: 400 clamp(41px, 5vw, 66px)/1 Georgia, serif; letter-spacing: -.035em; }
.library-section-heading p { margin: 0; color: #4c5b51; font-size: 19px; line-height: 1.65; }
.section-number { flex: none; width: 50px; height: 50px; border: 2px solid var(--forest); border-radius: 50%; display: grid; place-items: center; color: var(--orange-text); font-size: 13px; font-weight: 900; }

.lesson-section { background: #fffdf7; }
.lesson-viewer { max-width: 1280px; margin: 0 auto; border: 2px solid #344c3d; background: #14271c; box-shadow: 0 20px 55px rgba(18,37,25,.16); }
.lesson-stage { min-height: 520px; padding: clamp(12px, 2vw, 26px); display: grid; place-items: center; }
.lesson-stage img { display: block; width: 100%; max-height: 720px; object-fit: contain; background: white; }
.lesson-controls { min-height: 110px; padding: 19px 23px 19px 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px; color: #102018; background: #fffdf7; }
.lesson-controls > div:first-child { display: flex; flex-direction: column; gap: 5px; }
.lesson-controls span { color: #5a685e; font-size: 14px; font-weight: 800; }
.lesson-controls strong { font: 700 21px/1.3 Georgia, serif; }
.lesson-buttons { display: flex; gap: 10px; }
.lesson-buttons button { min-height: 54px; padding: 11px 18px; border: 2px solid var(--forest); border-radius: 4px; background: white; color: var(--forest); font-size: 16px; font-weight: 850; cursor: pointer; }
.lesson-buttons button:last-child { background: var(--forest); color: white; }
.lesson-buttons button:disabled { border-color: #a5aca7; background: #e5e6e1; color: #707a73; cursor: not-allowed; }
.video-lesson { max-width: 1280px; margin: 26px auto 0; border: 2px solid #637568; background: #f0f3e9; }
.video-lesson summary { min-height: 88px; padding: 17px 22px; display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 17px; cursor: pointer; list-style: none; }
.video-lesson summary::-webkit-details-marker { display: none; }
.video-play { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: var(--forest); color: white; font-size: 17px; }
.video-lesson summary strong { display: block; font-size: 19px; }
.video-lesson summary small { display: block; margin-top: 4px; color: #48584d; font-size: 15px; }
.video-lesson summary > span:last-child { font-size: 30px; }
.video-lesson[open] summary > span:last-child { transform: rotate(45deg); }
.video-wrap { padding: 0 20px 20px; }
.video-wrap video { display: block; width: min(1100px, 100%); max-height: 78vh; margin: 0 auto; background: #09120d; }

.glossary-section { background: #e4e0d4; }
.glossary-search-wrap { max-width: 980px; margin-bottom: 38px; }
.glossary-search-wrap label { display: block; margin-bottom: 9px; font-size: 19px; font-weight: 850; }
.glossary-search-box { min-height: 70px; padding: 0 13px 0 20px; display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 8px; border: 3px solid var(--forest); background: white; }
.glossary-search-box > span { font: 700 27px Georgia, serif; }
.glossary-search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 20px; }
.glossary-search-box button { min-height: 46px; padding: 8px 16px; border: 1px solid #647268; background: #f3f1e9; font-size: 15px; font-weight: 800; cursor: pointer; }
#glossary-count { margin: 10px 0 0; color: #435148; font-size: 16px; }
.glossary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.glossary-card { min-width: 0; padding: 0; border: 0; background: white; color: #102018; text-align: left; box-shadow: 0 8px 24px rgba(29,45,34,.12); cursor: pointer; transition: transform .2s, box-shadow .2s; }
.glossary-card:hover { transform: translateY(-4px); box-shadow: 0 14px 32px rgba(29,45,34,.2); }
.glossary-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #d9d7cf; }
.glossary-card span { min-height: 64px; padding: 14px 15px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font: 700 18px/1.25 Georgia, serif; }
.glossary-card span::after { content: "↗"; color: var(--orange-text); font: 800 20px sans-serif; }
.glossary-actions { margin-top: 36px; text-align: center; }
.glossary-actions .button { min-width: 250px; border: 0; cursor: pointer; }
.glossary-actions .button[hidden] { display: none; }

.visual-guides-section { background: #fffdf7; }
.quick-guide-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.quick-guide-grid a { overflow: hidden; display: grid; grid-template-columns: 1fr auto; background: #ece8dc; color: #102018; text-decoration: none; border: 1px solid #a7aea7; }
.quick-guide-grid img { grid-column: 1 / -1; width: 100%; aspect-ratio: 4/3; object-fit: cover; object-position: top; background: #263e30; }
.quick-guide-grid strong { padding: 15px 5px 16px 16px; font: 700 18px/1.25 Georgia, serif; }
.quick-guide-grid span { padding: 17px 16px 15px 5px; color: #315844; font-size: 12px; font-weight: 850; }

.guide-section { background: #233e2d; color: white; }
.guide-section .library-section-heading p { color: #d4ded6; }
.guide-section .section-number { border-color: #c8d8ca; color: #f2b17c; }
.pdf-guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.pdf-guide-grid article { min-height: 390px; padding: 28px; display: flex; flex-direction: column; background: #fffdf7; color: #102018; }
.pdf-badge { align-self: flex-start; padding: 7px 9px; border-radius: 3px; background: #b84f24; color: white; font-size: 12px; font-weight: 900; letter-spacing: .1em; }
.pdf-guide-grid small { margin-top: 35px; color: #66736b; text-transform: uppercase; font-size: 12px; font-weight: 850; letter-spacing: .1em; }
.pdf-guide-grid h3 { margin: 9px 0 12px; font: 700 30px/1.2 Georgia, serif; }
.pdf-guide-grid p { color: #45544a; font-size: 17px; line-height: 1.65; }
.pdf-guide-grid a { margin-top: auto; padding-top: 19px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: #173e2c; font-size: 16px; font-weight: 850; }

.library-return-banner { margin: 0; padding: 45px clamp(24px, 6vw, 90px); display: flex; align-items: center; justify-content: space-between; gap: 30px; background: var(--orange); color: #171b18; }
.library-return-banner small { font-size: 12px; font-weight: 900; letter-spacing: .13em; }
.library-return-banner h2 { margin: 7px 0 0; font: 400 clamp(30px, 4vw, 48px)/1.1 Georgia, serif; }
.library-return-banner .button-light { flex: none; background: #fffdf7; color: #173e2c; }

.glossary-modal { position: fixed; z-index: 100; inset: 0; padding: 18px; display: grid; place-items: center; background: rgba(7,18,12,.95); opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }
.glossary-modal.is-open { opacity: 1; visibility: visible; }
.glossary-modal > section { width: min(900px, 100%); height: min(950px, calc(100vh - 36px)); display: flex; flex-direction: column; overflow: hidden; border-radius: 7px; background: #fffdf7; }
.glossary-modal header { min-height: 86px; padding: 14px 20px 13px 26px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.glossary-modal header span { color: var(--orange-text); text-transform: uppercase; font-size: 12px; font-weight: 850; letter-spacing: .1em; }
.glossary-modal h2 { margin: 4px 0 0; font: 700 28px/1.2 Georgia, serif; }
#close-glossary-modal { flex: none; width: 48px; height: 48px; border: 2px solid #68766d; border-radius: 50%; background: white; font-size: 30px; cursor: pointer; }
.glossary-modal-stage { min-height: 0; flex: 1; padding: 18px; display: grid; place-items: center; overflow: auto; background: #20372a; }
.glossary-modal-stage img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.glossary-modal-footer { min-height: 62px; padding: 12px 26px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.glossary-modal-footer span { color: #4b5a50; font-size: 15px; }
.glossary-modal-footer a { color: #173e2c; font-weight: 850; text-decoration: underline; text-underline-offset: 4px; }

.extra-large-text .library-hero > div > p,
.extra-large-text .library-section-heading p,
.extra-large-text .pdf-guide-grid p { font-size: 23px; }
.extra-large-text .library-jump-grid small,
.extra-large-text .lesson-controls span,
.extra-large-text #glossary-count { font-size: 18px; }
.extra-large-text .library-jump-grid strong,
.extra-large-text .lesson-controls strong { font-size: 27px; }
.extra-large-text .glossary-search-box input { font-size: 24px; }
.extra-large-text .glossary-card span { font-size: 22px; min-height: 78px; }
.extra-large-text .pdf-guide-grid h3 { font-size: 34px; }

@media (max-width: 1100px) {
  .library-hero { grid-template-columns: 1fr; padding-top: 140px; }
  .library-jump-grid a { min-height: 170px; }
  .glossary-grid, .quick-guide-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 820px) {
  .library-section-heading { grid-template-columns: 1fr; gap: 20px; }
  .glossary-grid, .quick-guide-grid { grid-template-columns: repeat(2, 1fr); }
  .pdf-guide-grid { grid-template-columns: 1fr; }
  .pdf-guide-grid article { min-height: 330px; }
  .lesson-controls { align-items: flex-start; flex-direction: column; }
  .lesson-buttons { width: 100%; }
  .lesson-buttons button { flex: 1; }
  .library-return-banner { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
  .library-hero { min-height: auto; padding-top: 115px; }
  .library-hero h1 { font-size: 54px; }
  .library-jump-grid { grid-template-columns: 1fr; }
  .library-jump-grid a { min-height: 138px; }
  .library-section { padding: 65px 18px 75px; }
  .library-section-heading > div { align-items: flex-start; flex-direction: column; }
  .lesson-stage { min-height: 250px; padding: 8px; }
  .lesson-controls { padding: 17px; }
  .video-lesson summary { grid-template-columns: 48px 1fr auto; padding: 14px; }
  .video-play { width: 44px; height: 44px; }
  .glossary-grid, .quick-guide-grid { grid-template-columns: 1fr; }
  .glossary-search-box { grid-template-columns: 30px 1fr; }
  .glossary-search-box button { grid-column: 1 / -1; margin-bottom: 11px; }
  .glossary-card span { min-height: 70px; font-size: 20px; }
  .glossary-modal { padding: 0; }
  .glossary-modal > section { width: 100%; height: 100vh; border-radius: 0; }
  .glossary-modal-footer { align-items: flex-start; flex-direction: column; gap: 6px; }
}
