/*
 * Shared portal theme (pkg/cmsportal/theme): design tokens, base reset and
 * the page shell (header, nav, footer, cookie-consent trigger). Bricks style
 * themselves in portal-cards.css/portal-news.css/portal-events.css/
 * portal-calendar.css/portal-detail.css/portal-account.css, all served
 * alongside this file under one asset hash (theme.go StylesheetURLs). A
 * portal's look comes only from its design tokens (--portal-*, store data:
 * stores.config_json portal.tokens); the defaults below are a neutral light
 * design. Bricks carry semantic markup; CSS styles them by class and
 * data-portal-variant.
 */
/* Inter (@font-face) and the root scrollbar gutter come from the shared
   frame (ui-frame.css = pkg/ui/appbar frame.css), loaded before this file. */

/* Design tokens (--portal-* defaults) live in portal-tokens.css, loaded
   right before this file (theme.go stylesheetNames). */

/* Base reset. border-style/border-width match the legacy Tailwind preflight
   (every element pre-declares a solid, zero-width border), so a component
   only needs to set border-*-width to draw a line; this keeps border-style
   from ever showing as a page-frame diff against prod. */
/* border-color defaults to the token too, matching the legacy Tailwind
   preflight ("*,::after,::before{border-color:var(--border, currentColor)}")
   so a component that only sets border-*-width never falls back to
   currentColor (fix round 2, W1 evidence: prod's border colour on a
   zero-width edge is always the border token, never inherited text colour). */
*, *::before, *::after { box-sizing: border-box; border-style: solid; border-width: 0; border-color: var(--portal-border); }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html:has(dialog:modal, [data-portal-gallery-lightbox]:not([hidden])),
body:has(dialog:modal, [data-portal-gallery-lightbox]:not([hidden])) { overflow: hidden; }
dialog:modal, [data-portal-gallery-lightbox]:not([hidden]) { overscroll-behavior: contain; }
/* Unstyled controls take the theme, not the browser's grey and black
   (zero specificity: every brick's own control rule wins). */
:where(button, input, select, textarea) { color: inherit; font: inherit; }
:where(button) { background-color: transparent; }
:where(input, select, textarea) { background-color: var(--portal-surface); border-color: var(--portal-border); }

body {
  margin: 0; background: var(--portal-bg); color: var(--portal-text);
  font-family: var(--portal-font); font-size: 1rem; line-height: 1.5;
  -webkit-font-smoothing: antialiased; overflow-x: clip; /* clip: never a scroll container of its own */
}
/* Scrollbars: prod's global ::-webkit-scrollbar rules (index.css, fix round 4)
 * with the token mapping --bg-level-0 -> --portal-bg, --bg-level-3 ->
 * --portal-surface-alt, --text-low -> --portal-subtle, radius var(--phi) =
 * 1.618px; scrollbar-color is the same look for engines without the
 * ::-webkit- pseudo-elements. */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--portal-bg); }
::-webkit-scrollbar-thumb { background: var(--portal-surface-alt); border-radius: 1.618px; border: 2px solid var(--portal-bg); }
::-webkit-scrollbar-thumb:hover { background: var(--portal-subtle); }
* { scrollbar-color: var(--portal-surface-alt) var(--portal-bg); }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--portal-accent); }
:focus-visible { outline: 2px solid var(--portal-accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--portal-font-heading); line-height: 1.15; }
/* Block margins: prod ships the Tailwind preflight, which zeroes the user-agent
   margin of every heading, paragraph, quote and figure, so each ported rule
   states its own spacing. Resetting only h1-h3 left the UA margin on every
   h4/h5/h6 and <p> the port does not name: the inline promo measured 291px
   against prod's 217px (h4 1.33em twice plus the body <p>'s 1em = 74.3px),
   article paragraphs carried 16px prod has not, and the legal card ran 48px
   long (style-diff zo-p2-inlinepromo/zo-p3-body/zo-p4-privacy-card, 2026-09-20). */
