@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

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

:root {
  --bg:       #0D0D12;
  --surface:  #14141C;
  --card:     #1C1C28;
  --border:   rgba(255,255,255,0.08);
  --text:     #E4E4DC;
  --muted:    #7A7A88;
  --white:    #F5F5F0;

  --red:      #C0392B;
  --red-light:#E8574A;
  --red-glow: rgba(192,57,43,0.18);

  --blue:     #2E75B6;
  --blue-light:#5B9BD5;
  --blue-glow: rgba(46,117,182,0.18);

  --green:    #6E9E2A;
  --green-light:#8DC63F;
  --green-glow: rgba(110,158,42,0.18);

  --purple:   #5C2D8A;
  --purple-light:#8A52B8;
  --purple-glow: rgba(92,45,138,0.18);

  --radius:   12px;
  --nav-h:    70px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
}

/* ── NOISE TEXTURE ── */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 0;
}

/* ── NAV ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(13,13,18,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 2rem;
  gap: 1.5rem;
}
.nav-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  font-weight: 300;
  letter-spacing: 0.05em;
  color: var(--white);
  text-decoration: none;
  white-space: nowrap;
}
.nav-logo span { font-style: italic; color: var(--muted); }
.nav-divider { width: 1px; height: 24px; background: var(--border); }
.nav-standards {
  display: flex; gap: 0.25rem;
  overflow-x: auto; scrollbar-width: none;
}
.nav-standards::-webkit-scrollbar { display: none; }
.nav-std {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--border);
  transition: all 0.2s;
  flex-shrink: 0;
}
.nav-std:hover, .nav-std.active { color: var(--white); }
.nav-std[data-domain="1"]:hover, .nav-std[data-domain="1"].active { background: var(--red-glow); border-color: var(--red); color: var(--red-light); }
.nav-std[data-domain="pk"]:hover, .nav-std[data-domain="pk"].active { background: var(--blue-glow); border-color: var(--blue); color: var(--blue-light); }
.nav-std[data-domain="pp"]:hover, .nav-std[data-domain="pp"].active { background: var(--green-glow); border-color: var(--green); color: var(--green-light); }
.nav-std[data-domain="pe"]:hover, .nav-std[data-domain="pe"].active { background: var(--purple-glow); border-color: var(--purple); color: var(--purple-light); }

.nav-home {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-home:hover { color: var(--white); }

/* ── MAIN LAYOUT ── */
main { padding-top: var(--nav-h); position: relative; z-index: 1; }

/* ── TYPOGRAPHY ── */
h1, h2, h3 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  line-height: 1.2;
}
h1 { font-size: clamp(2.5rem, 6vw, 5rem); }
h2 { font-size: clamp(1.8rem, 3vw, 2.8rem); }
h3 { font-size: 1.4rem; }
p { color: var(--text); }

/* ── UTILITY ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 2rem; }
.tag {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid currentColor;
}

/* ── CARDS ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: border-color 0.25s, transform 0.25s;
}
.card:hover { transform: translateY(-2px); }

/* ── UPLOAD ZONE ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface);
}
.upload-zone:hover { border-color: currentColor; background: var(--card); }
.upload-zone .upload-icon { font-size: 2rem; margin-bottom: 0.75rem; opacity: 0.5; }
.upload-zone p { font-size: 0.875rem; color: var(--muted); }
.upload-zone strong { color: var(--text); }

/* ── ARTIFACT GRID ── */
.artifact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
.artifact-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.artifact-item:hover { border-color: rgba(255,255,255,0.2); }
.artifact-thumb {
  width: 100%; aspect-ratio: 4/3;
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
}
.artifact-info { padding: 0.75rem; }
.artifact-info .name { font-size: 0.8rem; font-weight: 500; margin-bottom: 0.2rem; }
.artifact-info .type { font-size: 0.7rem; color: var(--muted); font-family: 'DM Mono', monospace; }

/* ── REFLECTION EDITOR ── */
.reflection-area {
  width: 100%;
  min-height: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  line-height: 1.7;
  resize: vertical;
  transition: border-color 0.2s;
}
.reflection-area:focus { outline: none; border-color: rgba(255,255,255,0.25); }
.reflection-area::placeholder { color: var(--muted); }

/* ── SECTION LABEL ── */
.section-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: 0.75rem;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── BTN ── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
}
.btn:hover { border-color: rgba(255,255,255,0.2); background: var(--surface); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.15); }

/* ── FOOTER ── */
footer {
  margin-top: 6rem;
  padding: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
}
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--text); }

/* ── DOMAIN BADGE COLORS ── */
.domain-1 { --accent: var(--red); --accent-light: var(--red-light); --glow: var(--red-glow); }
.domain-pk { --accent: var(--blue); --accent-light: var(--blue-light); --glow: var(--blue-glow); }
.domain-pp { --accent: var(--green); --accent-light: var(--green-light); --glow: var(--green-glow); }
.domain-pe { --accent: var(--purple); --accent-light: var(--purple-light); --glow: var(--purple-glow); }

/* ── STANDARD PAGE HERO ── */
.std-hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
  position: relative;
  overflow: hidden;
}
.std-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 80% 50%, var(--glow) 0%, transparent 60%);
  pointer-events: none;
}
.std-hero .std-number {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-light);
  margin-bottom: 0.75rem;
}
.std-hero h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  color: var(--white);
  margin-bottom: 1rem;
  max-width: 700px;
}
.std-hero p {
  max-width: 600px;
  color: var(--muted);
  font-size: 1rem;
}
.std-hero .domain-tag {
  margin-top: 1.25rem;
  color: var(--accent-light);
  border-color: var(--accent);
  background: var(--glow);
}

