:root {
  --ink: #12302c;
  --ink-soft: #335853;
  --forest: #0c302b;
  --emerald: #1c6a5a;
  --paper: #f6f4ec;
  --cloud: #fbfaf5;
  --amber: #ee9f39;
  --coral: #d96b51;
  --line: rgba(18, 48, 44, .17);
  --muted: #63746f;
  --shadow: 0 22px 70px rgba(8, 44, 38, .15);
  --page-gutter: clamp(20px, 4.6vw, 92px);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  min-height: 100dvh;
  margin: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }

.site-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .22;
  background-image: radial-gradient(rgba(16, 48, 43, .11) .6px, transparent .7px);
  background-size: 7px 7px;
}

.topbar {
  min-height: 86px;
  padding: 15px var(--page-gutter);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(246, 244, 236, .91);
  backdrop-filter: blur(11px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.college-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.emblem-wrap { width: 48px; height: 48px; display: grid; place-items: center; overflow: hidden; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; background: var(--cloud); }
.emblem-wrap img { width: 40px; height: 40px; object-fit: contain; }
.college-brand strong, .college-brand small { display: block; }
.college-brand strong { font-family: Georgia, serif; font-size: 1.1rem; letter-spacing: -.02em; }
.college-brand small { color: var(--muted); font-size: .67rem; letter-spacing: .07em; text-transform: uppercase; }

.text-button, .logout-button, .back-link, .quiet-action button, .form-switch button { border: 0; background: transparent; color: var(--ink); font-weight: 700; }
.text-button { padding: 10px 0; white-space: nowrap; }
.text-button span { margin-left: 4px; color: var(--coral); }
.header-member { display: inline-flex; margin-right: 22px; color: var(--ink-soft); font-size: .75rem; font-weight: 800; letter-spacing: .04em; }
.header-member i { width: 7px; height: 7px; display: inline-block; margin: 6px 7px 0 0; border-radius: 50%; background: #50a67f; }

main { width: min(100%, 1920px); min-width: 0; margin: 0 auto; padding-inline: var(--page-gutter); }

.public-home {
  min-height: calc(100dvh - 162px);
  padding-block: clamp(42px, 6vh, 94px);
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr);
  align-items: center;
  gap: clamp(44px, 7vw, 154px);
}

.welcome-copy { max-width: 790px; }
.overline, .form-index { margin: 0 0 16px; color: var(--emerald); font-size: .7rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.welcome-copy h1, .account-intro h1, .welcome-state h1, .shelf-page-heading h1 {
  margin-bottom: 22px;
  font: 700 clamp(3.25rem, 5.5vw, 6.75rem)/.94 Georgia, "Times New Roman", serif;
  letter-spacing: -.065em;
}
.welcome-copy h1 em, .account-intro h1 em { color: var(--coral); font-weight: 400; }
.lead { max-width: 650px; margin-bottom: clamp(26px, 3vw, 36px); color: var(--ink-soft); font-size: clamp(1rem, 1.25vw, 1.18rem); line-height: 1.7; }
.access-points { max-width: 620px; display: grid; gap: 10px; color: var(--ink-soft); font-size: .91rem; }
.access-points span { display: flex; align-items: center; gap: 11px; }
.access-points b { width: 28px; flex: 0 0 auto; color: var(--coral); font-size: .7rem; letter-spacing: .04em; }

.access-card {
  width: min(100%, 480px);
  justify-self: end;
  position: relative;
  padding: clamp(32px, 3.1vw, 46px) clamp(27px, 3vw, 46px) 30px;
  overflow: hidden;
  border: 1px solid rgba(13, 54, 47, .45);
  border-radius: 3px 46px 3px 3px;
  background: var(--forest);
  color: #f7f6ef;
  box-shadow: var(--shadow);
}
.access-card::after { content: ""; position: absolute; width: 260px; height: 260px; right: -130px; bottom: -140px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 50%; }
.card-ribbon { color: #b3dfc8; font-size: .66rem; font-weight: 800; letter-spacing: .15em; }
.access-emblem { width: 65px; height: 65px; margin: 26px 0 25px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .4); border-radius: 50%; color: var(--amber); font: 700 2rem Georgia, serif; }
.access-card h2 { margin-bottom: 10px; font: 700 clamp(2.25rem, 3vw, 3.25rem)/1 Georgia, serif; letter-spacing: -.05em; }
.access-card p { color: #c1d7cd; line-height: 1.65; }
.primary-button { min-height: 49px; padding: 13px 20px; border: 1px solid var(--amber); border-radius: 2px; background: var(--amber); color: #24302c; font-weight: 800; transition: transform .2s, box-shadow .2s; }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 8px 0 rgba(0, 0, 0, .18); }
.primary-button span { margin-left: 14px; }
.access-card .primary-button { width: 100%; margin-top: 13px; }
.quiet-action { margin: 19px 0 0; text-align: center; font-size: .81rem; }
.quiet-action button { color: #fff5dc; text-decoration: underline; text-underline-offset: 4px; }

.account-page { padding-block: clamp(32px, 5vw, 76px); }
.back-link { margin: 0 0 30px; padding: 0; color: var(--ink-soft); font-size: .84rem; }
.account-grid { max-width: 1500px; margin: 0 auto; display: grid; grid-template-columns: minmax(310px, .82fr) minmax(460px, 1.18fr); overflow: hidden; border: 1px solid var(--line); background: var(--cloud); box-shadow: 0 18px 60px rgba(16, 49, 43, .08); }
.account-intro { padding: clamp(38px, 5vw, 76px); background: #dbe9df; }
.account-intro h1 { margin-bottom: 24px; font-size: clamp(2.8rem, 4.2vw, 5rem); }
.account-intro > p:not(.overline) { max-width: 430px; color: var(--ink-soft); line-height: 1.7; }
.login-fact { margin-top: 45px; padding-top: 20px; border-top: 1px solid var(--line); display: grid; gap: 3px; font-size: .84rem; }
.login-fact span { color: var(--muted); }
.account-form { padding: clamp(34px, 5vw, 74px); }
.account-form h2 { margin-bottom: 30px; font: 700 2.35rem/1 Georgia, serif; letter-spacing: -.045em; }
.account-form form { display: grid; gap: 17px; }
.account-form label { display: grid; gap: 7px; color: var(--ink-soft); font-size: .76rem; font-weight: 800; letter-spacing: .035em; }
.account-form input, .account-form select, .shelf-filters select { width: 100%; height: 48px; padding: 0 13px; border: 1px solid var(--line); border-radius: 2px; outline: none; background: #fffefa; color: var(--ink); font-weight: 500; }
.account-form input:focus, .account-form select:focus, .shelf-filters select:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(28, 106, 90, .12); }
.two-field { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-error { min-height: 1.1em; margin: 0; color: #af3d31; font-size: .8rem; }
.full { width: 100%; margin-top: 4px; }
.form-switch { margin: 24px 0 0; color: var(--muted); font-size: .86rem; }
.form-switch button { padding: 0; color: var(--emerald); text-decoration: underline; text-underline-offset: 3px; }

.welcome-state { max-width: 720px; padding-block: clamp(74px, 12vh, 150px); margin: 0 auto; text-align: center; }
.check-orbit { width: 76px; height: 76px; margin: 0 auto 27px; display: grid; place-items: center; border: 1px solid var(--emerald); border-radius: 50%; box-shadow: 0 0 0 10px #dcebe0; background: var(--forest); color: #fff; font-size: 1.6rem; }
.welcome-state h1 { margin-bottom: 18px; font-size: clamp(3rem, 5.5vw, 5.4rem); }
.welcome-state > p:not(.overline) { max-width: 540px; margin: 0 auto 28px; color: var(--muted); line-height: 1.7; }
.identity-code { max-width: 500px; margin: 0 auto 27px; padding: 15px 18px; display: flex; justify-content: space-between; align-items: center; gap: 16px; border: 1px dashed var(--emerald); background: #eef4ed; }
.identity-code code { min-width: 0; overflow-wrap: anywhere; color: var(--forest); font-size: 1.05rem; font-weight: 800; letter-spacing: .05em; }
.identity-code button { flex: 0 0 auto; border: 0; background: none; color: var(--emerald); font-size: 1.2rem; }

.member-home { padding-block: clamp(52px, 7vw, 100px); }
.member-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 25px; }
.member-heading h1 { margin-bottom: 9px; font: 700 clamp(3rem, 4.8vw, 5.5rem)/.95 Georgia, serif; letter-spacing: -.06em; }
.member-heading p:not(.overline) { color: var(--muted); }
.logout-button { padding: 9px 0; color: #a1493c; font-size: .83rem; white-space: nowrap; }
.member-grid { margin-top: clamp(32px, 4vw, 52px); display: grid; grid-template-columns: minmax(280px, .56fr) minmax(0, 1.44fr); gap: clamp(18px, 2vw, 28px); }
.member-card { min-height: 347px; padding: 21px; position: relative; overflow: hidden; background: var(--forest); color: #f9f7ee; }
.member-card::after { content: ""; position: absolute; width: 200px; height: 200px; right: -88px; bottom: -92px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 50%; }
.member-card-top { display: flex; justify-content: space-between; color: #bfe0cc; font-size: .65rem; font-weight: 800; letter-spacing: .12em; }
.member-monogram { width: 66px; height: 66px; margin: 35px 0 17px; display: grid; place-items: center; border-radius: 50%; background: var(--amber); color: var(--forest); font: 700 1.9rem Georgia, serif; }
.member-card h2 { margin-bottom: 4px; font: 700 1.9rem/1 Georgia, serif; }
.member-card p { color: #bdd2c7; font-size: .87rem; }
.member-card code { position: absolute; right: 20px; bottom: 20px; left: 20px; overflow-wrap: anywhere; color: #f8d9a9; font-size: .73rem; font-weight: 700; letter-spacing: .04em; }
.shelf-callout { padding: clamp(32px, 5vw, 64px); background: #dfece2; }
.shelf-callout h2 { margin-bottom: 17px; font: 700 clamp(2.2rem, 3.5vw, 4.1rem)/.97 Georgia, serif; letter-spacing: -.05em; }
.shelf-callout > p:not(.overline) { max-width: 680px; color: var(--ink-soft); line-height: 1.72; }
.shelf-actions { margin-top: 31px; display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.shelf-actions span { color: var(--muted); font-size: .78rem; }

.semester-upgrade {
  margin-top: clamp(18px, 2vw, 28px);
  padding: clamp(24px, 3vw, 35px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border: 1px solid var(--line);
  background: #fffefa;
}
.semester-upgrade h2, .pyq-heading h2 { margin-bottom: 7px; font: 700 clamp(1.7rem, 2.5vw, 2.35rem)/1 Georgia, serif; letter-spacing: -.045em; }
.semester-upgrade p:not(.overline) { max-width: 720px; margin: 0; color: var(--muted); line-height: 1.65; }
.semester-upgrade.is-complete { background: #e7eee6; }
.semester-upgrade.is-complete > span { color: var(--emerald); font: 700 1.15rem Georgia, serif; white-space: nowrap; }
.outline-button {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 12px 17px;
  border: 1px solid var(--emerald);
  background: transparent;
  color: var(--emerald);
  font-size: .82rem;
  font-weight: 800;
  transition: color .2s, background .2s;
}
.outline-button:hover { background: var(--emerald); color: #fff; }
.outline-button:disabled { opacity: .6; cursor: wait; }
.outline-button span { margin-left: 9px; }

.pyq-panel { margin-top: clamp(30px, 4vw, 54px); padding-top: clamp(30px, 4vw, 48px); border-top: 1px solid var(--line); }
.pyq-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.pyq-heading > div:first-child > p:not(.overline) { max-width: 570px; margin: 0; color: var(--muted); line-height: 1.65; }
.pyq-filters { min-width: min(100%, 380px); display: grid; grid-template-columns: 1.3fr .7fr; gap: 10px; }
.pyq-filters label { display: grid; gap: 6px; color: var(--ink-soft); font-size: .65rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.pyq-filters select { width: 100%; height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 2px; outline: none; background: #fffefa; color: var(--ink); font-size: .8rem; font-weight: 700; }
.pyq-filters select:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(28, 106, 90, .12); }
#pyqOutput { margin-top: 21px; }
.pyq-empty { min-height: 103px; margin: 0; padding: 25px; display: grid; place-items: center; border: 1px dashed var(--line); background: #f1f3ee; color: var(--muted); text-align: center; font-size: .87rem; }
.pyq-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.pyq-list li { border-bottom: 1px solid var(--line); }
.pyq-list a { min-height: 64px; padding: 13px 0; display: flex; align-items: center; justify-content: space-between; gap: 22px; color: var(--ink-soft); text-decoration: none; font-size: .87rem; font-weight: 700; }
.pyq-list a:hover { color: var(--emerald); }
.pyq-list b { flex: 0 0 auto; color: var(--coral); font-size: .72rem; letter-spacing: .02em; }

.shelf-page { padding-block: clamp(36px, 5vw, 76px); }
.shelf-page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 48px; }
.shelf-page-heading .back-link { display: block; margin-bottom: 37px; }
.shelf-page-heading h1 { margin: 0; }
.shelf-page-heading > p { max-width: 420px; margin: 0 0 8px; color: var(--muted); line-height: 1.65; }
.shelf-filters { margin: clamp(30px, 4vw, 52px) 0 25px; padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; border: 1px solid var(--line); background: #e5ede5; }
.shelf-filters label { display: grid; gap: 6px; color: var(--ink-soft); font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.catalogue-meta { padding: 29px 0 21px; display: flex; align-items: end; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.catalogue-meta h2 { margin: 0; color: var(--forest); font: 700 2.4rem/1 Georgia, serif; }
.catalogue-meta a { padding: 11px 0; color: var(--emerald); font-size: .82rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.catalogue-meta a:hover { text-decoration: underline; }
.catalogue-note { margin: 17px 0 24px; color: var(--muted); font-size: .81rem; }
.catalogue-note code, .folder-path { padding: 2px 5px; background: #e8eee7; color: var(--ink-soft); }
.course-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.course-card { min-height: 185px; padding: 22px; display: flex; flex-direction: column; border: 1px solid var(--line); background: #fffefa; }
.course-code { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.course-code code { color: var(--emerald); font-size: .75rem; font-weight: 800; }
.course-code span { color: var(--muted); font-size: .72rem; }
.course-card h3 { margin: 19px 0 24px; font: 700 1.4rem/1.17 Georgia, serif; letter-spacing: -.03em; }
.material-button { margin-top: auto; padding: 0; border: 0; background: none; color: var(--ink-soft); text-align: left; font-size: .78rem; font-weight: 800; }
.material-button span { margin-left: 4px; color: var(--coral); }
.material-button:disabled { color: var(--muted); cursor: wait; }
.material-drawer { margin: 17px -3px -3px; padding: 13px; border-left: 2px solid var(--amber); background: #f5f1e5; }
.material-drawer p { margin: 0 0 8px; color: var(--ink-soft); font-size: .78rem; }
.material-drawer small { display: block; margin-top: 7px; color: var(--muted); font-size: .69rem; line-height: 1.4; }
.material-drawer ul { padding: 0; margin: 0; list-style: none; }
.material-drawer li + li { border-top: 1px solid var(--line); }
.material-drawer li a { padding: 8px 0; display: flex; justify-content: space-between; gap: 10px; color: var(--emerald); font-size: .74rem; font-weight: 700; text-decoration: none; }
.material-drawer li a span { color: var(--coral); white-space: nowrap; }
.course-loading { min-height: 260px; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); font-size: .85rem; }
.course-loading span { width: 8px; height: 8px; display: inline-block; margin: 0 2px; border-radius: 50%; background: var(--emerald); animation: bounce 1s infinite alternate; }
.course-loading span:nth-child(2) { animation-delay: .17s; }
.course-loading span:nth-child(3) { animation-delay: .34s; }
.course-loading p { grid-column: 1 / -1; margin: 10px 0 0; }
.request-error { padding: 20px; border-left: 3px solid var(--coral); background: #fbeae5; color: #8d352b; }

.site-footer { padding: 26px var(--page-gutter); display: flex; justify-content: space-between; gap: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }
.site-footer a { color: var(--ink-soft); font-weight: 800; text-decoration: none; }
.site-footer a:hover { color: var(--emerald); }
.toast { position: fixed; right: 25px; bottom: 24px; z-index: 30; max-width: calc(100vw - 50px); padding: 13px 16px; display: flex; align-items: center; gap: 9px; border: 1px solid #9fc7ac; background: #eff8f0; box-shadow: 0 12px 30px rgba(8, 44, 38, .18); color: #225d3d; font-size: .84rem; font-weight: 700; animation: slide-in .25s ease-out; }
.toast-symbol { width: 19px; height: 19px; display: grid; place-items: center; border-radius: 50%; background: #54a86f; color: white; font-size: .7rem; }
.toast.is-error { border-color: #e2a095; background: #fff0ed; color: #a44035; }
.toast.is-error .toast-symbol { background: var(--coral); }

@keyframes bounce { to { transform: translateY(-8px); opacity: .3; } }
@keyframes slide-in { from { transform: translateY(13px); opacity: 0; } }

@media (min-width: 1680px) {
  .public-home { grid-template-columns: minmax(0, 1.4fr) minmax(410px, .6fr); }
  .lead { max-width: 690px; }
}

@media (max-width: 1180px) {
  :root { --page-gutter: clamp(24px, 4.5vw, 56px); }
  .public-home { grid-template-columns: minmax(0, 1.12fr) minmax(350px, .88fr); gap: clamp(36px, 5vw, 76px); }
  .welcome-copy h1 { font-size: clamp(3.3rem, 6vw, 5.4rem); }
  .member-grid { grid-template-columns: minmax(250px, .7fr) minmax(0, 1.3fr); }
  .account-grid { grid-template-columns: minmax(280px, .78fr) minmax(420px, 1.22fr); }
}

@media (max-width: 900px) {
  .public-home { min-height: 0; padding-block: clamp(50px, 8vw, 78px); grid-template-columns: 1fr; gap: 42px; }
  .welcome-copy { max-width: 760px; }
  .access-card { width: min(100%, 560px); justify-self: start; }
  .account-grid, .member-grid { grid-template-columns: 1fr; }
  .account-intro { padding: clamp(34px, 7vw, 60px); }
  .member-card { min-height: 278px; }
  .pyq-heading { align-items: flex-start; flex-direction: column; }
  .pyq-filters { width: min(100%, 480px); }
  .shelf-page-heading { align-items: flex-start; flex-direction: column; gap: 18px; }
  .shelf-page-heading > p { max-width: 640px; }
}

@media (max-width: 680px) {
  :root { --page-gutter: 20px; }
  .topbar { min-height: 74px; padding-block: 13px; }
  .emblem-wrap { width: 38px; height: 38px; }
  .emblem-wrap img { width: 32px; height: 32px; }
  .college-brand strong { font-size: 1rem; }
  .college-brand small, .header-member { display: none; }
  .welcome-copy h1, .account-intro h1, .welcome-state h1, .shelf-page-heading h1 { font-size: clamp(2.8rem, 13vw, 4.3rem); }
  .lead { font-size: 1rem; }
  .access-card { padding: 29px 24px 26px; }
  .account-page { padding-block: 25px 52px; }
  .account-grid { margin-inline: -2px; }
  .account-intro, .account-form { padding: 31px 24px; }
  .two-field, .shelf-filters { grid-template-columns: 1fr; }
  .member-home { padding-block: 48px 58px; }
  .member-heading { display: block; }
  .logout-button { margin-top: 14px; }
  .shelf-callout { padding: 31px 25px; }
  .semester-upgrade { align-items: flex-start; flex-direction: column; gap: 19px; }
  .semester-upgrade .outline-button { width: 100%; }
  .pyq-filters { width: 100%; grid-template-columns: 1fr 1fr; }
  .pyq-list a { align-items: flex-start; gap: 15px; }
  .pyq-list a span { overflow-wrap: anywhere; }
  .shelf-page { padding-block: 28px 52px; }
  .shelf-page-heading .back-link { margin-bottom: 30px; }
  .catalogue-meta { display: block; }
  .catalogue-meta a { display: inline-block; margin-top: 16px; white-space: normal; }
  .course-grid { grid-template-columns: 1fr; }
  .site-footer { display: grid; padding-block: 23px; }
  .identity-code { padding: 13px; }
  .identity-code code { font-size: .78rem; }
}

@media (max-width: 390px) {
  .topbar { gap: 12px; }
  .text-button { font-size: .82rem; }
  .welcome-copy h1 { font-size: 2.8rem; }
  .access-points { font-size: .85rem; }
  .access-card h2 { font-size: 2.15rem; }
  .course-card { padding: 19px; }
  .course-code { align-items: flex-start; flex-direction: column; gap: 5px; }
}
