/* Chelmsford College demo - mobile-first. Base styles are the phone layout;
   min-width media queries add tablet (40em) and desktop (64em) enhancements. */
:root {
  --blue: #007AC5;          /* brand blue: 4.6:1 on white (AA for text) */
  --blue-dark: #005B94;     /* links/hover: 7:1 on white */
  --blue-deep: #00375A;
  --green: #7BC242;         /* brand green: used as accent with dark text only */
  --green-light: #EAF5E0;
  --ink: #1B1F23;
  --muted: #4A5560;         /* 7.5:1 on white */
  --bg-soft: #F2F7FB;
  --line: #C9D4DD;
  --focus: #FFBF47;
  --radius: 10px;
  --wrap: 72rem;
  font-size: 100%;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); line-height: 1.55; background: #fff; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: clamp(1.75rem, 5vw + .5rem, 2.75rem); }
h2, .h2 { font-size: 1.5rem; }
h3, .h3 { font-size: 1.2rem; }
.h4 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--blue-dark); text-underline-offset: .15em; }
a:hover { color: var(--blue-deep); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 6px var(--focus); }
main:focus { outline: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1rem; }
.section { padding-top: 1.75rem; padding-bottom: 1.75rem; }
.narrow { max-width: 46rem; }
.lead { font-size: 1.15rem; }
.small { font-size: .925rem; color: var(--muted); }
.eyebrow { font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--blue-dark); margin-bottom: .35em; }
.eyebrow-invert { color: #fff; }

/* Skip link + demo banner */
.skip-link { position: absolute; left: .5rem; top: -100px; z-index: 100; background: var(--ink); color: #fff; padding: .75rem 1rem; border-radius: 0 0 var(--radius) var(--radius); font-weight: 700; }
.skip-link:focus { top: 0; color: #fff; }
.demo-banner { background: var(--ink); color: #fff; font-size: .8rem; padding: .35rem 1rem; text-align: center; margin: 0; }

/* Header */
.site-header { border-bottom: 4px solid var(--green); background: #fff; }
.header-inner { display: flex; flex-direction: column; gap: .5rem; padding-top: .75rem; padding-bottom: .5rem; }
.logo img { width: 200px; height: auto; }
.logo:focus-visible { display: inline-block; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem; }
.main-nav a { display: inline-block; padding: .6rem .8rem; min-height: 44px; font-weight: 700; text-decoration: none; color: var(--ink); border-radius: 6px; }
.main-nav a:hover { background: var(--bg-soft); }
.main-nav a[aria-current="page"] { background: var(--blue); color: #fff; }

/* Buttons + forms */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: .65rem 1.2rem; border-radius: 8px; border: 2px solid transparent; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--blue-dark); color: #fff; }
.btn-primary:hover { background: var(--blue-deep); color: #fff; }
.btn-secondary { background: #fff; color: var(--blue-dark); border-color: var(--blue-dark); }
.btn-accent { background: var(--green); color: var(--ink); border-color: #5E9A30; }
.btn-accent:hover { background: #6AB033; color: var(--ink); }
label { display: block; font-weight: 700; margin-bottom: .3rem; }
input[type="search"], select { width: 100%; min-height: 48px; padding: .5rem .75rem; font: inherit; color: var(--ink); background: #fff; border: 2px solid var(--muted); border-radius: 8px; }
.field { margin-bottom: 1rem; }
.filter-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.hook-note { background: var(--green-light); border-left: 5px solid var(--green); padding: .75rem 1rem; border-radius: 6px; font-size: .95rem; }

/* Hero */
.hero { position: relative; background: var(--blue-deep); }
.hero-img img, .hero picture img { width: 100%; height: 220px; object-fit: cover; }
.hero-panel { background: var(--blue); color: #fff; padding-top: 1.25rem; padding-bottom: 1.25rem; }
.hero-panel h1 { color: #fff; }
.hero-panel .lead { color: #fff; }
.hero-panel label { color: #fff; }
.hero-panel a { color: #fff; font-weight: 700; }
.search-row { display: flex; flex-direction: column; gap: .5rem; }
.search-row input { border-color: #fff; }
.search-box .btn-primary { background: var(--green); color: var(--ink); border-color: #fff; }
.hero-links { margin: .75rem 0 0; }

/* Cards + grid */
.grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; position: relative; }
.card-img img, img.card-img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.card-img-wide img, img.card-img-wide { aspect-ratio: 1380 / 496; object-fit: cover; }
.card-body { padding: 1rem; }
.card-title { font-size: 1.15rem; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; } /* whole card clickable */
.card:hover .card-title a, .card-title a:focus-visible { text-decoration: underline; color: var(--blue-dark); }
.card:focus-within { box-shadow: 0 0 0 3px var(--ink), 0 0 0 7px var(--focus); }
.card-title a:focus-visible { outline: none; box-shadow: none; }
.tags { list-style: none; padding: 0; margin: 0 0 .75rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.tag { font-size: .8rem; padding: .2rem .55rem; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--line); }
.tag-level { background: var(--green-light); border-color: #9BCB72; font-weight: 700; }
.band { background: var(--bg-soft); }
.subject-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; grid-template-columns: 1fr; }
.subject-list a { display: flex; justify-content: space-between; align-items: center; min-height: 48px; padding: .6rem 1rem; background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--blue); border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 700; }
.subject-list a:hover { border-left-color: var(--green); }
.count { background: var(--blue-dark); color: #fff; border-radius: 999px; padding: .1rem .55rem; font-size: .85rem; }
.video-area { margin: 0; }
.video-placeholder { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--ink); }
.video-note { margin: 0; padding: .75rem 1rem; background: var(--ink); color: #fff; font-size: .95rem; }
.video-area figcaption { font-size: .9rem; color: var(--muted); margin-top: .4rem; }

/* Breadcrumb */
.breadcrumb ol { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; font-size: .9rem; }
.breadcrumb li + li::before { content: "›"; padding: 0 .4rem; color: var(--muted); }
.breadcrumb-invert a, .breadcrumb-invert li + li::before { color: #fff; }

/* Search page */
.search-layout { display: grid; gap: 1.5rem; }
.filters { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.results-status { min-height: 1.5em; }
.results[aria-busy="true"] .grid { opacity: .6; }

/* Course page */
.course-header { background: var(--blue-dark); color: #fff; padding: 1.25rem 0 1rem; border-bottom: 6px solid var(--green); }
.course-header h1 { color: #fff; }
.course-layout { display: grid; gap: 1.5rem; padding-top: 1.25rem; padding-bottom: 6rem; }
.course-img img, img.course-img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius); }
.course-summary { background: var(--bg-soft); border: 1px solid var(--line); border-top: 5px solid var(--blue); border-radius: var(--radius); padding: 1rem; }
.facts { margin: 0 0 1rem; }
.facts > div { display: grid; grid-template-columns: 7.5rem 1fr; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; }
.accordion details { border: 1px solid var(--line); border-radius: 8px; margin-bottom: .5rem; background: #fff; }
.accordion summary { cursor: pointer; padding: .85rem 1rem; min-height: 48px; display: flex; align-items: center; gap: .6rem; list-style: none; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::before { content: "+"; font-weight: 700; font-size: 1.3rem; color: var(--blue-dark); width: 1.2rem; }
.accordion details[open] summary::before { content: "−"; }
.accordion summary h3 { margin: 0; font-size: 1.05rem; }
.details-body { padding: 0 1rem 1rem; }
.apply-bar { position: sticky; bottom: 0; background: #fff; border-top: 3px solid var(--green); box-shadow: 0 -4px 12px rgba(0,0,0,.08); z-index: 10; }
.apply-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .6rem; padding-bottom: .6rem; }
.apply-title { display: none; margin: 0; font-weight: 700; }

/* Events */
.filters-inline { margin-bottom: 1.25rem; }
.event-banner img { width: 100%; border-radius: var(--radius); margin-bottom: 1.25rem; }
.event-layout { display: grid; gap: 1.5rem; }
.event-when { font-weight: 700; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 32rem; font-size: .95rem; }
caption { text-align: left; font-weight: 700; padding-bottom: .5rem; }
th, td { border: 1px solid var(--line); padding: .5rem .6rem; text-align: left; vertical-align: top; }
thead th { background: var(--blue-dark); color: #fff; }
tbody th { background: var(--bg-soft); }
.pay-types { list-style: none; padding: 0; display: grid; gap: 1rem; }

/* Footer */
.site-footer { background: var(--blue-deep); color: #fff; margin-top: 2rem; border-top: 6px solid var(--green); }
.footer-inner { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.site-footer img { width: 180px; margin-bottom: 1rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .25rem; }
.site-footer a { color: #fff; display: inline-block; padding: .35rem 0; }
.site-footer .small { color: #fff; }

/* Tablet */
@media (min-width: 40em) {
  .header-inner { flex-direction: row; align-items: center; justify-content: space-between; }
  .logo img { width: 240px; }
  .search-row { flex-direction: row; }
  .search-row input { flex: 1; }
  .grid-2, .grid-2-lg, .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .subject-list { grid-template-columns: repeat(2, 1fr); }
  .hero-img img, .hero picture img { height: 320px; }
  .apply-title { display: block; }
  .pay-types { grid-template-columns: repeat(3, 1fr); }
  .filters-inline { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
  .filters-inline .field { margin: 0; min-width: 14rem; }
}
/* Desktop */
@media (min-width: 64em) {
  .hero { display: grid; }
  .hero > picture, .hero > .hero-panel { grid-area: 1 / 1; }
  .hero-img img, .hero picture img { height: 480px; }
  .hero-panel { align-self: center; justify-self: start; max-width: 36rem; margin-left: max(1rem, calc((100vw - var(--wrap)) / 2 + 1rem)); border-radius: var(--radius); padding: 1.75rem; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .subject-list { grid-template-columns: repeat(3, 1fr); }
  .search-layout { grid-template-columns: 18rem 1fr; align-items: start; }
  .filters:not(.filters-inline) { position: sticky; top: 1rem; }
  .course-layout { grid-template-columns: 1.4fr 1fr; }
  .course-media { grid-column: 1; }
  .course-summary { grid-column: 2; grid-row: 1 / span 2; align-self: start; position: sticky; top: 1rem; }
  .course-body { grid-column: 1; }
  .event-layout { grid-template-columns: 1fr 20rem; }
  .event-layout .course-summary { grid-column: 2; grid-row: 1; }
  .event-body { grid-column: 1; grid-row: 1; }
  .site-footer ul { grid-template-columns: repeat(3, auto); justify-content: start; column-gap: 2rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