/* ── PAGE GRID ── */
.page-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 900px) {
  .page-grid { grid-template-columns: 1fr; }
}

/* ── SIDEBAR ── */
.sidebar { position: sticky; top: calc(var(--nav-h) + 1.5rem); }
.sidebar-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.sidebar-card h4 {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}
.std-nav-links { display: flex; flex-direction: column; gap: 0.4rem; }
.std-nav-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.82rem;
  transition: all 0.2s;
}
.std-nav-link:hover { background: var(--surface); color: var(--text); }
.std-nav-link.active { background: var(--glow); color: var(--accent-light); }
.std-nav-link .num {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  width: 20px;
  flex-shrink: 0;
}
.progress-bar {
  height: 4px; border-radius: 2px;
  background: var(--surface);
  margin-top: 0.5rem;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s;
}

/* ── CONTENT SECTIONS ── */
.content-section { margin-bottom: 3rem; }
.content-section .card { margin-bottom: 1rem; }

/* ── LESSON CARD ── */
.lesson-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text);
}
.lesson-card:hover { border-color: rgba(255,255,255,0.2); transform: translateX(4px); }
.lesson-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  background: var(--glow);
  border: 1px solid var(--accent);
  flex-shrink: 0;
}
.lesson-meta { font-size: 0.7rem; color: var(--muted); margin-top: 0.2rem; }
.lesson-title { font-weight: 500; font-size: 0.9rem; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .nav-standards { gap: 0.15rem; }
  .nav-std { width: 30px; height: 30px; }
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.6s ease forwards; }
.fade-up-1 { animation-delay: 0.1s; opacity: 0; }
.fade-up-2 { animation-delay: 0.2s; opacity: 0; }
.fade-up-3 { animation-delay: 0.3s; opacity: 0; }
.fade-up-4 { animation-delay: 0.4s; opacity: 0; }

/* ── PRINT ── */
@media print {
  .nav, .sidebar { display: none; }
  main { padding-top: 0; }
}

/* ── LESSON CARD RICH ── */
.lesson-card-rich {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.25s, transform 0.25s;
  margin-bottom: 1rem;
}
.lesson-card-rich:hover { border-color: rgba(255,255,255,0.16); transform: translateY(-2px); }
.lesson-card-preview {
  background: #0D1B2A;
  height: 160px;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.preview-badge {
  position: absolute; top: 0.75rem; left: 0.75rem;
  font-family: 'DM Mono', monospace; font-size: 0.62rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  background: rgba(0,180,216,0.12); border: 1px solid rgba(0,180,216,0.35);
  color: #00b4d8; padding: 3px 8px; border-radius: 4px;
}
.lesson-card-body { padding: 1.25rem 1.5rem 1.5rem; }
.lesson-card-body h4 {
  font-family: 'Cormorant Garamond', serif; font-size: 1.25rem;
  font-weight: 400; color: var(--white); margin-bottom: 0.4rem;
}
.lesson-meta-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.875rem; }
.lesson-tag {
  font-family: 'DM Mono', monospace; font-size: 0.62rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 4px;
  border: 1px solid var(--border); color: var(--muted);
}
.lesson-card-body p { font-size: 0.85rem; color: var(--muted); line-height: 1.6; margin-bottom: 1.1rem; }
.lesson-launch-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.625rem 1.25rem; background: var(--accent);
  color: #fff; border: none; border-radius: 8px;
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
  font-family: 'DM Sans', sans-serif; transition: filter 0.2s;
}
.lesson-launch-btn:hover { filter: brightness(1.2); }
.lesson-std-links {
  display: flex; gap: 0.4rem; flex-wrap: wrap;
  margin-top: 0.875rem; padding-top: 0.875rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem; color: var(--muted); align-items: center;
}
.std-pill {
  font-family: 'DM Mono', monospace; font-size: 0.62rem;
  padding: 2px 8px; border-radius: 99px; border: 1px solid var(--border);
}

/* ── LESSON MODAL ── */
.lesson-modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.94);
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.lesson-modal-overlay.open { opacity: 1; pointer-events: all; }
.lesson-modal-bar {
  height: 52px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem; flex-shrink: 0;
}
.lesson-modal-title {
  font-size: 0.82rem; color: var(--muted); font-family: 'DM Mono', monospace;
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lesson-modal-close {
  width: 32px; height: 32px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--card);
  color: var(--text); cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s; flex-shrink: 0;
}
.lesson-modal-close:hover { background: rgba(255,255,255,0.08); }
.lesson-modal-frame { flex: 1; width: 100%; border: none; }

/* ── REFLECTION ENTRY ── */
.reflection-entry {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.5rem; margin-bottom: 1rem;
}
.ref-date {
  font-family: 'DM Mono', monospace; font-size: 0.65rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-light); margin-bottom: 0.75rem;
}
.reflection-entry h4 {
  font-size: 1rem; color: var(--white); font-weight: 500;
  margin-bottom: 0.625rem; font-family: 'DM Sans', sans-serif;
}
.reflection-entry p { font-size: 0.875rem; color: var(--muted); line-height: 1.8; }
.reflection-entry p + p { margin-top: 0.625rem; }