h1, h2, h3, h4, h5, h6, p, blockquote, figure, figcaption, dl, dd, pre { margin: 0; }

.portal-skip-link { position: absolute; left: -999px; top: 0; z-index: 60; padding: .5rem 1rem; background: var(--portal-accent); color: var(--portal-accent-ink); }
.portal-skip-link:focus { left: 1rem; top: 1rem; }

/* Header: fixed (not sticky) and blurred, matching prod exactly; border-color
   and box-shadow are set on every side like the legacy "border-border"
   utility even though only the bottom edge carries width. */
.portal-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  /* Use the token as-is: prod renders header_bg literally (hs #0d0e10, zo
     #fbfaf9), it never darkens it (fix round 2, W1 evidence). */
  background: var(--portal-header-bg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-color: var(--portal-border); border-bottom-width: 1px;
  box-shadow: 0 12px 30px rgba(12, 16, 24, .08);
}
.portal-header-inner {
  max-width: var(--portal-max-width); margin: 0 auto; padding: 0 var(--portal-gutter); min-height: 4rem;
  display: flex; align-items: center; justify-content: space-between; gap: clamp(1rem, 3vw, 2.5rem);
}
.portal-header-brand-group { display: flex; align-items: center; gap: clamp(1rem, 3vw, 2rem); flex-shrink: 0; }

/* Desktop nav (hidden below lg; the always-visible bottom tab row below is
   .portal-nav-mobile, a separate element like prod's, not a reflow of this
   one). An external link (no href match, opens elsewhere) carries no
   padding/underline on prod; an internal link always reserves the 2px
   underline track, coloured only when active. */
.portal-nav { display: none; align-items: center; gap: 1.5rem; font-size: .875rem; font-weight: 700; }
/* line-height: an absolute 1.25rem (20px), not the 1.4286 em-ratio prod's
   own utility resolves to (14px * 1.4286 = 20.0004px, a sub-pixel rounding
   diff against prod's exact 20px; fix round 2, W1 evidence). */
.portal-nav-link { color: var(--portal-nav-link); line-height: 1.25rem; border-color: var(--portal-border); border-bottom-width: 2px; padding: .25rem 0; transition: color .15s; }
.portal-nav-link[data-portal-nav-external] { padding: 0; border-bottom-width: 0; }
/* Only :hover brightens to full text colour; the active (aria-current) link
   keeps the idle nav-link colour like prod (the active item still carries
   the base nav-link class the light host dims — only its underline differs,
   via border-bottom-color below). */
.portal-nav-link:hover { color: var(--portal-text); }
/* border-color shorthand (all four sides), matching prod's active link, which
   sets border-color on every side even though only bottom carries width. */
.portal-nav-link[aria-current="page"] { border-color: var(--portal-accent); }

/* Mobile nav: an always-visible bottom tab row below the header bar, not a
   hamburger/drawer (prod has neither a toggle button nor an open/close
   state for it — it is simply hidden at >=lg via the responsive rule below,
   which must stay after this base rule to win the cascade). */
.portal-nav-mobile { display: flex; align-items: center; justify-content: space-around; border-color: var(--portal-border); border-top-width: 1px; padding: .5rem 0; font-size: .6875rem; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; }
.portal-nav-mobile-link { color: var(--portal-nav-link); transition: color .15s; }
.portal-nav-mobile-link:hover, .portal-nav-mobile-link[aria-current="page"] { color: var(--portal-accent); }

/* Page frame (every layout, not one brick's concern) */
main[data-portal-layout] { max-width: var(--portal-max-width); margin: 0 auto; padding: 6rem var(--portal-gutter) 4rem; }
/* Prod's archive wraps its grid as div.px-6 > div.max-w-7xl: the 80rem cap is
   the CONTENT box and the gutter sits outside it (1280px content vs the home
   page's 1232px), so the archive card measures 296px, not 290px. */
