/* ============================================================================
   CONTENT LIBRARY — shared stylesheet
   Base = House Style (quiet-luxury, gold-on-near-black, typography-first).
   Per-brand SIGNATURE color switches on <html data-brand="...">.
   Reading panes follow Kavita's legibility standard (21px / 1.7).
   ============================================================================ */

:root {
  --bg:         #0f0e17;
  --panel:      #1a1924;
  --panel-2:    #232231;
  --deep:       #0b0a12;
  --text:       #e8e6f0;
  --muted:      #8a87a3;
  --accent:     #c9a96e;   /* gold — luxe accent, dividers, active */
  --accent-lt:  #d4b87a;
  --accent-dim: #6b5d3f;
  --on-accent:  #1a1310;
  --purple:     #9d8fb8;
  --error:      #ff6b6b;
  --ok:         #7bd88f;
  --border:     #2d2c3d;
  --done:       #4f4d62;

  /* brand signature (overridden per data-brand). Default = KST deep blue, brightened for dark bg. */
  --brand:      #3f93c4;
  --brand-deep: #005282;

  --font-display: "Cinzel", serif;
  --font-body:    "Cormorant Garamond", Georgia, serif;
  --font-mono:    "DM Mono", ui-monospace, monospace;

  --radius:     12px;
  --radius-sm:  7px;
  --maxw:       960px;
}

/* ---- brand signatures ---- */
html[data-brand="kavita"]      { --brand:#3f93c4; --brand-deep:#005282; }  /* KST deep blue */
html[data-brand="alchemy"]     { --brand:#2ea6b8; --brand-deep:#0077A0; }  /* AOO teal */
html[data-brand="earthangel"]  { --brand:#b06a8e; --brand-deep:#65254D; }  /* EAW plum */

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); }

body {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.5;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-lt); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px 90px; }

/* ---------- Masthead ---------- */
.masthead {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--deep), var(--bg));
  padding: 30px 0 26px;
  margin-bottom: 8px;
}
.masthead .wrap { padding-bottom: 0; }
.brandmark {
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: .34em; text-transform: uppercase;
  color: var(--brand);
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.brandmark::before { content:""; width: 26px; height: 2px; background: var(--brand); display:inline-block; }
h1.title {
  font-family: var(--font-display);
  font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text); font-size: 30px; margin: 0 0 8px;
}
.tagline { font-family: var(--font-body); font-size: 20px; color: var(--muted); font-style: italic; margin: 0; max-width: 640px; }

.crumb {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em;
  color: var(--muted); margin: 22px 0 4px; display:flex; gap:10px; align-items:center;
}
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent); }
.crumb .sep { color: var(--accent-dim); }

/* ---------- Section labels ---------- */
.label {
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: .28em; text-transform: uppercase;
  color: var(--purple); margin: 32px 0 16px; display:flex; align-items:center; gap:14px;
}
.label::after { content:""; flex:1; height:1px; background: var(--border); }

