/* ==========================================================================
   RA Lab — Beauty Retouch Panel Training module pages (.ra-mod)
   Created 2026-08-30. Shared by every /br-training-N-module/ page, enqueued
   from inc/ra-module.php. Previously this lived inline in each page blob;
   it was extracted so a design change is one edit, not one per page.

   Everything is scoped under .ra-mod so the resets cannot touch the site
   header, footer, or any other page furniture.
   ========================================================================== */

.ra-mod, .ra-mod *, .ra-mod *::before, .ra-mod *::after { box-sizing: border-box; }
.ra-mod *, .ra-mod *::before, .ra-mod *::after { margin: 0; padding: 0; }

.ra-mod {
  --bg: var(--brpdp-page-bg, #f1eee7); --bg-2:#ece8df; --ink:#111110; --ink-2:#2a2826; --muted:#6b6760;
  --line:rgba(17,17,16,0.10); --accent:#C70606; --paper:#fbf9f4;
  --sans:"Geist","Inter",system-ui,sans-serif;
  --mono:"Geist Mono","JetBrains Mono",ui-monospace,monospace;
  --serif:"Instrument Serif","Times New Roman",serif;
  --max:1440px; --gutter:32px;
  font-family: var(--sans); background: var(--bg); color: var(--ink);
  font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
}

/* The theme ships broad p{color:…} rules at a higher specificity than a plain
   class, so inheritance has to be forced back on. */
.ra-mod p, .ra-mod li, .ra-mod h1, .ra-mod h2, .ra-mod h3,
.ra-mod span, .ra-mod blockquote { color: inherit; }

.ra-mod .ra-shell { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.ra-mod .ra-section { padding: 50px 0; position: relative; }
.ra-mod > .ra-section:first-child { padding-top: 20px; }

/* ── Type ───────────────────────────────────────────────────────────────── */
.ra-mod .t-h1 { font-size: clamp(34px,4.4vw,64px); font-weight: 600; letter-spacing: -0.035em; line-height: 0.98; color: var(--ink); }
.ra-mod .t-h1 em { font-family: var(--serif); font-style: italic; font-weight: 300; letter-spacing: -0.01em; }
.ra-mod .t-h3 { font-size: clamp(22px,2.2vw,30px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; color: var(--ink); }
.ra-mod .t-h3 em { font-family: var(--serif); font-style: italic; font-weight: 300; color: var(--ink); }
.ra-mod .t-lede { font-size: 16.5px; line-height: 1.68; letter-spacing: -0.01em; color: var(--ink-2); }
.ra-mod .t-body { font-size: 16.5px; line-height: 1.68; color: var(--ink-2); }
.ra-mod .t-cap { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }

.ra-mod a { color: var(--accent); }
.ra-mod a:hover { color: var(--ink); }
.ra-mod a.t-link { color: var(--accent); text-decoration: none; font-weight: 500; border-bottom: 1px solid rgba(199,6,6,0.30); transition: border-color .2s ease; }
.ra-mod a.t-link:hover { border-color: var(--accent); color: var(--accent); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.ra-mod .ra-btn { display: inline-flex; align-items: center; gap: 10px; height: 50px; padding: 0 26px; border-radius: 999px; font-size: 14px; font-weight: 500; border: 1px solid var(--ink); cursor: pointer; text-decoration: none; transition: transform .15s ease, background .2s ease, color .2s ease; white-space: nowrap; font-family: var(--sans); }
.ra-mod .ra-btn:hover { transform: translateY(-1px); }
.ra-mod .ra-btn-primary { background: var(--ink); color: var(--bg) !important; }
.ra-mod .ra-btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff !important; }
.ra-mod .ra-btn-ghost { background: transparent; color: var(--ink) !important; }
.ra-mod .ra-btn-ghost:hover { background: var(--ink); color: var(--bg) !important; }
.ra-mod .ra-arrow { display: inline-block; transition: transform .2s ease; }
.ra-mod .ra-btn:hover .ra-arrow.is-fwd { transform: translateX(3px); }
.ra-mod .ra-btn:hover .ra-arrow.is-back { transform: translateX(-3px); }

/* ── Module header ──────────────────────────────────────────────────────── */
.ra-mod .lesson-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 22px; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.ra-mod .lesson-crumb a { color: var(--muted); text-decoration: none; }
.ra-mod .lesson-crumb a:hover { color: var(--accent); }
.ra-mod .lesson-crumb .sep { opacity: .5; }
.ra-mod .lesson-crumb .cur { color: var(--ink); }
.ra-mod .module-head-grid { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: end; }
.ra-mod .module-head-grid .t-h1 { max-width: 20ch; }
.ra-mod .module-progress { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.ra-mod .mp-bar { width: 190px; height: 4px; border-radius: 999px; background: rgba(17,17,16,.12); overflow: hidden; }
.ra-mod .mp-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .35s cubic-bezier(.22,.7,.25,1); }

/* ── Tab rail ───────────────────────────────────────────────────────────────
   The rail wraps rather than shrinking indefinitely, so a module with 9
   lessons stays legible instead of squeezing every tab to a sliver. */
.ra-mod .module-layout { display: block; }
.ra-mod .lesson-rail { display: flex; flex-wrap: wrap; align-items: stretch; gap: 4px; margin-bottom: 0; position: relative; z-index: 1; }
.ra-mod .lesson-tab {
  -webkit-appearance: none; appearance: none; text-align: left; cursor: pointer; font-family: var(--sans);
  flex: 1 1 190px; min-width: 0; overflow: hidden; min-height: 52px; padding: 13px 16px; border-radius: 14px 14px 0 0;
  border: 1px solid var(--line); border-bottom: none; background: transparent; color: var(--muted);
  transition: flex-grow .38s cubic-bezier(.22,.7,.25,1), border-color .2s ease, background .2s ease, color .2s ease;
}
.ra-mod .lesson-tab:hover { color: var(--ink); border-color: rgba(17,17,16,.24); }
.ra-mod .lesson-tab:hover .tab-title { overflow: visible; text-overflow: clip; }
.ra-mod .lesson-tab[aria-selected="true"] { background: var(--paper); border-color: var(--line); color: var(--ink); position: relative; z-index: 2; margin-bottom: -1px; padding-bottom: 14px; }
.ra-mod .lesson-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ra-mod .tab-head { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.ra-mod .tab-num { flex: 0 0 auto; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; color: var(--muted); transition: color .2s ease; }
.ra-mod .lesson-tab[aria-selected="true"] .tab-num { color: var(--accent); }
.ra-mod .tab-title { min-width: 0; font-family: var(--mono); font-size: 13.5px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ra-mod .lesson-tab[aria-selected="true"] .tab-title { overflow: visible; text-overflow: clip; }
.ra-mod .rail-foot { margin-top: 30px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Single-lesson modules: a one-tab strip reads as broken, so hide the rail
   and close the top corners of the stage. Set data-single on .module-layout. */
.ra-mod .module-layout[data-single] .lesson-rail { display: none; }
.ra-mod .module-layout[data-single] .lesson-stage { border-radius: 16px; }
.ra-mod .module-layout[data-single] .lp-nav { border-top: 1px solid var(--line); }

/* ── Two-row rail (6+ lessons) ──────────────────────────────────
   Up to 5 lessons the rail is one row and the active tab merges into the card
   below. From 6 it becomes a balanced grid over two rows and the tabs detach
   into outlined pills: a tab in the upper row cannot merge into a card it is
   not touching, so the merge is dropped rather than half-applied.

   Column counts are quantity queries — later rules override earlier ones, so
   9 tabs matches the 6, 7 and 9 rules and ends on 5 columns:
     6 → 3 cols (3+3)      7,8 → 4 cols (4+4)
     9,10 → 5 cols (5+4)   11,12 → 6 cols (6+5)

   Scoped to min-width 1025px on purpose: :has() here scores (0,3,0) and would
   otherwise outrank the (0,2,0) tablet and phone rules further down the file,
   forcing five columns onto a 375px screen.
   ─────────────────────────────────────────────────────────────────── */
@media (min-width: 1025px) {
  .ra-mod .lesson-rail:has(.lesson-tab:nth-child(6)) {
    display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; margin-bottom: 10px;
  }
  .ra-mod .lesson-rail:has(.lesson-tab:nth-child(7))  { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .ra-mod .lesson-rail:has(.lesson-tab:nth-child(9))  { grid-template-columns: repeat(5, minmax(0,1fr)); }
  .ra-mod .lesson-rail:has(.lesson-tab:nth-child(11)) { grid-template-columns: repeat(6, minmax(0,1fr)); }

  .ra-mod .lesson-rail:has(.lesson-tab:nth-child(6)) .lesson-tab {
    flex: none; border-radius: 12px; border-bottom: 1px solid var(--line);
    margin-bottom: 0; padding-bottom: 13px;
  }
  .ra-mod .lesson-rail:has(.lesson-tab:nth-child(6)) .lesson-tab[aria-selected="true"] { border-color: var(--ink); }
  .ra-mod .lesson-rail:has(.lesson-tab:nth-child(6)) .tab-title { white-space: normal; overflow: visible; text-overflow: clip; }
  .ra-mod .module-layout:has(.lesson-tab:nth-child(6)) .lesson-stage { border-radius: 16px; }
}

/* ── Stage ──────────────────────────────────────────────────────────────── */
.ra-mod .lesson-stage { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 0 0 16px 16px; padding: clamp(32px,3.9vw,56px) clamp(26px,3.2vw,44px); }
.ra-mod .lesson-panel { display: none; }
.ra-mod .lesson-panel.is-active { display: block; animation: raPanelIn .3s ease both; }
@keyframes raPanelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ra-mod .lp-top { display: grid; grid-template-columns: minmax(0,1.12fr) minmax(0,.88fr); gap: clamp(24px,2.6vw,44px); align-items: start; margin-bottom: clamp(28px,3vw,40px); }
.ra-mod .lp-aside .t-h3 { margin-bottom: 12px; }
.ra-mod .lp-aside .t-lede { margin-bottom: 16px; }
.ra-mod .lp-aside .t-body { margin-bottom: 14px; }
.ra-mod .lp-aside .t-body:last-child, .ra-mod .lp-aside .ls-note:last-child { margin-bottom: 0; }
.ra-mod .lp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(22px,2.6vw,44px); align-items: start; }
.ra-mod .lp-cols > div > *:first-child { margin-top: 0; }

/* ── Video poster ───────────────────────────────────────────────────────── */
.ra-mod .hero-video {
  -webkit-appearance: none; appearance: none;
  position: relative; display: block; width: 100%; max-width: 100%; margin: 0;
  height: 0; padding: 0 0 56.25%;
  border: 1px solid var(--line); border-radius: 20px; overflow: hidden; cursor: pointer;
  background-color: #15140f;
  background-image: radial-gradient(130% 120% at 70% 12%, #3a352e 0%, #1d1b16 48%, #0f0e0b 100%);
  background-size: cover; background-position: center;
}
.ra-mod .hero-video::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(17,17,16,.28) 0%, rgba(17,17,16,.12) 36%, rgba(17,17,16,.66) 100%); transition: background .25s ease; }
.ra-mod .hero-video:hover::after { background: linear-gradient(180deg, rgba(17,17,16,.36) 0%, rgba(17,17,16,.2) 36%, rgba(17,17,16,.72) 100%); }
.ra-mod .hv-play { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 2; width: 84px; height: 84px; border-radius: 999px; background: rgba(251,249,244,.95); display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 40px rgba(0,0,0,.34); transition: background .2s ease, transform .2s ease; }
.ra-mod .hv-play svg { width: 26px; height: 26px; transform: translateX(3px); }
.ra-mod .hv-play svg path { fill: var(--ink); transition: fill .2s ease; }
.ra-mod .hero-video:hover .hv-play { background: var(--accent); transform: translate(-50%,-50%) scale(1.06); }
.ra-mod .hero-video:hover .hv-play svg path { fill: #fff; }
.ra-mod .hv-meta { position: absolute; left: 22px; bottom: 20px; z-index: 2; max-width: 78%; }
.ra-mod .hv-meta .hv-title { font-size: clamp(17px,1.8vw,23px); font-weight: 600; letter-spacing: -0.02em; color: #fff; line-height: 1.14; }
.ra-mod .hv-duration { position: absolute; right: 18px; bottom: 20px; z-index: 2; display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 12px; color: #fff; background: rgba(17,17,16,.5); padding: 6px 12px; border-radius: 999px; }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .ra-mod .hv-duration { -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); } }
.ra-mod .hv-duration svg { width: 13px; height: 13px; }
.ra-mod .hv-duration svg * { stroke: rgba(255,255,255,.85); }

/* Placeholder for written lessons that have no video yet. */
.ra-mod .hero-still {
  position: relative; display: flex; align-items: center; justify-content: center; text-align: center;
  width: 100%; max-width: 100%; height: 0; padding: 0 0 56.25%;
  border: 1px dashed rgba(17,17,16,.28); border-radius: 20px; overflow: hidden;
  background: var(--bg-2); background-size: cover; background-position: center;
}
.ra-mod .hero-still .hs-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; }
.ra-mod .hero-still .hs-ico { width: 30px; height: 30px; opacity: .5; }
.ra-mod .hero-still .hs-ico path, .ra-mod .hero-still .hs-ico circle, .ra-mod .hero-still .hs-ico rect { stroke: var(--ink); }
.ra-mod .hero-still .hs-label { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* ── Lesson body ────────────────────────────────────────────────────────── */
.ra-mod .lp-body { max-width: 760px; }
.ra-mod .lp-body.lp-cols { max-width: none; }
.ra-mod .lp-body p { margin-bottom: 16px; }
.ra-mod .lp-body p:last-child { margin-bottom: 0; }
.ra-mod .ls-sub { font-size: 16.5px; font-weight: 600; color: var(--ink); margin: 24px 0 12px; }
.ra-mod .ls-list { list-style: none; display: flex; flex-direction: column; gap: 11px; margin: 4px 0; }
.ra-mod .ls-list li { position: relative; padding-left: 26px; font-size: 16.5px; line-height: 1.68; color: var(--ink-2); list-style: none; }
.ra-mod .ls-list li::before { content: ""; position: absolute; left: 6px; top: 11px; width: 6px; height: 6px; border-radius: 999px; background: var(--accent); }
.ra-mod .ls-list li b { color: var(--ink); font-weight: 600; }
.ra-mod .ls-list li em { font-style: italic; color: var(--muted); }
.ra-mod .ls-note { display: flex; gap: 12px; align-items: flex-start; margin-top: 26px; padding: 18px 22px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; font-size: 16.5px; line-height: 1.68; color: var(--ink-2); }
.ra-mod .ls-note .cap-ico { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 3px; }
.ra-mod .ls-note .cap-ico path, .ra-mod .ls-note .cap-ico circle { stroke: var(--accent); }
.ra-mod .ls-quote { margin: 26px 0 0; padding: 20px 24px; border-left: 3px solid var(--accent); background: var(--bg-2); border-radius: 0 14px 14px 0; font-size: 16.5px; line-height: 1.68; color: var(--ink-2); }
.ra-mod .ls-quote cite { display: block; margin-top: 10px; font-style: normal; font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ra-mod .ls-fig { margin: 22px 0 0; }
.ra-mod .ls-fig img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.ra-mod .ls-fig figcaption { margin-top: 8px; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ra-mod .lp-nav { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 38px; padding-top: 26px; border-top: 1px solid var(--line); }
.ra-mod .lp-nav .ra-btn-primary { margin-left: auto; }

/* ── Video modal ────────────────────────────────────────────────────────────
   z-index must clear the site header (1100) or the player opens behind it. */
.ra-mod .video-modal { position: fixed; inset: 0; z-index: 2147483000; display: none; place-items: center; }
.ra-mod .video-modal.is-open { display: grid; }
.ra-mod .vm-backdrop { position: absolute; inset: 0; background: rgba(10,10,9,.9); }
.ra-mod .vm-inner { position: relative; z-index: 1; width: min(94vw, calc((94dvh - 56px) * 16 / 9)); height: min(94dvh - 56px, calc(94vw * 9 / 16)); background: #000; border-radius: 14px; overflow: hidden; box-shadow: 0 40px 120px rgba(0,0,0,.6); animation: raVmRise .28s cubic-bezier(.2,.7,.3,1) both; }
@keyframes raVmRise { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.ra-mod .vm-frame { position: absolute; inset: 0; }
.ra-mod .vm-inner iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.ra-mod .vm-close { position: absolute; top: 12px; right: 12px; z-index: 3; -webkit-appearance: none; appearance: none; display: inline-flex; align-items: center; gap: 8px; background: rgba(17,17,16,.55); border: 1px solid rgba(255,255,255,.3); color: #fff; font-family: var(--sans); font-size: 13px; font-weight: 500; height: 38px; padding: 0 15px; border-radius: 999px; cursor: pointer; transition: background .2s ease, border-color .2s ease; }
.ra-mod .vm-close:hover { background: var(--accent); border-color: var(--accent); }
.ra-mod .vm-close svg { width: 13px; height: 13px; }
.ra-mod .vm-close svg * { stroke: currentColor; }

.ra-mod img, .ra-mod video { -webkit-user-select: none; user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .ra-mod { --gutter: 28px; }
  .ra-mod .lesson-rail { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
  .ra-mod .lesson-tab { flex: none; border-radius: 12px; border-bottom: 1px solid var(--line); }
  .ra-mod .lesson-tab[aria-selected="true"] { flex: none; border-color: var(--ink); margin-bottom: 0; }
  .ra-mod .tab-title { white-space: normal; overflow: visible; text-overflow: clip; }
  .ra-mod .lesson-stage { border-radius: 16px; }
  .ra-mod .module-head-grid { grid-template-columns: 1fr; gap: 20px; align-items: start; }
  .ra-mod .module-progress { align-items: flex-start; }
  .ra-mod .lp-top { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .ra-mod { --gutter: 20px; }
  .ra-mod .ra-section { padding: 48px 0; }
  .ra-mod .hero-video, .ra-mod .hero-still { width: 96%; max-width: 96%; margin: 0 auto; }
  .ra-mod .lp-cols { grid-template-columns: 1fr; }
  .ra-mod .hv-play { width: 64px; height: 64px; }
  .ra-mod .hv-play svg { width: 20px; height: 20px; }
  .ra-mod .lesson-rail { grid-template-columns: 1fr; gap: 6px; margin-bottom: 12px; }
  .ra-mod .lesson-tab { min-height: 52px; padding: 14px 16px; }
  .ra-mod .lp-nav .ra-btn { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .ra-mod *, .ra-mod *::before, .ra-mod *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important;
  }
}
