/* Phase 2: payment calculator, compare, favorites, recently viewed, Car of the Week.
   Follows the 1.0.8 palette: #080808, ivory #F0E0D0, champagne gold #D8BE87. */

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ——— Shared tool buttons (favorite / compare) ——— */
.arm-tools {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.arm-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: rgba(8, 8, 8, 0.78);
  color: var(--ivory);
  border: 1px solid var(--gold-line);
  backdrop-filter: blur(10px);
  cursor: pointer;
  padding: 0.4rem 0.65rem;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.arm-tool svg { display: block; flex-shrink: 0; }
.arm-tool:hover,
.arm-tool:focus-visible {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(8, 8, 8, 0.92);
}
.arm-tool[aria-pressed="true"] {
  color: var(--bg);
  background: var(--gold);
  border-color: var(--gold);
}
.arm-tool[aria-pressed="true"]:hover { background: var(--gold-hover); color: var(--bg); }
.arm-tool--fav[aria-pressed="true"] svg { fill: currentColor; stroke: currentColor; }
.arm-tools--card {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  z-index: 2;
}
.arm-tools--card .arm-tool__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.arm-tools--card .arm-tool { width: 2.35rem; height: 2.35rem; padding: 0; }
.arm-tools--vehicle,
.arm-tools--cotw,
.arm-tools--compare {
  margin-top: 1rem;
}
.arm-card { position: relative; }
.arm-card__pay {
  display: block;
  width: calc(100% - 2.6rem);
  margin: -0.15rem 1.3rem 1.2rem;
  background: none;
  border: 0;
  border-top: 1px solid var(--gold-dim);
  padding: 0.7rem 0 0;
  color: var(--gold);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
}
.arm-card__pay:hover { color: var(--gold-hover); }
.arm-card__pay[hidden] { display: none !important; }

/* ——— Header saved button ——— */
.arm-header__end {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}
.arm-iconbtn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  background: none;
  border: 1px solid var(--gold-line);
  color: var(--ivory);
  cursor: pointer;
  padding: 0;
}
.arm-iconbtn:hover,
.arm-iconbtn[aria-expanded="true"] { color: var(--gold); border-color: var(--gold); }
.arm-iconbtn__badge {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.22rem;
  background: var(--gold);
  color: var(--bg);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.05rem;
  text-align: center;
  border-radius: 99px;
}
.arm-iconbtn__badge[hidden] { display: none !important; }
.arm-header__inner { gap: 1rem; }
@media (min-width: 721px) {
  .arm-nav { margin-left: auto; }
  .arm-header__end { margin-left: 0.75rem; }
}

/* ——— Car of the Week ——— */
.arm-cotw {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  background: var(--bg-raised);
  border-top: 1px solid var(--gold-dim);
  border-bottom: 1px solid var(--gold-dim);
  overflow: hidden;
  min-height: 28rem;
}
.arm-cotw__media {
  position: relative;
  min-height: 0;
  aspect-ratio: 4 / 3;
  background: #0d0d0d;
  overflow: hidden;
  align-self: center;
}
.arm-cotw__img,
.arm-cotw__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  position: absolute;
  inset: 0;
}
.arm-cotw__badge {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  margin: 0;
  z-index: 1;
  background: var(--gold);
  color: var(--bg);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.45rem 0.75rem;
  font-weight: 500;
}
.arm-cotw__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 5vw, 4.25rem) clamp(1.5rem, 4vw, 3.25rem);
}
.arm-cotw__body h2 {
  font-size: clamp(2.1rem, 4vw, 3.3rem);
  margin: 0 0 0.55rem;
}
.arm-cotw__meta {
  color: var(--muted);
  margin: 0 0 1.1rem;
  font-size: 0.95rem;
}
.arm-cotw__price {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 3.2vw, 2.7rem);
  color: var(--gold);
  margin: 0 0 1.5rem;
  letter-spacing: 0.02em;
}
@media (max-width: 1024px) {
  .arm-cotw { grid-template-columns: 1fr; min-height: 0; }
  .arm-cotw__media { min-height: 0; aspect-ratio: 4 / 3; }
  .arm-cotw__body { padding: 2rem var(--pad) 2.75rem; }
}

