:root {
  --navy: #0b2f6b;
  --navy-deep: #071d44;
  --sky: #e7efff;
  --orange: #ea2429;
  --cream: #f6f9ff;
  --paper: #ffffff;
  --ink: #142536;
  --muted: #637282;
  --line: #dfe6ec;
  --shadow: 0 22px 60px rgba(17, 51, 82, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--cream);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--cream); }
button, input, select { font: inherit; }
textarea { font: inherit; }
button, select { cursor: pointer; }
.prototype-note { min-height: 28px; display: grid; place-items: center; padding: 6px 16px; color: #d8e6fb; background: #061735; font-size: .6rem; font-weight: 800; letter-spacing: .15em; text-align: center; }

.hero {
  min-height: 410px;
  color: white;
  background:
    radial-gradient(circle at 82% 22%, rgba(109, 188, 233, .35), transparent 22rem),
    linear-gradient(128deg, var(--navy-deep), var(--navy));
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  width: 340px;
  height: 340px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 50%;
  right: -80px;
  bottom: -190px;
  box-shadow: 0 0 0 65px rgba(255,255,255,.04), 0 0 0 130px rgba(255,255,255,.025);
}

.nav, .hero-content, main, footer { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.nav { display: flex; align-items: center; justify-content: space-between; padding: 28px 0; }
.brand { color: white; text-decoration: none; display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 145px; height: 48px; padding: 8px 12px; border-radius: 12px; background: white; object-fit: contain; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.05rem; letter-spacing: .02em; }
.brand small { color: #bcd8eb; margin-top: 1px; }
.status { display: flex; align-items: center; gap: 9px; padding: 9px 14px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); border-radius: 999px; font-size: .82rem; }
.status span { width: 8px; height: 8px; border-radius: 50%; background: #62d38b; box-shadow: 0 0 0 4px rgba(98,211,139,.13); }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-chat-link { color: white; font-size: .82rem; font-weight: 800; text-decoration: none; }
.nav-chat-link:hover { text-decoration: underline; }

.hero-content { padding: 52px 0 116px; position: relative; z-index: 1; }
.portal-hero-grid { display: grid; grid-template-columns: 1fr 330px; gap: 42px; align-items: center; }
.portal-bot { width: 315px; height: 315px; justify-self: end; border: 1px solid rgba(255,255,255,.18); border-radius: 32px; object-fit: cover; box-shadow: 0 24px 55px rgba(0,0,0,.25); }
.eyebrow { margin: 0 0 14px; color: #9fd1ef; font-size: .75rem; font-weight: 800; letter-spacing: .17em; }
.eyebrow.dark { color: var(--navy); }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 760px; margin-bottom: 20px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.7rem, 7vw, 5rem); line-height: .98; letter-spacing: -.045em; font-weight: 500; }
.hero-copy { max-width: 650px; color: #c9dfed; font-size: clamp(1rem, 2vw, 1.23rem); line-height: 1.65; }
.hero-chat-button { display: inline-flex; align-items: center; gap: 20px; min-height: 50px; padding: 0 20px; border: 0; border-radius: 12px; color: var(--navy-deep); background: var(--orange); font-weight: 850; box-shadow: 0 10px 28px rgba(0,0,0,.15); }
.hero-chat-button:hover { transform: translateY(-1px); filter: brightness(1.04); }

main { margin-top: -70px; position: relative; z-index: 2; }
.search-panel { padding: 32px; background: var(--paper); border-radius: 22px; box-shadow: var(--shadow); }
.section-heading, .catalog-intro { display: flex; justify-content: space-between; gap: 28px; align-items: end; }
h2 { margin-bottom: 0; font-family: Georgia, "Times New Roman", serif; color: var(--navy-deep); font-size: clamp(1.8rem, 4vw, 2.55rem); font-weight: 500; letter-spacing: -.025em; }
.result-count { margin-bottom: 4px; color: var(--muted); font-size: .9rem; }
.filters { margin-top: 26px; display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 16px; align-items: end; }
label > span { display: block; margin-bottom: 8px; color: #526272; font-size: .76rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
select, .search-input { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfd; color: var(--ink); }
select { padding: 0 38px 0 13px; }
.keyword-field { grid-column: span 3; }
.search-input { display: flex; align-items: center; gap: 9px; padding: 0 14px; }
.search-input > span { color: var(--navy); font-size: 1.3rem; }
.search-input input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.clear-button { min-height: 48px; border: 1px solid var(--navy); border-radius: 11px; color: var(--navy); background: white; font-weight: 750; }
.clear-button:hover, .clear-button:focus-visible { background: var(--sky); }
select:focus-visible, input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid rgba(242,140,69,.45); outline-offset: 2px; }

.catalog { padding: 72px 0 34px; }
.catalog-intro { align-items: start; }
.catalog-intro > p { max-width: 470px; margin: 8px 0 0; color: var(--muted); line-height: 1.65; }
.results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 30px; }
.resource-card { display: flex; flex-direction: column; min-height: 370px; padding: 24px; border: 1px solid var(--line); border-radius: 17px; background: var(--paper); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.resource-card:hover { transform: translateY(-4px); border-color: #bdcfdd; box-shadow: 0 16px 32px rgba(20,58,95,.09); }
.card-topline { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 22px; }
.resource-type, .resource-term { font-size: .68rem; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.resource-type { padding: 6px 9px; border-radius: 7px; color: var(--navy); background: var(--sky); }
.resource-term { color: var(--orange); }
.resource-title { margin-bottom: 6px; color: var(--navy-deep); font-family: Georgia, "Times New Roman", serif; font-size: 1.5rem; font-weight: 500; line-height: 1.15; }
.resource-author { color: var(--muted); font-size: .87rem; }
.resource-summary { color: #425466; font-size: .9rem; line-height: 1.55; }
.resource-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 22px; }
.resource-tags span { padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: #526272; background: #fafbfc; font-size: .7rem; }
.resource-link { align-self: flex-start; margin: 0 0 18px; color: var(--navy); font-size: .8rem; font-weight: 800; text-decoration: none; }
.resource-link:hover { text-decoration: underline; }
.resource-link[hidden] { display: none; }
.resource-meta { display: grid; grid-template-columns: .7fr .8fr 1.5fr; gap: 8px; margin: auto 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.resource-meta div { min-width: 0; }
.resource-meta dt { margin-bottom: 4px; color: #89949f; font-size: .63rem; font-weight: 800; text-transform: uppercase; }
.resource-meta dd { margin: 0; color: var(--ink); font-size: .75rem; overflow-wrap: anywhere; }
.empty-state { margin-top: 30px; padding: 70px 20px; border: 1px dashed #bdcbd7; border-radius: 17px; text-align: center; background: rgba(255,255,255,.55); }
.empty-state > span { display: block; color: var(--navy); font-size: 2.2rem; }
.empty-state h3 { margin: 8px 0; color: var(--navy-deep); }
.empty-state p { margin-bottom: 0; color: var(--muted); }

.info-strip { display: grid; grid-template-columns: repeat(3, 1fr); margin: 24px 0 78px; border-radius: 18px; overflow: hidden; color: white; background: var(--navy); }
.info-strip div { display: flex; align-items: center; gap: 18px; min-height: 100px; padding: 22px 28px; border-right: 1px solid rgba(255,255,255,.13); }
.info-strip div:last-child { border-right: 0; }
.info-strip strong { color: var(--orange); font-family: Georgia, serif; font-size: 1.5rem; font-weight: 500; }
.info-strip span { color: #d8e7f1; font-size: .86rem; line-height: 1.4; }

footer { display: flex; justify-content: space-between; gap: 30px; padding: 36px 0 44px; border-top: 1px solid #d4d9dc; color: var(--muted); font-size: .8rem; }
footer strong { color: var(--navy); }
footer p { margin: 5px 0 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; }
.chat-launcher { position: fixed; z-index: 20; right: 24px; bottom: 22px; display: flex; align-items: center; gap: 11px; min-width: 244px; padding: 11px 16px 11px 11px; border: 1px solid rgba(255,255,255,.2); border-radius: 18px; color: white; background: var(--navy); box-shadow: 0 16px 42px rgba(8,37,64,.28); text-align: left; }
.chat-launcher:hover { background: var(--navy-deep); transform: translateY(-2px); }
.chat-launcher-mark, .chat-avatar { display:block; flex:0 0 auto; width:46px; height:46px; border:2px solid rgba(255,255,255,.55); border-radius:14px; object-fit:cover; object-position:50% 23%; background:#0b2f6b; }
.chat-launcher strong, .chat-launcher small, .chat-identity strong, .chat-identity small { display: block; }
.chat-launcher strong { font-size: .9rem; }
.chat-launcher small { margin-top: 2px; color: #cce0ee; font-size: .7rem; }

.chat-panel { position: fixed; z-index: 30; right: 24px; bottom: 92px; display: flex; flex-direction: column; width: min(400px, calc(100vw - 32px)); height: min(650px, calc(100vh - 120px)); overflow: hidden; border: 1px solid #cbd7df; border-radius: 22px; background: #f5f7f8; box-shadow: 0 28px 80px rgba(7,31,52,.3); }
.chat-panel[hidden] { display: none; }
.chat-panel.expanded { inset: 22px; width: auto; height: auto; max-width: 980px; margin: auto; }
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; padding: 12px 14px; color: white; background: linear-gradient(135deg, var(--navy-deep), var(--navy)); }
.chat-identity { display: flex; align-items: center; gap: 11px; }
.chat-avatar { width: 40px; height: 40px; border-radius: 12px; }
.chat-identity strong { font-size: .96rem; }
.chat-identity small { margin-top: 3px; color: #c8deeb; font-size: .7rem; }
.chat-identity i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #62d38b; }
.chat-window-actions { display: flex; gap: 5px; }
.chat-window-actions button { width: 36px; height: 36px; border: 0; border-radius: 9px; color: white; background: rgba(255,255,255,.1); font-size: 1.25rem; }
.chat-window-actions button:hover { background: rgba(255,255,255,.2); }
.chat-messages { flex: 1 1 auto; overflow-y: auto; padding: 20px 16px; scroll-behavior: smooth; }
.chat-message { width: fit-content; max-width: 88%; margin-bottom: 13px; padding: 11px 13px; border-radius: 15px; box-shadow: 0 3px 12px rgba(23,52,75,.06); }
.chat-message p { margin: 3px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .88rem; line-height: 1.55; }
.bot-message { border-bottom-left-radius: 5px; background: white; }
.user-message { margin-left: auto; border-bottom-right-radius: 5px; color: white; background: var(--navy); }
.message-author { color: var(--orange); font-size: .66rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.user-message .message-author { color: #acd5ed; }
.attachment-preview { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 12px 8px; padding: 9px 11px; border: 1px solid #cbd9e2; border-radius: 10px; color: #43586a; background: var(--sky); font-size: .75rem; }
.attachment-preview[hidden] { display: none; }
.attachment-preview button { border: 0; color: var(--navy); background: transparent; font-size: 1.2rem; }
.chat-status { min-height: 17px; margin: 0 15px 4px; color: #687b8a; font-size: .7rem; }
.chat-status.error { color: #a53232; }
.chat-composer { margin: 0 12px; padding: 10px; border: 1px solid #d4dde4; border-radius: 15px; background: white; box-shadow: 0 4px 18px rgba(22,49,71,.06); }
.chat-composer textarea { display: block; width: 100%; min-height: 42px; max-height: 120px; padding: 4px; resize: none; border: 0; outline: 0; color: var(--ink); background: transparent; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 5px; }
.media-actions { display: flex; gap: 6px; }
.icon-button { display: grid; place-items: center; width: 35px; height: 35px; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 9px; color: var(--navy); background: #f7f9fa; font-size: 1.2rem; font-weight: 700; cursor: pointer; }
.icon-button.recording { color: white; background: #c64141; animation: pulse 1.2s infinite; }
.chat-send { min-height: 36px; padding: 0 13px; border: 0; border-radius: 9px; color: white; background: var(--orange); font-size: .78rem; font-weight: 850; }
.chat-send:disabled { opacity: .55; cursor: wait; }
.chat-note { margin: 7px 16px 10px; color: #788692; font-size: .62rem; text-align: center; }
.podcast-lab { display: grid; grid-template-columns: .85fr 1.15fr; gap: 46px; margin: 48px 0; padding: 42px; border-radius: 26px; background: #f5efe5; box-shadow: 0 18px 45px rgba(18,58,99,.08); }
.vestibular-section { margin: 54px 0; padding: 44px; border-radius: 28px; background: #eef3f7; }
.vestibular-heading, .vestibular-list-title { display: flex; align-items: end; justify-content: space-between; gap: 36px; }
.vestibular-heading h2 { margin: 8px 0 0; color: var(--navy); font-size: clamp(2rem,4vw,3.4rem); line-height: 1; }
.vestibular-heading > p { max-width: 540px; color: #536575; line-height: 1.65; }
.learning-paths { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 32px 0 42px; }
.learning-paths article { padding: 25px; border: 1px solid #d6e0e8; border-radius: 18px; background: #fff; }
.learning-paths span { color: #8a2948; font-size: .72rem; font-weight: 900; letter-spacing: .12em; }
.learning-paths h3 { margin: 8px 0; color: var(--navy); font-size: 1.3rem; }
.learning-paths p { color: #5b6c79; line-height: 1.55; }
.vestibular-list-title h3 { margin: 5px 0 0; color: var(--navy); font-size: 1.7rem; }
.vestibular-list-title a { color: #7a2942; font-weight: 850; }
.rights-note { margin: 18px 0 24px; padding: 13px 16px; border-left: 4px solid #d9ad32; color: #536575; background: #fff9e8; font-size: .82rem; line-height: 1.55; }
.vestibular-grid { grid-template-columns: repeat(3, minmax(0,1fr)); max-height: 760px; padding-right: 8px; overflow: auto; }
.podcast-copy h2 { margin: 8px 0 14px; color: var(--navy); font-size: clamp(1.8rem,3vw,2.8rem); line-height: 1.05; }
.podcast-copy p { color: #536575; line-height: 1.7; }
.podcast-copy .podcast-limit { margin-top: 20px; color: #7a2942; font-size: .8rem; font-weight: 800; }
.podcast-form { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding: 24px; border: 1px solid #e0d5c4; border-radius: 20px; background: #fff; }
.podcast-form label { display: grid; gap: 7px; color: var(--navy); font-size: .74rem; font-weight: 800; }
.podcast-form input, .podcast-form select { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid #ccd5dc; border-radius: 10px; color: var(--ink); background: #fff; }
.podcast-topic, .podcast-status, .podcast-result { grid-column: 1 / -1; }
.podcast-form button { min-height: 46px; border: 0; border-radius: 10px; color: #fff; background: #7a2942; font-weight: 850; cursor: pointer; }
.podcast-form button:disabled { opacity: .6; cursor: wait; }
.podcast-status { min-height: 20px; margin: 0; color: #61717e; font-size: .78rem; }
.podcast-status.error { color: #a53232; }
.podcast-result { padding: 16px; border-radius: 12px; background: #f6f8fa; }
.podcast-result audio { width: 100%; }
.podcast-result a { display: inline-block; margin: 10px 0; color: #7a2942; font-weight: 800; }
.podcast-result pre { max-height: 220px; overflow: auto; white-space: pre-wrap; color: #273847; font: .78rem/1.55 Arial,sans-serif; }
@keyframes pulse { 50% { opacity: .6; } }

@media (max-width: 900px) {
  .portal-hero-grid { grid-template-columns: 1fr; }
  .portal-bot { display: none; }
  .filters { grid-template-columns: repeat(2, 1fr); }
  .keyword-field { grid-column: span 1; }
  .results { grid-template-columns: repeat(2, 1fr); }
  .info-strip { grid-template-columns: 1fr; }
  .podcast-lab { grid-template-columns: 1fr; }
  .vestibular-heading, .vestibular-list-title { display: block; }
  .vestibular-heading > p, .vestibular-list-title a { display: block; margin-top: 16px; }
  .vestibular-grid { grid-template-columns: repeat(2,1fr); }
  .info-strip div { border-right: 0; border-bottom: 1px solid rgba(255,255,255,.13); }
}

@media (max-width: 620px) {
  .prototype-note { font-size: .53rem; }
  .nav, .hero-content, main, footer { width: min(100% - 24px, 1180px); }
  .nav { align-items: flex-start; }
  .nav-actions { align-items: flex-end; flex-direction: column-reverse; }
  .nav-chat-link { display: none; }
  .status { max-width: 145px; border-radius: 12px; }
  .hero-content { padding-top: 35px; }
  .search-panel { padding: 24px 18px; }
  .section-heading, .catalog-intro, footer { display: block; }
  .result-count { margin-top: 12px; }
  .filters, .results { grid-template-columns: 1fr; }
  .podcast-lab { padding: 24px 18px; }
  .vestibular-section { padding: 26px 18px; }
  .learning-paths, .vestibular-grid { grid-template-columns: 1fr; }
  .podcast-form { grid-template-columns: 1fr; }
  .podcast-topic, .podcast-status, .podcast-result { grid-column: auto; }
  .keyword-field { grid-column: auto; }
  .catalog-intro > p { margin-top: 16px; }
  footer > p { margin-top: 22px; }
  .chat-launcher { right: 12px; bottom: 12px; min-width: auto; padding: 10px; border-radius: 16px; }
  .chat-launcher > span:last-child { display: none; }
  .chat-panel, .chat-panel.expanded { inset: 0; width: 100%; height: 100%; max-width: none; margin: 0; border: 0; border-radius: 0; }
  .chat-window-actions #chat-expand { display: none; }
}
