/* Configurator page — builds on styles.css tokens */

.cfg-page main { padding-top: 140px; }

/* ---------- Intro ---------- */

.cfg-intro { padding: 0 var(--gutter) clamp(48px, 7vw, 96px); }

.cfg-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(56px, 9vw, 150px);
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.cfg-title em { color: var(--muted); }

/* Intro lines rise on load rather than on scroll: the page opens on them */
.cfg-title .line > span { animation: rise 1.2s var(--ease) both; }
.cfg-title .line + .line > span { animation-delay: 0.12s; }
@keyframes rise { from { transform: translateY(110%); } to { transform: none; } }

.cfg-lede { max-width: 52ch; margin: 32px 0 0; color: rgba(236, 232, 225, 0.75); }

.cfg-steps {
  list-style: none;
  display: flex;
  gap: clamp(20px, 4vw, 56px);
  margin: 56px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.cfg-steps li { display: flex; gap: 10px; transition: color 0.5s var(--ease); }
.cfg-steps li span { color: inherit; opacity: 0.6; }
.cfg-steps li.is-current { color: var(--text); }
.cfg-steps li.is-current span { color: var(--accent); opacity: 1; }
.cfg-steps li.is-done { color: rgba(236, 232, 225, 0.6); }

/* ---------- Step 1: worlds ---------- */

.cfg-worlds { padding: 0 var(--gutter) clamp(80px, 10vw, 140px); }

.world-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(12px, 1.4vw, 24px);
}

.world {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  aspect-ratio: 3 / 4;
  padding: 24px;
  overflow: hidden;
  border: 0;
  background: var(--ink-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.world img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
  transform: scale(1.06);
  transition: opacity 0.9s var(--ease), transform 1.4s var(--ease);
}
.world::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 60%);
}
.world > * { position: relative; z-index: 1; }
.world-index { font-size: 11px; letter-spacing: 0.22em; color: var(--muted); }
.world-name {
  margin: 8px 0 6px;
  font-family: var(--serif);
  font-size: clamp(40px, 4.4vw, 72px);
  line-height: 1;
}
.world-name b { font-weight: 400; font-style: italic; color: var(--accent); }
.world-count { font-size: 12px; letter-spacing: 0.08em; color: rgba(236, 232, 225, 0.7); }

.world:hover img,
.world:focus-visible img { opacity: 0.85; transform: scale(1); }
.world[aria-pressed="true"] img { opacity: 1; transform: scale(1); }
.world[aria-pressed="true"] { outline: 1px solid var(--text); outline-offset: -1px; }
.world:focus-visible { outline: 1px solid var(--text); outline-offset: 4px; }

/* scroll-linked entrance, same engine as the homepage */
.world {
  opacity: clamp(0, (var(--p, 1) - var(--d, 0)) * 2.2, 1);
  translate: 0 calc((1 - clamp(0, (var(--p, 1) - var(--d, 0)) * 2.2, 1)) * 48px);
}

/* ---------- Step 2: toolbar ---------- */

.cfg-results { padding: 0 var(--gutter) var(--section); scroll-margin-top: 24px; }

.cfg-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 calc(var(--gutter) * -1) 40px;
  padding: 88px var(--gutter) 24px;
  background: linear-gradient(to bottom, var(--ink) 82%, rgba(11, 11, 11, 0));
}
.cfg-toolbar-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.cfg-toolbar-head .eyebrow { margin: 0; }
.cfg-toolbar .section-title { font-size: clamp(36px, 4.4vw, 64px); }

.filters { display: grid; grid-template-columns: 1.6fr 1.2fr auto; gap: 32px; align-items: start; }
.filter-label {
  margin: 0 0 12px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: rgba(236, 232, 225, 0.8);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 0.3s, background-color 0.3s, color 0.3s;
}
.chip:hover { border-color: rgba(236, 232, 225, 0.5); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--ink); }
.chip:disabled { opacity: 0.3; cursor: default; }

