/* The top menu bar, shared by every page that has it: the brand, five links and «Más» (a <details>, no JS),
   and the light/dark button theme.js adds. Pages keep only their own space under the bar and the Talavera tile
   strip. Linked before each page's own <style>, so a page rule of the same weight still wins. */
header.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px 16px; z-index: 10; margin: 0 -16px 20px; padding: 12px 16px; background: var(--bg) }
.brand { justify-self: start; display: inline-flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; font-weight: 600; font-size: 1rem }
.brand img { width: 20px; height: auto }
header.top .theme-btn { justify-self: end }

.site-nav { display: flex; align-items: center; gap: 4px }
.site-nav a, .site-nav summary { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 36px; padding: 0 8px; color: var(--muted); font-size: .9rem; font-weight: 500; line-height: 1; text-decoration: none; white-space: nowrap; transition: color .15s ease-out }
.site-nav .i { width: 16px; height: 16px; color: inherit }
/* The current page: its label in ink with a Talavera-blue rule under it; hover and an open «Más» get the rule in the line colour. */
.site-nav a::before, .site-nav summary::before { content: ""; position: absolute; left: 8px; right: 8px; bottom: 2px; height: 2px; background: transparent; transition: background-color .15s ease-out }
.site-nav a:hover, .site-nav summary:hover, .site-nav details[open] summary { color: var(--fg) }
.site-nav a:hover::before, .site-nav summary:hover::before, .site-nav details[open] summary::before { background: var(--line) }
.site-nav a[aria-current="page"], .site-nav details:has(a[aria-current="page"]) summary { color: var(--fg) }
.site-nav a[aria-current="page"]::before, .site-nav details:has(a[aria-current="page"]) summary::before { background: var(--brand) }
.site-nav a:focus-visible, .site-nav summary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); border-radius: 4px }

.site-nav details { position: relative }
.site-nav summary { list-style: none; cursor: pointer }
.site-nav summary::-webkit-details-marker { display: none }
.site-nav summary::after { content: ""; width: 6px; height: 6px; margin: 0 2px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg) }
.site-nav details[open] summary::after { transform: translateY(2px) rotate(225deg) }
.site-nav .mas-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; display: flex; flex-direction: column; min-width: 208px; padding: 8px 0; background: var(--surface); border: 1px solid var(--line); border-top: 3px double var(--brand); border-radius: 4px; box-shadow: 0 4px 12px rgb(0 0 0 / .1) }
.site-nav .mas-panel a { justify-content: flex-start; gap: 8px; padding: 0 16px }
.site-nav .mas-panel a::before { left: 0; right: auto; top: 8px; bottom: 8px; width: 2px; height: auto }

@media (max-width: 980px) { .site-nav .i { display: none } }
/* Phones and narrow windows: the brand and the button on one row, the six entries under them. */
@media (max-width: 760px) {
  header.top { grid-template-columns: 1fr auto; padding: 8px 16px }
  header.top .theme-btn { grid-column: 2; grid-row: 1 }
  .site-nav { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(6, auto); justify-content: space-between; gap: 0; margin: 0 -8px }
  .site-nav summary { display: flex }
}
@media (max-width: 560px) {
  .site-nav { grid-template-columns: repeat(3, 1fr) }
  .site-nav > a, .site-nav details { justify-self: center }
  .site-nav a, .site-nav summary { height: 40px }
  .site-nav .mas-panel a { height: 40px }
}
