/* Moodle's own pages in the new look (o1029-moodlepages): the account pages reached from the menus (profile, preferences,
   notification preferences, messages, agreements), fixed for phones without editing Moodle. Loaded by
   hook_callbacks::newui_head() after common.css, new look only. */

/* "You are logged in as <name> (Log out)": an inline link that wraps spans both lines, so its box crossed the name's on a
   phone (the name sat at the end of line 1, "Log" after it, "out)" on line 2). Each link is its own box; a long name wraps inside it. */
html[data-theme] #page-footer .logininfo a{display:inline-block;max-width:100%;overflow-wrap:anywhere}

/* Notification preferences scrolled sideways 39px on an iPhone: the Email column head holds core/hover_tooltip, whose tip
   ("Requires configuration") is absolute, nowrap and centred on the column; hidden (visibility:hidden) it still counts towards
   the page's width, and near the right edge it reached 432px of a 393px screen. While hidden it takes no room at all; it shows
   as Moodle draws it on hover or keyboard focus. Same cause anywhere Moodle uses core/hover_tooltip. */
html[data-theme] .hover-tooltip-container:not(:hover):not(:focus-within) .hover-tooltip{display:none}

/* /user/forum.php scrolled sideways 89px on an iPhone (WebKit): a select whose option text is longer than the box paints
   past its edge and counts towards the page width. Clip it to its own box; the open list still shows the full text. */
html[data-theme] select.form-select{overflow:hidden}

/* Touch: Moodle's small controls keep their look, and an invisible ::before makes each tap area at least 44 x 44, centred on it
   (owner 2026-10-29, as shell.css; under-13 crawl stack-test-4b21: Side panel 38, bell 36 wide, footer links 19-24 high, Back to top 19,
   38px buttons, block drawer 40, notification rows 39, file manager buttons 31). :where() keeps any position Moodle already gives. Form fields,
   switches and <input> buttons cannot carry a ::before: they stay as Moodle draws them. */
@media (pointer:coarse){
  :where(html[data-theme]) :where(a.btn, button.btn, .navbar-toggler, .popover-region-toggle, #page-footer a, th a,
    .content-item-container [tabindex], .fp-toolbar a, .fp-viewbar a, #page-admin-tool-policy-viewall .text-end > a, .float-end > a[href="#top"]){ position: relative; }
  html[data-theme] :is(a.btn, button.btn, .navbar-toggler, .popover-region.collapsed .popover-region-toggle, #page-footer a, th a,
    .content-item-container [tabindex], .fp-toolbar a, .fp-viewbar a, #page-admin-tool-policy-viewall .text-end > a, .float-end > a[href="#top"])::before{
    content: ""; display: block; position: absolute; left: 50%; top: 50%; right: auto; bottom: auto; border: 0; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%); }
  /* The file manager's toolbar clipped the areas (overflow:hidden only to hold its floats): flow-root holds them the same way. */
  html[data-theme] .filemanager-toolbar{ overflow: visible; display: flow-root; }
}

/* /message/output/popup/notifications.php: Moodle paints the list with fixed light colours (unread rows #f4f4f4, rules #ddd/#e3e3e3, an
   open item's time #666, hover #3867e8) while the text follows the theme, so in Dark an unread row was near-white text on #f4f4f4 (1.1:1). The theme's own colours
   instead: unread rows tinted with the accent, the rules and the hover from the tokens. */
html[data-theme] :is(.content-item-container, .notification-area .content-area .header){border-bottom-color:var(--ac-border-default)}
html[data-theme] .notification-area, html[data-theme] .notification-area .control-area{border-color:var(--ac-border-default)}
html[data-theme] .notification-area .content-area .header .timestamp{color:var(--ac-text-muted)}
html[data-theme] .content-item-container.unread{background-color:var(--ac-accent-subtle)}
html[data-theme] .content-item-container:hover,html[data-theme] .content-item-container.unread:hover{background-color:var(--ac-accent-solid);color:var(--ac-text-on-accent)}
html[data-theme] .content-item-container:hover .content-item-footer .timestamp{color:inherit}

/* ---- DEMO-1101 (others): Moodle's own pages (profile, preferences, policies, messages) in the demo look (switch demoui; html.ac-demo).
   Boost already takes its colours from the tokens (theme/acadence.scss, bridged by tokens.css), so this only gives Moodle's pieces the
   demo's shape: 700 page titles, soft-shadow cards, 44px buttons at weight 500, rounded fields. theme/acadence.scss is left alone, so the
   switch off (or the old look) is unchanged. */
