/* V-Twin Lab homepage styles. Tokens live in tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--vt-bg);
  color: var(--vt-text);
  font-family: var(--vt-font-body);
  font-size: var(--vt-size-body);
  line-height: var(--vt-line-body);
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--vt-font-display); font-weight: var(--vt-weight-display); line-height: 1.05; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--vt-focus); outline-offset: 3px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; stroke-width: 2; }
.wrap { width: 100%; max-width: var(--vt-max-content); margin-inline: auto; padding-inline: var(--vt-gutter); }

.skip-link {
  position: absolute; left: var(--vt-space-4); top: -100px; z-index: 100;
  background: var(--vt-copper); color: var(--vt-on-copper); font-weight: 600;
  padding: var(--vt-space-3) var(--vt-space-4); border-radius: var(--vt-radius-control); text-decoration: none;
}
.skip-link:focus { top: var(--vt-space-4); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--vt-space-3);
  min-height: var(--vt-control-min-height); padding: 0 var(--vt-space-5);
  border: 2px solid transparent; border-radius: var(--vt-radius-control);
  font-weight: var(--vt-weight-control); text-decoration: none; cursor: pointer;
  transition: background-color var(--vt-transition), border-color var(--vt-transition), color var(--vt-transition);
}
.btn-primary {
  background: var(--vt-copper); color: var(--vt-on-copper);
  font-family: var(--vt-font-display); font-weight: 700; font-size: 1.375rem; min-height: 3.5rem; padding: 0 var(--vt-space-6);
}
.btn-primary:hover { background: var(--vt-copper-hover); }
.btn-primary:active { background: #c96a1f; }
.btn-outline { border-color: var(--vt-copper); color: var(--vt-copper); background: transparent; }
.btn-outline:hover { background: rgb(216 119 41 / 0.12); color: var(--vt-copper-hover); border-color: var(--vt-copper-hover); }
.btn-quiet { border-color: var(--vt-border); color: var(--vt-text); background: transparent; }
.btn-quiet:hover { border-color: var(--vt-text-muted); }
.btn-text { padding: 0 var(--vt-space-2); color: var(--vt-text-muted); background: none; }
.btn-text:hover { color: var(--vt-text); }

/* ---------- Header ---------- */
.site-header { position: relative; z-index: 20; background: var(--vt-bg); border-bottom: 1px solid var(--vt-border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--vt-space-5); min-height: 4.75rem; }
.brand { display: inline-flex; align-items: center; min-height: var(--vt-control-min-height); border-radius: var(--vt-radius-control); }
.brand img { width: auto; height: 2.75rem; aspect-ratio: 640 / 129; }
.nav-list { display: flex; align-items: center; gap: var(--vt-space-6); list-style: none; margin: 0; padding: 0; }
.nav-link {
  display: inline-flex; align-items: center; min-height: var(--vt-control-min-height); padding: 0 var(--vt-space-1);
  color: var(--vt-text); text-decoration: none; font-weight: 500; font-size: 1.0625rem;
  background: none; border: 0; cursor: pointer; border-bottom: 2px solid transparent;
}
.nav-link:hover { border-bottom-color: var(--vt-copper); }
.nav-cta { margin-left: var(--vt-space-3); padding: 0 var(--vt-space-6); }
.menu-toggle {
  display: none; align-items: center; justify-content: center; gap: var(--vt-space-2);
  min-width: var(--vt-control-min-height); min-height: var(--vt-control-min-height); padding: 0 var(--vt-space-3);
  background: transparent; border: 1px solid var(--vt-border); border-radius: var(--vt-radius-control); cursor: pointer;
}
.menu-toggle .icon-close { display: none; }
.menu-toggle[aria-expanded="true"] .icon-open { display: none; }
.menu-toggle[aria-expanded="true"] .icon-close { display: block; }

