/* Automated driving page (automated-driving-2.html). Builds on css/software.css.
   The 3D scene is a sticky full-screen stage; the text panels scroll over it. */

.ad { overflow: visible; --ad-amber: #ffb648; }       /* sticky needs a visible overflow ancestor */
.ad-story { position: relative; background: var(--sw-bg); }

.ad-stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
  background: radial-gradient(900px 500px at 60% 55%, rgba(47, 123, 255, .25), transparent 70%), var(--sw-bg); }
.ad-stage canvas { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity 1s; }
.ad-stage.ready canvas { opacity: 1; }
.ad-stage.no-webgl canvas { display: none; }
.ad-shade { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(2, 3, 15, .55), transparent 22%, transparent 70%, rgba(2, 3, 15, .9)); }

/* telemetry strip */
.ad-hud { position: absolute; right: 28px; top: 24px; display: flex; gap: 10px; font-family: var(--f-head); }
.ad-hud div { min-width: 104px; padding: 10px 14px; border: 1px solid var(--sw-line); border-radius: 8px; background: rgba(4, 8, 24, .7); backdrop-filter: blur(6px); }
.ad-hud span { display: block; font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: #7f93ad; }
.ad-hud b { display: block; margin-top: 4px; font-size: 17px; font-variant-numeric: tabular-nums; }
.ad-hud i { font-style: normal; }
.ad-on { color: var(--sw-pass); }
.ad-note { position: absolute; right: 28px; bottom: 18px; font-size: 12px; letter-spacing: .06em; color: #62758f; }

/* labels pinned to the hardware in the scene */
.ad-callout { position: absolute; left: 0; top: 0; opacity: 0; transition: opacity .4s; pointer-events: none; will-change: transform; }
.ad-callout.on { opacity: 1; }
.ad-callout i { position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 5px rgba(111, 191, 228, .35), 0 0 22px 6px rgba(111, 191, 228, .8); animation: ad-ping 2s ease-out infinite; }
.ad-callout p { position: absolute; left: 34px; bottom: 26px; padding: 10px 16px; white-space: nowrap; border: 1px solid rgba(111, 191, 228, .55); border-radius: 8px; background: rgba(4, 8, 24, .88); backdrop-filter: blur(6px); }
.ad-callout p::before { content: ""; position: absolute; left: -32px; bottom: -22px; width: 38px; height: 1px; background: var(--sw-cyan); transform: rotate(-38deg); transform-origin: right center; }
/* the trunk label hangs below its point so the two labels never collide */
.ad-callout[data-callout="x2000"] p { bottom: auto; top: 26px; }
.ad-callout[data-callout="x2000"] p::before { bottom: auto; top: -22px; transform: rotate(38deg); }
.ad-callout b { display: block; font: 700 15px var(--f-head); }
.ad-callout span { display: block; margin-top: 3px; font-size: 13px; color: var(--sw-text); }
@keyframes ad-ping { 0% { box-shadow: 0 0 0 0 rgba(111, 191, 228, .7), 0 0 22px 6px rgba(111, 191, 228, .8); } 100% { box-shadow: 0 0 0 16px rgba(111, 191, 228, 0), 0 0 22px 6px rgba(111, 191, 228, .8); } }

/* text panels that scroll over the stage */
.ad-panels { position: relative; margin-top: -100vh; margin-top: -100svh; pointer-events: none; }
.ad-panel { display: flex; align-items: center; min-height: 100vh; min-height: 100svh; padding: 96px max(24px, calc((100% - 1240px) / 2)); }
.ad-panel + .ad-panel { min-height: 120vh; }
.ad-right { justify-content: flex-end; }
.ad-panel-pov { align-items: flex-end; padding-bottom: 14vh; }
.ad-card { pointer-events: auto; width: min(440px, 100%); padding: 30px 32px 32px; border: 1px solid var(--sw-line); border-radius: 16px; background: rgba(4, 8, 24, .72); backdrop-filter: blur(10px); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.ad-card h2 { font-size: clamp(24px, 2.3vw, 32px); line-height: 1.18; }
.ad-card > p:not(.ad-step):not(.sw-eyebrow):not(.sw-sub):not(.ad-scroll) { margin-top: 14px; font-size: 16.5px; line-height: 1.65; color: var(--sw-text); }
.ad-step { margin-bottom: 12px; font: 700 14px var(--f-head); letter-spacing: .2em; color: var(--sw-cyan); }
.ad-card ul { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; padding: 0; list-style: none; }
.ad-card li { padding: 7px 14px; border: 1px solid var(--sw-line); border-radius: 30px; font-size: 13.5px; color: #e6eef6; }
.ad-card li.ad-cyan { border-color: var(--sw-cyan); color: var(--sw-cyan); }
.ad-card li.ad-amber { border-color: var(--ad-amber); color: var(--ad-amber); }
.ad-card li.ad-green { border-color: var(--sw-pass); color: var(--sw-pass); }

.ad-card-hero { width: min(600px, 100%); padding: 0; border: 0; background: none; backdrop-filter: none; box-shadow: none; }
.ad-card-hero h1 { margin-top: 22px; font-size: clamp(38px, 4.4vw, 64px); line-height: 1.08; letter-spacing: -.02em; text-shadow: 0 4px 40px rgba(2, 3, 15, .9); }
.ad-card-hero h1 span { display: block; background: linear-gradient(90deg, #8fd4f5, #2f7bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ad-card-hero .sw-sub { text-shadow: 0 2px 20px rgba(2, 3, 15, 1); }
.ad-card-hero .sw-cta { margin-top: 34px; }
.ad-scroll { margin-top: 44px; font: 700 13px var(--f-head); letter-spacing: .14em; text-transform: uppercase; color: #8ea4bf; }
.ad-scroll span { display: inline-block; margin-left: 6px; animation: ad-bob 1.6s ease-in-out infinite; }
@keyframes ad-bob { 50% { transform: translateY(5px); } }

/* reference software */
.ad-modules { background: var(--sw-bg); }
.ad-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 52px; }
.ad-col { padding: 34px 34px 30px; border: 1px solid var(--sw-line); border-radius: 14px; background: linear-gradient(160deg, rgba(47, 123, 255, .1), rgba(5, 10, 28, .5) 55%); }
.ad-col h3 { display: flex; align-items: center; gap: 12px; font-size: 21px; }
.ad-dot { width: 10px; height: 10px; border-radius: 50%; background: #5d7190; }
.ad-dot-on { background: var(--sw-pass); box-shadow: 0 0 0 5px rgba(61, 242, 122, .2); }
.ad-col ul { margin-top: 20px; padding: 0; list-style: none; }
.ad-col li { padding: 13px 0; border-top: 1px solid var(--sw-line); font-size: 16px; color: #e6eef6; }
.ad-more { margin-top: 30px !important; margin-bottom: 0 !important; }

@media (max-width: 900px) {
  .ad-hud { left: 12px; right: 12px; top: 12px; gap: 6px; }
  .ad-hud div { flex: 1; min-width: 0; padding: 8px 10px; }
  .ad-hud span { font-size: 8.5px; letter-spacing: .08em; }
  .ad-hud b { font-size: 14px; }
  .ad-panel { align-items: flex-end; padding: 96px 16px 9vh; }
  .ad-panel-hero { align-items: center; padding-top: 120px; }
  .ad-right { justify-content: flex-start; }
  .ad-card { padding: 22px 22px 24px; }
  .ad-callout p { left: 22px; bottom: 20px; padding: 7px 11px; }
  .ad-callout b { font-size: 13px; } .ad-callout span { font-size: 11.5px; }
  .ad-cols { grid-template-columns: 1fr; }
  .ad-note { right: 12px; bottom: 8px; font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .ad-callout i, .ad-scroll span { animation: none; }
}

/* ---------- Game mode ("Explore visualization") ---------- */
html.ad-game-on { overflow: hidden; }
.ad-story.game .ad-panels, .ad-story.game .ad-hud, .ad-story.game .ad-callout, .ad-story.game .ad-note { display: none; }
.ad-game { position: absolute; inset: 0; pointer-events: none; font-family: var(--f-head, inherit); color: #fff; }
.ad-game[hidden] { display: none; }
.ad-game button { pointer-events: auto; cursor: pointer; font: inherit; }
.ad-game-bar { position: absolute; left: 50%; top: 20px; transform: translateX(-50%); display: flex; align-items: stretch; gap: 10px; max-width: calc(100% - 24px); }
.ad-game-bar > div { min-width: 104px; padding: 9px 14px; border: 1px solid rgba(140, 170, 220, .35); border-radius: 10px; background: rgba(4, 8, 24, .78); backdrop-filter: blur(6px); transition: border-color .3s, box-shadow .3s; }
.ad-game-bar > div.flash { border-color: #3df27a; box-shadow: 0 0 0 4px rgba(61, 242, 122, .28); }
.ad-game-bar span { display: block; font-size: 10.5px; letter-spacing: 1.4px; text-transform: uppercase; color: #9fb4d6; }
.ad-game-bar b { display: block; margin-top: 3px; font-size: 20px; line-height: 1.1; }
.ad-game-bar em { font-style: normal; color: #3df27a; }
.ad-game-next { min-width: 150px; }
.ad-game-next i { display: block; height: 8px; margin-top: 9px; border-radius: 4px; background: rgba(255, 255, 255, .16); overflow: hidden; }
.ad-game-next u { display: block; height: 100%; width: 0; background: #3df27a; }
.ad-game-bar button { padding: 0 18px; border: 1px solid rgba(140, 170, 220, .45); border-radius: 10px; background: rgba(4, 8, 24, .78); color: #fff; font-weight: 700; font-size: 14px; letter-spacing: .4px; }
.ad-game-bar button[data-g="mode"] { min-width: 96px; }
.ad-game-bar button[data-g="mode"][aria-pressed="true"] { background: #1c63d8; border-color: #1c63d8; }
.ad-game-bar button[data-g="mode"][aria-pressed="false"] { background: #ffb648; border-color: #ffb648; color: #1a1205; }
.ad-game-bar button:hover { filter: brightness(1.15); }
.ad-game-hint { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); margin: 0; padding: 9px 16px; border-radius: 999px; background: rgba(4, 8, 24, .72); font: 500 13.5px/1.3 var(--f-ui, inherit); white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; }
.ad-game-touch { position: absolute; left: 0; right: 0; bottom: 74px; display: none; justify-content: space-between; padding: 0 18px; }
.ad-game-touch button { width: 76px; height: 76px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .5); background: rgba(4, 8, 24, .6); color: #fff; font-size: 26px; }
@media (hover: none), (max-width: 760px) { .ad-game-touch { display: flex; } }
.ad-game-over { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(380px, calc(100% - 32px)); padding: 28px 28px 26px; border: 1px solid rgba(255, 110, 130, .6); border-radius: 16px; background: rgba(6, 9, 24, .92); text-align: center; pointer-events: auto; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.ad-game-over[hidden] { display: none; }
.ad-game-over h3 { margin: 0; font-size: 30px; color: #ff6e82; }
.ad-game-over p { margin: 10px 0 22px; font-size: 17px; color: #c9d6ea; }
.ad-game-over p b { color: #fff; font-size: 26px; margin-left: 6px; }
.ad-game-over div { display: flex; gap: 10px; justify-content: center; }
.ad-game-over button { height: 46px; padding: 0 20px; border-radius: 999px; border: 1px solid rgba(140, 170, 220, .5); background: transparent; color: #fff; font-weight: 700; }
.ad-game-over button[data-g="again"] { background: #1c63d8; border-color: #1c63d8; }
@media (max-width: 760px) {
  .ad-game-bar { top: 10px; gap: 6px; flex-wrap: wrap; justify-content: center; }
  .ad-game-bar > div { min-width: 0; padding: 7px 10px; }
  .ad-game-bar b { font-size: 16px; }
  .ad-game-next { min-width: 110px; }
  .ad-game-bar button { height: 40px; padding: 0 14px; }
  .ad-game-hint { display: none; }
}
/* the game overlay stays dark in both themes */
html[data-theme] .ad-game-over h3 { color: #ff6e82 !important; }
html[data-theme] .ad-game-over p { color: #c9d6ea !important; }
html[data-theme] .ad-game-over p b, html[data-theme] .ad-game-bar b, html[data-theme] .ad-game-hint { color: #fff !important; }
html[data-theme] .ad-game-bar span { color: #9fb4d6 !important; }
html[data-theme] .ad-game-bar em { color: #3df27a !important; }

/* Auto / Manual: two buttons side by side, the active one filled */
.ad-game-bar > .ad-game-mode { display: flex; min-width: 0; padding: 4px; gap: 4px; }
.ad-game-mode button { min-width: 92px; padding: 0 16px; border: 0; border-radius: 7px; background: transparent; color: #9fb4d6; font-weight: 700; font-size: 14px; letter-spacing: .4px; }
.ad-game-mode button[data-g="auto"][aria-pressed="true"] { background: #1c63d8; color: #fff; }
.ad-game-mode button[data-g="manual"][aria-pressed="true"] { background: #ffb648; color: #1a1205; }
.ad-game-mode button[aria-pressed="false"]:hover { background: rgba(255, 255, 255, .12); color: #fff; filter: none; }
@media (max-width: 760px) { .ad-game-mode button { min-width: 0; height: 40px; padding: 0 12px; } }
