/* ============ Reset & tokens ============ */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --accent: #14b8ac;
  --accent-dark: #0e8f86;
  --accent-soft: #d9f7fa;
  --accent-soft-2: #eefdfb;
  --text: #16232b;
  --text-muted: #5b6b76;
  --border: #e3ebee;
  --bg: #ffffff;
  --surface: #f6fafb;
  --danger: #e0554f;
  --danger-soft: #fdecea;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 2px 8px rgba(20, 40, 45, 0.06);
  --shadow-md: 0 12px 32px rgba(20, 40, 45, 0.10);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

a { color: inherit; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 200;
}
.skip-link:focus { left: 0; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ============ Navbar ============ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.navbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
  flex-shrink: 0;
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
}

.nav-menu > ul {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item { position: relative; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover, .nav-link:focus-visible {
  background: var(--accent-soft-2);
  color: var(--accent-dark);
  outline: none;
}

.chev { transition: transform 0.18s ease; flex-shrink: 0; }

.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 210px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  list-style: none;
  margin: 0;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.has-dropdown:hover .dropdown,
.has-dropdown:focus-within .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.has-dropdown:hover .chev,
.has-dropdown:focus-within .chev { transform: rotate(180deg); }

.dropdown li a {
  display: block;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.dropdown li a:hover, .dropdown li a:focus-visible {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 0 auto;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ Hero ============ */
.hero {
  padding: 56px 0 64px;
  background: linear-gradient(180deg, var(--accent-soft-2) 0%, var(--bg) 65%);
}

.hero-heading { text-align: center; max-width: 640px; margin: 0 auto 40px; }

.hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}

.hero-sub {
  font-size: 17px;
  color: var(--text-muted);
  margin: 0;
}

.calc-shell {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

.calc-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
  min-width: 0;
}

/* ---- Semester blocks ---- */
.semester-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 20px;
}

.semester {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 18px;
  min-width: 0;
}

.semester-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.semester-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 160px;
}

.semester-title {
  font: inherit;
  font-weight: 700;
  font-size: 15.5px;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  min-width: 0;
  flex: 1;
}

.semester-title:focus-visible {
  outline: none;
  background: var(--bg);
  box-shadow: 0 0 0 2px var(--accent);
}

.semester-gpa-chip {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-dark);
  background: var(--accent-soft);
  padding: 5px 11px;
  border-radius: 20px;
  white-space: nowrap;
}

.semester-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.weighted-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.weighted-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.semester-remove {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.semester-remove:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

/* ---- Course rows ---- */
.course-table-wrap { overflow-x: auto; }

.course-table { width: 100%; min-width: 640px; border-collapse: collapse; }

.course-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0 8px 8px 0;
}

.course-table td { padding: 5px 8px 5px 0; vertical-align: middle; }

.course-table input[type="text"],
.course-table input[type="number"],
.course-table select {
  width: 100%;
  min-width: 64px;
  font: inherit;
  font-size: 14px;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
}

.course-table input:focus-visible,
.course-table select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.col-name { min-width: 130px; }
.col-grade { min-width: 130px; }
.col-credits { width: 90px; }
.col-type { min-width: 120px; }
.col-remove { width: 34px; }

.grade-input-wrap { display: flex; align-items: center; gap: 6px; }
.grade-input-wrap select,
.grade-input-wrap input[type="number"] { flex: 1; min-width: 0; }

.percent-toggle {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.percent-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.course-remove {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.course-remove:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

.btn-add-course {
  margin-top: 12px;
}

/* ---- Buttons ---- */
.btn {
  font: inherit;
  font-size: 14.5px;
  font-weight: 700;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent-dark); }

.btn-add-semester { width: 100%; justify-content: center; }

/* ---- Result card ---- */
.result-card {
  background: var(--text);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  position: sticky;
  top: 96px;
  box-shadow: var(--shadow-md);
}

.result-eyebrow {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.65);
}

.result-value {
  margin: 0 0 18px;
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  color: var(--accent-soft);
  font-variant-numeric: tabular-nums;
}

