/* ============================================================
   Home landing page (index.html #homeContent) and route switching.
   html[data-route] is set by the inline route script in <head>
   before first paint: "home" shows the landing page, "app" the tools.
   ============================================================ */

html:not([data-route="app"]) #appContent { display: none; }
html[data-route="app"] #homeContent { display: none; }

/* Rate-limit banner and blog teaser belong to the two search tools only. */
html[data-app-tab]:not([data-app-tab="duty-calculator"]):not([data-app-tab="vehicles"]) .app-search-only {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- Duty Calculator heading + contextual hint ------------------------ */

.tool-heading { margin-bottom: 1.1rem; }

.tool-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--text-primary);
}

.tool-sub {
  margin-top: 0.25rem;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.duty-focus-hint {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 0.85rem 0.75rem 1rem;
  border: 1px solid rgba(79, 124, 255, 0.35);
  border-left-width: 3px;
  border-radius: 10px;
  background: rgba(79, 124, 255, 0.08);
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.duty-focus-hint[hidden] { display: none; }
.duty-focus-hint > span { flex: 1; }

.duty-focus-hint-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.duty-focus-hint-close:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ---- Landing page ----------------------------------------------------- */

.home-page {
  --home-border: rgba(99, 125, 255, 0.22);
  --home-border-strong: rgba(124, 140, 255, 0.55);
  --home-tile: rgba(8, 14, 32, 0.55);
  --home-icon: #9fb0ff;
  --home-hero-bg: #060b1a;
  display: block;
}

html[data-theme='light'] .home-page {
  --home-border: var(--border-color);
  --home-border-strong: var(--accent-blue);
  --home-tile: var(--bg-primary);
  --home-icon: var(--accent-blue);
}

/* Hero — always dark: the photo carries it in both themes. */
.home-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--home-hero-bg);
  border-bottom: 1px solid var(--home-border);
  color: #f1f5f9;
}

.home-hero-media {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 62%;
  z-index: -1;
}

.home-hero-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 60% center;
}

/* Painted after the photo (same z-index, later in order) to fade it into the text side. */
.home-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(90deg,
    var(--home-hero-bg) 0%,
    var(--home-hero-bg) 36%,
    rgba(6, 11, 26, 0.82) 48%,
    rgba(6, 11, 26, 0.25) 72%,
    rgba(6, 11, 26, 0) 100%);
}

.home-hero-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 3.5rem 2rem 3.25rem;
}

.home-hero-inner > * { max-width: 640px; }

.home-eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8ea2ff;
}

.home-hero-title {
  margin: 0.7rem 0 1rem;
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: #fff;
}

.home-hero-title span {
  background: linear-gradient(90deg, #8f95ff 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.home-hero-sub {
  max-width: 540px;
  font-size: 1.02rem;
  line-height: 1.6;
  color: #b6c2dc;
}

.home-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.6rem;
  padding: 0.35rem 0.35rem 0.35rem 1rem;
  border: 1px solid rgba(120, 140, 255, 0.38);
  border-radius: 12px;
  background: rgba(10, 17, 38, 0.88);
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.7);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.home-search:focus-within {
  border-color: #6d7dff;
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.25), 0 12px 32px -12px rgba(0, 0, 0, 0.7);
}

