/* Free student tools (/tools/). Loaded after /styles.css, which supplies the
   nav, footer and colour tokens. Everything here is scoped to .tools-page. */

.tools-page {
  --t-border: #dfe3ea;
  --t-border-strong: #c9d0db;
  --t-field: #ffffff;
  --t-soft: #f5f8fc;
  --t-ring: 0 0 0 4px rgba(1, 103, 235, 0.18);
  --t-good: #0a7d55;
  --t-bad: #c2410c;
  background: #fff;
  overflow-x: hidden;
}
.tools-page [hidden] { display: none !important; }
.tools-page section h2 { text-align: left; }
.tools-page main.tool-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 104px 32px 24px;
}

/* ─── Breadcrumb + heading ─── */
.crumbs {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 10px;
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs span[aria-hidden] { margin: 0 6px; opacity: .6; }
.tool-head h1 {
  font-size: 42px;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
}
.tool-head .lede {
  font-size: 17px;
  color: var(--muted);
  max-width: 640px;
  margin: 0 0 24px;
}

/* ─── Tool shell ─── */
.tool {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.tool.single { grid-template-columns: minmax(0, 1fr); }
.panel {
  background: #fff;
  border: 1px solid var(--t-border);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 28px rgba(15, 23, 42, 0.05);
  min-width: 0;
}
.panel h2, .panel-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
}
.result-panel {
  position: sticky;
  top: 96px;
  background: linear-gradient(180deg, #f3f8ff 0%, #ffffff 100%);
  border-color: rgba(1, 103, 235, 0.18);
}

/* ─── Fields ─── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label {
  font-size: 13px;
  font-weight: 600;
  color: #2a2f3a;
}
.field .hint { font-size: 12.5px; color: var(--muted); }
.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields + .fields { margin-top: 14px; }
.tools-page input[type="text"],
.tools-page input[type="number"],
.tools-page input[type="month"],
.tools-page select,
.tools-page textarea {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming on focus */
  color: var(--text);
  background: var(--t-field);
  border: 1px solid var(--t-border-strong);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 46px;
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.tools-page select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235b6472' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
.tools-page textarea { min-height: 260px; line-height: 1.6; resize: vertical; padding: 14px; }
.tools-page input:hover, .tools-page select:hover, .tools-page textarea:hover { border-color: #aab4c3; }
.tools-page input:focus, .tools-page select:focus, .tools-page textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--t-ring);
}
.tools-page input[aria-invalid="true"] { border-color: var(--t-bad); }
.tools-page input[type="number"]::-webkit-inner-spin-button { opacity: .4; }

.affix { position: relative; display: block; }
.affix > .pre, .affix > .post {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 15px;
  pointer-events: none;
}
.affix > .pre { left: 12px; }
.affix > .post { right: 12px; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s var(--spring), box-shadow .15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:focus-visible, .seg button:focus-visible, .icon-btn:focus-visible, .preset:focus-visible,
.tools-page a:focus-visible, .tools-page summary:focus-visible {
  outline: none;
  box-shadow: var(--t-ring);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-ghost { background: #fff; color: var(--accent); border-color: rgba(1, 103, 235, 0.3); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-dark { background: #0a0a0a; color: #fff; }
.btn-dark:hover { background: #222; color: #fff; }
.btn-light { background: #fff; color: var(--accent); }
.btn-light:hover { background: #f1f6ff; color: var(--accent-dark); }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex: none;
}
.icon-btn:hover { background: #fdf0ec; color: var(--t-bad); }

/* Segmented control */
.seg {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: 999px;
  background: #eef2f7;
  max-width: 100%;
}
.seg button {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border: 0;
  background: transparent;
  color: #3b4250;
  border-radius: 999px;
  padding: 8px 16px;
  min-height: 38px;
  cursor: pointer;
}
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

/* ─── Results ─── */
.result-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0;
}
.result-num {
  font-size: 60px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin: 6px 0 4px;
  overflow-wrap: anywhere;
}
.result-num.md { font-size: 44px; }

.result-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.result-pair .result-num { font-size: 52px; }
.result-pair > div + div .result-num { color: #0a0a0a; }
.result-num.empty, .result-pair .result-num.empty { color: #c3cad6; }
.result-sub { font-size: 14px; color: var(--muted); margin: 0; }
.stat-list { list-style: none; padding: 0; margin: 18px 0 0; border-top: 1px solid var(--t-border); }
.stat-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--t-border);
  font-size: 15px;
}
.stat-list li span:first-child { color: #3b4250; }
.stat-list li strong { font-variant-numeric: tabular-nums; text-align: right; }
.stat-list li:last-child { border-bottom: 0; }
.note {
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 0;
  line-height: 1.5;
}
.callout {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(1, 103, 235, 0.16);
  font-size: 14.5px;
  line-height: 1.5;
}
.callout strong { color: var(--accent); }
.good { color: var(--t-good) !important; }
.bad { color: var(--t-bad) !important; }

/* ─── Soft CTA ─── */
.cta-block {
  position: relative;
  overflow: hidden;
  margin: 48px 0 8px;
  padding: 32px;
  border-radius: 24px;
  background: var(--accent);
  color: #fff;
  isolation: isolate;
}
.cta-block::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1.4px, transparent 1.6px);
  background-size: 26px 26px;
  z-index: -1;
}
.cta-block h2 { font-size: 28px; line-height: 1.15; margin: 0 0 8px; color: #fff; }
.cta-block p { margin: 0 0 20px; color: rgba(255, 255, 255, 0.9); max-width: 560px; font-size: 16px; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ─── Article content under the tool ─── */
.tool-content {
  max-width: 760px;
  margin: 56px 0 0;
}
.tool-content h2 {
  font-size: 26px;
  line-height: 1.2;
  font-weight: 750;
  margin: 44px 0 12px;
}
.tool-content h2:first-child { margin-top: 0; }
.tool-content > section + section { margin-top: 44px; }
.tool-content > section + section > h2:first-child { margin-top: 0; }
.tool-content h3 { font-size: 18px; margin: 26px 0 8px; }
.tool-content p, .tool-content li { font-size: 16px; line-height: 1.7; color: #333; }
.tool-content ol, .tool-content ul { padding-left: 22px; }
.tool-content .src { font-size: 14px; color: var(--muted); }
.tbl-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 16px 0 24px;
  border: 1px solid rgba(1, 103, 235, 0.12);
  border-radius: 16px;
}
.tbl-wrap table { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl-wrap th, .tbl-wrap td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--t-border);
  font-variant-numeric: tabular-nums;
}
.tbl-wrap th {
  font-size: 12.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  background: rgba(1, 103, 235, 0.05);
}
.tbl-wrap tr:last-child td { border-bottom: 0; }
.tbl-wrap td.num, .tbl-wrap th.num { text-align: right; }
.example {
  background: var(--t-soft);
  border: 1px solid var(--t-border);
  border-radius: 16px;
  padding: 18px 20px;
}
.example p:first-child { margin-top: 0; }
.example p:last-child { margin-bottom: 0; }

.tool-faq h3 { margin-top: 24px; }

/* Related tools */
.related { margin: 56px 0 24px; }
.related h2 { font-size: 22px; margin: 0 0 14px; }
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.tool-grid a {
  display: block;
  height: 100%;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--t-border);
  background: #fff;
  color: var(--text);
  transition: border-color .15s ease, transform .2s var(--spring), box-shadow .2s ease;
}
.tool-grid a:hover {
  text-decoration: none;
  border-color: rgba(1, 103, 235, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(1, 103, 235, 0.10);
}
.tool-grid strong { display: block; font-size: 16px; margin-bottom: 4px; }
.tool-grid span { display: block; font-size: 14px; color: var(--muted); line-height: 1.45; }
.tool-grid.big { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.tool-grid.big a { padding: 22px; }
.tool-grid.big strong { font-size: 19px; margin-bottom: 6px; }
.tool-grid.big span { font-size: 15px; }
.tool-grid .go { margin-top: 12px; color: var(--accent); font-weight: 600; font-size: 14px; }

/* Embed snippet */
.embed-box {
  position: relative;
  margin: 12px 0 0;
}
.embed-box textarea {
  min-height: 0;
  height: 120px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: var(--t-soft);
}
.copy-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.copy-status { font-size: 14px; color: var(--t-good); }

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

/* Embed mode (?embed=1): only the tool and a credit link */
.powered { display: none; }
.is-embed .nav-wrap, .is-embed footer, .is-embed .tool-after, .is-embed .crumbs, .is-embed .tool-head .lede { display: none !important; }
.is-embed .tools-page main.tool-main { padding: 12px 12px 8px; }
.is-embed .tool-head h1 { font-size: 22px; margin-bottom: 12px; }
.is-embed .result-panel { position: static; }
.is-embed .powered {
  display: block;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 4px;
}
.is-embed .tool { grid-template-columns: minmax(0, 1fr); }

/* ─── Footer column list for tools ─── */
.tools-page .foot-cols { grid-template-columns: 2fr 1fr 1fr 1fr; }

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .tool { grid-template-columns: minmax(0, 1fr); }
  .result-panel { position: static; }
  /* Result first on narrow screens so the number stays visible while you type */
  .tool .result-panel.first-narrow { order: -1; }
}
@media (max-width: 720px) {
  .tools-page main.tool-main { padding: 84px 16px 16px; }
  .tool-head h1 { font-size: 30px; }
  .tool-head .lede { font-size: 15.5px; margin-bottom: 16px; }
  .panel { padding: 16px; border-radius: 18px; }
  .result-num { font-size: 50px; }
  .result-num.md { font-size: 38px; }
  .fields.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cta-block { padding: 24px 20px; border-radius: 20px; }
  .cta-block h2 { font-size: 24px; }
  .cta-actions .btn { flex: 1 1 100%; }
  .tool-content { margin-top: 40px; }
  .tool-content h2 { font-size: 22px; }
  .tools-page footer { padding: 48px 16px 32px; }
  .tools-page .foot-cols { grid-template-columns: 1fr; }
}

/* ─── GPA course rows ─── */
.course-head, .course-row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, .8fr) minmax(0, .7fr) minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: end;
}
.course-head {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 0 2px 6px;
}
.course-rows { display: flex; flex-direction: column; gap: 8px; }
.course-row .cell { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.course-row .mini {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.row-actions { display: flex; align-items: center; gap: 8px; margin: 14px 0 4px; flex-wrap: wrap; }
.btn-text { background: transparent; color: var(--muted); padding-left: 12px; padding-right: 12px; }
.btn-text:hover { color: var(--t-bad); }
details.opt {
  margin-top: 14px;
  border-top: 1px solid var(--t-border);
  padding-top: 12px;
}
details.opt summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  color: var(--accent);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border-radius: 8px;
}
details.opt summary::-webkit-details-marker { display: none; }
details.opt summary::before {
  content: "";
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .2s var(--spring);
  margin: 0 4px 0 2px;
}
details.opt[open] summary::before { transform: rotate(45deg); }
details.opt .fields { margin-top: 10px; }

@media (max-width: 600px) {
  .course-head { display: none; }
  .course-row {
    grid-template-columns: minmax(0, .9fr) minmax(0, .7fr) minmax(0, .9fr) 40px;
    grid-template-areas: "name name name del" "grade cr lvl lvl";
    padding: 10px 12px 12px;
    border: 1px solid var(--t-border);
    border-radius: 14px;
    background: var(--t-soft);
    gap: 8px;
  }
  .course-row .c-name { grid-area: name; }
  .course-row .c-del { grid-area: del; }
  .course-row .c-grade { grid-area: grade; }
  .course-row .c-cr { grid-area: cr; }
  .course-row .c-lvl { grid-area: lvl; }
  .course-row .mini {
    position: static; width: auto; height: auto; overflow: visible; clip: auto;
    font-size: 12px; font-weight: 600; color: var(--muted);
  }
  .course-row .icon-btn { width: 40px; }
  .result-pair .result-num { font-size: 44px; }
}

/* ─── Converter ─── */
.big-field { margin-top: 18px; }
.big-field input[type="text"], .big-field select { font-size: 28px; font-weight: 700; min-height: 64px; letter-spacing: -0.01em; }
.tools-page input[type="range"] {
  width: 100%;
  margin: 10px 0 0;
  accent-color: var(--accent);
  height: 28px;
  cursor: pointer;
}

/* ─── Chips (quick fill) ─── */
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 16px; }
.chips-label { font-size: 13px; color: var(--muted); margin-right: 2px; }
.chip, .preset {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(1, 103, 235, 0.25);
  background: #fff;
  color: var(--accent);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.chip:hover, .preset:hover { background: var(--accent-soft); }
.chip:focus-visible { outline: none; box-shadow: var(--t-ring); }
.preset[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.tools-page .affix > input { padding-left: 28px; }
.tools-page .affix.has-post > input { padding-left: 12px; padding-right: 34px; }
.tools-page .affix.has-post.wide-post > input { padding-right: 62px; }

/* Collapsible schedule under a tool */
details.panel.sched { margin-top: 20px; padding: 0; }
details.sched summary {
  cursor: pointer;
  list-style: none;
  padding: 18px 22px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 20px;
}
details.sched summary::-webkit-details-marker { display: none; }
details.sched summary::before {
  content: "";
  width: 8px; height: 8px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
  transition: transform .2s var(--spring);
}
details.sched[open] summary::before { transform: rotate(45deg); }
details.sched .tbl-wrap { margin: 0 22px 22px; }
.formula {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px !important;
  background: var(--t-soft);
  border: 1px solid var(--t-border);
  border-radius: 12px;
  padding: 12px 16px;
  overflow-x: auto;
}
@media (max-width: 720px) {
  details.sched summary { padding: 16px; }
  details.sched .tbl-wrap { margin: 0 12px 12px; }
}

/* Floating result bar on narrow screens while the result panel is off screen */
.result-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(10, 10, 10, 0.92);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: #fff;
  font: inherit;
  border: 0;
  text-align: left;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
  cursor: pointer;
  transform: translateY(140%);
  transition: transform .35s var(--spring);
}
.result-bar.show { transform: none; }
.result-bar .rb-label { font-size: 13px; opacity: .75; }
.result-bar .rb-value { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.result-bar .rb-go { font-size: 13px; color: #9cc3ff; font-weight: 600; white-space: nowrap; }
@media (min-width: 901px) { .result-bar { display: none; } }
.is-embed .result-bar { display: none; }

/* ─── Word counter ─── */
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.custom-row { margin: 0 0 14px; }
.meter { height: 6px; border-radius: 999px; background: #e9edf3; overflow: hidden; margin-top: 12px; }
.meter-fill { height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .2s ease, background .2s ease; }
.meter-fill.near { background: var(--warning); }
.meter-fill.over { background: var(--t-bad); }
.limit-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.limit-status { margin: 0; font-size: 15px; font-weight: 600; color: #3b4250; }
.privacy { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.privacy svg { flex: none; color: var(--t-good); }

/* ─── Cost calculator ─── */
.sub-title { margin-top: 22px !important; padding-top: 18px; border-top: 1px solid var(--t-border); }
.year-panel { margin-top: 20px; }
.year-panel .tbl-wrap { margin: 0; }
.tbl-wrap tr.tot td { background: var(--t-soft); }
@media (max-width: 720px) {
  .year-panel .tbl-wrap th, .year-panel .tbl-wrap td { padding: 9px 8px; font-size: 13.5px; }
  .year-panel .tbl-wrap th { font-size: 11px; }
}

@media (max-width: 600px) {
  .presets { gap: 6px; }
  .preset { font-size: 13px; padding: 5px 10px; min-height: 34px; }
  .tools-page textarea#text { min-height: 200px; }
  .result-bar { padding: 10px 14px; }
  .result-bar .rb-value { font-size: 20px; }
}
.is-embed .tool .result-panel { order: -1; }

/* Hub: tools grouped by topic, each group led by the app's artwork. */
.tools-page .hub-groups { display: grid; gap: 48px; margin-top: 8px; }
.tools-page .hub-group-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.tools-page .hub-group-head img { width: 56px; height: 56px; object-fit: contain; }
.tools-page .hub-group-head h2 { margin: 0; font-size: clamp(22px, 2.4vw, 28px); letter-spacing: -0.02em; }
.tools-page .hub-count { margin-left: 4px; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; }
