@font-face {
  font-family: "Noto Sans Thai";
  src: url("./fonts/NotoSansThai-Regular.ttf") format("truetype");
  font-weight: 400;
}

@font-face {
  font-family: "Noto Sans Thai";
  src: url("./fonts/NotoSansThai-SemiBold.ttf") format("truetype");
  font-weight: 600;
}

@font-face {
  font-family: "Noto Sans Thai";
  src: url("./fonts/NotoSansThai-Bold.ttf") format("truetype");
  font-weight: 700;
}

:root {
  color-scheme: light;
  --petrol: #111827;
  --petrol-soft: #e8edf5;
  --champagne: #1d4ed8;
  --champagne-soft: #dbeafe;
  --ink: #101418;
  --muted: #667085;
  --line: #d9e0e8;
  --paper: #f4f6f8;
  --surface: #ffffff;
  --danger: #d21f2b;
  --shadow: 0 18px 48px rgba(17, 24, 39, 0.12);
  --shadow-lg: 0 24px 64px rgba(17, 24, 39, 0.18);
  --radius: 12px;
  font-family: "Noto Sans Thai", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(17, 24, 39, 0.035), transparent 320px),
    var(--paper);
}

body.drawer-open,
body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  border-bottom: 1px solid rgba(217, 224, 232, 0.94);
  padding: 0 18px;
  background: rgba(244, 246, 248, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: grid;
  gap: 0;
  min-width: 0;
  color: var(--petrol);
  line-height: 1.15;
  text-decoration: none;
}

.brand span {
  color: var(--champagne);
  font-size: 0.78rem;
  font-weight: 700;
}

.brand strong {
  font-size: 1rem;
}

.site-header nav {
  display: none;
  gap: 18px;
}

.site-header nav a {
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
  transition: color 0.18s ease;
}

.site-header nav a:hover {
  color: var(--petrol);
}

.hero {
  display: grid;
  gap: 20px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 38px 0 46px;
}

.hero-copy {
  display: grid;
  align-content: center;
}

.eyebrow,
.status-pill {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 30px;
  border-radius: 999px;
  padding: 5px 11px;
  color: #153eaa;
  background: var(--petrol-soft);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
}

h1 {
  max-width: 780px;
  margin-bottom: 14px;
  color: var(--petrol);
  font-size: clamp(2.55rem, 9vw, 5.9rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 4vw, 3rem);
  line-height: 1.1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.muted,
.hero-copy p,
.form-status {
  color: var(--muted);
  line-height: 1.7;
}

.hero-search {
  display: grid;
  gap: 10px;
  width: min(620px, 100%);
  margin-top: 18px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px;
  color: var(--ink);
  background: var(--surface);
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--champagne);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.14);
}

.primary-button,
.ghost-button,
.icon-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--petrol);
  border-radius: 999px;
  padding: 10px 17px;
  color: var(--petrol);
  background: transparent;
  font-weight: 700;
  text-decoration: none;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.primary-button {
  color: var(--surface);
  border-color: var(--champagne);
  background: var(--champagne);
}

.danger-button {
  color: var(--danger);
  border-color: rgba(166, 55, 43, 0.45);
}

.primary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(29, 78, 216, 0.18);
}

.hero-panel,
.filter-panel,
.car-card,
.snapshot-grid article,
.spec-card,
.finance-card,
.contact-card,
.lead-form,
.admin-section,
.lead-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.hero-panel {
  overflow: hidden;
  position: relative;
  border-color: rgba(17, 24, 39, 0.18);
  box-shadow: var(--shadow);
}

.hero-panel img {
  width: 100%;
  aspect-ratio: 1.55;
  object-fit: cover;
  background: #0b1220;
}

.hero-panel div {
  padding: 18px;
}

.hero-panel span {
  color: var(--champagne);
  font-weight: 700;
}

.hero-panel strong {
  display: block;
  margin-top: 4px;
  color: var(--petrol);
  font-size: 1.28rem;
}

.hero-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.hero-proof span {
  border: 1px solid rgba(29, 78, 216, 0.18);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--petrol);
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
  font-weight: 700;
}

.inventory-shell,
.detail-view,
.contact-section {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.inventory-shell {
  padding: 36px 0 50px;
  border-top: 1px solid rgba(217, 224, 232, 0.9);
}

.section-heading,
.block-heading {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-heading {
  align-items: end;
}

.filter-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  box-shadow: 0 14px 34px rgba(17, 24, 39, 0.07);
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  font-weight: 700;
}

.category-strip {
  display: flex;
  gap: 10px;
  margin: 18px 0;
  overflow-x: auto;
  padding-bottom: 4px;
}

.category-button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  color: var(--petrol);
  background: var(--surface);
  font-weight: 700;
}

.category-button.is-active {
  border-color: var(--champagne);
  color: var(--surface);
  background: var(--champagne);
}

.content-block {
  margin-top: 24px;
}

.car-row {
  display: grid;
  gap: 14px;
}

.car-grid {
  display: grid;
  gap: 16px;
}

