/* ═══════════════════════════════════════════════
   EST LITERACY PRACTICE — PLUGIN STYLES
   Scoped to #est-literacy-app to avoid WP conflicts
═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,900;1,700&family=IBM+Plex+Mono:wght@400;500;600&family=Crimson+Pro:ital,wght@0,300;0,400;0,600;1,400&display=swap');

#est-literacy-app {
  --est-ink:     #0f0e0c;
  --est-paper:   #f7f3ec;
  --est-cream:   #ede8da;
  --est-red:     #b5341a;
  --est-navy:    #1a3a5c;
  --est-gold:    #c8a84b;
  --est-muted:   #6b6560;
  --est-border:  #ccc4b0;
  --est-green:   #2d6a4f;
  --est-danger:  #7f1d1d;
  --est-serif:   'Crimson Pro', Georgia, serif;
  --est-display: 'Playfair Display', Georgia, serif;
  --est-mono:    'IBM Plex Mono', 'Courier New', monospace;

  font-family: var(--est-serif);
  font-size: 17px;
  line-height: 1.7;
  color: var(--est-ink);
  background: var(--est-paper);
  -webkit-font-smoothing: antialiased;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
}

#est-literacy-app *, #est-literacy-app *::before, #est-literacy-app *::after {
  box-sizing: border-box;
}

/* ─── HOME ─── */
#est-home {
  padding: 56px 32px 64px;
}

.est-hero {
  text-align: center;
  margin-bottom: 56px;
}

.est-hero-eyebrow {
  font-family: var(--est-mono);
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--est-muted);
  margin-bottom: 18px;
}

.est-hero-title {
  font-family: var(--est-display);
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 900;
  line-height: 1.05;
  margin: 0 0 20px;
  color: var(--est-ink);
}

.est-hero-title em {
  font-style: italic;
  color: var(--est-red);
}

.est-hero-sub {
  font-size: 18px;
  color: var(--est-muted);
  max-width: 520px;
  margin: 0 auto;
  font-style: italic;
  line-height: 1.6;
}

/* Module Cards */
.est-module-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 48px;
}

@media (max-width: 720px) {
  .est-module-grid { grid-template-columns: 1fr; }
}

.est-mod-card {
  background: white;
  border: 2px solid var(--est-border);
  padding: 36px 28px 32px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
  width: 100%;
}

.est-mod-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--est-border);
  transition: background .2s;
}

.est-mod-card:nth-child(1)::before { background: var(--est-red); }
.est-mod-card:nth-child(2)::before { background: var(--est-navy); }
.est-mod-card:nth-child(3)::before { background: var(--est-green); }

.est-mod-card:hover {
  border-color: var(--est-ink);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,.12);
}

.est-mod-num {
  font-family: var(--est-display);
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
  color: var(--est-border);
  display: block;
  margin-bottom: 16px;
  transition: color .2s;
}

.est-mod-card:nth-child(1):hover .est-mod-num { color: var(--est-red); }
.est-mod-card:nth-child(2):hover .est-mod-num { color: var(--est-navy); }
.est-mod-card:nth-child(3):hover .est-mod-num { color: var(--est-green); }

.est-mod-name {
  font-family: var(--est-display);
  font-size: 20px;
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
  color: var(--est-ink);
}

.est-mod-focus {
  font-family: var(--est-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--est-muted);
  display: block;
  margin-bottom: 16px;
}

.est-mod-desc {
  font-size: 14px;
  color: var(--est-muted);
  line-height: 1.5;
  display: block;
  flex: 1;
  margin-bottom: 20px;
}

.est-mod-arrow {
  font-size: 20px;
  color: var(--est-border);
  transition: color .2s, transform .2s;
  display: block;
}

.est-mod-card:hover .est-mod-arrow {
  color: var(--est-ink);
  transform: translateX(6px);
}

.est-tagline {
  text-align: center;
  font-family: var(--est-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--est-muted);
  text-transform: uppercase;
}

/* ─── LOADING ─── */
#est-loading {
  min-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.est-loading-inner {
  text-align: center;
  padding: 48px;
}

.est-spinner-ring {
  width: 56px;
  height: 56px;
  border: 3px solid var(--est-border);
  border-top-color: var(--est-red);
  border-radius: 50%;
  animation: estSpin .9s linear infinite;
  margin: 0 auto 24px;
}

@keyframes estSpin { to { transform: rotate(360deg); } }

.est-loading-mod {
  font-family: var(--est-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--est-ink);
}

.est-loading-txt {
  font-family: var(--est-mono);
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--est-muted);
  text-transform: uppercase;
  margin-bottom: 20px;
}

