/* ──────────────────────────────────────────────────────────────────────────
   App shell: desktop left rail, mobile top bar + bottom navigation.
   Six areas: My Garage · Diagnose · Repair · Buy · Learn · Auto Expert.
   ────────────────────────────────────────────────────────────────────────── */
body.app { display: grid; grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; min-height: 100dvh; background: var(--canvas); }
body.app > main.page { grid-column: 1; width: 100%; }
body.app .site-footer { grid-column: 1; }

/* Top bar (mobile and tablet) */
.ax-top { position: sticky; top: 0; z-index: 60; height: var(--topbar-h); background: rgba(247,248,250,0.92); backdrop-filter: saturate(1.2) blur(8px); border-bottom: 1px solid var(--hairline); display: flex; align-items: center; gap: 12px; padding: 0 16px; }
.ax-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; letter-spacing: -0.01em; font-size: 0.95rem; }
.ax-mark { width: 24px; height: 24px; flex: none; }
.ax-brand small { display: block; font-size: 0.62rem; font-weight: 600; letter-spacing: 0.14em; color: var(--text-2); text-transform: uppercase; margin-top: 1px; }
.ax-top .ax-vehicle { margin-left: auto; min-width: 0; text-align: right; font-size: var(--fs-xs); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.ax-top .ax-vehicle b { display: block; color: var(--text); font-weight: 600; font-size: var(--fs-sm); }
.ax-top .ax-expert { flex: none; }

/* Rail (desktop) */
.ax-rail { display: none; }
.ax-nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ax-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: var(--tap); border-radius: var(--radius); color: var(--text-2); text-decoration: none; font-size: var(--fs-sm); font-weight: 500; transition: background var(--ease), color var(--ease); }
.ax-nav a:hover { background: var(--surface-2); color: var(--text); }
.ax-nav a[aria-current="page"] { background: var(--surface); color: var(--blue-deep); box-shadow: inset 0 0 0 1px var(--hairline); font-weight: 600; }
.ax-nav a[aria-current="page"] svg { color: var(--blue); }
.ax-nav svg { width: 20px; height: 20px; flex: none; color: var(--text-3); }
.ax-nav .ax-sub { display: none; }
.ax-rail-vehicle { margin-top: auto; border-top: 1px solid var(--hairline); padding-top: 14px; }
.ax-rail-vehicle a { display: block; text-decoration: none; color: var(--text); padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--hairline); background: var(--surface); }
.ax-rail-vehicle a:hover { border-color: var(--hairline-strong); }
.ax-rail-vehicle .ymm, .ax-rail-vehicle .add, .ax-rail-vehicle .meta { display: block; }
.ax-rail-vehicle .ymm { font-weight: 600; font-size: var(--fs-sm); }
.ax-rail-vehicle .meta { color: var(--text-2); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.ax-rail-vehicle .add { color: var(--blue-deep); font-weight: 600; font-size: var(--fs-sm); }

/* Bottom nav (mobile) */
.ax-bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; height: calc(var(--bottombar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: rgba(255,255,255,0.96); backdrop-filter: saturate(1.2) blur(10px); border-top: 1px solid var(--hairline); display: grid; grid-template-columns: repeat(5, 1fr); }
.ax-bottom a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--text-2); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.02em; min-height: var(--bottombar-h); }
.ax-bottom a svg { width: 22px; height: 22px; }
.ax-bottom a[aria-current="page"] { color: var(--blue-deep); }
body.app main.page { padding-bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom) + 24px); }
body.app .site-footer { margin-bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom)); }

/* Focus modes (Mechanic / Negotiation) hide navigation chrome */
body.focus-mode .ax-top, body.focus-mode .ax-bottom, body.focus-mode .ax-rail, body.focus-mode .site-footer { display: none !important; }
body.focus-mode main.page { padding: 0 !important; max-width: none !important; }

@media (min-width: 1024px) {
  body.app { grid-template-columns: var(--rail-w) minmax(0, 1fr); grid-template-rows: 1fr auto; }
  .ax-top { display: none; }
  .ax-bottom { display: none; }
  body.app main.page { grid-column: 2; padding-bottom: var(--sp-7); }
  body.app .site-footer { grid-column: 2; margin-bottom: 0; }
  .ax-rail { display: flex; flex-direction: column; grid-column: 1; grid-row: 1 / span 2; position: sticky; top: 0; height: 100dvh; padding: 18px 14px 18px; border-right: 1px solid var(--hairline); background: var(--canvas); }
  .ax-rail .ax-brand { padding: 4px 12px 18px; }
  .ax-nav .ax-sub { display: block; font-size: var(--fs-xs); color: var(--text-3); font-weight: 400; margin-top: 1px; }
  .ax-nav a { align-items: flex-start; padding: 9px 12px; }
  .ax-nav a svg { margin-top: 1px; }
  .ax-nav .ax-label { display: flex; flex-direction: column; }
  .ax-rail .ax-expert { margin: 14px 0 0; }
}
@media (min-width: 1440px) { :root { --rail-w: 256px; } }