.home-search-icon { flex-shrink: 0; color: #94a3b8; }

.home-search input {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 0.25rem;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f1f5f9;
  font-family: inherit;
  font-size: 1rem;
}

.home-search input::placeholder { color: #8391ab; }
.home-search input::-webkit-search-cancel-button { filter: invert(0.7); }

.home-search-btn-short { display: none; }

.home-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.65rem 1.15rem;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.home-btn-primary {
  background: linear-gradient(135deg, #4f6bff 0%, #5b4cf0 100%);
  color: #fff;
  box-shadow: 0 8px 20px -10px rgba(79, 107, 255, 0.8);
}

.home-btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.home-btn:focus-visible { outline: 2px solid #a5b4fc; outline-offset: 2px; }

.home-popular {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.home-popular-label { font-size: 0.82rem; font-weight: 500; color: #94a3b8; }

.home-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
}

.home-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.3rem 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.65);
  color: #dbe4f5;
  font-size: 0.8rem;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.home-chip:hover { border-color: #6d7dff; background: rgba(79, 124, 255, 0.16); color: #fff; }

/* Body grid */
.home-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 2rem 0;
}

.home-row { display: grid; gap: 1.5rem; }
.home-row--chapters { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
.home-row--pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.home-card {
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
  border: 1px solid var(--home-border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(79, 124, 255, 0.05) 0%, rgba(79, 124, 255, 0) 60%), var(--bg-card);
}

.home-card-head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.home-feature-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.home-icon-badge {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(79, 124, 255, 0.32);
  border-radius: 12px;
  background: rgba(79, 124, 255, 0.12);
  color: var(--home-icon);
}

.home-icon-badge--sm { width: 42px; height: 42px; border-radius: 10px; }

.home-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.home-card-text {
  margin-top: 0.3rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Chapters */
.home-chapter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  list-style: none;
}

.home-chapter {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  height: 100%;
  min-height: 120px;
  padding: 1rem;
  border: 1px solid var(--home-border);
  border-radius: 12px;
  background: var(--home-tile);
  color: var(--text-primary);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.home-chapter svg { color: var(--home-icon); margin-bottom: 0.35rem; }
.home-chapter-range { font-size: 1.05rem; font-weight: 700; line-height: 1.2; }
.home-chapter-name { font-size: 0.85rem; line-height: 1.35; color: var(--text-secondary); }

.home-chapter:hover,
.home-chapter:focus-visible {
  border-color: var(--home-border-strong);
  background: rgba(79, 124, 255, 0.1);
  transform: translateY(-2px);
  outline: none;
}

.home-chapter--feature { border-color: var(--home-border-strong); }

.home-chapter .home-chapter-arrow {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  margin: 0;
  color: var(--text-secondary);
}

.home-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-blue);
  text-decoration: none;
}

.home-link:hover { text-decoration: underline; }

/* Vehicle card */
.home-vehicle {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.home-vehicle-media img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;
  height: auto;
  object-fit: cover;
}

.home-vehicle-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
}

.home-vehicle-body .home-btn,
.home-feature .home-btn { align-self: flex-start; margin-top: auto; }

/* Preferential / regulatory */
.home-feature {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 200px;
}

.home-feature > .home-card-text { margin-top: 0; max-width: 460px; }

.home-feature::after {
  content: '';
  position: absolute;
  right: -60px;
  bottom: -60px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 124, 255, 0.16) 0%, rgba(79, 124, 255, 0) 70%);
  pointer-events: none;
}

/* Platform */
.home-platform {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: 2rem;
}

.home-platform-media { display: block; width: 100%; max-width: 100%; min-width: 0; }
.home-platform-media--light { display: none; }
html[data-theme='light'] .home-platform-media--dark { display: none; }
html[data-theme='light'] .home-platform-media--light { display: block; }

.home-platform-media img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--home-border);
  border-radius: 12px;
}

.home-platform-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.9rem;
}

.home-platform-body > .home-card-text { margin-top: 0; }

.home-checklist {
  display: grid;
  gap: 0.6rem;
  list-style: none;
}

.home-checklist li {
  position: relative;
  padding-left: 2rem;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--text-primary);
}

.home-checklist li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 1.25rem;
  height: 1.25rem;
  border: 1.5px solid var(--home-icon);
  border-radius: 5px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239fb0ff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / 0.8rem no-repeat;
}

html[data-theme='light'] .home-checklist li::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E");
}

.home-platform-cta { margin-top: 0.35rem; }

