/* =========================================================
   COLOURS & GRADIENTS
   Gradients are shown on a tile/banner when it has no photo.
   ========================================================= */
:root {
  --bg: #151515;
  --ink: #f2f2f2;      /* main text */
  --muted: #b4b4b4;    /* menu / secondary text */
  --line: #333;
  --accent: #8fb5ad;   /* circle + hover colour */

  --fog:  linear-gradient(180deg, #e6e8ea 0%, #c9ced2 40%, #6c757b 65%, #1f262b 100%);
  --sand: linear-gradient(180deg, #e4e5e6 0%, #b9a48d 45%, #c98f57 70%, #5a3d27 100%);
  --dusk: linear-gradient(180deg, #e9e7e6 0%, #a79b93 45%, #8a6a4c 70%, #2b2622 100%);
  --sea:  linear-gradient(180deg, #d7e0e5 0%, #9fb3bd 45%, #5f7480 70%, #26343c 100%);
  --rock: linear-gradient(180deg, #cfd6da 0%, #8f9da4 45%, #55666d 75%, #1f2a2f 100%);
  --lake: linear-gradient(180deg, #a99988 0%, #7f8b8f 45%, #4d5b60 75%, #232d31 100%);
}
.fog  { background: var(--fog); }
.sand { background: var(--sand); }
.dusk { background: var(--dusk); }
.sea  { background: var(--sea); }
.rock { background: var(--rock); }
.lake { background: var(--lake); }

/* =========================================================
   BASE
   ========================================================= */
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Poppins, system-ui, sans-serif;
  font-weight: 300;
  line-height: 1.7;
}
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* =========================================================
   HERO (top intro)
   ========================================================= */
.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 40vh;
  padding: 3.2rem 1.5rem 0;
}
/* Cover photo behind the hero text (anchored to the bottom of the photo) */
.hero { position: relative; isolation: isolate; min-height: 55vh; padding-bottom: 3.2rem; }
.hero-bg {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center bottom;
}
.hero::after {                  /* dark tint so the text stays readable */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(21,21,21,.55) 0%, rgba(21,21,21,.6) 70%, rgba(21,21,21,.85) 100%);
}
.hero h1, .hero p { text-shadow: 0 2px 8px rgba(0,0,0,.6); }
.hero h1 {
  margin: 0 0 1rem;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: .03em;
  line-height: 1.15;
}
.hero p {
  max-width: 40rem;
  margin: 0;
  font-size: 14px;
  letter-spacing: .06em;
  line-height: 1.9;
  text-transform: uppercase;
}

/* =========================================================
   PAGE LAYOUT: menu (left) + content (right) + contact
   ========================================================= */
.layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-areas: "nav main" "contact main";
  grid-template-rows: auto 1fr;
  gap: 3rem;
}
main { grid-area: main; min-width: 0; }

/* ---------- Side menu ---------- */
.side { grid-area: nav; }
.side a {
  display: block;
  padding: .35rem 0;
  font-size: 12px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--muted);
}
.side a:hover { color: var(--ink); }
.side .label {
  margin: 1.75rem 0 .5rem;
  font-size: 10px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: .7;
}
.side .sub { list-style: none; margin: .15rem 0 .65rem 1rem; padding: 0; color: var(--muted); line-height: 1.65; }
.side .sub li { position: relative; padding-left: 1rem; }
.side .sub li::before { content: "•"; position: absolute; left: 0; }
.side .sub a { padding: .1rem 0; font-size: 11px; letter-spacing: .08em; text-transform: none; }

/* ---------- Contact (bottom of left column) ---------- */
.contact {
  grid-area: contact;
  align-self: end;
  justify-self: center;
  display: flex;
  gap: .8rem;
  align-items: center;
}
.mono {
  flex: none;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border: 1px solid var(--accent);
  border-radius: 50%;
  font-size: 26px;
}
.contact ul { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.contact a:hover { color: var(--accent); }

/* =========================================================
   TILES (homepage grid + engine models grid)
   ========================================================= */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.75rem; }
.sub-grid { margin-top: 2.5rem; }
.tile {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 3 / 4;
  padding: 1.25rem;
  overflow: hidden;
  text-align: center;
  color: #fff;
}
.tile img {                     /* photo fills the tile */
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.tile::before {                 /* dark tint over the photo */
  content: "";
  position: absolute; inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, .4);
  transition: background .25s;
}
.tile:hover::before, .tile:focus-visible::before { background: rgba(0, 0, 0, .6); }
.tile strong {
  position: relative; z-index: 2;
  padding-left: .28em;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: .28em;
  line-height: 1.4;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0,0,0,.9), 0 0 12px rgba(0,0,0,.7);
}

/* =========================================================
   PROJECT PAGES
   ========================================================= */
.back {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 12px;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--muted);
}
.back:hover { color: var(--ink); }
.banner {
  position: relative;
  display: flex; justify-content: center; align-items: center;
  min-height: 16rem;
  margin-bottom: 2rem;
  padding: 2rem 1.5rem;
  text-align: center;
  color: #fff;
}
.banner::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.2), rgba(0,0,0,.55));
}
.banner h2 {
  position: relative;
  margin: 0;
  padding-left: .25em;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: .25em;
  line-height: 1.3;
  text-transform: uppercase;
}
.detail { max-width: 42rem; }
.detail p { font-size: 16px; }
.shot {                          /* project photo box */
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  margin: 2rem 0;
  display: grid; place-items: center;
  border: 1px dashed var(--line);
  font-size: 14px;
  color: var(--muted);
}
.shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* =========================================================
   PAGE SWITCHING (no JavaScript needed)
   Each project is an <article id="...">. A link to "#that-id"
   shows it and hides the homepage. The browser Back button
   works automatically.
   ========================================================= */
.project { display: none; }
.project:target { display: block; }
body:has(.project:target) .home { display: none; }

/* Highlight the menu item of the page you are on */
body:not(:has(.project:target)) .side a[href="#"],
body:has(#racing-short-block:target)  .side a[href="#racing-short-block"],
body:has(#high-performance:target)    .side a[href="#high-performance"],
body:has(#efi-conversion:target)      .side a[href="#efi-conversion"],
body:has(#turbo-conversion:target)    .side a[href="#turbo-conversion"],
body:has(#product-design:target)      .side a[href="#product-design"],
body:has(#ecu-tuning:target)          .side a[href="#ecu-tuning"],
body:has(#engine-rebuilds:target)     .side a[href="#engine-rebuilds"],
body:has(#honda-crm250:target)        .side a[href="#honda-crm250"],
body:has(#husqvarna-te610:target)     .side a[href="#husqvarna-te610"],
body:has(#suzuki-drz400:target)       .side a[href="#suzuki-drz400"],
body:has(#suzuki-gsxr1000:target)     .side a[href="#suzuki-gsxr1000"],
body:has(#yamaha-t135:target)         .side a[href="#yamaha-t135"],
body:has(#yamaha-wr426f:target)       .side a[href="#yamaha-wr426f"],
body:has(#fork-rebuild:target)        .side a[href="#fork-rebuild"],
body:has(#printing-3d:target)         .side a[href="#printing-3d"] { color: var(--ink); }

/* =========================================================
   SMALLER SCREENS
   ========================================================= */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .hero { min-height: 45vh; padding-bottom: 2rem; }
  .layout {
    margin-top: 0;
    padding-top: .6rem;
    grid-template-columns: 1fr;
    grid-template-areas: "nav" "main" "contact";
    gap: 2.5rem;
  }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
  .tile { aspect-ratio: 4 / 5; }
}
