/*
 * Shared header and footer of the Edumasoft websites (see app/brand/brand.php). MASTER COPY: htdocs/EDUMASOFT.
 * Every rule starts with .ems- and sets what it needs itself, so a site's own styles and this file don't affect each other.
 * A site may set --ems-max (footer width) and --ems-foot-space (room under the footer for floating buttons).
 */
.ems-head, .ems-foot {
    --ems-900: #06301f;
    --ems-800: #0b4530;
    --ems-600: #0b6b47;
    --ems-100: #dfeee5;
    --ems-mist: #f1f7f3;
    --ems-ink: #10261c;
    --ems-line: #d5e2da;
    --ems-bg: #fff;
    --ems-soft: #4a5f55;
    --ems-on: #0b6b47;
    --ems-edge: #0b6b47;
    --ems-line-ink: #0b4530;
    --ems-title: 'Jost', 'DM Sans', system-ui, sans-serif;
    --ems-gutter: clamp(1rem, 4vw, 2.5rem);
    box-sizing: border-box;
    font: 400 16px/1.5 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    letter-spacing: normal;
    text-align: left;
}
.ems-head *, .ems-foot * { box-sizing: border-box; }
.ems-head ul, .ems-foot ul { margin: 0; padding: 0; list-style: none; }
.ems-head li, .ems-foot li { margin: 0; padding: 0; }
.ems-head a, .ems-foot a { color: inherit; text-decoration: none; }
.ems-head a:focus-visible, .ems-head button:focus-visible, .ems-head summary:focus-visible { outline: 3px solid var(--ems-on); outline-offset: 2px; border-radius: 8px; box-shadow: none; }
.ems-foot a:focus-visible { outline: 3px solid #ffc857; outline-offset: 3px; border-radius: 6px; box-shadow: none; }
.ems-head .ems-ico { display: block; flex: none; width: 1.15em; height: 1.15em; }
.ems-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Header ---------- */
.ems-head { position: sticky; top: 0; z-index: 1030; width: 100%; background: var(--ems-bg); border-bottom: 1px solid var(--ems-line); color: var(--ems-ink); }
.ems-head .ems-in { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; width: 100%; max-width: 1480px; min-height: 76px; margin: 0 auto; padding: 0 var(--ems-gutter); }
.ems-head .ems-brand { display: flex; flex: none; align-items: center; gap: .75rem; min-width: 0; }
.ems-head .ems-brand img { flex: none; width: 42px; height: 42px; margin: 0; border-radius: 10px; object-fit: cover; }
.ems-head .ems-mark { display: grid; flex: none; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--ems-900); color: #fff; font: 700 14px/1 var(--ems-title); }
.ems-head .ems-names { display: grid; min-width: 0; }
.ems-head .ems-name { overflow: hidden; color: var(--ems-ink); font: 600 19px/1.25 var(--ems-title); text-overflow: ellipsis; white-space: nowrap; }
.ems-head .ems-sub { overflow: hidden; color: var(--ems-soft); font-size: 13px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.ems-head .ems-toggle { display: none; flex: none; align-items: center; gap: .5rem; min-height: 46px; margin: 0; padding: .4rem .9rem; border: 2px solid var(--ems-line); border-radius: 99px; background: var(--ems-bg); color: inherit; font-family: inherit; font-size: 16px; font-weight: 700; line-height: 1; cursor: pointer; }
.ems-head .ems-menu { display: flex; flex: none; align-items: center; gap: .6rem; }
.ems-head .ems-links { display: flex; align-items: center; }
.ems-head .ems-links a, .ems-head .ems-drop > summary:not(.ems-btn) { display: flex; align-items: center; gap: .3rem; min-height: 44px; padding: 0 .6rem; color: var(--ems-ink); font-weight: 500; white-space: nowrap; }
/* A line under the link: pale on hover, solid for the active page and an open menu. The text never gets bolder in the
   desktop row, so the links don't move. Hover rules are only for a mouse: on touch screens they'd stay on after a tap. */
.ems-head .ems-links > li > a, .ems-head .ems-drop > summary:not(.ems-btn) { position: relative; transition: color .2s, background-color .2s; }
.ems-head .ems-links > li > a::after, .ems-head .ems-drop > summary:not(.ems-btn)::after { content: ''; position: absolute; right: .6rem; bottom: 3px; left: .6rem; height: 3px; border-radius: 3px; background: var(--ems-on); opacity: .4; transform: scaleX(0); transition: transform .2s, opacity .2s; pointer-events: none; }
@media (hover: hover) {
    .ems-head .ems-links a:hover, .ems-head .ems-drop > summary:not(.ems-btn):hover { color: var(--ems-on); }
    .ems-head .ems-links > li > a:hover::after, .ems-head .ems-drop > summary:not(.ems-btn):hover::after { transform: scaleX(1); }
    .ems-head .ems-brand:hover .ems-name { color: var(--ems-on); }
    .ems-head .ems-toggle:hover { border-color: var(--ems-on); color: var(--ems-on); }
}
.ems-head .ems-links > li > a[aria-current], .ems-head .ems-drop > summary.ems-on:not(.ems-btn), .ems-head .ems-drop[open] > summary:not(.ems-btn) { color: var(--ems-on); }
.ems-head .ems-links > li > a[aria-current]::after, .ems-head .ems-drop > summary.ems-on:not(.ems-btn)::after, .ems-head .ems-drop[open] > summary:not(.ems-btn)::after { opacity: 1; transform: scaleX(1); }
.ems-head.ems-open .ems-toggle { border-color: var(--ems-on); color: var(--ems-on); }
.ems-head .ems-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 46px; padding: .5rem 1.15rem; border: 2px solid var(--ems-edge); border-radius: 99px; font-weight: 700; line-height: 1.2; white-space: nowrap; transition: background-color .2s, border-color .2s, color .2s, box-shadow .2s; }
.ems-head .ems-btn-line { color: var(--ems-line-ink); }
.ems-head .ems-btn-line:hover, .ems-head .ems-btn-line[aria-current], .ems-head .ems-btn-line.ems-on, .ems-head .ems-drop[open] > .ems-btn-line { background: var(--ems-100); color: var(--ems-line-ink); }
.ems-head .ems-btn-main { background: var(--ems-600); color: #fff; }
.ems-head .ems-btn-main:hover, .ems-head .ems-btn-main[aria-current] { border-color: var(--ems-900); background: var(--ems-900); color: #fff; }
/* The button of the page you are on has a ring around it */
.ems-head .ems-btn[aria-current], .ems-head .ems-btn.ems-on { box-shadow: 0 0 0 2px var(--ems-bg), 0 0 0 4px var(--ems-on); }
.ems-head .ems-drop { position: relative; margin: 0; }
.ems-head .ems-drop > summary { list-style: none; cursor: pointer; }
.ems-head .ems-drop > summary::-webkit-details-marker { display: none; }
.ems-head .ems-drop > summary .ems-ico { width: 1em; height: 1em; transition: transform .2s; }
.ems-head .ems-drop[open] > summary .ems-ico { transform: rotate(180deg); }
.ems-head .ems-list { position: absolute; top: calc(100% + .6rem); right: 0; z-index: 1; min-width: 220px; padding: .5rem; border: 1px solid var(--ems-line); border-radius: 14px; background: var(--ems-bg); box-shadow: 0 18px 40px -18px rgba(6, 48, 31, .45); }
.ems-head .ems-list a { display: flex; align-items: center; min-height: 46px; padding: .5rem .8rem; border-radius: 9px; color: var(--ems-ink); font-weight: 500; }
.ems-head .ems-list a { transition: background-color .2s, color .2s; }
.ems-head .ems-list a:hover { background: var(--ems-mist); color: var(--ems-on); }
.ems-head .ems-list a[aria-current] { background: var(--ems-100); color: var(--ems-on); font-weight: 700; }
.ems-head .ems-split { margin-top: .4rem; padding-top: .4rem; border-top: 1px solid var(--ems-line); }

/* Optional: small buttons that always show (cart, dark mode) */
.ems-head.ems-has-tools .ems-brand { margin-right: auto; }
.ems-head .ems-tools { display: flex; flex: none; order: 2; align-items: center; gap: .4rem; }
.ems-head .ems-tool { position: relative; display: inline-grid; flex: none; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0; border: 1px solid var(--ems-line); border-radius: 50%; background: var(--ems-bg); color: var(--ems-ink); font-size: 18px; line-height: 1; cursor: pointer; }
.ems-head .ems-tool:hover { border-color: var(--ems-on); color: var(--ems-on); }

/* Optional: a large menu */
.ems-head .ems-wide { position: static; }
.ems-head .ems-panel { top: 100%; right: auto; left: 50%; width: min(780px, calc(100vw - 2rem)); max-height: calc(100dvh - 100px); padding: 1.25rem; overflow-y: auto; transform: translateX(-50%); }
.ems-head .ems-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1.25rem; }
.ems-head .ems-groups ul { display: flex; flex-wrap: wrap; }
.ems-head .ems-links .ems-panel a, .ems-head.ems-compact .ems-links .ems-panel a { display: inline-flex; min-height: 44px; padding: .3rem .7rem; border: 0; font-size: 16px; text-decoration: none; white-space: normal; }
.ems-head .ems-links .ems-panel a.ems-group { font-weight: 700; }
.ems-head .ems-more { display: flex; flex-wrap: wrap; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--ems-line); }
.ems-head .ems-links .ems-more a { color: var(--ems-on); font-weight: 700; }

/* Optional: search */
.ems-head .ems-search-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.ems-head .ems-search form { display: none; gap: .5rem; width: min(360px, calc(100vw - 2rem)); padding: .75rem; }
.ems-head .ems-search[open] form { display: flex; }
.ems-head .ems-search[open] > summary .ems-ico { transform: none; }
.ems-head .ems-search input { flex: 1 1 auto; min-width: 0; min-height: 46px; margin: 0; padding: .5rem .9rem; border: 1px solid #7d9488; border-radius: 12px; background: var(--ems-bg); color: var(--ems-ink); font: inherit; }

/* Dark mode, for sites that have it (they set data-bs-theme="dark" on <html>) */
[data-bs-theme="dark"] .ems-head { --ems-bg: #0b1020; --ems-ink: #eef2f7; --ems-soft: #a9b4c4; --ems-line: #2a344a; --ems-mist: #18213a; --ems-100: #14332a; --ems-on: #5fd3a2; --ems-edge: #2f9d73; --ems-line-ink: #c9f2e0; }
[data-bs-theme="dark"] .ems-head .ems-mark { background: #0b6b47; }
[data-bs-theme="dark"] .ems-head .ems-btn-main { border-color: #0b6b47; }

/* Menu button version: phones, and any screen the links don't fit on (brand.js adds ems-compact) */
.ems-head.ems-compact .ems-brand { flex: 0 1 auto; }
.ems-head.ems-compact .ems-toggle { display: inline-flex; }
.ems-head.ems-compact .ems-menu { position: absolute; top: 100%; right: 0; left: 0; display: none; flex-direction: column; align-items: stretch; gap: .25rem; max-height: calc(100vh - 100%); max-height: calc(100dvh - 76px); padding: .75rem var(--ems-gutter) 1.5rem; overflow-y: auto; overscroll-behavior: contain; border-bottom: 1px solid var(--ems-line); background: var(--ems-bg); }
.ems-head.ems-compact.ems-open .ems-menu { display: flex; }
.ems-head.ems-compact .ems-links { display: block; }
.ems-head.ems-compact .ems-links a, .ems-head.ems-compact .ems-drop > summary:not(.ems-btn) { justify-content: space-between; min-height: 52px; padding: 0 .9rem; border-bottom: 1px solid var(--ems-line); font-size: 18px; }
/* In the phone menu the line is on the left, and the row is tinted */
.ems-head.ems-compact .ems-links > li > a::after, .ems-head.ems-compact .ems-drop > summary:not(.ems-btn)::after { top: 8px; right: auto; bottom: 8px; left: 0; width: 4px; height: auto; transform: scaleY(0); }
.ems-head.ems-compact .ems-links > li > a[aria-current], .ems-head.ems-compact .ems-drop > summary.ems-on:not(.ems-btn) { background: var(--ems-100); font-weight: 700; }
.ems-head.ems-compact .ems-links > li > a[aria-current]::after, .ems-head.ems-compact .ems-drop > summary.ems-on:not(.ems-btn)::after, .ems-head.ems-compact .ems-drop[open] > summary:not(.ems-btn)::after { transform: scaleY(1); }
@media (hover: hover) {
    .ems-head.ems-compact .ems-links > li > a:hover, .ems-head.ems-compact .ems-drop > summary:not(.ems-btn):hover { background: var(--ems-mist); }
    .ems-head.ems-compact .ems-links > li > a:hover::after, .ems-head.ems-compact .ems-drop > summary:not(.ems-btn):hover::after { transform: scaleY(1); }
}
.ems-head.ems-compact .ems-list { position: static; margin: .5rem 0; box-shadow: none; }
.ems-head.ems-compact .ems-btn { width: 100%; margin-top: .6rem; }
.ems-head.ems-compact .ems-toggle { order: 3; }
.ems-head.ems-compact .ems-panel { width: auto; max-height: none; padding: .75rem; transform: none; }
.ems-head.ems-compact .ems-search-label { position: static; width: auto; height: auto; margin: 0 auto 0 .6rem; clip-path: none; }
.ems-head.ems-compact .ems-search form { width: auto; }
.ems-head.ems-compact .ems-search .ems-btn { width: auto; margin: 0; }
@media (max-width: 640px) {
    .ems-head .ems-in { gap: .75rem; min-height: 68px; }
    .ems-head .ems-brand { gap: .6rem; }
    .ems-head .ems-brand img, .ems-head .ems-mark { width: 38px; height: 38px; }
    .ems-head .ems-name { font-size: 17px; }
    .ems-head .ems-toggle { padding: .4rem .75rem; }
    .ems-head.ems-has-tools .ems-toggle { justify-content: center; width: 46px; padding: 0; }
    .ems-head.ems-has-tools .ems-toggle span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .ems-head.ems-has-tools .ems-in { gap: .4rem; }
    .ems-head.ems-has-tools .ems-tools { gap: .3rem; }
    .ems-head.ems-compact .ems-menu { max-height: calc(100dvh - 68px); }
}

/* ---------- Footer ---------- */
.ems-foot { position: relative; z-index: 0; margin: 0; padding: 4rem 0 var(--ems-foot-space, 0px); background: var(--ems-900); color: #d7e7de; }
.ems-foot .ems-foot-in, .ems-foot .ems-foot-end { width: 100%; max-width: var(--ems-max, 1160px); margin: 0 auto; padding: 0 var(--ems-gutter); }
.ems-foot .ems-foot-in { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.4fr; gap: 2.5rem 2rem; }
.ems-foot .ems-foot-brand a { display: grid; justify-items: start; gap: .9rem; color: #fff; font: 600 20px/1.3 var(--ems-title); }
.ems-foot .ems-foot-brand img { display: block; width: 46px; height: 46px; border-radius: 11px; }
.ems-foot .ems-foot-brand p { max-width: 22em; margin: .4rem 0 0; color: inherit; font: inherit; }
.ems-foot h2 { margin: 0 0 .6rem; padding: 0; color: #fff; font: 600 18px/1.3 var(--ems-title); letter-spacing: normal; }
.ems-foot li { overflow-wrap: anywhere; }
.ems-foot li a { display: inline-flex; align-items: center; min-height: 40px; }
.ems-foot .ems-foot-contact li:last-child { padding: .45rem 0; }
.ems-foot a:hover { color: #fff; text-decoration: underline; text-underline-offset: .25em; }
.ems-foot li a[aria-current] { color: #fff; font-weight: 700; }
.ems-foot .ems-foot-end { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.5rem; margin-top: 2.5rem; padding-top: 1.25rem; padding-bottom: 1.5rem; }
.ems-foot .ems-foot-end a { display: inline-flex; align-items: center; min-height: 44px; }
@media (max-width: 999px) {
    .ems-foot .ems-foot-in { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
    .ems-foot { padding-top: 3rem; }
    .ems-foot .ems-foot-brand, .ems-foot .ems-foot-contact { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
    .ems-head .ems-btn, .ems-head .ems-ico, .ems-head a, .ems-head summary, .ems-head a::after, .ems-head summary::after { transition: none !important; }
}
@media print {
    .ems-head, .ems-foot { display: none; }
}