@media (max-width: 760px) {
  .header-inner { min-height: 4rem; }
  .brand img { height: 2.25rem; }
  .menu-toggle { display: inline-flex; }
  .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--vt-bg); border-bottom: 1px solid var(--vt-border); padding: var(--vt-space-2) var(--vt-gutter) var(--vt-space-5);
  }
  .site-nav.is-open { display: block; }
  .nav-list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav-link { width: 100%; min-height: 3.25rem; border-bottom: 1px solid var(--vt-border); font-size: 1.125rem; }
  .nav-link:hover { border-bottom-color: var(--vt-border); color: var(--vt-copper-hover); }
  .nav-cta { margin: var(--vt-space-4) 0 0; width: 100%; min-height: 3.25rem; }
}

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--vt-border); background: var(--vt-bg); }
.hero-media { position: absolute; top: 0; right: 0; bottom: 0; width: min(100%, 76rem); }
.hero-media img {
  width: 100%; height: 100%; object-fit: cover; object-position: 62% 70%;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 28%);
          mask-image: linear-gradient(90deg, transparent 0%, #000 28%);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgb(18 20 22 / 0.96) 0%, rgb(18 20 22 / 0.86) 26%, rgb(18 20 22 / 0.35) 50%, rgb(18 20 22 / 0) 68%);
}
.hero-content { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; min-height: 30rem; padding-block: var(--vt-space-8); }
.hero h1 { font-size: var(--vt-size-hero); line-height: var(--vt-line-display); letter-spacing: -0.005em; text-transform: uppercase; }
.hero h1 span { display: block; }
.hero-lede { margin-top: var(--vt-space-4); font-size: clamp(1.125rem, 1.7vw, 1.5rem); max-width: 42ch; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--vt-space-5) var(--vt-space-6); margin-top: var(--vt-space-6); }
.link-arrow {
  display: inline-flex; align-items: center; gap: var(--vt-space-2); min-height: var(--vt-control-min-height);
  font-size: 1.125rem; font-weight: 500; text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer;
  border-bottom: 2px solid var(--vt-copper);
}
.link-arrow .icon { color: var(--vt-copper); transition: transform var(--vt-transition); }
.link-arrow:hover .icon { transform: translateX(3px); }

@media (max-width: 760px) {
  .hero-media { position: relative; width: 100%; aspect-ratio: 16 / 10; }
  .hero-media img { object-position: 72% 60%; -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent 100%); mask-image: linear-gradient(180deg, #000 70%, transparent 100%); }
  .hero::after { display: none; }
  .hero-content { min-height: 0; padding-block: var(--vt-space-4) var(--vt-space-7); }
  .hero-actions .btn-primary { width: 100%; }
}

/* ---------- Tool directory ---------- */
.tools { padding-block: var(--vt-space-7) var(--vt-space-6); scroll-margin-top: var(--vt-space-4); }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--vt-space-4) var(--vt-space-6); margin-bottom: var(--vt-space-5); }
.section-head h2, .garage h2 { font-size: var(--vt-size-section); }
.search { position: relative; flex: 0 1 30.5rem; width: 100%; }
.search .icon-search { position: absolute; left: var(--vt-space-4); top: 50%; transform: translateY(-50%); color: var(--vt-text-muted); pointer-events: none; }
.search input {
  width: 100%; min-height: 2.875rem; padding: 0 3rem 0 3rem;
  background: var(--vt-bg); border: 1px solid var(--vt-border); border-radius: var(--vt-radius-control); font-size: 1rem;
}
.search input::placeholder { color: var(--vt-text-muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search input:hover { border-color: #4a535c; }
.search-clear {
  position: absolute; right: 1px; top: 1px; bottom: 1px; width: 2.875rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: var(--vt-radius-control); color: var(--vt-text-muted); cursor: pointer;
}
.search-clear:hover { color: var(--vt-text); }
.search-clear[hidden] { display: none; }

.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--vt-space-5); list-style: none; margin: 0; padding: 0; }
.tool-grid > li { display: flex; min-width: 0; }
.tool-grid > li.is-featured { grid-column: 1 / -1; }
@media (max-width: 1023px) { .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) { .tool-grid { grid-template-columns: minmax(0, 1fr); gap: var(--vt-space-4); } }

.tool-card {
  position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto 1fr auto; column-gap: var(--vt-space-4);
  width: 100%; min-height: 8rem; padding: var(--vt-card-padding);
  background: var(--vt-surface); border: 1px solid var(--vt-border); border-radius: var(--vt-radius-panel);
  transition: border-color var(--vt-transition), background-color var(--vt-transition);
}
.tool-card:hover { border-color: var(--vt-copper); background: var(--vt-surface-raised); }
.tool-card:focus-within { border-color: var(--vt-copper); }
.tool-icon { grid-row: 1 / span 3; align-self: start; width: 3rem; height: 3rem; color: var(--vt-copper); stroke-width: 1.5; }
.tool-card h3 { font-size: 1.375rem; font-weight: 700; line-height: 1.15; }
.tool-card .card-action {
  background: none; border: 0; padding: 0; margin: 0; text-align: left; text-decoration: none; cursor: pointer;
  font: inherit; color: inherit;
}
/* Stretch the heading's action over the whole card so the entire card is clickable */
.tool-card .card-action::after { content: ""; position: absolute; inset: 0; border-radius: var(--vt-radius-panel); }
.tool-card .card-action:focus-visible { outline: none; }
.tool-card .card-action:focus-visible::after { outline: 3px solid var(--vt-focus); outline-offset: 3px; }
.tool-card h3, .tool-desc, .tool-foot { grid-column: 2; }
.tool-card h3 { grid-row: 1; } .tool-desc { grid-row: 2; } .tool-foot { grid-row: 3; }
.tool-desc { margin-top: var(--vt-space-1); color: var(--vt-text-muted); }
.tool-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--vt-space-3); margin-top: var(--vt-space-4); }
.tool-status { white-space: nowrap; font-size: 0.875rem; font-weight: 600; color: var(--vt-text-muted); border: 1px solid var(--vt-border); border-radius: 4px; padding: 0.125rem 0.5rem; }
.tool-status.is-live { color: var(--vt-on-copper); background: var(--vt-copper); border-color: var(--vt-copper); }
.tool-arrow { color: var(--vt-copper); transition: transform var(--vt-transition); }
.tool-card:hover .tool-arrow { transform: translateX(3px); }