/* ——— Payment calculator ——— */
.arm-calc {
  margin-top: 1.75rem;
  padding: 1.5rem 1.4rem 1.35rem;
  background: var(--bg-raised);
  border: 1px solid var(--gold-dim);
}
.arm-calc h2 {
  font-size: clamp(1.55rem, 2.4vw, 1.95rem);
  margin: 0 0 0.4rem;
}
.arm-calc__intro {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1.2rem;
}
.arm-calc__form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.95rem 1rem;
}
.arm-calc__field {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  margin: 0;
}
.arm-calc__field--full { grid-column: 1 / -1; }
.arm-calc__field span {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.arm-calc input,
.arm-calc select,
.arm-form input[type="file"] {
  width: 100%;
  background: var(--bg-input);
  color: var(--ivory);
  border: 1px solid var(--gold-line);
  border-radius: 0;
  padding: 0.7rem 0.8rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 300;
  appearance: none;
}
.arm-calc select {
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 3px), calc(100% - 11px) calc(50% - 3px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 1.8rem;
}
.arm-calc input:focus,
.arm-calc select:focus,
.arm-form input[type="file"]:focus {
  outline: none;
  border-color: var(--gold);
}
.arm-field__hint {
  font-style: normal;
  font-size: 0.78rem;
  color: var(--muted-dim);
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.45;
}
.arm-calc__result {
  margin-top: 1.35rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--gold-dim);
}
.arm-calc__result[hidden] { display: none !important; }
.arm-calc__monthly {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.55rem 0.85rem;
  margin: 0 0 0.85rem;
  font-family: var(--font-serif);
  font-size: clamp(2.15rem, 4vw, 2.85rem);
  color: var(--gold);
  line-height: 1;
}
.arm-calc__per {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
}
.arm-calc__note { color: var(--ivory-soft); font-size: 0.92rem; margin: 0 0 0.9rem; }
.arm-calc__breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.75rem 1rem;
  margin: 0;
}
.arm-calc__breakdown div { margin: 0; }
.arm-calc__breakdown dt {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.25rem;
}
.arm-calc__breakdown dd {
  margin: 0;
  font-size: 1.05rem;
  color: var(--ivory);
}
.arm-calc__disclaimer {
  margin: 1.2rem 0 0;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--muted);
}
.arm-calc__disclaimer p { margin: 0 0 0.7rem; font-size: inherit; line-height: inherit; color: inherit; }
.arm-calc__disclaimer p:last-child { margin-bottom: 0; }
.arm-calc__panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}
.arm-calc__close,
.arm-saved__close,
.arm-calcdlg__close {
  background: none;
  border: 1px solid var(--gold-line);
  color: var(--ivory);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.4rem 0.7rem;
}
.arm-calc__close:hover,
.arm-saved__close:hover,
.arm-calcdlg__close:hover { color: var(--gold); border-color: var(--gold); }
.arm-calc--inventory {
  margin: 0 0 1.5rem;
}
.arm-calc--inventory[hidden] { display: none !important; }
.arm-calc--modal { margin: 0; border: 0; background: transparent; padding: 0; }
.arm-filters__calc {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--gold);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0.25rem 0;
}
.arm-filters__calc:hover { color: var(--gold-hover); }

/* Calculator dialog (used from cards on pages without a panel) */
.arm-calcdlg[hidden],
.arm-saved[hidden] { display: none !important; }
.arm-calcdlg,
.arm-saved {
  position: fixed;
  inset: 0;
  z-index: 80;
}
.arm-calcdlg__backdrop,
.arm-saved__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
}
.arm-calcdlg__panel,
.arm-saved__panel {
  position: absolute;
  background: var(--bg);
  border: 1px solid var(--gold-line);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  overflow: auto;
}
.arm-calcdlg__panel {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(36rem, calc(100vw - 1.5rem));
  max-height: min(44rem, calc(100svh - 2rem));
  padding: 2rem 1.5rem 1.5rem;
}
.arm-calcdlg__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
}

/* ——— Saved drawer ——— */
.arm-saved__panel {
  top: 0;
  right: 0;
  bottom: 0;
  width: min(26rem, 100vw);
  padding: 1.5rem 1.35rem 2rem;
  border-right: 0;
  display: flex;
  flex-direction: column;
  max-height: 100svh;
}
.arm-saved__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.arm-saved__head h2 { font-size: 1.85rem; margin: 0; }
.arm-saved__close { width: 2.35rem; height: 2.35rem; padding: 0; font-size: 1.4rem; }
.arm-saved__note {
  color: var(--muted-dim);
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 0 0 1.35rem;
}
.arm-saved__section { margin-bottom: 1.6rem; }
.arm-saved__section h3 {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.75rem;
}
.arm-saved__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.arm-saved__item {
  display: grid;
  grid-template-columns: 4.4rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--gold-dim);
  padding: 0.45rem;
}
.arm-saved__item img {
  width: 4.4rem;
  height: 3.1rem;
  object-fit: cover;
  background: #050505;
}
.arm-saved__item a {
  color: var(--ivory);
  text-decoration: none;
}
.arm-saved__item a:hover { color: var(--gold); }
.arm-saved__item-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.25;
  margin: 0 0 0.15rem;
  display: block;
}
.arm-saved__item-meta {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}
.arm-saved__remove {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.35rem;
}
.arm-saved__remove:hover { color: var(--danger); }
.arm-saved__empty { color: var(--muted); font-size: 0.9rem; margin: 0; }
.arm-saved__empty[hidden] { display: none !important; }