.filter-sort select,
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  border-radius: 0;
}
.filter-sort select { min-width: 200px; cursor: pointer; }
select option { background: var(--ink); color: var(--text); }
.field input:focus,
.field select:focus,
.field textarea:focus,
.filter-sort select:focus { outline: none; border-bottom-color: var(--text); }

/* ---------- Results ---------- */

.car-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(32px, 4vw, 56px) clamp(16px, 2vw, 32px);
}

.car {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
  animation: card-in 0.9s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 50ms);
}
@keyframes card-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.car-media { aspect-ratio: 4 / 3; overflow: hidden; background: var(--ink-2); }
.car-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.car:hover .car-media img,
.car:focus-visible .car-media img { transform: scale(1.04); }
.car:focus-visible { outline: 1px solid var(--text); outline-offset: 6px; }

.car-meta { display: flex; justify-content: space-between; gap: 16px; margin: 20px 0 6px; font-size: 10px; font-weight: 500; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); }
.car-name { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(24px, 2vw, 30px); line-height: 1.1; }
.car-specs { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.car-price { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; letter-spacing: 0.04em; }
.car-price small { color: var(--muted); font-size: 11px; }

.cfg-empty { max-width: 52ch; color: var(--muted); }

/* ---------- Step 3: drawer ---------- */

.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer[hidden] { display: none; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); animation: fade 0.5s var(--ease) both; }
.drawer-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(640px, 100%);
  overflow-y: auto;
  background: var(--ink);
  border-left: 1px solid var(--line);
  animation: slide 0.8s var(--ease) both;
}
.drawer.is-closing .drawer-scrim { animation: fade 0.4s var(--ease) reverse both; }
.drawer.is-closing .drawer-panel { animation: slide 0.5s var(--ease) reverse both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide { from { transform: translateX(100%); } to { transform: none; } }

.drawer-close {
  position: absolute;
  top: 20px; right: 20px;
  z-index: 2;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.drawer-media { margin: 0; aspect-ratio: 4 / 3; overflow: hidden; }
.drawer-media img { width: 100%; height: 100%; object-fit: cover; }
.drawer-body { padding: 40px clamp(20px, 4vw, 48px) 56px; }
.drawer-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(36px, 4vw, 56px); line-height: 1.02; }
.drawer-price { margin: 16px 0 0; font-size: 18px; letter-spacing: 0.04em; }
.drawer-price small { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }

.specs { display: grid; grid-template-columns: repeat(3, 1fr); margin: 32px 0 40px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.specs div { padding: 16px 0; }
.specs div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.specs dt { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.specs dd { margin: 6px 0 0; font-size: 14px; }

.enquiry { display: grid; gap: 20px; margin-bottom: 32px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field { display: grid; gap: 2px; }
.field span { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.field textarea { resize: vertical; }
.field.is-invalid input { border-bottom-color: var(--accent); }

.btn { background: none; color: var(--text); font-family: inherit; cursor: pointer; }
.btn-solid { justify-self: start; background: var(--text); color: var(--ink); }
.btn-solid:hover { background: transparent; color: var(--text); }
.form-note { margin: 0; min-height: 1.4em; font-size: 13px; color: var(--muted); }
.form-note.is-ok { color: var(--text); }

.cfg-footer { padding-top: 0; }

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

@media (max-width: 960px) {
  .world-grid { grid-template-columns: repeat(2, 1fr); }
  .world { aspect-ratio: 4 / 5; }
  .filters { grid-template-columns: 1fr; gap: 20px; }
  .car-grid { grid-template-columns: repeat(2, 1fr); }
  .cfg-toolbar { position: static; padding-top: 24px; background: none; }
}

@media (max-width: 560px) {
  .cfg-page main { padding-top: 112px; }
  .world-grid { gap: 10px; }
  .world { padding: 16px; }
  .car-grid { grid-template-columns: 1fr; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin-right: calc(var(--gutter) * -1); padding-right: var(--gutter); scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .field-row { grid-template-columns: 1fr; }
  .specs { grid-template-columns: 1fr; }
  .specs div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
}
