/* Page layout. The studio sets its own background and text colours with a selector
   that outranks site-common.css's html[data-theme="dark"] body rule, so the studio
   stays light and readable when the site header's theme toggle switches to dark. */
:root body.aiop-page,
:root[data-theme] body.aiop-page {
  margin: 0;
  background: var(--aiop-bg);
  color: var(--aiop-text);
  font-family: var(--aiop-font-sans);
  font-size: var(--aiop-size-body);
  line-height: 1.6;
}

.aiop-page *,
.aiop-page *::before,
.aiop-page *::after { box-sizing: border-box; }

/* Pinned bars. The site header (site-common.css) is pinned at the top; on studio pages the
   studio bar is pinned just below it. app/components/sticky-offsets.js measures both and
   updates these values; the defaults are today's site header height with no studio bar.
   scroll-padding-top keeps anything scrolled to or tabbed to below the pinned bars. */
:root {
  --aiop-site-header-h: 77px;
  --aiop-bar-h: 0px;
  --aiop-sticky-offset: calc(var(--aiop-site-header-h) + var(--aiop-bar-h) + var(--aiop-space-3));
}
html:has(body.aiop-page) { scroll-padding-top: var(--aiop-sticky-offset); }

/* The element rules below skip the shared site header and contact dialog that
   site-common.js adds (.site-shell, .contact-dialog), so those keep the main site's own
   colours and spacing. :where() keeps the specificity the same as before. */
.aiop-page h1:where(:not(.site-shell *, .contact-dialog *)),
.aiop-page h2:where(:not(.site-shell *, .contact-dialog *)),
.aiop-page h3:where(:not(.site-shell *, .contact-dialog *)) {
  font-family: var(--aiop-font-serif);
  color: var(--aiop-text);
  line-height: 1.25;
  font-weight: 600;
  scroll-margin-top: var(--aiop-sticky-offset);
}
.aiop-page h1:where(:not(.site-shell *, .contact-dialog *)) { font-size: var(--aiop-size-h1); margin: var(--aiop-space-3) 0 var(--aiop-space-4); }
.aiop-page h2:where(:not(.site-shell *, .contact-dialog *)) { font-size: var(--aiop-size-h2); margin: var(--aiop-space-6) 0 var(--aiop-space-3); }
.aiop-page h3:where(:not(.site-shell *, .contact-dialog *)) { font-size: var(--aiop-size-h3); margin: 0 0 var(--aiop-space-2); }
/* The page heading takes focus after each route change so screen readers announce the new
   page. It is not a control, so it shows no focus ring. */
.aiop-page h1:focus, .aiop-page h1:focus-visible { outline: none; }

.aiop-page p:where(:not(.site-shell *, .contact-dialog *)) { margin: 0 0 var(--aiop-space-4); }
.aiop-page a:where(:not(.site-shell *, .contact-dialog *)) { color: var(--aiop-link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.aiop-page a:where(:not(.site-shell *, .contact-dialog *)):hover { color: var(--aiop-navy); }

/* Focus is always visible on studio controls. */
.aiop-page a:focus-visible,
.aiop-page button:focus-visible,
.aiop-page input:focus-visible,
.aiop-page select:focus-visible,
.aiop-page textarea:focus-visible,
.aiop-page summary:focus-visible {
  outline: 3px solid var(--aiop-focus);
  outline-offset: 2px;
}
/* The site header, its dropdown panels and the contact dialog inherit body text; give them
   the main site's font, size and line height so they match mikehadaway.info exactly. */
.aiop-page .site-shell,
.aiop-page .contact-dialog { font-family: Karla, Arial, sans-serif; font-size: 1rem; line-height: 1.62; }
/* On the dark site header and contact dialog, use the site's own accent so focus shows. */
.aiop-page .site-shell :focus-visible,
.aiop-page .contact-dialog :focus-visible { outline-color: var(--nav-accent, var(--aiop-focus-on-dark)); }

.aiop-skip {
  position: absolute;
  left: -9999px;
  top: var(--aiop-space-2);
  z-index: 1200;
  background: var(--aiop-navy);
  color: var(--aiop-ivory);
  padding: var(--aiop-space-2) var(--aiop-space-4);
  border-radius: var(--aiop-radius);
}
.aiop-skip:focus { left: var(--aiop-space-2); }
.aiop-page .aiop-skip:focus-visible { outline: 3px solid var(--aiop-bronze); outline-offset: 2px; color: var(--aiop-ivory); }

/* Studio bar: sits after the site header. Not a <header>, so site-common.js
   always finds the site header first. Pinned just below the site header, and stacked
   below it (the site header is 1000) so the site's dropdowns and phone menu cover it. */
.aiop-bar {
  position: sticky;
  top: var(--aiop-site-header-h);
  z-index: 900;
  background: var(--aiop-navy);
  color: var(--aiop-ivory);
}
.aiop-bar-inner {
  max-width: var(--aiop-page-max);
  margin: 0 auto;
  padding: var(--aiop-space-3) var(--aiop-space-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--aiop-space-2) var(--aiop-space-5);
}
.aiop-page .aiop-brand {
  color: var(--aiop-ivory);
  text-decoration: none;
  font-family: var(--aiop-font-serif);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
}
.aiop-brand-sub { display: block; font-family: var(--aiop-font-sans); font-size: var(--aiop-size-min); font-weight: 400; }
.aiop-page .aiop-bar a:focus-visible { outline-color: var(--aiop-focus-on-dark); }

.aiop-primary-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--aiop-space-1) var(--aiop-space-4); }
.aiop-page .aiop-primary-nav a {
  display: inline-block;
  color: var(--aiop-ivory);
  text-decoration: none;
  padding: var(--aiop-space-1) 0;
  border-bottom: 3px solid transparent;
}
.aiop-page .aiop-primary-nav a:hover { border-bottom-color: var(--aiop-ivory); color: var(--aiop-ivory); }
.aiop-page .aiop-primary-nav a[aria-current="page"] { border-bottom-color: var(--aiop-bronze); font-weight: 700; }