.car-card {
  overflow: hidden;
  border-color: rgba(217, 224, 232, 0.96);
  box-shadow: 0 12px 30px rgba(17, 24, 39, 0.07);
  transition:
    border-color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.car-card:hover {
  border-color: rgba(29, 78, 216, 0.45);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.car-card button {
  display: grid;
  width: 100%;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.card-media {
  position: relative;
  overflow: hidden;
  background: #0b1220;
}

.card-media img {
  width: 100%;
  aspect-ratio: 1.6;
  object-fit: cover;
  transition: transform 0.28s ease;
}

.car-card:hover .card-media img {
  transform: scale(1.035);
}

.car-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  border-radius: 999px;
  padding: 7px 10px;
  color: #fff;
  background: rgba(29, 78, 216, 0.94);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
}

.card-copy {
  display: grid;
  gap: 11px;
  padding: 16px;
}

.car-spec-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.car-spec-chips span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  background: #f8fafc;
  font-weight: 700;
}

.card-copy h4 {
  margin: 0;
  color: var(--petrol);
  font-size: 1.18rem;
  line-height: 1.25;
}

.view-link {
  margin: 0;
  color: var(--champagne);
  font-weight: 700;
}

.card-foot {
  display: grid;
  gap: 12px;
  color: var(--petrol);
  font-weight: 700;
}

.card-foot strong {
  font-size: 1.35rem;
}

.card-foot span {
  color: var(--muted);
}

.detail-view {
  padding: 14px 0 34px;
}

.back-button {
  margin-bottom: 16px;
}

.detail-hero {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-gallery {
  display: grid;
  gap: 10px;
  padding: 10px;
}

#detailMainImage {
  width: 100%;
  min-height: 300px;
  max-height: 620px;
  border-radius: calc(var(--radius) - 3px);
  object-fit: cover;
  background: var(--petrol-soft);
}

.detail-thumbs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.thumb-button {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--surface);
}

.thumb-button.is-active {
  border-color: var(--champagne);
}

.thumb-button img {
  width: 100%;
  aspect-ratio: 1.45;
  object-fit: cover;
}

.detail-summary {
  display: grid;
  align-content: center;
  padding: 22px;
}

.detail-summary h2 {
  color: var(--petrol);
}

.price {
  display: block;
  margin: 14px 0;
  color: var(--petrol);
  font-size: clamp(1.55rem, 5vw, 2.55rem);
  line-height: 1.1;
}

.detail-actions {
  display: grid;
  gap: 10px;
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.snapshot-grid article {
  padding: 16px;
  border-color: rgba(217, 224, 232, 0.96);
}

.snapshot-grid span,
.spec-list dt,
.lead-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.snapshot-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--petrol);
  font-size: 1.16rem;
}

.detail-sections,
.contact-section {
  display: grid;
  gap: 18px;
}

.spec-card,
.finance-card,
.lead-form {
  padding: 18px;
}

.spec-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 14px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.spec-list div {
  padding: 13px;
  border-bottom: 1px solid var(--line);
}

.spec-list dd {
  margin: 4px 0 0;
  color: var(--petrol);
  font-weight: 700;
}

.finance-estimate {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.finance-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.finance-row strong {
  color: var(--petrol);
}

.contact-section {
  padding: 48px 0 70px;
  border-top: 1px solid rgba(217, 224, 232, 0.9);
}

.contact-card {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  padding: 16px;
}

.contact-card strong {
  color: var(--petrol);
}

.contact-card span {
  color: var(--muted);
}

.form-grid,
.drawer-actions,
.modal-actions {
  display: grid;
  gap: 12px;
}

.form-status {
  min-height: 24px;
  margin: 0;
}

.form-status[data-state="success"] {
  color: var(--petrol);
}

.form-status[data-state="error"] {
  color: var(--danger);
}

.admin-drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  justify-content: flex-end;
  background: rgba(16, 47, 53, 0.45);
}

.admin-drawer.is-open {
  display: flex;
}

.drawer-panel {
  width: min(820px, 100%);
  height: 100%;
  overflow: auto;
  padding: 20px;
  background: var(--paper);
  box-shadow: -18px 0 42px rgba(16, 47, 53, 0.17);
}

.drawer-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.admin-section {
  margin-bottom: 18px;
  padding: 18px;
}

.admin-form {
  display: grid;
  gap: 14px;
}

.lead-list {
  display: grid;
  gap: 10px;
}

.lead-item {
  padding: 14px;
}

.lead-item header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.lead-item p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.lead-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.lead-actions button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--petrol);
  background: var(--surface);
  font-weight: 700;
}

.lead-actions button[data-delete-lead] {
  color: var(--danger);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 47, 53, 0.5);
}

.modal[hidden] {
  display: none;
}

.modal-panel {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: var(--surface);
  box-shadow: 0 22px 58px rgba(16, 47, 53, 0.18);
}

.modal-panel h2 {
  margin-top: 12px;
}

.modal-panel p {
  color: var(--muted);
  line-height: 1.7;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
  width: min(360px, calc(100% - 36px));
  border: 1px solid rgba(29, 78, 216, 0.35);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--petrol);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 700;
}

.toast[hidden] {
  display: none;
}

.empty-note {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--muted);
  background: var(--surface);
  text-align: center;
}

@media (min-width: 700px) {
  .site-header {
    padding: 0 32px;
  }

  .site-header nav {
    display: flex;
  }

  .hero {
    grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.75fr);
    align-items: center;
    min-height: calc(100svh - 68px);
  }

  .hero-search {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .inventory-shell,
  .detail-view,
  .contact-section {
    width: min(1180px, calc(100% - 64px));
  }

  .filter-panel {
    grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
    align-items: end;
  }

  .car-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .car-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-actions,
  .form-grid,
  .drawer-actions,
  .modal-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-sections,
  .contact-section {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1020px) {
  .car-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .car-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .detail-hero {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
  }
}

@media (max-width: 560px) {
  .site-header {
    gap: 8px;
  }

  .brand {
    flex: 1 1 auto;
  }

  .site-header .ghost-button {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 12px;
  }

  .section-heading,
  .block-heading,
  .lead-item header {
    display: grid;
    align-items: start;
  }

  .primary-button,
  .ghost-button,
  .danger-button {
    width: 100%;
  }

  .snapshot-grid,
  .spec-list {
    grid-template-columns: 1fr;
  }

  .detail-thumbs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