main[data-portal-layout="portal_event_archive"] { max-width: none; }
main[data-portal-layout="portal_event_archive"] > * { max-width: var(--portal-max-width); margin-inline: auto; }
main [data-portal-node="page_shell"], main [data-portal-node="stack"] { display: flex; flex-direction: column; gap: clamp(1.5rem, 3vw, 2.5rem); min-width: 0; }
/* Mobile-first: base is one column (matches prod at every viewport below its
   own breakpoint); each variant only ever ADDS its multi-column mode at
   min-width, so there is no higher-specificity rule left to out-rank a later
   "collapse" override (fix round 1 evidence: the 2.7:1 weighted variant kept
   its two columns below 64rem because a same-specificity collapse rule at
   max-width:1023px could never beat this selector's own extra attribute
   selector — main column measured 238px instead of prod's full-width 342px). */
[data-portal-variant="portal_columns"] { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4rem; align-items: start; }
[data-portal-variant="portal_columns"][data-portal-weights="2.7,1"] { gap: 2rem; }
[data-portal-variant="portal_aside"] { display: flex; flex-direction: column; gap: 1.5rem; }
@media (width>=64rem) {
  [data-portal-variant="portal_columns"] { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  [data-portal-variant="portal_aside"] { position: sticky; top: 5.5rem; }
}
/* The event detail page is prod's twelve-column grid ("grid grid-cols-1
   lg:grid-cols-12 gap-16", main "lg:col-span-8", aside "lg:col-span-4"):
   twelve real tracks, because the eleven 4rem gaps inside them are what make
   the columns measure 800px and 368px in the 1232px page - an 8fr:4fr split
   of the same row would give 779px and 389px. compose.go emits the 8,4
   weights for PortalPublicRouteKindEventDetail only. */
@media (width>=64rem) {
  [data-portal-variant="portal_columns"][data-portal-weights="8,4"] { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  [data-portal-variant="portal_columns"][data-portal-weights="8,4"] > :first-child { grid-column: span 8; }
  [data-portal-variant="portal_columns"][data-portal-weights="8,4"] > :last-child { grid-column: span 4; }
}
/* Same page, its side rail: prod spaces the event detail boxes "space-y-12"
   (3rem) and leaves the column in flow, while every other page keeps the
   1.5rem sticky rail above. The page kind is already on the root stack
   (compose.go RootVariant "portal_" + page kind), so no new attribute and no
   tenant name is needed to tell the two apart. */
[data-portal-variant="portal_event_detail"] [data-portal-variant="portal_aside"] { gap: 3rem; }
@media (width>=64rem) {
  [data-portal-variant="portal_event_detail"] [data-portal-variant="portal_aside"] { position: static; top: auto; }
}
/* The 2.7:1 home/article split (news-layout-home-grid/news-layout-article-grid)
   switches at prod's own 990px breakpoint, narrower than the generic 64rem
   split above. */
@media (width>=61.875rem) {
  [data-portal-variant="portal_columns"][data-portal-weights="2.7,1"] { grid-template-columns: minmax(0, 2.7fr) minmax(0, 1fr); }
}
/* The same split's two columns are prod's own boxes: both stacks space their
   blocks "space-y-8" (2rem, not the generic stack clamp's 2.5rem), and the rail
   column carries "border-l border-white/10 pl-6" at every width - the hairline
   plus 1.5rem that make the rail's content 299px inside the 324px track
   (style-diff zo-p2-railbanner: 324x123 against prod's 299x115, 2026-09-20).
   The hairline is a token: the light host repaints exactly this column
   (`.news-theme-light .news-rail-column{border-color:var(--border)}`). */
[data-portal-variant="portal_columns"][data-portal-weights="2.7,1"] > [data-portal-variant="portal_main"],
[data-portal-variant="portal_columns"][data-portal-weights="2.7,1"] > [data-portal-variant="portal_aside"] { gap: 2rem; }
[data-portal-variant="portal_columns"][data-portal-weights="2.7,1"] > [data-portal-variant="portal_aside"] {
  border-color: var(--portal-border); border-left-width: 1px; padding-left: 1.5rem;
}

/* Header/inline search (brick markup, styled here because the header uses
   it directly; portal-cards.css also applies to any other .portal-search) */
.portal-search { display: flex; gap: .5rem; align-items: stretch; max-width: 36rem; }
/* The label stays a non-flex (block) box so the input inside it is never a
   flex item itself: a flex item's "inline-block" display computes as
   blockified "block" (CSS Display §2.7), which was making the input's
   display compute as "block" instead of prod's "inline-block". */
.portal-search-label { position: relative; display: block; flex: 1; }
.portal-search-label-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.portal-search-input {
  width: 100%; font: inherit; font-size: .875rem; line-height: calc(1.25 / .875); min-height: 0; color: var(--portal-text); background: var(--portal-surface);
  border-color: var(--portal-border); border-width: 1px; border-radius: var(--portal-radius); padding: .375rem 1rem;
  transition: color .15s, background-color .15s, border-color .15s, box-shadow .15s;
}
.portal-search-input::placeholder { color: var(--portal-subtle); }
.portal-search-input:focus { outline: none; border-color: var(--portal-accent); box-shadow: 0 0 0 1px var(--portal-accent); }
.portal-search-submit {
  font: inherit; font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; cursor: pointer;
  border-width: 0; border-radius: calc(var(--portal-radius) - 2px); padding: 0 1.1rem; background: var(--portal-accent); color: var(--portal-accent-ink);
}
/* Header search (Site.HeaderSearch): the same brick markup, grown to fill
   the header between the brand/nav group and the header's end, with a
   leading icon the plain body search form does not carry. */
.portal-header-search { flex: 1; max-width: 28rem; margin: 0; }
.portal-header-search .portal-search-input { padding-left: 2.25rem; } /* only the header search draws an icon */
.portal-header-search-icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--portal-subtle); display: flex; }
/* Header actions + account icon link: legacy header.templ "flex items-center
   gap-2 md:gap-4" and "p-2 hover:bg-white/5 rounded-xl transition-all
   text-text-low hover:text-highlight" with a "w-5 h-5 md:w-6 md:h-6" user
   icon, resolved from prod CSS. text-text-low is a no-op on prod (unknown
   class), so the idle colour inherits; the 5% white hover wash is the one
   literal prod renders on both the dark and the light host. */
.portal-header-actions { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.portal-header-account { display: inline-flex; padding: .5rem; border-radius: calc(var(--portal-radius) + 4px); color: inherit; transition: all .15s cubic-bezier(.4, 0, .2, 1); }
.portal-header-account svg { width: 1.25rem; height: 1.25rem; }
@media (hover:hover) {
  .portal-header-account:hover { background-color: rgba(255, 255, 255, .05); color: var(--portal-accent); }
}
@media (width>=48rem) {
  .portal-header-actions { gap: 1rem; }
  .portal-header-account svg { width: 1.5rem; height: 1.5rem; }
}

/* Footer and its cookie-settings trigger live in portal-footer.css (shared
   with product shells outside the portal: theme.FooterHTML); the consent
   dialog the trigger opens lives in portal-consent.css. */

/* Responsive */
@media (min-width: 1024px) {
  .portal-nav { display: flex; }
  .portal-nav-mobile { display: none; }
}
@media (max-width: 767px) {
  .portal-search { max-width: none; }
  /* Must come after ".portal-search { max-width: none }" above (equal
     specificity, later source wins) so the header search keeps its own,
     narrower mobile width instead of growing to fill the header row. */
  .portal-header-search { max-width: 11.5rem; }
  .portal-search-input { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