.est-loading-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.est-loading-dots span {
  width: 8px; height: 8px;
  background: var(--est-red);
  border-radius: 50%;
  animation: estPulse 1.2s ease-in-out infinite;
}
.est-loading-dots span:nth-child(2) { animation-delay: .2s; }
.est-loading-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes estPulse { 0%,80%,100%{opacity:.2;transform:scale(.8)} 40%{opacity:1;transform:scale(1)} }

/* ─── PRACTICE SCREEN ─── */
#est-practice {
  padding: 0;
}

.est-practice-top {
  background: var(--est-ink);
  color: white;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 50;
}

.est-back-btn {
  font-family: var(--est-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: #aaa;
  background: transparent;
  border: 1px solid #444;
  padding: 7px 14px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all .2s;
  white-space: nowrap;
}

.est-back-btn:hover { color: white; border-color: white; }

.est-practice-meta {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.est-practice-mod-badge {
  font-family: var(--est-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: var(--est-gold);
  color: var(--est-ink);
  padding: 3px 10px;
  white-space: nowrap;
}

.est-practice-title {
  font-family: var(--est-display);
  font-size: 16px;
  font-weight: 700;
  color: white;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.est-score-mini {
  font-family: var(--est-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--est-gold);
  white-space: nowrap;
}

/* ── SPLIT PANE LAYOUT ──
   Left pane  = passage (scrolls independently)
   Right pane = questions + score (scrolls independently)
   Both panes fill the viewport height under the sticky top bar.
────────────────────────────────────────────────────── */
.est-practice-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 0;
  /* Fill whatever height is left below the sticky header (~56px) */
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* Left pane — passage only */
.est-left-col {
  overflow-y: auto;
  border-right: 2px solid var(--est-border);
  padding: 32px 28px 48px;
  background: var(--est-paper);
}

/* Right pane — questions + score */
.est-right-col {
  overflow-y: auto;
  padding: 24px 24px 48px;
  background: white;
  display: flex;
  flex-direction: column;
  gap: 0;
  /* Un-sticky the score card — it lives inline in the right pane */
  position: static;
  top: auto;
}

@media (max-width: 880px) {
  .est-practice-body {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .est-left-col {
    overflow-y: visible;
    border-right: none;
    border-bottom: 2px solid var(--est-border);
    padding: 24px 18px 28px;
  }
  .est-right-col {
    overflow-y: visible;
    padding: 24px 18px 40px;
  }
}

/* Pane section labels */
.est-pane-label {
  font-family: var(--est-mono);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--est-muted);
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1.5px solid var(--est-border);
}

/* Passage Box — no border of its own inside the pane */
.est-passage-box {
  background: transparent;
  border: none;
  padding: 0;
  margin-bottom: 0;
}

.est-passage-type-tag {
  display: inline-block;
  font-family: var(--est-mono);
  font-size: 9px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  padding: 3px 10px;
  color: white;
  margin-bottom: 14px;
}

.est-passage-title-text {
  font-family: var(--est-display);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
  line-height: 1.2;
}

.est-passage-author-text {
  font-style: italic;
  color: var(--est-muted);
  font-size: 15px;
  margin-bottom: 20px;
}

.est-passage-rule {
  width: 100%;
  height: 1px;
  background: var(--est-border);
  margin: 16px 0 20px;
}

.est-passage-section-label {
  font-family: var(--est-mono);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--est-muted);
  margin: 24px 0 8px;
}

.est-passage-section-label:first-child { margin-top: 0; }

.est-passage-content {
  font-family: var(--est-serif);
  font-size: 16px;
  line-height: 1.85;
  color: var(--est-ink);
}

.est-passage-content u {
  text-decoration-color: var(--est-red);
  text-decoration-thickness: 2px;
}

/* Questions */
.est-q-item {
  border: 1.5px solid var(--est-border);
  background: var(--est-cream);
  padding: 22px 24px;
  margin-bottom: 20px;
  transition: border-color .15s;
}

.est-q-meta {
  font-family: var(--est-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--est-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.est-q-type-tag {
  background: var(--est-border);
  color: var(--est-ink);
  padding: 1px 6px;
  font-size: 9px;
  letter-spacing: 1.5px;
}

.est-q-text {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  line-height: 1.5;
  color: var(--est-ink);
}

.est-q-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.est-q-opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 16px;
  border: 1.5px solid var(--est-border) !important;
  background: white !important;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-family: var(--est-serif);
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
  width: 100%;
  /* Force black text — overrides any WP theme button resets */
  color: #111111 !important;
}

/* Also force on child spans so theme can't override them */
.est-q-opt span {
  color: #111111 !important;
}

.est-q-opt:hover:not(:disabled) { border-color: var(--est-navy) !important; background: #f0f4f8 !important; color: #111111 !important; }
.est-q-opt.est-selected  { border-color: var(--est-navy) !important; background: #e8eff7 !important; color: #111111 !important; }
.est-q-opt.est-correct   { border-color: var(--est-green) !important; background: #d8f0e4 !important; color: #111111 !important; }
.est-q-opt.est-incorrect { border-color: var(--est-danger) !important; background: #f8e0e0 !important; color: #111111 !important; }
.est-q-opt:disabled { cursor: default; }

.est-opt-letter {
  font-family: var(--est-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--est-red) !important;
  min-width: 18px;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Letter colors after answer reveal */
.est-q-opt.est-correct  .est-opt-letter { color: var(--est-green) !important; }
.est-q-opt.est-incorrect .est-opt-letter { color: var(--est-danger) !important; }

.est-q-feedback {
  margin-top: 12px;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.65;
  border-left: 3px solid;
  display: none;
}

.est-q-feedback.est-fb-show { display: block; }
.est-q-feedback.est-fb-correct   { border-color: var(--est-green); background: #f0faf5; color: #1a4a30; }
.est-q-feedback.est-fb-incorrect { border-color: var(--est-danger); background: #fdf0f0; color: var(--est-danger); }

/* Submit Row */
.est-submit-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px 0;
  border-top: 1.5px solid var(--est-border);
  margin-top: 8px;
  flex-wrap: wrap;
}

.est-submit-btn {
  padding: 16px 36px;
  background: var(--est-navy);
  color: white;
  border: none;
  font-family: var(--est-display);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
  letter-spacing: .5px;
}

.est-submit-btn:hover { background: var(--est-red); }
.est-submit-btn:disabled { background: var(--est-muted); cursor: not-allowed; }

.est-ans-progress {
  font-family: var(--est-mono);
  font-size: 12px;
  color: var(--est-muted);
  letter-spacing: 1px;
}

/* Results Banner */
.est-results-banner {
  background: var(--est-ink);
  color: white;
  padding: 36px;
  text-align: center;
  margin-top: 24px;
}

.est-results-pct {
  font-family: var(--est-display);
  font-size: 72px;
  font-weight: 900;
  color: var(--est-gold);
  display: block;
  line-height: 1;
}

.est-results-label {
  font-family: var(--est-mono);
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #aaa;
  margin-top: 8px;
  display: block;
}

.est-results-sub {
  color: #ccc;
  font-size: 16px;
  margin-top: 12px;
}

/* ─── SIDE PANEL ─── */
/* .est-right-col handled in split-pane block above */

.est-score-card {
  background: var(--est-ink);
  color: white;
  padding: 18px 20px;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.est-sc-label {
  font-family: var(--est-mono);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--est-gold);
  margin-bottom: 20px;
}

.est-sc-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.est-sc-item {
  text-align: center;
}

.est-sc-num {
  font-family: var(--est-display);
  font-size: 30px;
  font-weight: 900;
  display: block;
  line-height: 1;
}

.est-sc-num.est-green  { color: #6fcf97; }
.est-sc-num.est-red    { color: #eb5757; }
.est-sc-num.est-gold   { color: var(--est-gold); }

.est-sc-sub {
  font-family: var(--est-mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  color: #888;
  text-transform: uppercase;
  margin-top: 4px;
  display: block;
}

.est-progress-wrap {
  background: #333;
  height: 5px;
  margin-bottom: 22px;
}

.est-progress-bar {
  height: 100%;
  background: var(--est-gold);
  transition: width .4s ease;
  width: 0%;
}

.est-new-btn {
  width: 100%;
  padding: 13px;
  background: var(--est-red);
  color: white;
  border: none;
  font-family: var(--est-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .2s;
}

.est-new-btn:hover:not(:disabled) { background: #c84020; }
.est-new-btn:disabled { background: #444; cursor: not-allowed; }

.est-analysis-card {
  background: var(--est-cream);
  border: 1.5px solid var(--est-border);
  padding: 20px;
}

.est-analysis-label {
  font-family: var(--est-mono);
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--est-muted);
  margin-bottom: 12px;
}

.est-analysis-body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--est-ink);
  font-style: italic;
}

/* ─── ERROR ─── */
.est-error-box {
  text-align: center;
  padding: 72px 32px;
  max-width: 480px;
  margin: 0 auto;
}

.est-error-icon {
  width: 56px;
  height: 56px;
  background: var(--est-danger);
  color: white;
  font-size: 28px;
  font-weight: 900;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-family: var(--est-display);
}

.est-error-msg {
  font-size: 16px;
  color: var(--est-danger);
  margin-bottom: 24px;
  line-height: 1.6;
}

.est-error-retry {
  padding: 12px 28px;
  background: var(--est-ink);
  color: white;
  border: none;
  font-family: var(--est-mono);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 600px) {
  #est-home { padding: 36px 20px 48px; }
  .est-practice-top { padding: 12px 16px; }
  .est-practice-body { padding: 20px 16px; }
  .est-passage-box { padding: 20px 18px; }
  .est-q-item { padding: 18px 16px; }
  .est-score-mini { display: none; }
}
