/* Site-wide chrome fixes (Drive-in banners, card scrollers, heroes, nav).
   Loaded last from layout.html so one nav style wins over page-specific sheets. */

/* ---------- Global frosted nav: every page, both themes, all widths ----------
   Light mode: light translucent frosted bar. Dark mode: dark translucent
   frosted bar. Always on, not gated on scroll or hero-mix. Tab colors
   follow the theme, so over-hero white type is not used (that is what
   left solid black bars on Optimus and News in light mode). */
.nav-fade {
  background: var(--frost);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
}

/* Disable the old scroll-linked gradient layers. The bar itself is the frost. */
.nav-frost {
  bottom: 0;
  background: transparent;
}
.nav-frost::before,
.nav-frost::after,
html.theme-light .nav-frost::before,
html.theme-light .nav-frost::after,
html.theme-light body:has(.stage, .a-hero) .nav-frost::before,
html.theme-light body:has(.stage, .a-hero) .nav-frost::after {
  display: none;
  opacity: 0;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.nav a:not([aria-current="page"]),
html.theme-light body:has(.stage, .a-hero) .nav a:not([aria-current="page"]),
.optimus-page .nav a:not([aria-current="page"]),
body.news-page .nav a:not([aria-current="page"]) {
  color: var(--tab);
}
.nav a[aria-current="page"],
html.theme-light body:has(.stage, .a-hero) .nav a[aria-current="page"] {
  background: var(--tab-on);
  color: var(--tab-on-text);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: var(--tab-shadow);
}
.theme-toggle,
html.theme-light body:has(.stage, .a-hero) .theme-toggle,
.optimus-page .theme-toggle,
body.news-page .theme-toggle {
  background: var(--pill);
  color: var(--tile-text);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.theme-toggle:hover,
html.theme-light body:has(.stage, .a-hero) .theme-toggle:hover,
.optimus-page .theme-toggle:hover,
.optimus-page .account:hover {
  background: var(--pill);
  color: var(--tab-on-text);
}

/* News index and article pages previously forced a clear or solid nav. */
body.news-page .nav-fade,
html.theme-light body.news-page .nav-fade,
body.article-page .nav-fade,
html.theme-light body.article-page .nav-fade,
html.theme-light body:has(.stage, .a-hero) .nav-fade {
  background: var(--frost);
}
body.article-page .nav-frost {
  bottom: 0;
  background: transparent;
}
body.article-page .nav-frost::before,
body.article-page .nav-frost::after {
  display: none;
}

/* Optimus used a separate sticky .chrome with a near-solid dark gradient.
   Use the same frosted nav-fade bar as every other page. */
.optimus-page .nav-frost { display: none; }
.optimus-page .chrome::before,
.optimus-page .chrome::after,
html.theme-light .optimus-page .chrome::before,
html.theme-light .optimus-page .chrome::after {
  display: none !important;
  opacity: 0 !important;
}
.optimus-page .nav-fade {
  background: var(--frost);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
}
@media (min-width: 701px) {
  .optimus-page .chrome {
    padding-bottom: 0;
    background: transparent;
  }
}
@media (max-width: 700px) {
  .optimus-page .nav-fade {
    position: sticky;
    top: 0;
    z-index: 30;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .nav-fade,
  .optimus-page .nav-fade,
  body.news-page .nav-fade,
  body.article-page .nav-fade,
  html.theme-light body:has(.stage, .a-hero) .nav-fade {
    background: var(--frost-solid);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* Do not paint a solid #0c0c0e strip behind the phone nav on is-wide heroes
   (News, Optimus, Drive-in). That was the light-mode black bar. */
@media (max-width: 700px) {
  html.theme-light .stage.is-wide:not(.is-home) .stage-scrim {
    background: linear-gradient(to bottom, rgba(8,8,10,.55) 0, rgba(8,8,10,0) 120px);
  }
  /* Let full-bleed photo heroes tuck under the frosted nav, like Home / Suppliers. */
  .stage.is-wide:not(.is-home) .stage-media {
    margin-top: 0;
  }

  /* Optimus is the exception. The official booth still is 16:9, with the
     visor near the top of the frame; tucking it under the 44px nav hides
     the head in both themes. Put the still back below the frosted bar
     (the original presence.css phone offset) and paint the chrome gap
     with the page background so light mode does not grow a black bar. */
  .optimus-page .a-hero.stage.is-wide,
  body[data-page="optimus"] .a-hero.stage.is-wide {
    background: var(--bg);
  }
  .optimus-page .stage.is-wide .stage-media,
  body[data-page="optimus"] .stage.is-wide .stage-media {
    margin-top: var(--chrome, 44px);
  }
  .optimus-page .stage.is-wide .stage-scrim,
  html.theme-light .optimus-page .stage.is-wide .stage-scrim,
  body[data-page="optimus"] .stage.is-wide .stage-scrim,
  html.theme-light body[data-page="optimus"] .stage.is-wide .stage-scrim {
    top: var(--chrome, 44px);
    background: linear-gradient(to bottom, rgba(8,8,10,.55) 0, rgba(8,8,10,0) 120px);
  }
}

/* Stronger top scrim on map and photo heroes so labels under the tabs recede.
   The frosted nav is the main treatment; this only darkens the media itself. */
.stage.is-map .stage-scrim,
.stage.is-wide:not(.is-home) .stage-scrim {
  background: linear-gradient(to bottom, rgba(8,8,10,.55) 0, rgba(8,8,10,0) 120px);
}
@media (max-width: 700px) {
  .stage.is-map .stage-scrim {
    background: linear-gradient(to bottom, rgba(8,8,10,.55) 0, rgba(8,8,10,0) 120px);
  }
}

/* Zoom controls stay below the sticky nav. */
.stage.is-map .leaflet-top.leaflet-right,
.stage.is-map .map-extent-toggle,
.stage.is-map .map-past-toggle {
  top: calc(var(--chrome, 52px) + 12px);
}

/* ---------- In-page hero anchors ---------- */
#later-h,
#week-h,
#up-h,
#s-h,
#past-h,
#now,
#new-h,
#last-h,
#featured-heading {
  scroll-margin-top: calc(var(--chrome, 52px) + 16px);
}

@media (prefers-reduced-motion: no-preference) {
  html:not(.lightbox-open):not(.sheet-open):not(.scroll-locked) {
    scroll-behavior: auto; /* JS handles the hero buttons; avoid surprising lightbox/hash jumps */
  }
}

/* ---------- Card scrollers: clip inside the lift card, both themes ----------
   Shared by: On screen tonight (.di-strip), New on the menu (.lift-row),
   Last to leave (.lift-row). overflow hidden on .lift respects the
   radius; the inset 1px outline stays outside the padding box once the
   negative bleed margin is removed. */
.lift {
  overflow: hidden;
}
@media (max-width: 700px) {
  .lift-row {
    margin-right: 0;
    padding-right: 12px;
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 16px), transparent);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 16px), transparent);
  }
  .di-strip {
    margin-right: 0;
    padding-right: 12px;
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 16px), transparent);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 16px), transparent);
  }
  .lift-row::-webkit-scrollbar,
  .di-strip::-webkit-scrollbar { display: none; }
}

