/* =============================================================================
   Sunrise Auto Sales — header, footer and shared page chrome
   =============================================================================
   Depends on the tokens in sunrise.css.
   ========================================================================== */

/* -----------------------------------------------------------------------------
   Icons
   -------------------------------------------------------------------------- */

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  /* Icons inherit text colour so a single sprite works on any background. */
  color: currentColor;
}

.icon--xs { width: 14px; height: 14px; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 28px; height: 28px; }

/* -----------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  /* Only the shadow animates on scroll — animating the whole header causes a
     visible jump as its height changes. */
  transition: box-shadow var(--duration) var(--ease-out);
}

.site-header.is-stuck {
  box-shadow: var(--shadow);
}

/* When the page is scrolled the utility strip collapses away, giving the
   sticky bar a smaller footprint on long inventory pages. */
.site-header .topbar {
  background: var(--ink-950);
  color: var(--ink-300);
  font-size: var(--text-xs);
  max-height: 46px;
  overflow: hidden;
  transition: max-height var(--duration) var(--ease-out),
    opacity var(--duration) var(--ease-out);
}

.site-header.is-stuck .topbar {
  max-height: 0;
  opacity: 0;
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  min-height: 46px;
}

.topbar__contact {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.topbar__contact a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--ink-300);
  transition: color var(--duration-fast) var(--ease-out);
}

.topbar__contact a:hover {
  color: var(--white);
}

.topbar__contact .icon {
  width: 15px;
  height: 15px;
  color: var(--red-500);
}

.topbar__social {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.topbar__social a {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  color: var(--ink-400);
  transition: color var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out);
}

.topbar__social a:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.1);
}

.topbar__social .icon {
  width: 16px;
  height: 16px;
}

/* Main nav bar ------------------------------------------------------------- */

.nav {
  border-bottom: 1px solid var(--border);
  background: var(--white);
}

.nav__inner {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  min-height: var(--header-h);
}

.nav__logo {
  flex: none;
}

.nav__logo img {
  width: auto;
  height: 48px;
  object-fit: contain;
  background: none;
}

.nav__menu {
  flex: 1;
}

.nav__menu > ul {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav__menu > ul > li {
  position: relative;
}

.nav__menu > ul > li > a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-700);
  border-radius: var(--radius);
  white-space: nowrap;
  transition: color var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out);
}

.nav__menu > ul > li > a:hover {
  color: var(--accent);
  background: var(--ink-050);
}

.nav__menu > ul > li > a[aria-current="page"] {
  color: var(--accent);
}

/* Submenu ------------------------------------------------------------------- */

.submenu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 230px;
  padding: var(--space-2);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out),
    visibility var(--duration-fast);
  z-index: 20;
}

/* Opens on hover for pointer users and on focus for keyboard users. */
.has-submenu:hover .submenu,
.has-submenu:focus-within .submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Long make lists scroll rather than running off the viewport. */
.submenu > ul {
  max-height: min(60vh, 420px);
  overflow-y: auto;
}

.submenu a {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--ink-700);
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out);
}

.submenu a:hover {
  color: var(--accent);
  background: var(--ink-050);
}

/* Nav actions --------------------------------------------------------------- */

.nav__actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex: none;
}

.nav__call {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}

.nav__call .icon {
  width: 34px;
  height: 34px;
  padding: 8px;
  color: var(--white);
  background: var(--accent);
  border-radius: var(--radius-full);
}