html.ac-demo[data-theme] body:not(:has(.cm-top)) :is(#page-header h1, .page-header-headings h1, #region-main > h2:first-child){font-family:var(--ac-font-heading);font-weight:700;letter-spacing:-.03em}
html.ac-demo[data-theme] body:not(:has(.cm-top)) #region-main :is(.card, .block){border:1px solid var(--ac-border-default);border-radius:var(--ac-radius-panel);box-shadow:var(--ac-demo-shadow-card)}
html.ac-demo[data-theme] body:not(:has(.cm-top)) :is(.btn-primary, .btn-secondary, .btn-outline-secondary){min-height:44px;border-radius:var(--ac-radius-control);font-weight:500}
html.ac-demo[data-theme] body:not(:has(.cm-top)) .btn-primary{--bs-btn-bg:var(--ac-accent-solid);--bs-btn-border-color:var(--ac-accent-solid);--bs-btn-color:var(--ac-text-on-accent);
  --bs-btn-hover-bg:var(--ac-accent-hover);--bs-btn-hover-border-color:var(--ac-accent-hover);--bs-btn-hover-color:var(--ac-text-on-accent)}
html.ac-demo[data-theme] body:not(:has(.cm-top)) #region-main :is(.form-control, .form-select, .custom-select){min-height:44px;border-radius:var(--ac-radius-control)}
html.ac-demo[data-theme] body:not(:has(.cm-top)) #region-main :is(table.generaltable, table.flexible) th{font-size:12px;font-weight:500;letter-spacing:.02em;color:var(--ac-text-muted);background:var(--ac-bg-raised)}
/* ---- DEMO-1101 wave 2 (w2people): the rest of the demo look on Moodle's own pages (profile, preferences, notification and
   calendar pages; not the app's shell pages or the sign-in chain): DM Sans, ink links, the demo's top bar, 16px cards with
   600 headings. html.ac-demo only (switch demoui); tokens only. */
html.ac-demo[data-theme] body:not(:has(.cm-top)):not(:has(main.sh)){--bs-body-font-family:var(--ac-font-ui);font-family:var(--ac-font-ui)}
html.ac-demo[data-theme] body:not(:has(.cm-top)):not(:has(main.sh)) :is(h1,h2,h3,h4,h5,.h1,.h2,.h3,.h4,.h5){font-family:var(--ac-font-heading);font-weight:600;letter-spacing:-.01em}
html.ac-demo[data-theme] body:not(:has(.cm-top)):not(:has(main.sh)) #region-main a:not(.btn):not(.nav-link):not(.dropdown-item){color:var(--ac-text-default);text-decoration:underline;text-decoration-color:var(--ac-border-strong);text-underline-offset:3px}
html.ac-demo[data-theme] body:not(:has(.cm-top)):not(:has(main.sh)) #region-main a:not(.btn):not(.nav-link):not(.dropdown-item):hover{text-decoration-color:currentColor}
html.ac-demo[data-theme] body:not(:has(.cm-top)):not(:has(main.sh)) nav.navbar{background:var(--ac-bg-surface);border-bottom:1px solid var(--ac-border-default);box-shadow:none}
html.ac-demo[data-theme] body:not(:has(.cm-top)):not(:has(main.sh)) #region-main :is(.card,.block){border-radius:16px;background:var(--ac-bg-surface)}
html.ac-demo[data-theme] body:not(:has(.cm-top)):not(:has(main.sh)) #region-main .card-body{padding:22px 24px}
html.ac-demo[data-theme] body:not(:has(.cm-top)):not(:has(main.sh)) #region-main :is(.card-title,.card h3,.card .h3){font-size:17px;font-weight:600}
html.ac-demo[data-theme] body:not(:has(.cm-top)):not(:has(main.sh)) .btn-primary{--bs-btn-bg:var(--ac-demo-solid);--bs-btn-border-color:var(--ac-demo-solid);--bs-btn-color:var(--ac-demo-on-solid);
  --bs-btn-hover-bg:var(--ac-demo-solid-hover);--bs-btn-hover-border-color:var(--ac-demo-solid-hover);--bs-btn-hover-color:var(--ac-demo-on-solid);border-radius:9px}
