/* AI Databank: header menu panel and the front-page band. Colours and type come from the design system tokens. */

/* header item: a caret, and the panel fixed under it (positioned by ad-databank.js) */
.ad-header .ad-nav li.ad-db > .fl-has-submenu-container { display: flex; align-items: stretch; }
.ad-header .ad-nav li.ad-db .fl-menu-toggle { display: none; }
.ad-header .ad-nav ul.menu > li.ad-db > a::after,
.ad-header .ad-nav ul.menu > li.ad-db > .fl-has-submenu-container > a::after { content: ""; width: 7px; height: 7px; margin: -4px 0 0 9px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform 160ms ease; }
.ad-header .ad-nav li.ad-db.is-open > .fl-has-submenu-container > a::after,
.ad-header .ad-nav li.ad-db.is-open > a::after { transform: translateY(4px) rotate(-135deg); }
.ad-header .ad-nav li.ad-db > .fl-has-submenu-container > a { display: flex; align-items: center; min-height: 52px; padding: 0 12px; color: var(--ds-color-paper); font-family: var(--ds-font-body); font-size: 0.9375rem; font-weight: 640; font-stretch: 104%; text-decoration: none; white-space: nowrap; box-shadow: inset 0 -4px 0 0 transparent; transition: box-shadow 160ms ease, color 160ms ease; }
.ad-header .ad-nav li.ad-db > .fl-has-submenu-container > a:is(:hover, :focus-visible),
.ad-header .ad-nav li.ad-db.is-open > .fl-has-submenu-container > a { color: var(--ds-color-white); box-shadow: inset 0 -4px 0 0 var(--ds-color-terrain); }
.ad-header .ad-nav li.ad-db:is(.current-menu-parent, .current-menu-ancestor) > .fl-has-submenu-container > a { color: var(--ds-color-white); box-shadow: inset 0 -4px 0 0 var(--ds-color-signal); }

.ad-header .ad-nav li.ad-db a:focus:not(:focus-visible) { outline: none; }
.ad-header .ad-nav li.ad-db > .sub-menu { display: none; position: fixed; z-index: 1000; float: none; min-width: 240px; width: max-content; margin: 0; padding: 8px 0; list-style: none; background: var(--ds-color-ink); border: 0; border-top: 4px solid var(--ds-color-terrain); box-shadow: 0 18px 40px rgb(0 0 0 / 0.28); opacity: 1; visibility: visible; }
.ad-header .ad-nav li.ad-db.is-open > .sub-menu { display: block; }
.ad-header .ad-nav li.ad-db > .sub-menu > li { float: none; display: block; width: auto; border: 0; }
.ad-header .ad-nav li.ad-db > .sub-menu > li > a { display: block; padding: 12px 22px; color: var(--ds-color-paper); background: none; font-family: var(--ds-font-body); font-size: 0.9375rem; font-weight: 640; font-stretch: 104%; line-height: 1.3; text-decoration: none; white-space: nowrap; border: 0; }
.ad-header .ad-nav li.ad-db > .sub-menu > li > a:is(:hover, :focus-visible) { color: var(--ds-color-white); background: var(--ds-color-ink-lift); }
.ad-header .ad-nav li.ad-db > .sub-menu > li:is(.current-menu-item, .current_page_item) > a { color: var(--ds-color-white); box-shadow: inset 4px 0 0 0 var(--ds-color-signal); }

/* special sections (AI Databank, Events, Watch; class ad-nav-sec, placed last by the menu filter) read in City, set off from the topics by a rule */
.ad-header .ad-nav ul.menu > li.ad-nav-sec > a,
.ad-header .ad-nav ul.menu > li.ad-nav-sec > .fl-has-submenu-container > a { color: var(--ds-color-city); }
.ad-header .ad-nav ul.menu > li.ad-nav-sec > a:is(:hover, :focus-visible),
.ad-header .ad-nav ul.menu > li.ad-nav-sec > .fl-has-submenu-container > a:is(:hover, :focus-visible),
.ad-header .ad-nav ul.menu > li.ad-nav-sec.is-open > .fl-has-submenu-container > a { color: var(--ds-color-city); box-shadow: inset 0 -4px 0 0 var(--ds-color-city); }
.ad-header .ad-nav ul.menu > li.ad-nav-sec:is(.current-menu-item, .current_page_item, .current-menu-parent, .current-menu-ancestor, .current-post-ancestor) > a,
.ad-header .ad-nav ul.menu > li.ad-nav-sec:is(.current-menu-item, .current_page_item, .current-menu-parent, .current-menu-ancestor, .current-post-ancestor) > .fl-has-submenu-container > a { color: var(--ds-color-city); box-shadow: inset 0 -4px 0 0 var(--ds-color-city); }
.ad-header .ad-nav ul.menu > li:not(.ad-nav-sec) + li.ad-nav-sec { display: flex; align-items: center; }
.ad-header .ad-nav ul.menu > li:not(.ad-nav-sec) + li.ad-nav-sec::before { content: ""; flex: none; width: 1px; height: 22px; margin-right: 8px; background: currentColor; color: var(--ds-color-paper); opacity: 0.3; }

