/* CSSE Plan of Study Planner: mobile-first styles.
   Auburn navy #03244D and orange #DD550C. Orange text uses a darker shade so it
   meets WCAG AA contrast; the brand orange is kept for borders and accents. */

:root {
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --text: #14202E;
  --muted: #4A5568;
  --border: #D5DBE3;
  --navy: #03244D;
  --navy-2: #0B3A73;
  --orange: #DD550C;
  --orange-text: #B84A0A;
  --link: #0B4A9A;
  --primary-bg: #03244D;
  --primary-fg: #FFFFFF;
  --chip-on-bg: #03244D;
  --chip-on-fg: #FFFFFF;
  --warn-bg: #FFF1E7;
  --warn-border: #DD550C;
  --warn-text: #7A2E05;
  --info-bg: #E7EEF7;
  --info-text: #03244D;
  --ok: #1E6B3A;
  --focus: #DD550C;
  --shadow: 0 1px 2px rgba(3, 36, 77, .08), 0 2px 8px rgba(3, 36, 77, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1524; --surface: #13233A; --surface-2: #10203A; --text: #E8EDF4; --muted: #A9B6C8;
    --border: #2A3D58; --navy: #03244D; --navy-2: #0B3A73; --orange: #F59E63; --orange-text: #FF9A5C;
    --link: #9CC3F5; --primary-bg: #F59E63; --primary-fg: #0B1524; --chip-on-bg: #F59E63; --chip-on-fg: #0B1524;
    --warn-bg: #2A1A10; --warn-border: #F59E63; --warn-text: #FFD3B8; --info-bg: #162B47; --info-text: #C9DBF2;
    --ok: #7FD39B; --focus: #F59E63; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1524; --surface: #13233A; --surface-2: #10203A; --text: #E8EDF4; --muted: #A9B6C8;
  --border: #2A3D58; --navy: #03244D; --navy-2: #0B3A73; --orange: #F59E63; --orange-text: #FF9A5C;
  --link: #9CC3F5; --primary-bg: #F59E63; --primary-fg: #0B1524; --chip-on-bg: #F59E63; --chip-on-fg: #0B1524;
  --warn-bg: #2A1A10; --warn-border: #F59E63; --warn-text: #FFD3B8; --info-bg: #162B47; --info-text: #C9DBF2;
  --ok: #7FD39B; --focus: #F59E63; --shadow: none; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 120px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--link); }
a:hover { color: var(--orange-text); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .25rem; color: var(--text); }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 0 0 .4rem; }
h1:focus { outline: none; }
p { margin: 0 0 .75rem; }
.lead { color: var(--muted); margin-bottom: 1rem; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .875rem; margin: .35rem 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); color: var(--text); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: .5rem; top: .5rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- header and stepper ---------- */
/* The department logo has a white background (and must not be recolored), so it sits on white in both themes. */
.logo-band { background: #FFFFFF; }
.logo-in { max-width: 1080px; margin: 0 auto; padding: .6rem 1rem; }
.logo-in img { display: block; width: 340px; max-width: 100%; height: auto; }
.top { position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: .5rem; max-width: 1080px; margin: 0 auto; padding: .55rem 1rem; }
.brand { display: flex; flex-direction: column; min-width: 0; }
.brand-sub { font-size: .75rem; color: #C9D6E8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-title { font-weight: 700; font-size: 1.1rem; }
.top-actions { display: flex; gap: .4rem; flex-shrink: 0; }
.top-btn {
  display: inline-flex; align-items: center; gap: .3rem; min-height: 44px; padding: 0 .75rem;
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.45); border-radius: 8px; font: inherit; font-size: .9rem; cursor: pointer;
}
.top-btn:hover { background: rgba(255,255,255,.12); }
.steps { border-top: 3px solid #DD550C; background: var(--navy-2); }
.steps ol { display: flex; list-style: none; margin: 0 auto; padding: 0 .25rem; max-width: 1080px; }
.steps li { flex: 1; }
.steps button {
  width: 100%; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: none; border: 0; color: #DCE6F2; font: inherit; font-size: .78rem; cursor: pointer; padding: .3rem .1rem;
  border-bottom: 3px solid transparent;
}
.steps .n {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid currentColor; font-size: .75rem; font-weight: 700;
}
.steps button[aria-current="step"] { color: #fff; border-bottom-color: #DD550C; font-weight: 700; }
.steps button[aria-current="step"] .n { background: #DD550C; border-color: #DD550C; color: #fff; }
.steps button.done .n { background: rgba(255,255,255,.18); }
.steps button:hover { color: #fff; }

/* ---------- layout ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 1.1rem 1rem 1.5rem; }
.step { animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .step { animation: none; } * { transition: none !important; } }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem; margin: 0 0 1rem; box-shadow: var(--shadow);
}
fieldset.card { min-width: 0; }
fieldset.card > legend { font-weight: 700; font-size: 1.05rem; padding: 0 .35rem; margin-left: -.35rem; }
.field { margin: .25rem 0 1rem; border: 0; padding: 0; min-width: 0; }
.field:last-child { margin-bottom: .25rem; }
fieldset.sub, div.field.sub { border-left: 3px solid var(--orange); padding-left: .75rem; }
fieldset.sub > legend { padding: 0; }
.label { display: block; font-weight: 600; margin-bottom: .4rem; }
.label.sm { font-size: .875rem; font-weight: 600; }
.grid2 { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }

.xfer-list:not(:empty) { margin: .6rem 0; }
.xfer-row { border: 1px solid var(--border); border-radius: 8px; padding: .6rem .75rem .75rem; margin-bottom: .6rem; background: var(--surface); }
.xfer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .2rem; }
.xfer-head .label { margin: 0; }
.xfer-grid { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: .6rem; margin-top: .5rem; }
.xfer-row .label.sm { margin-bottom: .25rem; }
#transfer-box > .btn { margin-top: .5rem; }

select, input[type="number"], input[type="search"], input[type="email"], input[type="text"], textarea {
  width: 100%; min-height: 44px; padding: .55rem .7rem; font: inherit; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px;
}
select:focus, input:focus, textarea:focus { border-color: var(--navy-2); }
textarea { min-height: 72px; resize: vertical; }
.check { display: flex; align-items: flex-start; gap: .55rem; padding: .45rem 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: .15rem 0 0; flex-shrink: 0; accent-color: var(--navy-2); }

/* segmented radio buttons */
.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg label { position: relative; flex: 1 1 auto; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 44px; padding: .4rem .8rem;
  border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface); font-size: .95rem;
}
.seg input:checked + span { background: var(--chip-on-bg); color: var(--chip-on-fg); border-color: var(--chip-on-bg); font-weight: 600; }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.seg-wrap label { flex-basis: 100%; }

/* course picker */
.picker { border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface); }
.picker summary { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding: .5rem .75rem; cursor: pointer; list-style: none; }
.picker summary::-webkit-details-marker { display: none; }
.picker-cta { color: var(--link); font-weight: 600; }
.picker[open] .picker-cta::after { content: " \25B4"; }
.picker:not([open]) .picker-cta::after { content: " \25BE"; }
.picker-body { padding: 0 .75rem .75rem; }
.course-list { max-height: 320px; overflow-y: auto; margin-top: .5rem; border-top: 1px solid var(--border); }
.course-list h4 { margin: .75rem 0 .1rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.course-list .check { padding: .35rem 0; font-size: .95rem; }
.chips-static { list-style: none; padding: 0; margin: .5rem 0 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.chips-static li { background: var(--info-bg); color: var(--info-text); border-radius: 999px; padding: .2rem .65rem; font-size: .85rem; }

/* interests */
.igroup { margin-bottom: 1rem; }
.igroup h2 { display: flex; align-items: baseline; gap: .5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .75rem; }
.chip {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: .4rem .85rem; text-align: left;
  border: 1.5px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text);
  font: inherit; font-size: .93rem; cursor: pointer;
}
.chip:hover { border-color: var(--orange); }
.chip[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--chip-on-fg); border-color: var(--chip-on-bg); }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; opacity: .55; }
.dots i.on { background: currentColor; opacity: 1; }
.chip:not([aria-pressed="true"]) .dots { display: none; }

/* boxes */
.box { border-radius: 10px; padding: .75rem 1rem; margin: 0 0 1rem; }
.box.info { background: var(--info-bg); color: var(--info-text); }
.box.warn { background: var(--warn-bg); color: var(--warn-text); border-left: 4px solid var(--warn-border); }
.box h2 { font-size: 1rem; margin-bottom: .35rem; color: inherit; }
.box ul { margin: 0; padding-left: 1.2rem; }
.box li { margin: .25rem 0; }
.box a { color: inherit; font-weight: 600; }
.approval { font-weight: 600; border-left: 4px solid var(--orange); padding: .55rem .8rem; background: var(--surface-2); border-radius: 0 8px 8px 0; }

/* programs */
.programs { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.prog { position: relative; }
.prog.selected { border: 2px solid var(--orange); }
.prog-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.prog h2 { margin-bottom: .2rem; }
.badges { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .4rem; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .12rem .5rem; border-radius: 999px; background: var(--info-bg); color: var(--info-text); }
.badge.best { background: var(--orange-text); color: #fff; }
.badge.mine { background: var(--navy-2); color: #fff; }
.score { text-align: right; flex-shrink: 0; }
.score b { font-size: 1.35rem; color: var(--text); }
.meter { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; margin: .4rem 0 .6rem; }
.meter > span { display: block; height: 100%; background: var(--orange); border-radius: 999px; }
.prog .notes { font-size: .9rem; color: var(--muted); margin: 0 0 .6rem; padding-left: 1.1rem; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .5rem 1.1rem;
  border-radius: 8px; border: 1.5px solid var(--navy-2); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--orange); color: var(--text); }
.btn.primary { background: var(--primary-bg); color: var(--primary-fg); border-color: var(--primary-bg); }
.btn.primary:hover { background: var(--orange-text); border-color: var(--orange-text); color: #fff; }
.btn.small { min-height: 36px; padding: .25rem .7rem; font-size: .875rem; }
.linkbtn { background: none; border: 0; padding: .3rem 0; color: var(--link); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; min-height: 36px; }
.nav-row { display: flex; justify-content: space-between; gap: .75rem; margin-top: 1.25rem; }

/* plan */
.plan-title { font-size: 1.1rem; font-weight: 700; margin: 0; }
.tallies { display: grid; grid-template-columns: 1fr; gap: .75rem; margin-bottom: 1rem; }
.tally { margin: 0; }
.tally .big { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.tally .big small { font-size: 1rem; font-weight: 600; color: var(--muted); }
.tally .meter > span.over { background: #B42318; }
.tally ul { margin: .3rem 0 0; padding-left: 1.1rem; font-size: .875rem; color: var(--muted); }
.terms { display: grid; grid-template-columns: 1fr; gap: .75rem; }
.card.term { margin: 0; padding: 0; overflow: hidden; }
.term-h { display: flex; justify-content: space-between; align-items: center; padding: .6rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.term-h h3 { margin: 0; font-size: 1.02rem; }
.term-h .hrs { font-weight: 700; color: var(--muted); font-size: .9rem; }
.term table { width: 100%; border-collapse: collapse; }
.term td { padding: .55rem 1rem; border-top: 1px solid var(--border); vertical-align: top; }
.term tr:first-child td { border-top: 0; }
.term .code { font-weight: 700; white-space: nowrap; }
.term .ttl { display: block; }
.term .cr { text-align: right; white-space: nowrap; color: var(--muted); width: 3.5rem; }
.role { display: inline-block; margin-top: .2rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: .05rem .45rem; border-radius: 4px; background: var(--info-bg); color: var(--info-text); }
.role.elective { background: var(--warn-bg); color: var(--warn-text); }
.inote { display: block; font-size: .82rem; color: var(--muted); margin-top: .2rem; }
.inote.conf { color: var(--warn-text); font-weight: 600; }
.swap { margin-top: .4rem; }
.swap-form { display: grid; gap: .4rem; margin-top: .4rem; padding: .6rem; background: var(--surface-2); border-radius: 8px; border: 1px solid var(--border); }
.swap-form .row { display: flex; gap: .5rem; flex-wrap: wrap; }
.settings summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.settings[open] summary { margin-bottom: .75rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .2rem .75rem; margin: .5rem 0 0; font-size: .95rem; }
.kv dt { font-weight: 600; }
.kv dd { margin: 0; }
.steps-list { margin: .35rem 0 0; padding-left: 1.2rem; }

/* milestones */
.timeline { list-style: none; margin: 0 0 1rem; padding: 0; border-left: 3px solid var(--orange); }
.timeline li { position: relative; padding: .1rem 0 1rem 1.1rem; }
.timeline li::before { content: ""; position: absolute; left: -8.5px; top: .45rem; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--link); }
.timeline .when { display: inline-block; font-size: .8rem; font-weight: 700; color: var(--orange-text); text-transform: uppercase; letter-spacing: .03em; }
.timeline .what { display: block; }
.timeline .cite { display: block; font-size: .8rem; color: var(--muted); }
.share-btns { display: flex; flex-direction: column; gap: .5rem; }
.email-status { margin-top: .75rem; padding: .7rem .85rem; border-radius: 8px; background: var(--info-bg); color: var(--info-text); border-left: 3px solid var(--orange); }
.email-status p { margin: 0 0 .4rem; }
.email-status p:last-child { margin-bottom: 0; }
.email-status a { color: inherit; font-weight: 600; }

/* footer */
.foot { max-width: 1080px; margin: 0 auto; padding: 1rem 1rem 2rem; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); }
.foot p { margin: .35rem 0; }

.print-only { display: none; }

/* ---------- larger screens ---------- */
@media (min-width: 600px) {
  .seg-wrap label { flex-basis: auto; }
  .share-btns { flex-direction: row; flex-wrap: wrap; }
  .tallies { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}
@media (min-width: 760px) {
  main { padding: 1.5rem 1.25rem 2rem; }
  h1 { font-size: 1.75rem; }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .steps button { flex-direction: row; gap: .45rem; font-size: .92rem; }
  .terms { grid-template-columns: 1fr 1fr; align-items: start; }
  .term.summer { grid-column: span 1; }
  .programs { grid-template-columns: 1fr 1fr; }
  .brand-title { font-size: 1.25rem; }
}
@media (max-width: 380px) {
  .top-btn #theme-label { display: none; }
  .top-in { padding: .5rem .75rem; }
  main { padding: 1rem .75rem 1.25rem; }
  .card { padding: .85rem; }
  .term td { padding: .5rem .75rem; }
}

/* ---------- print: a clean summary only ---------- */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .logo-band, .top, main, .foot, .skip, #live { display: none !important; }
  .print-only { display: block !important; }
  #print-summary h1 { font-size: 15pt; margin: 0 0 2pt; color: #03244D; }
  #print-summary h2 { font-size: 11.5pt; margin: 10pt 0 4pt; color: #03244D; border-bottom: 1.5pt solid #DD550C; padding-bottom: 2pt; }
  #print-summary p { margin: 0 0 4pt; }
  #print-summary table { width: 100%; border-collapse: collapse; margin-bottom: 6pt; page-break-inside: auto; }
  #print-summary tr { page-break-inside: avoid; }
  #print-summary th, #print-summary td { text-align: left; border: .5pt solid #999; padding: 2.5pt 5pt; vertical-align: top; }
  #print-summary th { background: #E7EEF7; }
  #print-summary .approval { border: 1pt solid #DD550C; padding: 5pt 7pt; font-weight: 700; background: none; }
  #print-summary ul { margin: 0 0 4pt; padding-left: 14pt; }
  #print-summary .small { font-size: 8.5pt; color: #333; }
  #print-summary .nw { white-space: nowrap; }
}

/* requirement totals table */
.sum { width: 100%; border-collapse: collapse; margin-bottom: .5rem; }
.sum td { padding: .45rem 0; border-top: 1px solid var(--border); vertical-align: top; }
.sum tr:first-child td { border-top: 0; }
.sum .cr { text-align: right; padding-left: 1rem; white-space: nowrap; }
#plan-terms:focus { outline: none; }

/* Badge and hover colors that keep AA contrast in both themes */
:root { --best-bg: #B84A0A; --best-fg: #FFFFFF; --hover-bg: #B84A0A; --hover-fg: #FFFFFF; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --best-bg: #F59E63; --best-fg: #0B1524; --hover-bg: #FFB685; --hover-fg: #0B1524; }
}
:root[data-theme="dark"] { --best-bg: #F59E63; --best-fg: #0B1524; --hover-bg: #FFB685; --hover-fg: #0B1524; }
.badge.best { background: var(--best-bg); color: var(--best-fg); }
.btn.primary:hover { background: var(--hover-bg); border-color: var(--hover-bg); color: var(--hover-fg); }