.tool-card.is-featured { grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; align-items: center; min-height: 0; padding-block: var(--vt-space-5); }
.tool-card.is-featured .tool-icon { grid-row: 1 / span 2; align-self: center; }
.tool-card.is-featured .tool-foot { grid-column: 3; grid-row: 1 / span 2; margin: 0; gap: var(--vt-space-4); }
.foot-action { white-space: nowrap; display: inline-flex; align-items: center; gap: var(--vt-space-2); }
.open-label { font-weight: 600; color: var(--vt-copper); }
@media (max-width: 639px) {
  .tool-card.is-featured { grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; }
  .tool-card.is-featured .tool-icon { grid-row: 1 / span 3; align-self: start; }
  .tool-card.is-featured .tool-foot { grid-column: 2; grid-row: 3; margin-top: var(--vt-space-4); }
}
.no-results { margin-top: var(--vt-space-4); padding: var(--vt-space-5); border: 1px dashed var(--vt-border); border-radius: var(--vt-radius-panel); color: var(--vt-text-muted); }

/* ---------- Garage ---------- */
.garage-section { padding-block: var(--vt-space-4) var(--vt-space-8); }
.garage {
  position: relative; overflow: hidden; scroll-margin-top: var(--vt-space-4);
  background: #15181b; border: 1px solid var(--vt-border); border-radius: var(--vt-radius-panel);
}
.garage-media { position: absolute; top: 0; right: 0; bottom: 0; width: 68%; }
.garage-media img {
  width: 100%; height: 100%; object-fit: cover; object-position: 70% 45%;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 40%);
          mask-image: linear-gradient(90deg, transparent 0%, #000 40%);
}
.garage-body { position: relative; z-index: 1; max-width: 42rem; padding: var(--vt-space-7) var(--vt-space-7) var(--vt-space-7); }
.garage-lede { margin-top: var(--vt-space-2); font-size: clamp(1.125rem, 1.5vw, 1.375rem); }
.garage-form { margin-top: var(--vt-space-6); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--vt-space-4); }
.field label { display: block; margin-bottom: var(--vt-space-2); font-weight: 600; font-size: 0.9375rem; }
.field select, .field input {
  width: 100%; min-height: 2.875rem; padding: 0 var(--vt-space-4);
  background: rgb(18 20 22 / 0.88); border: 1px solid #535c65; border-radius: var(--vt-radius-control);
}
.field select {
  appearance: none; -webkit-appearance: none; padding-right: 2.75rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23F2EFE6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.875rem center;
}
.field select option { background: var(--vt-surface); color: var(--vt-text); }
.field input::placeholder { color: var(--vt-text-muted); }
.field select:hover, .field input:hover { border-color: var(--vt-text-muted); }
.field [aria-invalid="true"] { border-color: var(--vt-error); }
.field-error { margin-top: var(--vt-space-2); color: var(--vt-error); font-size: 0.9375rem; font-weight: 500; }
.field-error:empty { display: none; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--vt-space-4); margin-top: var(--vt-space-5); }
.form-actions .btn-primary { min-width: 16rem; }
.form-note { margin-top: var(--vt-space-4); color: var(--vt-text-muted); font-size: 0.9375rem; }

