/* ============================================================
   MEGR 3171 — Mechatronics 2  |  Dr. Roger Tipton  |  UNCC
   Shared Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,600;0,8..60,700;1,8..60,400&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* --- Variables --- */
:root {
  --navy:        #0d1f3c;
  --navy-mid:    #162d52;
  --navy-light:  #1e3a68;
  --terracotta:  #c0503a;
  --terra-light: #d9684f;
  --gold:        #e8a92a;
  --cream:       #faf7f2;
  --offwhite:    #f2ede6;
  --text:        #1a1a2e;
  --text-muted:  #4a4a6a;
  --border:      #ddd6cc;
  --code-bg:     #1b2b4b;
  --radius:      6px;
  --shadow:      0 2px 12px rgba(13,31,60,0.10);
  --shadow-lg:   0 6px 28px rgba(13,31,60,0.14);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

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

/* --- Header / Nav --- */
header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(13,31,60,0.35);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-brand {
  display: flex;
  flex-direction: column;
}

.site-brand .course-code {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-brand .course-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}

.header-meta {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.65);
  text-align: right;
  line-height: 1.5;
}

/* --- Hero Banner (index page) --- */
.hero {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-light) 60%, var(--terracotta) 130%);
  color: #fff;
  padding: 72px 28px 60px;
  text-align: center;
}

.hero h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 16px;
}

.hero .subtitle {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.82);
  max-width: 640px;
  margin: 0 auto 28px;
}

.hero .badge-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.badge {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.9);
  font-size: 0.78rem;
  padding: 5px 14px;
  border-radius: 20px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.04em;
}

/* --- Page Hero (inner pages) --- */
.page-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  padding: 44px 28px 36px;
}

.page-hero-inner {
  max-width: 900px;
  margin: 0 auto;
}

.week-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--gold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.page-hero h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 12px;
}

.page-hero .lead {
  font-size: 1rem;
  color: rgba(255,255,255,0.78);
  max-width: 680px;
  line-height: 1.65;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 0.84rem;
  margin-bottom: 20px;
  transition: color 0.2s;
}

.back-link:hover { color: var(--gold); }
.back-link::before { content: '←'; }

/* --- Main Container --- */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 28px 80px;
}

.content-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 28px 80px;
}

/* --- Module Grid (index page) --- */
.module-section {
  margin-bottom: 56px;
}

.section-heading {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--terracotta);
  display: inline-block;
}

.section-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  margin-top: 8px;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.week-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  box-shadow: var(--shadow);
}

.week-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--terracotta);
}

.week-card .wk-num {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: var(--terracotta);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.week-card h3 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.3;
}

.week-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.week-card .go-arrow {
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--terracotta);
  font-weight: 500;
}

/* Exam cards */
.exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.exam-card {
  background: var(--navy);
  color: #fff;
  border-radius: 8px;
  padding: 26px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.18s, box-shadow 0.18s;
  box-shadow: var(--shadow);
}

.exam-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.exam-card .exam-tag {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: var(--gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.exam-card h3 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.1rem;
  color: #fff;
}

.exam-card p {
  font-size: 0.84rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.55;
}

/* --- Study Guide Content --- */
.objectives-box {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: #fff;
  border-radius: 8px;
  padding: 28px 32px;
  margin-bottom: 40px;
}

.objectives-box h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}

.objectives-box ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.objectives-box ul li {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.88);
  padding-left: 20px;
  position: relative;
  line-height: 1.55;
}

.objectives-box ul li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--gold);
  font-weight: 700;
}

.content-section {
  margin-bottom: 44px;
}

.content-section h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--offwhite);
}

.content-section h3 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--navy);
  margin: 22px 0 10px;
}

.content-section p {
  margin-bottom: 14px;
  color: var(--text);
  line-height: 1.75;
}

.content-section ul,
.content-section ol {
  padding-left: 22px;
  margin-bottom: 16px;
}

.content-section li {
  margin-bottom: 6px;
  line-height: 1.65;
  color: var(--text);
}

/* Concept Cards */
.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.concept-card {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--terracotta);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.concept-card h4 {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}

.concept-card p {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

/* Equation Boxes */
.equation-box {
  background: var(--code-bg);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 18px 24px;
  margin: 16px 0;
  overflow-x: auto;
}

.equation-box .eq-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: var(--gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.equation-box code {
  font-family: 'DM Mono', monospace;
  font-size: 0.95rem;
  color: #e8e8f0;
  display: block;
  white-space: pre-wrap;
  line-height: 1.8;
}

/* Inline code */
code {
  font-family: 'DM Mono', monospace;
  font-size: 0.86em;
  background: var(--offwhite);
  color: var(--navy);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.equation-box code { background: none; border: none; color: #e8e8f0; padding: 0; }

/* Info / Callout Boxes */
.callout {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 18px 0;
  font-size: 0.9rem;
  line-height: 1.65;
}

.callout-tip   { background: #eef7ee; border-left: 4px solid #4caf50; }
.callout-warn  { background: #fff8e6; border-left: 4px solid var(--gold); }
.callout-info  { background: #e6eef8; border-left: 4px solid var(--navy); }
.callout-exam  { background: #fdecea; border-left: 4px solid var(--terracotta); }

.callout strong { display: block; margin-bottom: 4px; }

/* Practice Problems */
.problems-section { margin-top: 48px; }

.problems-section h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.4rem;
  color: var(--navy);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--terracotta);
}

.problem-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.problem-item .prob-q {
  padding: 18px 22px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.problem-item .prob-q strong {
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  color: var(--terracotta);
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 6px;
}

.solution-toggle {
  width: 100%;
  text-align: left;
  padding: 12px 22px;
  background: var(--offwhite);
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.83rem;
  color: var(--navy);
  font-weight: 500;
  transition: background 0.15s;
}

.solution-toggle:hover { background: var(--border); }

.solution-body {
  padding: 18px 22px;
  display: none;
  background: #fcfaf8;
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text);
  border-top: 1px solid var(--border);
}

.solution-body.open { display: block; }

.solution-body .answer {
  font-family: 'DM Mono', monospace;
  font-size: 0.9rem;
  color: var(--navy);
  background: var(--offwhite);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-top: 12px;
  display: block;
}

/* Key Equations Table */
.eq-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.88rem;
}

.eq-table th {
  background: var(--navy);
  color: var(--gold);
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 16px;
  text-align: left;
}

.eq-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.6;
}

.eq-table tr:nth-child(even) td { background: var(--offwhite); }
.eq-table tr:hover td { background: #efe9e0; }

.eq-table td:first-child {
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  color: var(--terracotta);
  white-space: nowrap;
}

/* --- Footer --- */
footer {
  background: var(--navy);
  color: rgba(255,255,255,0.55);
  text-align: center;
  padding: 28px 20px;
  font-size: 0.82rem;
  line-height: 1.7;
}

footer span { color: rgba(255,255,255,0.8); }

/* --- Responsive --- */
@media (max-width: 680px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: 4px; }
  .header-meta { text-align: left; }
  .hero { padding: 48px 18px 40px; }
  main, .content-container { padding: 28px 16px 60px; }
  .week-grid, .exam-grid { grid-template-columns: 1fr; }
  .concept-grid { grid-template-columns: 1fr; }
}