.home-platform-mobile-note {
  display: none;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Ads band */
.home-ads {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 1.5rem;
  border-color: var(--home-border-strong);
}

.home-ads--with-ad { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.home-ads-slot[hidden] { display: none; }
.home-ads .hs-ad-panel { margin: 0; }

.home-ads-cta {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.home-ads-cta-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.home-ads-cta-body .home-card-title { font-size: 1.1rem; }
.home-ads-cta-body .home-btn { margin-top: 0.6rem; white-space: normal; text-align: left; }

/* ---- Responsive ------------------------------------------------------- */

/* Side by side, the chapters card sets the row height and the vehicle
   photo shrinks to match it. height: 0 keeps the photo from stretching
   the row; min-height: 100% fills the height the chapters card defines. */
@media (min-width: 1101px) {
  .home-vehicle {
    height: 0;
    min-height: 100%;
  }
  .home-vehicle-media {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
  }
  .home-vehicle-body { flex: 0 0 auto; }
  .home-vehicle-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
  }
}

@media (max-width: 1100px) {
  .home-row--chapters { grid-template-columns: minmax(0, 1fr); }
  .home-vehicle { flex-direction: row; }
  .home-vehicle-media { flex: 0 0 44%; }
  .home-vehicle-media img { height: 100%; aspect-ratio: auto; min-height: 240px; }
}

@media (max-width: 900px) {
  .home-hero-media { width: 100%; }
  .home-hero-media img { object-position: 70% center; }
  .home-hero::after {
    background: linear-gradient(180deg, rgba(6, 11, 26, 0.72) 0%, rgba(6, 11, 26, 0.86) 55%, var(--home-hero-bg) 100%);
  }
  .home-hero-inner { padding: 2.75rem 1.5rem 2.5rem; }
  .home-row--pair { grid-template-columns: minmax(0, 1fr); }
  .home-feature { min-height: 0; }
  .home-platform { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .home-platform-mobile-note { display: block; }
  .home-ads--with-ad { grid-template-columns: minmax(0, 1fr); }
  .home-vehicle { flex-direction: column; }
  .home-vehicle-media { flex: none; }
  .home-vehicle-media img { height: auto; min-height: 0; aspect-ratio: 16 / 9; }
  .home-body { padding: 1.5rem 1.5rem 0; }
}

@media (max-width: 640px) {
  .home-hero-inner { padding: 2rem 1rem 1.9rem; }
  .home-hero-sub { font-size: 0.95rem; }
  .home-search { margin-top: 1.25rem; padding-left: 0.8rem; }
  .home-search input { font-size: 16px; } /* prevents iOS zoom on focus */
  .home-search-btn { padding: 0.6rem 0.9rem; }
  .home-search-btn-full { display: none; }
  .home-search-btn-short { display: inline; }
  .home-popular { gap: 0.5rem; }
  .home-popular-label { width: 100%; }
  .home-body { gap: 1rem; padding: 1rem 1rem 0; }
  .home-row { gap: 1rem; }
  .home-card { padding: 1.15rem; border-radius: 14px; }
  .home-card-head { gap: 0.8rem; margin-bottom: 1rem; }
  .home-icon-badge { width: 42px; height: 42px; }
  .home-card-title { font-size: 1.08rem; }
  .home-chapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .home-chapter { min-height: 104px; padding: 0.85rem; }
  .home-vehicle { padding: 0; }
  .home-vehicle-body { padding: 1.15rem; }
  .home-btn { width: 100%; }
  .home-search .home-btn { width: auto; }
  .home-vehicle-body .home-btn,
  .home-feature .home-btn { align-self: stretch; }
  .home-ads-cta { flex-direction: column; }
  .home-ads-cta-body { align-items: stretch; }
  .home-ads-cta-body .home-btn { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .home-btn,
  .home-chapter,
  .home-chip { transition: none; }
  .home-btn-primary:hover,
  .home-chapter:hover { transform: none; }
}

/* ---- Duty Calculator: static SEO copy (crawlable, no-JS friendly) ------- */

.duty-info {
  margin-top: 1.75rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: grid;
  gap: 1.75rem;
}

/* The results panel is shared with Vehicle Search, so only reveal the duty
   calculator's SEO copy when the duty-calculator tab is active. */
html[data-app-tab]:not([data-app-tab="duty-calculator"]) .duty-info {
  display: none;
}

.duty-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.duty-info-col {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.duty-info-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--text-primary);
}

.duty-info-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.duty-info-points,
.duty-info-steps {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.duty-info-points li,
.duty-info-steps li { padding-left: 1.35rem; position: relative; }

.duty-info-points li::before {
  content: '';
  position: absolute;
  left: 0.15rem;
  top: 0.55rem;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--accent-blue);
}

.duty-info-steps { counter-reset: duty-step; }

.duty-info-steps li { counter-increment: duty-step; }

.duty-info-steps li::before {
  content: counter(duty-step);
  position: absolute;
  left: 0;
  top: 0.15rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-blue);
}

.duty-info-points strong,
.duty-info-steps strong {
  font-weight: 600;
  color: var(--text-primary);
}

.duty-levies,
.duty-agreements,
.duty-authorities {
  display: grid;
  gap: 0.85rem;
}

.duty-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.duty-data-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.duty-data-table th,
.duty-data-table td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border-color);
}

