/*---------------------------------------
  MEDIA PAGE
  Page-specific styles only. Colours, fonts, radii and buttons come from
  tooplate-clean-work.css (:root variables, .custom-btn).
-----------------------------------------*/

#ma-root {
  --ma-shadow: 0 8px 26px rgba(79, 131, 209, 0.12);
  --ma-shadow-hover: 0 14px 34px rgba(79, 131, 209, 0.24);
  --ma-radius: var(--border-radius-medium);
  --ma-ink: #1d2a3a;
}
#ma-root [hidden], .ma-lb [hidden] { display: none !important; }
#ma-root :focus-visible, .ma-lb :focus-visible { outline: 3px solid var(--secondary-color); outline-offset: 3px; }
#ma-root button { font-family: inherit; }

/* ---------- Intro (compact two-column band: text left, search right) ---------- */
.ma-intro { position: relative; padding: 30px 20px; overflow: hidden; background: #eef5fd; }
.ma-intro > .container { position: relative; z-index: 1; }
.ma-intro-decor { position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  background-image: radial-gradient(rgba(79, 131, 209, .22) 1.3px, transparent 1.6px), linear-gradient(135deg, #e4effc 0%, #f4f9ff 60%, #eaf3fd 100%);
  background-size: 22px 22px, auto; }
.ma-intro-decor::before, .ma-intro-decor::after { content: ""; position: absolute; border-radius: 50%; }
.ma-intro-decor::before { width: 380px; height: 380px; left: -150px; top: -200px; background: radial-gradient(circle at 60% 60%, rgba(79, 131, 209, .20), rgba(79, 131, 209, 0) 70%); }
.ma-intro-decor::after { width: 320px; height: 320px; right: -90px; bottom: -170px; background: radial-gradient(circle at 40% 40%, rgba(79, 131, 209, .16), rgba(79, 131, 209, 0) 70%); }

.ma-intro-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px 44px; align-items: center; }
.ma-intro-text { text-align: left; }
.ma-intro-top { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.ma-intro-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 13px; background: linear-gradient(135deg, var(--secondary-color), #3a68b0); color: var(--white-color); font-size: 19px; box-shadow: 0 0 0 5px rgba(79, 131, 209, .14), 0 8px 18px rgba(79, 131, 209, .32); transform: rotate(-6deg); }
.ma-intro-icon i { transform: rotate(6deg); }
.ma-intro-eyebrow { margin: 0; color: var(--secondary-color); font-size: 12px; font-weight: var(--font-weight-medium); letter-spacing: .18em; text-transform: uppercase; }
.ma-intro h2 { position: relative; display: block; width: fit-content; font-size: clamp(36px, 4.4vw, 50px); font-weight: var(--font-weight-bold); line-height: 1.05; letter-spacing: -.02em; margin: 0 0 12px; padding-bottom: 12px; color: #1d2a3a; }
.ma-intro h2::after { content: ""; position: absolute; left: 0; bottom: 0; width: 56px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--secondary-color), #8fb6ea); }
.ma-lead { color: #4a5a70; font-size: 16px; line-height: 1.6; margin: 0; max-width: 470px; }
.ma-lead strong { color: var(--secondary-color); font-weight: var(--font-weight-medium); }

/* ---------- Search + tags ---------- */
.ma-finder { position: relative; margin: 0; padding: 14px 16px 12px; background: var(--white-color); border: 1px solid #d5e5f7; border-radius: var(--ma-radius); box-shadow: var(--ma-shadow); }
.ma-search { position: relative; }
.ma-search > .bi-search { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--secondary-color); font-size: 17px; pointer-events: none; }
.ma-search input { width: 100%; height: 48px; padding: 0 46px 0 46px; font-family: inherit; font-size: 15px; color: var(--dark-color); background: var(--section-bg-color); border: 1.5px solid transparent; border-radius: var(--border-radius-large); transition: border-color .25s, box-shadow .25s, background .25s; -webkit-appearance: none; appearance: none; }
.ma-search input::-webkit-search-cancel-button { display: none; }
.ma-search input:focus { outline: none; background: var(--white-color); border-color: var(--secondary-color); box-shadow: 0 0 0 4px rgba(79, 131, 209, .16); }
.ma-search-clear { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--p-color); cursor: pointer; }
.ma-search-clear:hover { background: #dcebfa; color: var(--secondary-color); }

.ma-tagrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ma-chip { background: var(--white-color); border: 1.5px solid var(--border-color); color: var(--ma-ink); border-radius: var(--border-radius-large); font-size: 13px; line-height: 1.2; padding: 6px 13px; cursor: pointer; }
.ma-chip:hover { border-color: var(--secondary-color); color: var(--secondary-color); }
.ma-chip[aria-pressed="true"] { background: var(--secondary-color); border-color: var(--secondary-color); color: var(--white-color); }
.ma-chip--more { border-style: dashed; color: var(--secondary-color); }
.ma-result { margin: 0; font-size: 14px; color: var(--p-color); }
.ma-result:not(:empty) { margin-top: 8px; }
.ma-link { background: none; border: 0; padding: 2px 6px; color: var(--secondary-color); font-size: 14px; font-weight: var(--font-weight-medium); cursor: pointer; }
.ma-link:hover { text-decoration: underline; }

/* ---------- Empty state ---------- */
.ma-block--empty { background: var(--white-color); }
.ma-empty { text-align: center; background: var(--section-bg-color); border: 1px dashed #b9d3f0; border-radius: var(--ma-radius); padding: 48px 24px; }
.ma-empty > i { font-size: 42px; color: var(--secondary-color); opacity: .85; }
.ma-empty h3 { font-size: 26px; font-weight: var(--font-weight-bold); margin: 12px 0 8px; }
.ma-empty p { max-width: 440px; margin: 0 auto 20px; }
.ma-clear { font-size: 16px; padding: 12px 26px; }

/* ---------- Blocks ---------- */
.ma-block { background: var(--white-color); padding-top: 30px; padding-bottom: 38px; }
.ma-block--alt { background: var(--section-bg-color); }
.ma-block-head { margin-bottom: 20px; }
.ma-block-head h3 { font-size: 28px; font-weight: var(--font-weight-bold); margin: 0 0 6px; }
.ma-block-head p { margin: 0; max-width: 720px; }

/* ---------- Framed collection (one border + heading around a set of cards) ---------- */
.ma-collection { border: 2px solid #b9d3f0; border-top: 6px solid var(--secondary-color); border-radius: var(--ma-radius); background: #f6faff; box-shadow: var(--ma-shadow); overflow: hidden; }
.ma-collection-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 32px; padding: 16px 26px 14px; background: linear-gradient(180deg, #e8f2fd, #f6faff); border-bottom: 1px solid #cfe1f6; }
.ma-collection-text { max-width: 720px; }
.ma-collection-eyebrow { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 6px; background: var(--secondary-color); color: var(--white-color); font-size: 12px; font-weight: var(--font-weight-medium); letter-spacing: .06em; text-transform: uppercase; padding: 5px 12px; border-radius: var(--border-radius-large); }
.ma-collection-text h3 { font-size: 26px; font-weight: var(--font-weight-bold); margin: 0 0 2px; }
.ma-collection-text p:last-child { margin: 0; }
.ma-collection-stats { list-style: none; padding: 0; margin: 0; display: flex; gap: 26px; }
.ma-collection-stats li { display: flex; flex-direction: column; margin: 0; line-height: 1.2; }
.ma-collection-stats strong { font-size: 24px; color: var(--secondary-color); font-weight: var(--font-weight-bold); }
.ma-collection-stats span { font-size: 13px; color: var(--p-color); }
.ma-collection > .ma-cards { padding: 22px 26px 28px; }

/* ---------- Card grid: 4 columns ---------- */
.ma-cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 26px; }
.ma-cards > li { margin: 0; min-width: 0; }

.ma-card {
  display: flex; flex-direction: column; width: 100%; height: 100%; padding: 0; text-align: left;
  background: var(--white-color); border: 1px solid var(--border-color); border-radius: var(--ma-radius);
  box-shadow: var(--ma-shadow); overflow: visible; cursor: pointer; position: relative;
  transition: transform .3s, box-shadow .3s;
}
button.ma-card:hover { transform: translateY(-4px); box-shadow: var(--ma-shadow-hover); }
.ma-card.is-empty { cursor: default; }

/* folder: a few "sheets" peeking out behind the card */
.ma-card.is-folder { box-shadow: 5px 5px 0 -1px #dbe9f9, 10px 10px 0 -2px #ebf3fc, var(--ma-shadow); }
.ma-card.is-folder:hover { box-shadow: 6px 6px 0 -1px #cfe1f6, 12px 12px 0 -2px #e3eefb, var(--ma-shadow-hover); }

.ma-card-media { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--section-bg-color); overflow: hidden; border-radius: var(--ma-radius) var(--ma-radius) 0 0; }
.ma-card-media > img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; transition: transform .5s; }
button.ma-card:hover .ma-card-media > img { transform: scale(1.05); }
.ma-cover-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--section-bg-color), #dcecfb); color: var(--secondary-color); font-size: 42px; }

.ma-badge { position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 20px); background: rgba(15, 30, 55, .8); color: var(--white-color); font-size: 12px; line-height: 1.2; padding: 5px 10px; border-radius: var(--border-radius-large); }
.ma-badge i { margin-right: 4px; }
.ma-badge--soon { background: rgba(255, 255, 255, .92); color: var(--p-color); }
.ma-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 52px; height: 52px; border-radius: 50%; background: rgba(255, 255, 255, .92); color: var(--secondary-color); display: flex; align-items: center; justify-content: center; font-size: 28px; box-shadow: 0 4px 14px rgba(0, 0, 0, .3); }
.ma-play i { margin-left: 3px; }

.ma-card-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.ma-card-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: var(--font-weight-medium); color: var(--secondary-color); }
.ma-card-title { font-size: 19px; font-weight: var(--font-weight-bold); line-height: 1.25; color: var(--dark-color); }
.ma-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }

.ma-tag { display: inline-block; background: var(--section-bg-color); color: var(--secondary-color); border-radius: var(--border-radius-large); font-size: 12px; line-height: 1; padding: 6px 10px; }
.ma-block--alt .ma-card .ma-tag { background: var(--section-bg-color); }

.ma-note { text-align: center; color: var(--p-color); background: var(--section-bg-color); border: 1px dashed #b9d3f0; border-radius: var(--ma-radius); padding: 26px; margin: 0; }
.ma-note i { color: var(--secondary-color); margin-right: 6px; }

/* ---------- Viewer ---------- */
html.ma-lb-open { overflow: hidden; }
.ma-lb { position: fixed; inset: 0; z-index: 2000; background: rgba(8, 18, 34, .985); }
.ma-lb-close { position: absolute; top: 12px; right: 14px; z-index: 5; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--section-bg-color); color: var(--secondary-color); font-size: 19px; cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
.ma-lb-close:hover { background: var(--secondary-color); color: var(--white-color); }
.ma-lb-close:focus-visible { outline-color: var(--white-color); }
.ma-lb :focus-visible { outline-color: var(--white-color); }
.ma-lb-info :focus-visible { outline-color: var(--secondary-color); }

.ma-lb-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 380px; height: 100%; }

.ma-lb-stage { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; padding: 64px 70px 48px; }
.ma-lb-media { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.ma-lb-media img, .ma-lb-media video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; background: #000; }
.ma-lb-media video { width: 100%; }
.ma-lb-media.slide-next { animation: ma-in-next .3s ease; }
.ma-lb-media.slide-prev { animation: ma-in-prev .3s ease; }
@keyframes ma-in-next { from { opacity: 0; transform: translateX(46px); } to { opacity: 1; transform: none; } }
@keyframes ma-in-prev { from { opacity: 0; transform: translateX(-46px); } to { opacity: 1; transform: none; } }

.ma-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16); color: var(--white-color); font-size: 22px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.ma-lb-nav:hover { background: rgba(255, 255, 255, .32); }
.ma-lb-prev { left: 12px; }
.ma-lb-next { right: 12px; }
.ma-lb-count { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font-size: 14px; color: rgba(255, 255, 255, .85); background: rgba(255, 255, 255, .12); padding: 4px 14px; border-radius: var(--border-radius-large); }

.ma-lb-doc { display: flex; flex-direction: column; align-items: center; gap: 20px; max-height: 100%; }
.ma-lb-doc img { max-height: calc(100% - 80px); max-width: 100%; object-fit: contain; border-radius: 6px; background: #fff; }
.ma-lb-doc > i { font-size: 96px; color: rgba(255, 255, 255, .6); }
.ma-lb-doc .custom-border-btn { color: var(--white-color); border-color: var(--white-color); }
.ma-lb-fail { text-align: center; color: rgba(255, 255, 255, .8); }
.ma-lb-fail i { font-size: 40px; }
.ma-lb-fail p { color: inherit; }

.ma-lb-info { background: var(--white-color); color: var(--ma-ink); padding: 64px 26px 26px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.ma-lb-label { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: var(--font-weight-medium); color: var(--secondary-color); }
.ma-lb-title { font-size: 24px; font-weight: var(--font-weight-bold); line-height: 1.25; margin: 0; }
.ma-lb-caption { margin: 0; font-size: 14px; color: var(--p-color); font-style: italic; }
.ma-lb-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ma-lb-meta { margin: 0; display: grid; gap: 10px; padding: 12px 0; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); }
.ma-lb-meta > div { margin: 0; }
.ma-lb-meta dt { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-weight: var(--font-weight-medium); color: var(--p-color); }
.ma-lb-meta dd { margin: 0; font-size: 15px; font-weight: var(--font-weight-medium); color: var(--dark-color); overflow-wrap: anywhere; }
.ma-lb-desc { margin: 0; font-size: 15px; }
.ma-lb-people summary { cursor: pointer; font-size: 14px; font-weight: var(--font-weight-medium); color: var(--secondary-color); }
.ma-lb-people ul { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow: auto; }
.ma-lb-people li { margin: 0; font-size: 14px; padding: 6px 10px; background: var(--section-bg-color); border-radius: var(--border-radius-small); }
.ma-lb-people small { display: block; font-size: 11px; color: var(--p-color); }
.ma-lb-dl { margin-top: auto; text-align: center; font-size: 16px; padding: 13px 22px; }
.ma-lb-dl i { margin-right: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 1199px) { .ma-cards { gap: 20px; } }

@media (max-width: 991px) {
  .ma-intro-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .ma-intro-text { text-align: center; }
  .ma-intro-top { justify-content: center; }
  .ma-intro h2 { margin-left: auto; margin-right: auto; }
  .ma-intro h2::after { left: 50%; margin-left: -28px; }
  .ma-lead { margin: 0 auto; max-width: 620px; }
  .ma-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ma-lb-wrap { grid-template-columns: 1fr; grid-template-rows: minmax(0, 52%) minmax(0, 1fr); }
  .ma-lb-stage { padding: 56px 58px 44px; }
  .ma-lb-info { padding: 20px 20px 24px; }
  .ma-lb-title { font-size: 21px; }
}

@media (max-width: 575px) {
  .ma-intro { padding: 24px 16px 22px; }
  .ma-block { padding-top: 24px; padding-bottom: 30px; }
  .ma-lead { font-size: 15px; }
  .ma-finder { padding: 12px; }
  .ma-tagrow { flex-wrap: nowrap; overflow-x: auto; margin-left: -12px; margin-right: -12px; padding: 2px 12px 8px; scrollbar-width: none; }
  .ma-tagrow::-webkit-scrollbar { display: none; }
  .ma-chip { flex: 0 0 auto; white-space: nowrap; }
  .ma-collection-head { padding: 16px 16px 12px; }
  .ma-collection-text h3 { font-size: 24px; }
  .ma-collection-stats strong { font-size: 24px; }
  .ma-collection > .ma-cards { padding: 16px 14px 22px; }
  .ma-block-head h3 { font-size: 24px; }
  .ma-cards { gap: 16px; }
  .ma-card-body { padding: 10px 12px 12px; }
  .ma-card-title { font-size: 16px; }
  .ma-card-label { font-size: 11px; }
  .ma-tag { font-size: 11px; padding: 5px 8px; }
  .ma-badge { font-size: 11px; left: 6px; bottom: 6px; padding: 4px 8px; }
  .ma-lb-stage { padding: 52px 8px 40px; }
  .ma-lb-nav { width: 40px; height: 40px; font-size: 18px; background: rgba(8, 18, 34, .6); }
  .ma-lb-prev { left: 6px; }
  .ma-lb-next { right: 6px; }
}
@media (max-width: 360px) { .ma-cards { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  #ma-root *, .ma-lb * { transition: none !important; animation: none !important; }
}