/* ---------- Course cards (home) ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 18px; margin-top: 20px; }
.course-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: border-color .16s, transform .16s;
  display:flex; flex-direction: column;
}
.course-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.course-card .cover {
  height: 150px; background: linear-gradient(135deg, var(--brand-deep), var(--deep));
  background-size: cover; background-position: center; position: relative;
}
.course-card .cover .lockchip {
  position:absolute; top:12px; right:12px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing:.16em; text-transform:uppercase;
  padding: 5px 10px; border-radius: 100px; backdrop-filter: blur(4px);
}
.lockchip.free   { background: rgba(123,216,143,.16); color:#a9e8ba; border:1px solid rgba(123,216,143,.3); }
.lockchip.gated  { background: rgba(201,169,110,.16); color: var(--accent-lt); border:1px solid var(--accent-dim); }
.course-card .body { padding: 18px 20px 20px; flex:1; display:flex; flex-direction: column; }
.course-card h3 { font-family: var(--font-display); font-weight:500; letter-spacing:.05em; font-size: 20px; margin: 0 0 8px; color: var(--text); }
.course-card p  { margin: 0 0 14px; color: var(--muted); font-size: 17px; line-height:1.45; flex:1; }
.course-card .meta { font-family: var(--font-mono); font-size: 11px; letter-spacing:.08em; color: var(--muted); display:flex; gap:14px; align-items:center; }
.course-card .bar { height: 4px; background: var(--panel-2); border-radius: 100px; overflow:hidden; margin-top:12px; }
.course-card .bar > i { display:block; height:100%; background: var(--brand); width:0; transition: width .3s; }

/* ---------- Course view: modules (collapsed by default) ---------- */
.module { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; background: var(--panel); }
.module > .head {
  display:flex; align-items:center; gap:14px; padding: 16px 20px; cursor: pointer; user-select:none;
}
.module > .head:hover { background: var(--panel-2); }
.module .chev { color: var(--accent); font-family: var(--font-mono); transition: transform .18s; font-size:13px; }
.module.open .chev { transform: rotate(90deg); }
.module .m-title { font-family: var(--font-display); font-weight:500; letter-spacing:.05em; font-size: 19px; flex:1; }
.module .m-count { font-family: var(--font-mono); font-size: 11px; letter-spacing:.1em; color: var(--muted); }
.module .lessons { display:none; border-top: 1px solid var(--border); }
.module.open .lessons { display:block; }
.lesson-row {
  display:flex; align-items:center; gap:14px; padding: 13px 20px 13px 22px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s;
}
.lesson-row:last-child { border-bottom: none; }
.lesson-row:hover { background: var(--panel-2); }
.lesson-row .tick {
  width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--done);
  display:flex; align-items:center; justify-content:center; font-size: 12px; color: var(--deep); flex-shrink:0;
}
.lesson-row.done .tick { background: var(--brand); border-color: var(--brand); color:#fff; }
.lesson-row .l-title { flex:1; font-size: 18px; }
.lesson-row .l-meta { font-family: var(--font-mono); font-size: 11px; color: var(--muted); display:flex; gap:10px; align-items:center; }
.lesson-row .vid-ico { color: var(--brand); }

/* ---------- Lesson view ---------- */
.videowrap { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; border-radius: var(--radius); overflow:hidden; border:1px solid var(--border); margin: 6px 0 26px; }
.videowrap iframe { position:absolute; inset:0; width:100%; height:100%; border:0; }
.reading { font-size: 21px; line-height: 1.7; color: var(--text); }
.reading p { margin: 0 0 18px; }
.reading h2 { font-family: var(--font-display); font-weight:500; letter-spacing:.05em; color: var(--text); font-size: 24px; margin: 30px 0 12px; }
.reading h3 { font-family: var(--font-display); font-weight:500; color: var(--accent-lt); font-size: 20px; margin: 24px 0 10px; }
.reading ul, .reading ol { margin: 0 0 18px; padding-left: 24px; }
.reading li { margin-bottom: 8px; }
.reading blockquote { border-left: 3px solid var(--accent-dim); margin: 0 0 18px; padding: 4px 0 4px 20px; color: var(--purple); font-style: italic; }
.reading a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.reading img { max-width: 100%; border-radius: var(--radius-sm); }

.lesson-nav { display:flex; justify-content: space-between; gap:14px; margin-top: 40px; border-top: 1px solid var(--border); padding-top: 22px; }

/* ---------- Buttons ---------- */
button, .btn {
  font-family: var(--font-mono); font-size: 13px; letter-spacing:.04em;
  border-radius: var(--radius-sm); border:1px solid var(--border);
  background: var(--panel-2); color: var(--text); padding: 11px 18px; cursor: pointer;
  transition: all .15s; text-transform: uppercase; letter-spacing:.08em;
}
button:hover, .btn:hover { border-color: var(--brand); color: var(--text); }
.btn-primary {
  background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 500;
}
.btn-primary:hover { filter: brightness(1.12); color:#fff; }
.btn-gold { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-gold:hover { background: var(--accent-lt); color: var(--on-accent); }
.btn-ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: default; }

/* ---------- Gate / lead forms ---------- */
.gate {
  max-width: 460px; margin: 40px auto; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 34px 30px;
}
.gate h2 { font-family: var(--font-display); font-weight:500; letter-spacing:.06em; font-size: 22px; margin: 0 0 6px; color: var(--text); }
.gate .sub { color: var(--muted); font-size: 18px; margin: 0 0 22px; line-height:1.5; }
.field { margin-bottom: 16px; }
label {
  display:block; font-family: var(--font-mono); font-size: 11px; letter-spacing:.16em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 7px;
}
input[type=text], input[type=email] {
  width:100%; font-family: var(--font-body); font-size: 18px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; transition: border-color .15s;
}
input:focus { outline:none; border-color: var(--brand); }
::placeholder { color: var(--muted); opacity:1; }
.formnote { font-family: var(--font-mono); font-size: 12px; margin-top: 12px; min-height: 16px; }
.formnote.err { color: var(--error); }
.formnote.ok  { color: var(--ok); }

/* ---------- Footer ---------- */
.foot {
  margin-top: 60px; border-top: 1px solid var(--border); padding-top: 22px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing:.06em; color: var(--muted);
  display:flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.foot a { color: var(--muted); }
.foot a:hover { color: var(--accent); }

.empty { text-align:center; color: var(--muted); padding: 60px 20px; font-style: italic; font-size: 19px; }

@media (max-width: 640px) {
  h1.title { font-size: 24px; }
  .reading { font-size: 20px; }
  .grid { grid-template-columns: 1fr; }
  .lesson-nav { flex-direction: column; }
}
