/* =========================================================
   Physics Equations Worksheet - Main Stylesheet
   Minimal, fast, mobile-first, print-friendly.
   ========================================================= */

* { box-sizing: border-box; }

:root {
  --c-bg: #ffffff;
  --c-text: #1a1a1a;
  --c-muted: #5a6470;
  --c-primary: #1d4ed8;       /* deep blue */
  --c-primary-dark: #1e3a8a;
  --c-accent: #0891b2;
  --c-border: #e5e7eb;
  --c-soft: #f3f6fb;
  --c-success: #15803d;
  --c-equation-bg: #eef4ff;
  --radius: 8px;
  --maxw: 1100px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-eq: "Cambria Math", Cambria, Georgia, "Times New Roman", serif;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; color: var(--c-text); margin-top: 1.6em; }
h1 { font-size: 2rem; margin-top: 0.6em; }
h2 { font-size: 1.5rem; border-bottom: 2px solid var(--c-border); padding-bottom: 6px; }
h3 { font-size: 1.2rem; }

p, ul, ol { margin: 0.8em 0; }

/* ============== HEADER ============== */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 20px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--c-text);
}
.logo:hover { text-decoration: none; }
.logo-mark {
  font-size: 1.4rem;
  color: var(--c-primary);
}
.main-nav ul {
  display: flex;
  gap: 18px;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}
.main-nav a {
  color: var(--c-text);
  font-size: 0.95rem;
  font-weight: 500;
}
.main-nav a:hover { color: var(--c-primary); }

/* ============== BREADCRUMBS ============== */
.breadcrumbs {
  background: var(--c-soft);
  font-size: 0.88rem;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
}
.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  margin: 0;
}
.breadcrumbs .sep { color: var(--c-muted); margin: 0 4px; }
.breadcrumbs [aria-current="page"] { color: var(--c-muted); }

/* ============== HERO ============== */
.hero {
  background: linear-gradient(135deg, #1d4ed8 0%, #0891b2 100%);
  color: #fff;
  padding: 50px 20px 60px;
  text-align: center;
}
.hero h1 {
  color: #fff;
  margin: 0 0 14px;
  font-size: 2.2rem;
}
.hero p {
  font-size: 1.1rem;
  max-width: 720px;
  margin: 0 auto 22px;
  opacity: 0.96;
}
.hero .cta {
  display: inline-block;
  background: #fff;
  color: var(--c-primary-dark);
  padding: 12px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
}
.hero .cta:hover { background: #f3f6fb; text-decoration: none; }

/* ============== CARDS / GRID ============== */
.section {
  padding: 40px 0;
}
.section h2 { margin-top: 0; }

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.card {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 20px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover {
  border-color: var(--c-primary);
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.08);
  transform: translateY(-2px);
}
.card h3 { margin: 0 0 8px; font-size: 1.1rem; }
.card h3 a { color: var(--c-text); }
.card h3 a:hover { color: var(--c-primary); text-decoration: none; }
.card .meta {
  font-size: 0.82rem;
  color: var(--c-muted);
  margin-bottom: 10px;
}
.card .tag {
  display: inline-block;
  background: var(--c-soft);
  color: var(--c-primary-dark);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-right: 6px;
}
.card p { font-size: 0.94rem; margin: 0 0 12px; color: var(--c-muted); }
.card .card-link {
  font-weight: 600;
  font-size: 0.92rem;
}

/* ============== WORKSHEET PAGE ============== */
.worksheet-header {
  background: var(--c-soft);
  padding: 30px 0;
  border-bottom: 1px solid var(--c-border);
}
.worksheet-header h1 { margin: 0 0 8px; }
.worksheet-header .meta {
  color: var(--c-muted);
  font-size: 0.95rem;
  margin-bottom: 12px;
}
.worksheet-header .tag {
  display: inline-block;
  background: var(--c-primary);
  color: #fff;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-right: 6px;
}

.download-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}
.btn {
  display: inline-block;
  padding: 10px 18px;
  background: var(--c-primary);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
}
.btn:hover { background: var(--c-primary-dark); text-decoration: none; }
.btn.btn-secondary {
  background: #fff;
  color: var(--c-primary);
  border: 2px solid var(--c-primary);
}
.btn.btn-secondary:hover { background: var(--c-soft); }

/* Equations table */
.equations-box {
  background: var(--c-equation-bg);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 16px 22px;
  margin: 22px 0;
}
.equations-box h3 { margin-top: 0; color: var(--c-primary-dark); }
.equations-box table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-eq);
}
.equations-box td {
  padding: 8px 10px;
  border-bottom: 1px solid #bfdbfe;
  vertical-align: top;
}
.equations-box td:first-child {
  font-weight: 600;
  font-size: 1.1rem;
  white-space: nowrap;
  color: var(--c-primary-dark);
  width: 35%;
}
.equations-box tr:last-child td { border-bottom: none; }

/* Symbols table */
.symbols-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}
.symbols-table th, .symbols-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--c-border);
}
.symbols-table th {
  background: var(--c-soft);
  font-weight: 600;
}

/* Problems list */
.problems {
  counter-reset: problem;
  list-style: none;
  padding: 0;
}
.problems > li {
  counter-increment: problem;
  margin: 0 0 16px;
  padding: 14px 16px 14px 56px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  position: relative;
  background: #fff;
}
.problems > li::before {
  content: counter(problem);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 30px;
  height: 30px;
  background: var(--c-primary);
  color: #fff;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}
.problems .question { margin: 0; }
.problems details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--c-border);
}
.problems summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--c-primary);
  user-select: none;
}
.problems details[open] summary { margin-bottom: 8px; }
.problems .answer {
  font-family: var(--font-eq);
  background: #f0fdf4;
  padding: 10px 14px;
  border-left: 3px solid var(--c-success);
  border-radius: 4px;
  color: #14532d;
}

/* ============== CATEGORY / LISTING ============== */
.page-intro {
  padding: 30px 0 10px;
}
.page-intro h1 { margin-top: 0; }

/* ============== FOOTER ============== */
.site-footer {
  background: #0f172a;
  color: #cbd5e1;
  padding: 50px 0 0;
  margin-top: 60px;
  font-size: 0.92rem;
}
.site-footer h3 {
  color: #fff;
  font-size: 1rem;
  margin: 0 0 12px;
  border: none;
}
.site-footer a { color: #cbd5e1; }
.site-footer a:hover { color: #fff; }
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 28px;
  padding-bottom: 36px;
}
.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-col li { margin: 6px 0; }
.footer-bottom {
  border-top: 1px solid #1e293b;
  padding: 20px 20px;
  text-align: center;
  font-size: 0.85rem;
  color: #94a3b8;
}

/* ============== UTILITIES ============== */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* ============== PRINT ============== */
@media print {
  .site-header, .breadcrumbs, .site-footer, .download-bar, .hero .cta { display: none; }
  body { font-size: 12pt; }
  .problems details { display: block; }
  .problems summary { display: none; }
  .problems .answer { background: #fafafa; }
  a { color: #000; text-decoration: none; }
}

/* ============== RESPONSIVE ============== */
@media (max-width: 640px) {
  .header-inner { padding: 10px 16px; }
  .main-nav ul { gap: 12px; }
  .main-nav a { font-size: 0.85rem; }
  .hero { padding: 36px 16px 42px; }
  .hero h1 { font-size: 1.6rem; }
  h1 { font-size: 1.5rem; }
  .equations-box td:first-child { width: auto; }
}