.duty-data-table thead th {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.duty-levy-table tbody th {
  width: 4.5rem;
  font-weight: 700;
  color: var(--accent-blue);
  white-space: nowrap;
}

.duty-levy-table td:nth-child(2) {
  width: 16rem;
  font-weight: 600;
  color: var(--text-primary);
}

.duty-agreement-table tbody th,
.duty-authority-table tbody th {
  font-weight: 600;
  color: var(--text-primary);
}

.duty-agreement-table .duty-table-code {
  width: 7.5rem;
  font-weight: 700;
  color: var(--accent-blue);
  white-space: nowrap;
}

.duty-authority-table td:nth-child(2) {
  width: 5.5rem;
  text-align: center;
}

.duty-authority-table thead th:nth-child(2) {
  text-align: center;
}

.duty-verified {
  display: inline-flex;
  color: #10b981;
  line-height: 1;
  vertical-align: middle;
}

.duty-data-table.is-collapsed .duty-row-extra {
  display: none;
}

.duty-more-toggle {
  justify-self: start;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-blue);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.duty-more-toggle:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .duty-info { padding: 1.25rem; }
  .duty-info-grid { grid-template-columns: minmax(0, 1fr); }

  .duty-data-table thead { display: none; }

  .duty-data-table,
  .duty-data-table tbody,
  .duty-data-table tr,
  .duty-data-table th,
  .duty-data-table td { display: block; width: auto; }

  .duty-data-table tr {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
  }

  .duty-data-table th,
  .duty-data-table td {
    padding: 0;
    border-bottom: 0;
    white-space: normal;
  }

  .duty-levy-table tbody th,
  .duty-agreement-table tbody th {
    display: inline;
    margin-right: 0.45rem;
  }

  .duty-levy-table td:nth-child(2),
  .duty-agreement-table .duty-table-code {
    display: inline;
    width: auto;
    white-space: normal;
  }

  .duty-levy-table td:nth-child(3),
  .duty-agreement-table td:nth-child(3) {
    display: block;
    margin-top: 0.25rem;
  }

  .duty-authority-table tbody th {
    display: inline;
    margin-right: 0.45rem;
  }

  .duty-authority-table td:nth-child(2) {
    display: inline-flex;
    align-items: center;
    width: auto;
    margin-top: 0;
    vertical-align: middle;
    text-align: left;
  }

  .duty-authority-table td:nth-child(3) {
    display: block;
    width: auto;
    margin-top: 0.25rem;
    text-align: left;
  }

  .duty-authority-table td:empty {
    display: none;
    margin: 0;
  }
}