/* Page frame inside the shell */
main.page { max-width: var(--measure); margin: 0 auto; padding: var(--sp-5) 16px var(--sp-7); }
main.page.wide { max-width: 980px; }
main.page.full { max-width: none; padding-left: 0; padding-right: 0; padding-top: 0; }
@media (min-width: 1024px) { main.page { padding-left: 32px; padding-right: 32px; padding-top: 32px; } main.page.full { padding-left: 0; padding-right: 0; padding-top: 0; } }

/* Section landing grids */
.ax-area-head { margin-bottom: var(--sp-5); }
.ax-area-head h1 { font-size: clamp(1.6rem, 3.2vw, 2.1rem); letter-spacing: -0.02em; margin-bottom: 6px; }
.ax-area-head .lead { color: var(--text-2); font-size: var(--fs-md); margin: 0; max-width: 56ch; }
.ax-tools { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); border-radius: var(--radius-lg); overflow: hidden; }
@media (min-width: 640px) { .ax-tools { grid-template-columns: 1fr 1fr; } }
.ax-tool { display: flex; gap: 14px; align-items: flex-start; padding: 16px; background: var(--surface); text-decoration: none; color: var(--text); min-height: 84px; transition: background var(--ease); }
.ax-tool:hover { background: var(--surface-2); color: var(--text); }
.ax-tool:focus-visible { box-shadow: inset var(--focus); outline: none; }
.ax-tool svg { width: 22px; height: 22px; flex: none; color: var(--blue); margin-top: 2px; }
.ax-tool .t { display: block; font-weight: 600; font-size: var(--fs-md); letter-spacing: -0.01em; }
.ax-tool .d { display: block; color: var(--text-2); font-size: var(--fs-sm); margin-top: 2px; line-height: 1.4; }
.ax-tool .tag { margin-left: auto; align-self: flex-start; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--blue-deep); background: var(--blue-soft); padding: 3px 7px; border-radius: 4px; white-space: nowrap; }

/* Expert sheet (contextual assistant) */
.ax-expert-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--hairline-strong); background: var(--surface); color: var(--text); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; }
.ax-expert-btn svg { width: 18px; height: 18px; color: var(--blue); }
.ax-expert-btn:hover { background: var(--blue-soft); border-color: var(--blue); }
dialog.ax-expert-sheet { border: 0; padding: 0; border-radius: var(--radius-lg); width: min(640px, calc(100vw - 24px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lift); }
dialog.ax-expert-sheet::backdrop { background: rgba(20,34,53,0.35); }
.ax-expert-body { padding: 20px; display: grid; gap: 14px; }
.ax-expert-body h2 { margin: 0; font-size: var(--fs-xl); letter-spacing: -0.015em; }
.ax-expert-body textarea { min-height: 96px; font-size: 1.05rem; }
.ax-expert-routes { display: grid; gap: 6px; }
.ax-expert-routes a, .ax-expert-routes button { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; font: inherit; font-size: var(--fs-sm); font-weight: 500; cursor: pointer; text-align: left; }
.ax-expert-routes a:hover, .ax-expert-routes button:hover { border-color: var(--blue); background: var(--blue-soft); }
.ax-expert-routes .r { font-size: var(--fs-xs); color: var(--text-2); font-weight: 400; }
.ax-expert-examples { display: flex; flex-wrap: wrap; gap: 6px; }
.ax-expert-examples button { border: 1px solid var(--hairline); border-radius: 999px; background: var(--surface); padding: 6px 12px; font: inherit; font-size: var(--fs-xs); color: var(--text-2); cursor: pointer; }
.ax-expert-examples button:hover { border-color: var(--blue); color: var(--blue-deep); }

/* full-bleed pages still keep a readable gutter for their inner content */
main.page.full > .page-inner { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 1024px) { main.page.full > .page-inner { padding: 0 40px; } }

/* Scrolling and focus land clear of the fixed bars */
html { scroll-padding-top: calc(var(--topbar-h) + 12px); scroll-padding-bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom) + 16px); }
@media (min-width: 1024px) { html { scroll-padding-top: 12px; scroll-padding-bottom: 12px; } }
body.focus-mode { --bottombar-h: 0px; }

/* ---- refinements from the visual pass ---- */
.ax-brand small { white-space: nowrap; letter-spacing: 0.1em; }
@media (max-width: 1023px) { .ax-top .ax-brand small { display: none; } }
@media (max-width: 479px) { .ax-top .ax-vehicle { display: none !important; } .ax-top .ax-expert { margin-left: auto; } }
.btn svg, .btn-link svg { width: 18px; height: 18px; flex: none; }
.btn.small svg { width: 16px; height: 16px; }