.saved-bike { margin-top: var(--vt-space-6); }
.saved-card {
  display: flex; flex-direction: column; gap: var(--vt-space-2); padding: var(--vt-space-5);
  background: rgb(30 35 40 / 0.92); border: 1px solid var(--vt-border); border-radius: var(--vt-radius-panel); max-width: 34rem;
}
.saved-label { color: var(--vt-text-muted); font-weight: 600; font-size: 0.9375rem; }
.saved-name { font-family: var(--vt-font-display); font-weight: 700; font-size: clamp(1.75rem, 3vw, 2.25rem); line-height: 1.1; overflow-wrap: anywhere; }
.saved-actions { display: flex; flex-wrap: wrap; gap: var(--vt-space-3); margin-top: var(--vt-space-3); }
.status-msg { margin-top: var(--vt-space-4); font-weight: 500; }
.status-msg.is-warning { color: var(--vt-error); }
.status-msg:empty { display: none; }

@media (max-width: 900px) {
  .garage-media { position: relative; width: 100%; aspect-ratio: 21 / 9; }
  .garage-media img { object-position: 70% 50%; -webkit-mask-image: linear-gradient(180deg, #000 65%, transparent 100%); mask-image: linear-gradient(180deg, #000 65%, transparent 100%); }
  .garage-body { max-width: none; padding: 0 var(--vt-space-5) var(--vt-space-6); margin-top: calc(var(--vt-space-6) * -1); }
}
@media (max-width: 560px) {
  .garage-media { aspect-ratio: 16 / 9; }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .form-actions .btn-primary, .form-actions .btn { width: 100%; min-width: 0; }
  .saved-actions .btn { flex: 1 1 auto; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--vt-border); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--vt-space-4); min-height: 4.5rem; padding-block: var(--vt-space-4); }
.footer-brand img { width: auto; height: 1.875rem; aspect-ratio: 640 / 129; }
.footer-link { color: var(--vt-text-muted); text-decoration: none; display: inline-flex; align-items: center; min-height: var(--vt-control-min-height); }
.footer-link:hover { color: var(--vt-text); text-decoration: underline; }

/* ---------- Dialog ---------- */
.info-dialog {
  width: min(30rem, calc(100vw - 2.5rem)); padding: 0; color: var(--vt-text);
  background: var(--vt-surface); border: 1px solid var(--vt-border); border-radius: var(--vt-radius-panel);
  box-shadow: 0 1.5rem 3rem rgb(0 0 0 / 0.5);
}
.info-dialog::backdrop { background: rgb(8 9 10 / 0.72); }
.dialog-inner { position: relative; padding: var(--vt-space-6); }
.dialog-inner h2 { font-size: 2rem; padding-right: var(--vt-space-7); }
.dialog-desc { margin-top: var(--vt-space-2); color: var(--vt-text-muted); font-size: 1.0625rem; }
.dialog-status { margin-top: var(--vt-space-4); font-size: 1.0625rem; }
.dialog-close {
  position: absolute; top: var(--vt-space-4); right: var(--vt-space-4);
  display: inline-flex; align-items: center; justify-content: center; width: var(--vt-control-min-height); height: var(--vt-control-min-height);
  background: none; border: 1px solid var(--vt-border); border-radius: var(--vt-radius-control); cursor: pointer;
}
.dialog-close:hover { border-color: var(--vt-text-muted); }
.dialog-actions { margin-top: var(--vt-space-6); }