/* front-page band: one column per section, ruled like the leaderboard strip */
.ad-dbrow:not(:has(.ad-dbh)) { display: none; }
.ad-dbh { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px 40px; }
.ad-dbh__col { display: flex; flex-direction: column; border-top: 2px solid var(--ad-fg, var(--ds-color-ink)); padding-top: 14px; }
.ad-dbh__name { margin: 0; font-family: var(--ds-font-display); font-size: 1.375rem; font-weight: 780; font-stretch: 108%; line-height: 1.1; letter-spacing: -0.02em; text-transform: none; }
.ad-dbh__count { margin: 6px 0 0; font-family: var(--ds-font-readout); font-size: 0.8125rem; letter-spacing: 0.02em; color: var(--ds-color-graphite); }
.ad-dbh__list { list-style: none; margin: 12px 0 0; padding: 0; flex: 1 1 auto; }
.ad-dbh__list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--ad-rule, var(--ds-color-line)); font-family: var(--ds-font-body); font-size: 1rem; font-weight: 600; line-height: 1.3; }
.ad-dbh__list li:first-child { border-top: 0; }
.ad-dbh__meta { font-family: var(--ds-font-readout); font-size: 0.75rem; font-weight: 400; color: var(--ds-color-graphite); }
.ad-dbh__more { margin: 12px 0 0; font-family: var(--ds-font-body); font-size: 0.875rem; font-weight: 640; }
.ad-dbh a, .fl-ds-page .ad-sec .ad-dbh a { color: inherit; text-decoration: none; background: linear-gradient(var(--ds-color-signal), var(--ds-color-signal)) 0 100% / 0 2px no-repeat; transition: background-size 200ms ease; }
.ad-dbh a:is(:hover, :focus-visible) { background-size: 100% 2px; }
@media (max-width: 1024px) { .ad-dbh { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .ad-dbh { grid-template-columns: minmax(0, 1fr); gap: 28px; } }

/* the strip's fade mask clips the fixed panel on narrow screens, so it lifts while the panel is open */
.ad-header .ad-nav .fl-module-content:has(li.ad-db.is-open) { -webkit-mask-image: none; mask-image: none; }
/* Lowest-ranked header topic: hidden on desktop only (ailerondaily-core.php nav filter). */
@media (min-width: 769px) { .ad-nav .menu > li.ad-nav-low { display: none; } }
/* Masthead readout: "N stories today" links to /stories/ (every story, newest first). */
.ad-readout a.ad-readout__count { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.ad-readout a.ad-readout__count:hover, .ad-readout a.ad-readout__count:focus-visible { color: var(--ds-color-ink); text-decoration-thickness: 2px; }
/* Masthead search: magnifier after the story count; opens a field to its left, submits to /?s= (Themer Search layout). */
.ad-readout { align-items: center; }
.ad-msearch { display: inline-flex; align-items: center; margin: -6px 0 -6px -12px; }
.ad-msearch .screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ad-readout .ad-msearch__q { width: 0; min-width: 0; padding: 0; border: 0; border-bottom: 1px solid transparent; background: transparent; font: inherit; color: var(--ds-color-ink); opacity: 0; transition: width 200ms ease, opacity 150ms ease; }
.ad-readout .ad-msearch.is-open .ad-msearch__q, .ad-readout .ad-msearch__q:not(:placeholder-shown) { width: 180px; padding: 4px 2px; border-bottom-color: var(--ds-color-ink); opacity: 1; }
.ad-msearch__q::-webkit-search-cancel-button { display: none; }
.ad-msearch__q:focus { outline: none; }
.ad-readout .ad-msearch__btn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ds-color-ink); cursor: pointer; }
.ad-readout .ad-msearch__btn:hover, .ad-readout .ad-msearch__btn:focus-visible { background: var(--ds-color-city); }
@media (prefers-reduced-motion: reduce) { .ad-msearch__q { transition: none; } }
@media (max-width: 600px) {
	.ad-header .ad-read-col:has(.ad-msearch) { display: block; }
	.ad-header .ad-read-col:has(.ad-msearch) .ad-readout__date, .ad-header .ad-read-col:has(.ad-msearch) .ad-readout__count { display: none; }
	.ad-readout__upd { display: none; }
	.ad-msearch { position: relative; }
	.ad-header .ad-readout form.ad-msearch.is-open input.ad-msearch__q, .ad-header .ad-readout form.ad-msearch input.ad-msearch__q:not(:placeholder-shown) { position: absolute; right: 46px; border-radius: 0; top: 50%; transform: translateY(-50%); z-index: 2; width: calc(100vw - 98px); background: var(--ds-color-paper); box-shadow: 0 0 0 10px var(--ds-color-paper); }
}