/* ——— Compare tray ——— */
.arm-cmpbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  background: rgba(8, 8, 8, 0.96);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--gold-line);
  padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom, 0px));
}
.arm-cmpbar[hidden] { display: none !important; }
.arm-cmpbar__inner {
  width: min(var(--max), 100%);
  margin: 0 auto;
  padding: 0 var(--pad);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.15rem;
}
.arm-cmpbar__count {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ivory);
}
.arm-cmpbar__thumbs { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.arm-cmpbar__thumbs img {
  width: 3.4rem;
  height: 2.35rem;
  object-fit: cover;
  border: 1px solid var(--gold-dim);
}
.arm-cmpbar__actions { display: flex; gap: 0.55rem; margin-left: auto; }
.arm-cmpbar__actions .arm-btn { padding: 0.55rem 1rem; min-width: 0; }
.arm-cmpbar__hint { margin: 0; color: var(--muted); font-size: 0.85rem; width: 100%; }
.arm-cmpbar__hint[hidden] { display: none !important; }
@media (max-width: 720px) {
  /* Action bar is a corner card, not a full-width dock; compare tray can sit at the bottom. */
  .arm-cmpbar { bottom: 0; padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px)); }
  body.arm-has-cmpbar { padding-bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px)); }
  body.arm-has-cmpbar .arm-actionbar { bottom: calc(5.65rem + env(safe-area-inset-bottom, 0px)); }
  .arm-cmpbar__actions { width: 100%; margin-left: 0; }
  .arm-cmpbar__actions .arm-btn { flex: 1; justify-content: center; }
}
@media (min-width: 721px) {
  .arm-cmpbar { left: 0; right: 0; width: 100%; }
  body.arm-has-cmpbar { padding-bottom: 5.5rem; }
  body.arm-has-cmpbar .arm-actionbar { bottom: 6.25rem; }
}

/* ——— Compare page ——— */
.arm-compare-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1.5rem 0 3rem; }
.arm-compare {
  width: 100%;
  border-collapse: collapse;
  min-width: 36rem;
}
.arm-compare th,
.arm-compare td {
  vertical-align: top;
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--gold-dim);
  font-weight: 300;
}
.arm-compare thead th {
  background: var(--bg-raised);
  border-bottom: 1px solid var(--gold-line);
  min-width: 14rem;
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}
.arm-compare thead th:first-child,
.arm-compare tbody th {
  position: sticky;
  left: 0;
  background: var(--bg);
  z-index: 1;
  min-width: 8.5rem;
  width: 8.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
}
.arm-compare thead th:first-child { background: var(--bg-raised); }
.arm-compare__media {
  position: relative;
  display: block;
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.arm-compare__photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  object-position: center;
  background: #0d0d0d;
  margin-bottom: 0;
}
.arm-compare__title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--ivory);
  margin: 0 0 0.3rem;
  display: block;
  text-transform: none;
  letter-spacing: 0.01em;
  font-weight: 400;
}
.arm-compare__price {
  color: var(--gold);
  font-size: 1.15rem;
  margin: 0 0 0.6rem;
}
.arm-compare__features { margin: 0; padding: 0; list-style: none; }
.arm-compare__features li {
  position: relative;
  padding: 0.15rem 0 0.15rem 1rem;
  font-size: 0.9rem;
  color: var(--ivory-soft);
  text-transform: none;
  letter-spacing: 0;
}
.arm-compare__features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75rem;
  width: 0.35rem;
  height: 1px;
  background: var(--gold);
}
.arm-compare__empty { color: var(--muted); }
.arm-compare__dash { color: var(--muted-dim); }
.arm-compare-intro { color: var(--muted); max-width: 38rem; }
.arm-compare-add { margin: 0 0 1.5rem; }

/* ——— Screen-reader live region ——— */
.arm-sr-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* File input on the dark form */
.arm-form input[type="file"] {
  padding: 0.55rem;
  color: var(--muted);
}
.arm-form input[type="file"]::file-selector-button {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-line);
  padding: 0.4rem 0.75rem;
  margin-right: 0.8rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}
.arm-form input[type="file"]::file-selector-button:hover { background: var(--gold); color: var(--bg); }
.arm-form select {
  width: 100%;
  background: var(--bg-input);
  color: var(--ivory);
  border: 1px solid var(--gold-line);
  padding: 0.7rem 1.8rem 0.7rem 0.8rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 300;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 3px), calc(100% - 11px) calc(50% - 3px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  border-radius: 0;
}
.arm-form select:focus { outline: none; border-color: var(--gold); }

@media (max-width: 720px) {
  .arm-calc__form,
  .arm-calc__breakdown { grid-template-columns: 1fr; }
  .arm-tools--vehicle { width: 100%; }
  .arm-tools--vehicle .arm-tool { flex: 1; }
  .arm-calcdlg__panel { width: calc(100vw - 1rem); padding: 2.25rem 1.1rem 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  html.arm-motion .arm-cotw__img,
  html.arm-motion .arm-cotw__media img {
    animation: none !important;
    transform: none !important;
  }
}

@media print {
  .arm-tools,
  .arm-cmpbar,
  .arm-saved,
  .arm-calcdlg,
  .arm-iconbtn,
  .arm-card__pay { display: none !important; }
}