.result-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: rgba(255,255,255,0.85);
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.14);
  margin-bottom: 14px;
}

.result-meta span { font-weight: 700; color: #fff; }

.result-scale-note {
  font-size: 12.5px;
  color: rgba(255,255,255,0.55);
}

/* ============ Info cards ============ */
.info-cards-section { padding: 60px 0; }

.info-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.info-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.info-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  font-size: 22px;
  margin-bottom: 16px;
}

.info-card h3 { margin: 0 0 8px; font-size: 17px; }
.info-card p { margin: 0; font-size: 14.5px; color: var(--text-muted); }

/* ============ Content sections ============ */
.content-section { padding: 56px 0; }
.content-section-alt { background: var(--surface); }

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}

.content-grid.reverse { direction: rtl; }
.content-grid.reverse > * { direction: ltr; }

.content-text h2 { font-size: 28px; margin: 0 0 14px; letter-spacing: -0.01em; }
.content-text p { color: var(--text-muted); font-size: 15.5px; margin: 0 0 18px; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--accent-dark);
  text-decoration: none;
}
.link-arrow:hover { text-decoration: underline; }

.content-table table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.content-table th, .content-table td {
  padding: 10px 14px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.content-table th {
  background: var(--surface);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.content-table tr:last-child td { border-bottom: none; }

.content-example {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  font-size: 14.5px;
}

.example-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-dark);
  margin: 0 0 12px;
}

.content-example p { margin: 0 0 8px; color: var(--text-muted); }
.example-total { margin-top: 14px !important; padding-top: 14px; border-top: 1px dashed var(--border); color: var(--text) !important; }

/* ============ FAQ ============ */
.faq-section { padding: 60px 0 72px; }
.faq-section h2 { text-align: center; font-size: 28px; margin: 0 0 32px; }

.faq-list { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  padding: 4px 20px;
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
  font-weight: 700;
  font-size: 15.5px;
  cursor: pointer;
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }

.faq-icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: transform 0.2s ease;
}

.faq-item[open] .faq-icon { transform: rotate(45deg); }

.faq-item p { margin: 0 0 18px; color: var(--text-muted); font-size: 14.5px; }

/* ============ Footer ============ */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 48px 0 0; }

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
  padding-bottom: 36px;
}

.footer-col h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 14px; color: var(--text-muted); }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.footer-col a { text-decoration: none; font-size: 14.5px; color: var(--text); }
.footer-col a:hover { color: var(--accent-dark); }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-muted);
}
.footer-bottom a { text-decoration: none; }
.footer-bottom a:hover { color: var(--accent-dark); }
.footer-bottom p { margin: 0; }

/* ============ Responsive ============ */
@media (max-width: 960px) {
  .calc-shell { grid-template-columns: 1fr; }
  .result-card { position: static; }
  .content-grid { grid-template-columns: 1fr; }
  .content-grid.reverse { direction: ltr; }
}

@media (max-width: 860px) {
  .navbar-inner { flex-wrap: wrap; }
  .logo { order: 1; }
  .nav-toggle { display: flex; order: 2; }
  .nav-menu {
    order: 3;
    flex-basis: 100%;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.22s ease;
  }
  .nav-menu.open { max-height: 620px; overflow-y: auto; }
  .nav-menu > ul { flex-direction: column; align-items: stretch; gap: 2px; padding: 10px 0 16px; }
  .nav-link { width: 100%; justify-content: space-between; padding: 13px 12px; }
  .dropdown {
    position: static;
    opacity: 1; visibility: visible; transform: none;
    box-shadow: none; border: none; background: var(--surface);
    margin: 2px 0 6px; display: none;
  }
  .has-dropdown.open .dropdown { display: block; }
  .has-dropdown.open .chev { transform: rotate(180deg); }
  .info-cards { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .navbar-inner { padding: 12px 16px; }
  .hero { padding: 40px 0 48px; }
  .calc-card { padding: 16px; }
  .semester { padding: 14px; }
  .result-value { font-size: 44px; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}