.nav__call span {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.nav__call small {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.nav__call strong {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
}

.nav__toggle {
  display: none;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  color: var(--ink-800);
  transition: background-color var(--duration-fast) var(--ease-out);
}

.nav__toggle:hover {
  background: var(--ink-050);
}

/* Header breakpoints -------------------------------------------------------- */

@media (max-width: 1200px) {
  .site-header .topbar { display: none; }
  .nav__menu { display: none; }
  .nav__call { display: none; }
  .nav__toggle { display: grid; }
  .nav__inner { justify-content: space-between; gap: var(--space-4); }
}

@media (max-width: 560px) {
  .nav__cta { display: none; }
  .nav__logo img { height: 40px; }
}

/* -----------------------------------------------------------------------------
   Mobile drawer
   -------------------------------------------------------------------------- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(11, 14, 19, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--duration) var(--ease-out);
}

.drawer-backdrop.is-open {
  opacity: 1;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 160;
  width: min(380px, 88vw);
  display: flex;
  flex-direction: column;
  background: var(--white);
  transform: translateX(100%);
  transition: transform var(--duration-slow) var(--ease-out);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.drawer__logo img {
  height: 42px;
  width: auto;
  object-fit: contain;
  background: none;
}

.drawer__close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  color: var(--ink-700);
  transition: background-color var(--duration-fast) var(--ease-out);
}

.drawer__close:hover {
  background: var(--ink-050);
}

.drawer__nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
}

.drawer__nav > ul > li > a,
.drawer__group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: var(--space-3);
  padding: var(--space-4);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--ink-800);
  border-radius: var(--radius);
  text-align: left;
  transition: color var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out);
}

.drawer__nav > ul > li > a:hover,
.drawer__group-toggle:hover {
  color: var(--accent);
  background: var(--ink-050);
}

.drawer__group-toggle .icon {
  transition: transform var(--duration) var(--ease-out);
}

.drawer__group-toggle[aria-expanded="true"] .icon {
  transform: rotate(180deg);
}

/* Collapsed by default. The height is set in pixels by the drawer script from
   the content's scrollHeight, so there is no magic max-height to outgrow.

   The `grid-template-rows: 0fr -> 1fr` technique was tried here and does not
   work reliably: in a grid whose height is indefinite, `fr` tracks are sized
   from content rather than free space, so the track refuses to collapse back
   to zero once it has been laid out open. */
.drawer__sub {
  height: 0;
  overflow: hidden;
  transition: height var(--duration) var(--ease-out);
}

.drawer__sub a {
  display: block;
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-8);
  font-size: var(--text-sm);
  color: var(--ink-600);
  border-radius: var(--radius);
}

.drawer__sub a:hover {
  color: var(--accent);
  background: var(--ink-050);
}

.drawer__foot {
  padding: var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}

.drawer__social {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

.drawer__social a {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--ink-600);
  transition: color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.drawer__social a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Prevents the page behind the drawer from scrolling. */
body.is-locked {
  overflow: hidden;
}

/* -----------------------------------------------------------------------------
   Page hero (interior pages)
   -------------------------------------------------------------------------- */

.page-hero {
  position: relative;
  padding-block: clamp(3rem, 2rem + 5vw, 5.5rem);
  background: var(--ink-950);
  color: var(--white);
  overflow: hidden;
}

/* Subtle diagonal sheen so the flat charcoal band does not read as dead space. */
.page-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 85% 0%, rgba(216, 39, 28, 0.22), transparent 55%),
    radial-gradient(ellipse at 10% 100%, rgba(255, 255, 255, 0.06), transparent 50%);
  pointer-events: none;
}

.page-hero .container {
  position: relative;
  z-index: 1;
}

.page-hero h1 {
  color: var(--white);
  margin-top: var(--space-3);
}

.page-hero p {
  color: var(--ink-300);
  margin-top: var(--space-4);
  max-width: 60ch;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-5);
  font-size: var(--text-sm);
  color: var(--ink-400);
}

.breadcrumb a {
  color: var(--ink-300);
  transition: color var(--duration-fast) var(--ease-out);
}

.breadcrumb a:hover {
  color: var(--white);
}

.breadcrumb li:not(:last-child)::after {
  content: "/";
  margin-left: var(--space-2);
  color: var(--ink-600);
}

.breadcrumb li {
  display: inline-flex;
  align-items: center;
}

/* -----------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  background: var(--ink-950);
  color: var(--ink-300);
  padding-top: var(--space-20);
}

.site-footer h2,
.site-footer h3 {
  color: var(--white);
}

/* Footer CTA ---------------------------------------------------------------- */

.footer-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  padding: clamp(2rem, 1.4rem + 3vw, 3.5rem);
  margin-bottom: var(--space-20);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(216, 39, 28, 0.16), transparent 60%),
    var(--ink-900);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-cta__text {
  max-width: 52ch;
}

.footer-cta .lead {
  color: var(--ink-300);
  margin-top: var(--space-3);
}

.footer-cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* Footer columns ------------------------------------------------------------- */

.footer-grid {
  display: grid;
  gap: var(--space-10) var(--space-8);
  /* The brand column is wider than the link columns. */
  grid-template-columns: 1.6fr repeat(4, 1fr);
  padding-bottom: var(--space-16);
}

@media (max-width: 1100px) {
  .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--space-8) var(--space-6); }
}

@media (max-width: 420px) {
  .footer-grid { grid-template-columns: 1fr; }
}

.footer-brand img {
  height: 54px;
  width: auto;
  object-fit: contain;
  background: none;
  margin-bottom: var(--space-5);
}

.footer-brand p {
  font-size: var(--text-sm);
  line-height: 1.7;
  max-width: 40ch;
}

.footer-social {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-6);
}

.footer-social a {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-300);
  transition: background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.footer-social a:hover {
  background: var(--accent);
  color: var(--white);
  transform: translateY(-2px);
}

.footer-col h3 {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: var(--space-5);
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-col a {
  font-size: var(--text-sm);
  color: var(--ink-400);
  transition: color var(--duration-fast) var(--ease-out);
}

.footer-col a:hover {
  color: var(--white);
}

.footer-contact li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--ink-400);
  line-height: 1.6;
}

.footer-contact .icon {
  width: 17px;
  height: 17px;
  color: var(--red-500);
  margin-top: 3px;
}

/* Footer legal --------------------------------------------------------------- */

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-6);
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  font-size: var(--text-sm);
  color: var(--ink-500);
}

.footer-bottom ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
}

.footer-bottom a {
  color: var(--ink-400);
  transition: color var(--duration-fast) var(--ease-out);
}

.footer-bottom a:hover {
  color: var(--white);
}