/* Compact studio bar on narrow screens: one row, so the pinned bars take little height. */
@media (max-width: 767.98px) {
  .aiop-bar-inner {
    flex-wrap: nowrap;
    padding: var(--aiop-space-2) var(--aiop-space-4);
    gap: var(--aiop-space-3);
  }
  .aiop-brand-sub { display: none; }
  .aiop-page .aiop-brand { flex: none; white-space: nowrap; }
  /* If the links ever do not fit, they scroll sideways inside the bar, never the page.
     The padding leaves room for the focus outline inside the scrolling area. */
  .aiop-primary-nav { flex: 1 1 auto; min-width: 0; overflow-x: auto; padding: var(--aiop-space-1) var(--aiop-space-1); }
  .aiop-primary-nav ul { flex-wrap: nowrap; gap: var(--aiop-space-1) var(--aiop-space-3); }
  .aiop-page .aiop-primary-nav a { white-space: nowrap; }
  .aiop-bar .aiop-mentor-toggle { flex: none; }
}
/* On phones the studio title is hidden: "Learn" goes to the same page. */
@media (max-width: 599.98px) {
  .aiop-page .aiop-brand { display: none; }
  .aiop-bar .aiop-mentor-toggle { padding: var(--aiop-space-1) var(--aiop-space-2); }
  /* "Mentor" alone on phones, so the four links keep full-size text. */
  .aiop-mentor-rest { display: none; }
  .aiop-bar-inner { padding-left: var(--aiop-space-3); padding-right: var(--aiop-space-3); gap: var(--aiop-space-2); }
  .aiop-primary-nav ul { gap: 0 var(--aiop-space-3); }
  .aiop-bar .aiop-mentor-toggle[aria-pressed="true"] { font-size: var(--aiop-size-min); padding: var(--aiop-space-1) var(--aiop-space-2); }
}
/* Touch-sized targets on small screens: 44px tall, 16px text, still one row. */
@media (max-width: 767.98px) {
  .aiop-bar-inner { padding-top: 2px; padding-bottom: 2px; }
  .aiop-page .aiop-primary-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0; font-size: 1rem; }
  .aiop-bar .aiop-mentor-toggle { min-height: 44px; }
}

.aiop-notices { max-width: var(--aiop-page-max); margin: 0 auto; padding: 0 var(--aiop-space-4); }

.aiop-main {
  display: block;
  max-width: var(--aiop-page-max);
  margin: 0 auto;
  padding: var(--aiop-space-4) var(--aiop-space-4) var(--aiop-space-7);
}
.aiop-main:focus { outline: none; }
.aiop-main { scroll-margin-top: var(--aiop-sticky-offset); }
.aiop-reading { max-width: var(--aiop-measure); }
/* Body text never runs wider than a comfortable line, wherever it sits. */
.aiop-main p, .aiop-main li, .aiop-main dd, .aiop-main dt, .aiop-main blockquote { max-width: var(--aiop-measure); }

.aiop-footer {
  border-top: 1px solid var(--aiop-rule);
  color: var(--aiop-text-muted);
  font-size: var(--aiop-size-small);
}
.aiop-footer-inner { max-width: var(--aiop-page-max); margin: 0 auto; padding: var(--aiop-space-5) var(--aiop-space-4); }
.aiop-footer p { margin: 0 0 var(--aiop-space-2); }

/* Live session: stage rail beside the stage on wide screens, above it on narrow ones. */
.aiop-stage-layout { display: grid; gap: var(--aiop-space-5); }
@media (min-width: 900px) {
  .aiop-stage-layout { grid-template-columns: 15rem minmax(0, 1fr); align-items: start; }
}

.aiop-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .aiop-page *, .aiop-page *::before, .aiop-page *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