/* ---------- Drive-in placeholder logo (Tesla diner-placeholder.svg) ---------- */
.mini-photo.tile-fallback--diner,
.di-week .di-thumb.tile-fallback--diner {
  background: var(--ph-bg);
}
.mini-photo.tile-fallback--diner::after,
.di-week .di-thumb.tile-fallback--diner::after {
  /* diner-placeholder.svg viewBox 800×578, but the ink sits in a
     padded box (ink ≈ 264×347). Sizing the mask to the tile height
     (contain) makes the visible logo ≈ 60% of the tile tall, with
     even padding from the SVG itself. 40% of --strong stays clearly
     visible but subdued. */
  background: color-mix(in srgb, var(--strong) 40%, transparent);
  -webkit-mask-size: auto 100%;
  mask-size: auto 100%;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
/* The mark is always dead centre (the SVG's ink box is centred in its own
   800x578 viewBox to within 0.2 units, so mask-position: center is exact).
   On phone, the On-screen-tonight peek tiles (146x74 at 390) are so short
   that a centred 60% mark runs under a time chip like "4:08pm", so those
   tiles alone get a smaller mark instead of an off-centre one. */
@media (max-width: 700px) {
  .di-strip .mini:not(:first-child) .mini-photo.tile-fallback--diner::after {
    -webkit-mask-size: auto 61%;
    mask-size: auto 61%;
  }
}

/* ---------- Light-mode solid bottom edge on full-bleed photo / map heroes ----------
   Dark mode keeps its existing soft bottom fade. Home already has its own
   C2 hard cut and is left alone. */
@media (max-width: 700px) {
  html.theme-light .stage.is-wide:not(.is-home) .stage-fade,
  html.theme-light .stage.is-wide:not(.is-home) .stage-media::after,
  html.theme-light .stage.is-map .stage-fade,
  html.theme-light .stage.is-map .stage-media::after,
  html.theme-light .stage.is-wall .stage-fade,
  html.theme-light .stage.is-wall .stage-media::after {
    display: none;
    background: none;
  }
  html.theme-light .stage.is-wide:not(.is-home) .stage-inner,
  html.theme-light .stage.is-wall .stage-inner {
    margin-top: 0;
    padding-top: 16px;
  }
}

/* Suppliers phone: tighten the blank gap under the map.
   Dark: keep the soft fade and sit the eyebrow in it (Drive-in-like spacing).
   Light: hard edge, then normal spacing to the header. */
@media (max-width: 700px) {
  .stage.is-map .stage-inner {
    margin-top: -148px;
    padding-top: 0;
    align-items: flex-end;
  }
  html.theme-light .stage.is-map .stage-inner {
    margin-top: 0;
    padding-top: 20px;
    padding-bottom: 20px;
    align-items: flex-start;
  }
}

/* Desktop light mode: end photo/map heroes on a clean cut, not a soft ramp
   into the light page. News no longer pulls "Latest" up onto the photo. */
@media (min-width: 701px) {
  html.theme-light .stage.is-wide:not(.is-home) .stage-fade,
  html.theme-light .stage.is-map .stage-fade,
  html.theme-light .stage.is-wall .stage-fade {
    display: none;
  }
  html.theme-light .stage.is-wide:not(.is-home) .stage-media,
  html.theme-light .stage.is-wide:not(.is-home) .stage-scrim,
  html.theme-light .stage.is-map .stage-media,
  html.theme-light .stage.is-map .stage-scrim,
  html.theme-light .stage.is-wall .stage-media,
  html.theme-light .stage.is-wall .stage-scrim {
    -webkit-clip-path: inset(0 0 0 0);
    clip-path: inset(0 0 0 0);
  }
  /* Drive-in: cut just above the lifted card, like Home C2. */
  html.theme-light body[data-page="drivein"] .stage.is-wide {
    --c2-cut: 156px;
  }
  html.theme-light body[data-page="drivein"] .stage.is-wide .stage-media,
  html.theme-light body[data-page="drivein"] .stage.is-wide .stage-scrim {
    -webkit-clip-path: inset(0 0 var(--c2-cut) 0);
    clip-path: inset(0 0 var(--c2-cut) 0);
  }
  /* Optimus: do not clip the still. The photo box is already 16:9 (or a
     taller mid-width cover that only crops the sides), and the calendar
     sits in a gap under it, so a bottom inset would cut off the hands. */
  html.theme-light .optimus-page .stage.is-wide .stage-media,
  html.theme-light .optimus-page .stage.is-wide .stage-scrim,
  html.theme-light body[data-page="optimus"] .stage.is-wide .stage-media,
  html.theme-light body[data-page="optimus"] .stage.is-wide .stage-scrim {
    -webkit-clip-path: none;
    clip-path: none;
  }
  html.theme-light body.news-page .featured,
  html.theme-light .news-page .featured {
    margin-top: 28px;
  }
  html.theme-light body.news-page .featured > h2,
  html.theme-light .news-page .featured > h2 {
    color: var(--strong);
    text-shadow: none;
  }
}

/* News phone: tighten the Photo: Tesla → Latest gap to normal section spacing. */
@media (max-width: 700px) {
  body.news-page .stage.is-wide .stage-inner,
  .news-page .stage.is-wide .stage-inner {
    padding-bottom: 8px;
  }
  html.theme-light body.news-page .stage.is-wide .stage-inner,
  html.theme-light .news-page .stage.is-wide .stage-inner {
    margin-top: 0;
    padding-top: 16px;
    padding-bottom: 8px;
  }
  body.news-page .featured,
  .news-page .featured {
    margin-top: 24px;
  }
}

/* Hero CTA pair: size each pill to its label, with comfortable
   padding (20px on phone; existing 22px on larger screens is left
   alone). If the pair cannot fit on one row at that padding, they
   wrap and each grows to full width (primary first). Same rule on
   every hero (Menu, Home, Optimus, Drive-in, Suppliers). Never
   shrink the font or ellipsize. Long names wrap inside the pill
   only after the button is already full width. */
.stage .btns,
.a-hero .btns {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}
.stage .btn,
.stage .btn.btn-solid,
.stage a.btn,
.stage .btn-out,
.stage a.btn-out,
.a-hero .btn,
.optimus-page .stage .btn,
.optimus-page .stage a.btn,
.optimus-page .a-hero .btn,
body[data-page="optimus"] .stage .btn,
body[data-page="optimus"] .stage a.btn {
  flex: 1 0 auto;
  width: auto;
  min-width: min(100%, max-content);
  max-width: 100%;
  box-sizing: border-box;
  height: auto;
  min-height: 44px;
  white-space: normal;
  text-align: center;
  font-size: 15px;
  overflow: visible;
  text-overflow: unset;
}
@media (max-width: 700px) {
  .stage .btns,
  .a-hero .btns {
    width: 100%;
  }
  .stage .btn,
  .stage .btn.btn-solid,
  .stage a.btn,
  .stage .btn-out,
  .stage a.btn-out,
  .a-hero .btn,
  .optimus-page .stage .btn,
  .optimus-page .stage a.btn,
  .optimus-page .a-hero .btn,
  body[data-page="optimus"] .stage .btn,
  body[data-page="optimus"] .stage a.btn {
    flex: 1 0 auto;
    min-width: min(100%, max-content);
    max-width: 100%;
    width: auto;
    padding: 0 20px;
    white-space: normal;
    font-size: 15px;
  }
}


/* ---------- Lift card headers: keep the right-side count on one line ----------
   Last to leave ("5 items"), On the menu now ("All 19 shown"), New on the
   menu (Hide merch), On screen tonight (Times in PT). The eyebrow may wrap;
   the count/meta must not shrink or split. On phone, drop the timezone
   abbreviation from Last to leave so the date can stay "Oct 26, 9:14am". */
.lift-head {
  flex-wrap: wrap;
  align-items: baseline;
}
.lift-title {
  min-width: 0;
  flex: 1 1 auto;
}
.lift-head > .lift-link,
.lift-head .page-tools,
.lift-head .page-tools .lift-link {
  white-space: nowrap;
  flex-shrink: 0;
}
@media (max-width: 700px) {
  .lift-tz { display: none; }
}

/* ---------- Tap targets: bigger hit area, nothing visible changes (audit F18, axe target-size) ----------
   Vertical padding on an inline link grows its pointer box to 24px tall, but
   padding on an inline box does not change the line box, so no text moves.
   None of these links has a background, border or box-shadow, so the padding
   never paints. On keyboard focus the padding is dropped, so the focus ring is
   the same size as before. Text is 11-14px here (14-17px boxes).
   Two credit lines stacked 3px apart (Optimus cards) split the space instead
   of overlapping: the upper link grows upward, the lower one downward. */
.fx.foot-cnonestep .fc-by a,
.home-page .a-follow a,
.item-page .back a,
.credit a {
  padding-block: 5px;
}
.credit:has(+ .credit) a { padding-top: 9px; padding-bottom: 1px; }
.credit + .credit a { padding-top: 1px; padding-bottom: 9px; }
.fx.foot-cnonestep .fc-by a:focus-visible,
.home-page .a-follow a:focus-visible,
.item-page .back a:focus-visible,
.credit a:focus-visible {
  padding-block: 0;
}
