/* Materials portal: cinematic scientific cover, quiet editorial course directory.
   The portal's 2026-09 redesign follows the requested reference sites. */
:root { --portal-paper: #f6f8fd; --portal-ink: #20226b; --portal-accent: #4c46bd; --portal-line: #dce2ee; }
body.portal-home { font-size: 16px; background: var(--portal-paper); }
.portal-home .grid-rules { display: none; }
.portal-home:not(.portal-inner) .site-header + .page-layer { padding-top: 0; }
.portal-home .brand-title, .portal-home .brand-university, .portal-home .nav-link { color: #172338; }
.portal-home .brand-university { opacity: 1; }
.portal-home .brand img { background: transparent; width: 38px; height: 38px; }
.portal-home .nav-link:hover { color: var(--portal-accent); }
.portal-home .eyebrow { font-size: 12px; letter-spacing: .13em; }
.portal-home .eyebrow::before { display: none; }
.materials-cover { position: relative; isolation: isolate; overflow: hidden; background: #cdddfa; color: var(--portal-ink); }
.materials-cover-art { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.materials-cover::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg,rgba(250,252,255,.23),rgba(250,252,255,.12) 38%,transparent 60%); }
.materials-globe { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.materials-globe canvas { display: block; width: 100%; height: 100%; }
.globe-label { position: absolute; transform: translate(-50%,-50%); color: #fff; font-family: var(--font-sans); font-weight: 700; line-height: 1; filter: drop-shadow(0 0 12px rgba(220,218,255,.45)); }
.globe-label > span { display: block; transform: perspective(900px) rotate(-13deg) rotateY(28deg) rotateX(7deg); background: linear-gradient(112deg,rgba(214,206,255,.45),#fff 19%,rgba(178,164,255,.4) 30%,#fff 49%,rgba(214,206,255,.42) 60%,#fff 79%,rgba(190,178,255,.45)); background-size: 320% 100%; background-clip: text; -webkit-background-clip: text; color: transparent; -webkit-text-stroke: 1px rgba(255,250,235,.85); }
.cover-content { z-index: 1; }
.cover-motion { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; background: rgba(255,255,255,.55); border: 1px solid rgba(71,74,149,.32); border-radius: 3px; color: #343c82; font-size: 12px; cursor: pointer; }
.cover-motion:hover { border-color: var(--portal-accent); color: var(--portal-ink); }
.cover-motion:focus-visible { outline-color: var(--portal-accent); }
.motion-paused .globe-label > span { animation-play-state: paused; }
@media (prefers-reduced-motion: no-preference) {
  .globe-label > span { animation: globe-sheen 9s linear infinite; }
}
@keyframes globe-sheen { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
.cover-content { position: relative; padding-top: clamp(104px,12vh,124px); padding-bottom: 94px; min-height: clamp(640px,74svh,760px); }
.cover-copy { max-width: 565px; }
.cover-copy .eyebrow { color: #34358e; }
.cover-copy h1 { margin-top: 20px; color: var(--portal-ink); font-size: clamp(48px,4.4vw,68px); line-height: 1.12; letter-spacing: .045em; }
.cover-copy h1 span { display: block; }
.cover-subtitle { margin-top: 18px; color: var(--portal-ink); font: 700 21px/1.65 var(--font-display); }
.cover-lede { max-width: 31em; margin-top: 12px; color: #373f82; font-size: 16px; line-height: 1.85; }
.course-search { margin-top: 20px; max-width: 550px; }
.course-search > div { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 16px; border: 1px solid rgba(217,219,249,.8); border-radius: 6px; background: rgba(255,255,255,.97); box-shadow: 0 8px 30px rgba(69,76,156,.1); }
.course-search > div > svg { flex-shrink: 0; color: #6e76a9; }
.course-search input { min-width: 0; width: 100%; padding: 9px 12px; border: 0; background: transparent; color: var(--ink-900); }
.course-search input::placeholder { color: #687181; font-size: 14px; }
.course-search input:focus, .course-search input:focus-visible { outline: none; box-shadow: none; }
.course-search:focus-within > div { background: #fff; box-shadow: 0 8px 30px #5a50b429; }
.course-search button { flex-shrink: 0; padding-inline: 18px; background: var(--portal-accent); border-color: var(--portal-accent); }
.course-search button:hover { background: #353197; border-color: #353197; }
.cover-stats { display: flex; gap: 0; margin-top: 25px; color: #343c82; font-size: 14px; }
.cover-stats span { display: flex; align-items: baseline; gap: 8px; padding-inline: 22px; border-right: 1px solid #9199c2; }
.cover-stats span:first-child { padding-left: 0; }
.cover-stats span:last-child { border: 0; padding-right: 0; }
.cover-stats b { color: var(--portal-ink); font: 500 24px/1.3 var(--font-mono); }
.cover-bottom { position: absolute; inset: auto 32px 26px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.cover-bottom > div { display: flex; align-items: center; gap: 28px; }
.cover-signature { color: #424a93; font: 400 12px/1.8 var(--font-mono); letter-spacing: .24em; }
.cover-caption { display: flex; align-items: center; gap: 18px; color: #414b92; font-size: 14px; line-height: 1.8; }
.cover-caption::before { content: ""; width: 52px; height: 1px; background: #747eb7; }
.discipline-map-band { background: #fff; border-bottom: 1px solid var(--portal-line); }
.discipline-map { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); }
.discipline-map a { position: relative; padding: 25px 26px; display: grid; gap: 6px; border-right: 1px solid var(--portal-line); }
.discipline-map a:first-child { padding-left: 0; }
.discipline-map a:last-child { border-right: 0; }
.discipline-map a > span { color: #73736c; font: 400 11px/1.5 var(--font-mono); letter-spacing: .02em; }
.discipline-map strong { color: #262a2d; font: 700 20px/1.5 var(--font-display); }
.discipline-map small { display: flex; align-items: center; gap: 12px; color: #676c70; font-size: 12px; }
.discipline-map small svg { margin-left: auto; }
.discipline-map a:hover strong { color: var(--sjtu-red); }
.portal-home .section { background: transparent; border-top: 0; padding-block: 64px; }
.catalogue-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.catalogue-heading h2 { margin-top: 13px; font-size: clamp(28px,3vw,38px); }
.catalogue-heading > p, .catalogue-heading > a { color: #646a70; font-size: 14px; }
.catalogue-heading time { font-family: var(--font-mono); }
.catalogue-filters { display: flex; flex-wrap: wrap; gap: 8px 26px; margin-top: 25px; padding-bottom: 12px; border-bottom: 1px solid #caccc9; }
.catalogue-filters a { display: inline-flex; gap: 10px; align-items: center; min-height: 44px; font-size: 14px; color: #565f66; }
.catalogue-filters a[aria-current] { color: var(--sjtu-red); box-shadow: inset 0 -2px var(--sjtu-red); font-weight: 600; }
.catalogue-filters span { font: 400 12px var(--font-mono); }
.portal-course-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin-top: 24px; }
.portal-course-grid .course-card { position: relative; min-width: 0; background: #fff; border: 1px solid #dce4f0; border-radius: 12px; box-shadow: 0 3px 12px rgba(37,55,95,.035); transition: border-color 180ms, transform 180ms, box-shadow 180ms; }
.portal-course-grid .course-card:hover { border-color: #aab8db; box-shadow: 0 8px 22px rgba(37,55,95,.08); transform: translateY(-2px); }
.portal-course-grid .course-card-body { padding: 18px; gap: 16px; }
.course-card-heading { display: flex; align-items: flex-start; gap: 14px; }
.course-card-copy { min-width: 0; flex: 1; }
.portal-course-grid .course-cover { flex: 0 0 88px; width: 88px; height: 88px; aspect-ratio: 1; overflow: hidden; border: 1px solid #edf1f8; border-radius: 10px; background: #eff5fc; }
.portal-course-grid .course-cover img { width: 100%; height: 100%; object-fit: cover; }
.portal-course-grid .course-category { margin: 0 0 6px; color: #66729a; font-size: 12px; line-height: 1.5; letter-spacing: .02em; }
.portal-course-grid h3 { min-height: 0; font: 700 18px/1.5 var(--font-display); color: #242f55; overflow-wrap: anywhere; }
.portal-course-grid h3 a:hover { color: var(--portal-accent); }
.course-site-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.course-site-link:focus-visible { outline: none; }
.course-site-link:focus-visible::after { outline: 3px solid var(--portal-accent); outline-offset: -3px; }
.portal-course-grid .course-teachers { margin: 7px 0 0; font-size: 14px; line-height: 1.6; color: #68748b; }
.course-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; padding-top: 12px; border-top: 1px solid #edf0f7; }
.course-action { position: relative; z-index: 2; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 34px; padding: 4px 9px; border-radius: 6px; color: #566585; background: #f4f6fb; font-size: 14px; line-height: 1.5; white-space: nowrap; }
.course-action:hover { color: #343b90; background: #e9eefb; }
.course-action-primary { color: #4846a8; background: #eceefc; font-weight: 600; }
.course-action-primary:hover { color: #fff; background: #5552b9; }
.catalogue-note { margin-top: 24px; color: #696e70; font-size: 13px; }
.search-result { margin-top: 20px; font-size: 14px; }
.search-result a { margin-left: 14px; }
.catalogue-empty { padding: 48px 20px; text-align: center; }
.catalogue-empty p { margin: 12px 0 22px; }
.portal-home .portal-labs { background: #fff; border-block: 1px solid var(--portal-line); }
.labs-lede { margin-top: 18px; max-width: 44em; color: #626b73; }
.portal-labs .demo-grid { margin-top: 28px; }
.portal-labs .demo-card { box-shadow: none; border-color: var(--portal-line); }
.portal-labs .demo-body { padding: 26px; }
.portal-labs .demo-body h3 { font-family: var(--font-display); font-size: 22px; }
.portal-labs .demo-body > p { font-size: 14px; }
.portal-colophon .container { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; }
.portal-colophon h2 { font-size: 28px; margin-top: 16px; }
.portal-colophon p:not(.eyebrow) { color: #626b73; margin-bottom: 18px; }
.portal-home .site-footer { background: #edf1f9; border-color: var(--portal-line); }
.portal-gateways { padding-block: 32px 48px; background: #f3f6fc; }
.gateway-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px; }
.gateway-card { display: flex; flex-direction: column; padding: 30px 34px; border: 1px solid #d4deee; border-radius: 10px; background: #fff; color: var(--portal-ink); transition: transform 180ms,box-shadow 180ms; }
.gateway-knowledge { background: linear-gradient(120deg,#edf2ff,#f9faff); border-color: #cbd5f0; }
.gateway-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px #29346a12; }
.gateway-card:focus-visible, .domain-card:focus-visible { outline: 3px solid var(--portal-accent); outline-offset: 4px; }
.gateway-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #555f92; font-size: 14px; }
.gateway-meta > span:first-child { font: 400 12px/1.5 var(--font-mono); letter-spacing: .1em; }
.gateway-card h2 { margin-top: 20px; font: 700 34px/1.35 var(--font-display); color: var(--portal-ink); }
.gateway-card > p { margin-top: 12px; color: #555f7c; font-size: 16px; }
.gateway-bottom { margin-top: 25px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #626e88; font-size: 12px; line-height: 1.9; }
.gateway-arrow { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border: 1px solid #c5cde7; border-radius: 50%; color: var(--portal-accent); }
.portal-page-heading { padding: 34px 0 40px; background: linear-gradient(120deg,#f3f6fd,#eaf0fc); border-bottom: 1px solid var(--portal-line); }
.portal-back { display: inline-flex; gap: 8px; align-items: center; color: #596688; font-size: 14px; margin-bottom: 24px; }
.portal-page-heading .eyebrow { color: #60639c; }
.portal-page-heading h1 { margin-top: 14px; color: var(--portal-ink); font: 700 clamp(32px,4vw,48px)/1.35 var(--font-display); }
.portal-page-lede { margin-top: 16px; max-width: 44em; font-size: 17px; color: #53607c; }
.domain-collection { padding-block: 34px 52px; }
.domain-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 22px; }
.domain-card { display: flex; flex-direction: column; padding: 28px; background: #fff; border: 1px solid var(--portal-line); border-radius: 8px; transition: border-color 180ms; }
.domain-card:hover { border-color: #777fac; }
.domain-card .eyebrow { color: #747b99; font-size: 12px; }
.domain-card h2 { font: 700 25px/1.5 var(--font-display); margin-top: 18px; color: var(--portal-ink); }
.domain-card > p:not(.eyebrow) { margin-top: 15px; color: #5b667e; line-height: 1.9; font-size: 16px; }
.domain-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.domain-tags span { padding: 4px 10px; background: #edf1fa; color: #5d6692; font-size: 13px; border-radius: 3px; }
.domain-card-bottom { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: auto; padding-top: 28px; color: #646d8e; font-size: 13px; }
.domain-navigation { border-bottom: 1px solid var(--portal-line); background: #fff; }
.domain-navigation nav { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.domain-navigation a { padding-block: 16px; color: #606b88; font-size: 14px; }
.domain-navigation a[aria-current] { color: var(--portal-accent); box-shadow: inset 0 -2px var(--portal-accent); }
.domain-module-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-top: 26px; }
.domain-module-list a { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 24px; background: #fff; border: 1px solid var(--portal-line); border-radius: 6px; }
.domain-module-list a:hover { border-color: #959dbf; }
.domain-module-list span { font-size: 13px; color: #6b7590; }
.domain-module-list h3 { margin-top: 10px; font: 700 20px/1.6 var(--font-display); }
.domain-module-list svg { flex-shrink: 0; color: var(--portal-accent); }

@media (max-width: 1023px) {
  .gateway-card { padding: 26px; }
  .domain-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .cover-copy { max-width: 510px; }
  .cover-signature { letter-spacing: .15em; font-size: 10px; }
  .portal-course-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .discipline-map a { padding: 22px 16px; }
  .discipline-map a > span { font-size: 10px; }
  .discipline-map strong { font-size: 18px; }
}
@media (max-width: 767px) {
  .gateway-grid, .domain-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .domain-module-list { grid-template-columns: 1fr; }
  .portal-gateways { position: relative; z-index: 2; margin-top: -56px; padding-block: 0 12px; background: transparent; }
  .gateway-card { position: relative; padding: 16px; border-radius: 12px; }
  .gateway-meta > span:first-child, .gateway-card > p, .gateway-bottom > span:first-child { display: none; }
  .gateway-meta { font-size: 13px; }
  .gateway-card h2 { font-size: 23px; margin-top: 8px; padding-right: 24px; }
  .gateway-bottom { position: absolute; right: 12px; bottom: 16px; margin: 0; }
  .gateway-arrow { width: 26px; height: 26px; border: 0; }
  .gateway-arrow svg { width: 20px; height: 20px; }
  .portal-page-heading { padding-block: 18px 22px; }
  .portal-page-heading .eyebrow { display: none; }
  .portal-back { margin-bottom: 14px; }
  .portal-page-heading h1 { margin-top: 0; font-size: 32px; }
  .portal-page-lede { margin-top: 10px; font-size: 16px; }
  .domain-collection { padding-block: 22px 30px; }
  .domain-card { padding: 16px 14px; border-radius: 10px; }
  .domain-card > p, .domain-card .domain-tags { display: none; }
  .domain-card h2 { min-height: 2.8em; margin-top: 0; font-size: 20px; line-height: 1.4; }
  .domain-card-bottom { padding-top: 12px; gap: 8px; align-items: flex-end; font-size: 12px; }
  .domain-card-bottom svg { flex-shrink: 0; width: 18px; height: 18px; }
  .domain-navigation nav { flex-wrap: nowrap; gap: 20px; overflow-x: auto; scrollbar-width: thin; }
  .domain-navigation a { flex-shrink: 0; padding-block: 12px; }
  .cover-bottom { display: none; }
  .cover-bottom > div { gap: 0; }
  .cover-signature, .cover-caption { display: none; }
  .cover-motion { min-height: 40px; border-radius: 20px; }

  .portal-home .brand { gap: 8px; }
  .portal-home .brand img { width: 28px; height: 28px; }
  .portal-home .brand-university { display: none; }
  .portal-home .site-nav .nav-link { padding-inline: 6px; font-size: 14px; }
  /* Give the floating globe and the lower materials display separate vertical space. */
  .portal-home:not(.portal-inner) .page-layer > main { display: flex; flex-direction: column; }
  .materials-cover { display: flex; flex: 1 0 auto; background: #e2ebfc; }
  .portal-gateways { flex: 0 0 auto; }
  .cover-content { padding-top: 88px; padding-bottom: 460px; min-height: 0; }
  .cover-copy { max-width: 100%; }
  .cover-copy h1 { margin-top: 0; font-size: clamp(30px,8.8vw,38px); line-height: 1.22; letter-spacing: .02em; }
  .cover-copy h1 span { display: inline; }
  .cover-copy .eyebrow, .cover-lede, .cover-stats { display: none; }
  .cover-subtitle { font-size: 16px; margin-top: 10px; }
  .materials-cover-art {
    inset: auto 0 0; height: clamp(360px, 108vw, 480px); object-position: 63% top;
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 30%);
    mask-image: linear-gradient(180deg, transparent, #000 30%);
  }
  .materials-cover::after { background: linear-gradient(180deg,rgba(240,246,255,.87),rgba(240,246,255,.75) 48%,rgba(240,246,255,.04) 70%); }
  .course-search > div { gap: 0; padding: 5px 5px 5px 10px; }
  .course-search input { padding: 8px 6px; font-size: 16px; line-height: 1.5; }
  .course-search input::placeholder { font-size: 16px; }
  .course-search button { padding-inline: 12px; font-size: 14px; }
  .course-search button svg { display: none; }
  .materials-cover .course-search { margin-top: 18px; }
  .materials-cover .course-search > div { padding-left: 16px; border-radius: 999px; }
  .materials-cover .course-search button { flex: 0 0 44px; width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; }
  .materials-cover .course-search button span { display: none; }
  .materials-cover .course-search button svg { display: block; width: 20px; height: 20px; }
  .discipline-map { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .discipline-map a { padding: 18px 14px; border-bottom: 1px solid var(--portal-line); }
  .discipline-map a:nth-child(odd) { padding-left: 0; }
  .discipline-map a:nth-child(even) { border-right: 0; }
  .discipline-map strong { font-size: 17px; }
  .portal-home .section { padding-block: 32px; }
  .catalogue-heading { flex-direction: column; align-items: flex-start; gap: 14px; }
  .catalogue-heading > p { font-size: 13px; }
  .catalogue-filters { gap: 2px 20px; margin-top: 20px; }
  .portal-course-grid { grid-template-columns: 1fr; gap: 16px; }
  .portal-course-grid h3 { min-height: auto; }
  .portal-course-grid .course-card-body { padding: 16px; }
  .portal-course-grid .course-cover { flex-basis: 80px; width: 80px; height: 80px; }
  .portal-home .course-action { min-height: 44px; }
  .portal-colophon .container { grid-template-columns: 1fr; gap: 24px; }
}
@media (prefers-reduced-motion: reduce) { .portal-course-grid .course-card, .gateway-card, .domain-card { transition: none; transform: none; } }

/* Disable native search-field chrome as well as the shared focus outline. */
.materials-cover .course-search input[type="search"],
.materials-cover .course-search input[type="search"]:focus,
.materials-cover .course-search input[type="search"]:focus-visible {
  -webkit-appearance: none; appearance: none;
  border: 0; outline: 0; outline-offset: 0; box-shadow: none; border-radius: 0;
}
.materials-cover .course-search input::-webkit-search-decoration { -webkit-appearance: none; }
html[lang="en"] .cover-copy h1 { font-size: clamp(42px,4.1vw,64px); letter-spacing: -.025em; }
html[lang="en"] .cover-subtitle { font-size: 20px; }
html[lang="en"] .portal-course-grid h3 { font-size: 16px; line-height: 1.35; }
html[lang="en"] .course-action { font-size: 12px; }
html[lang="en"] .domain-card h2 { font-size: 24px; line-height: 1.3; }
@media (max-width: 767px) {
  html[lang="en"] .cover-copy h1 { font-size: clamp(30px,8.3vw,38px); line-height: 1.12; }
  html[lang="en"] .cover-copy h1 span { display: block; }
  html[lang="en"] .cover-subtitle { font-size: 15px; }
  html[lang="en"] .gateway-card h2 { font-size: 21px; }
  html[lang="en"] .domain-card h2 { font-size: 19px; }
  html[lang="en"] .course-action { font-size: 13px; }
}
