/* Jim.Breslin.ca — shared stylesheet.
   Look: shop-floor grey, tire-black nav, number-plate yellow for years, steel-blue links.
   Light and dark follow the visitor's device setting. Colours are tokens; change them here only. */

:root {
  --bg: #EEF0EF;
  --surface: #FFFFFF;
  --ink: #1A1D21;
  --muted: #5B636B;
  --line: #D2D7DA;
  --nav-bg: #1A1D21;
  --nav-fg: #EEF0EF;
  --plate: #F2C21B;
  --plate-ink: #141414;
  --steel: #2C5B86;
  --shadow: 0 10px 28px -18px rgba(0, 0, 0, .45);

  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --gutter: 20px;
  --max: 1120px;
  color-scheme: light;
}

/* Dark: a soft charcoal rather than black, so photos still pop without a hard edge. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #262B30;
    --surface: #30363C;
    --ink: #E9ECEE;
    --muted: #A9B2BA;
    --line: #444C53;
    --nav-bg: #1D2125;
    --nav-fg: #E9ECEE;
    --steel: #8DBCE6;
    --shadow: 0 10px 28px -18px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; height: auto; }
a { color: var(--steel); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--plate); outline-offset: 2px; }
/* Linked photos: a 2px link-blue edge on hover. Drawn as an inset outline so nothing shifts. */
a:hover img { outline: 2px solid var(--steel); outline-offset: -2px; }
p { margin: 0; }

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

h1, h2, h3 {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: .01em;
  line-height: 1.02;
  text-wrap: balance;
  margin: 0;
}
h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); font-weight: 900; }
h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; }
h3 { font-size: 1.3rem; font-weight: 800; }

.label {
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Number plate: years and dates, styled like a race number */
.plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--plate);
  color: var(--plate-ink);
  font-family: var(--display);
  font-weight: 900;
  font-size: 1rem;
  line-height: 1;
  padding: 5px 8px 4px;
  border: 2px solid var(--plate-ink);
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  white-space: nowrap;
}
.plate-lg { font-size: 1.5rem; padding: 7px 12px 5px; border-width: 3px; border-radius: 7px; }

/* ---------- Header / nav ---------- */
.site-nav { background: var(--nav-bg); color: var(--nav-fg); padding-top: env(safe-area-inset-top, 0px); }
.site-nav .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 14px;
}
.wordmark {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.6rem;
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: 1;
  color: var(--nav-fg);
  text-decoration: none;
}
.wordmark em { font-style: normal; color: var(--plate); }
.nav-links { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0; padding: 0; list-style: none; }
.nav-links a {
  color: var(--nav-fg);
  text-decoration: none;
  font-weight: 500;
  font-size: .95rem;
  opacity: .8;
  padding-block: 4px;
}
.nav-links a:hover { opacity: 1; }
.nav-links a[aria-current] { opacity: 1; box-shadow: inset 0 -2px 0 var(--plate); }

main { flex: 1; padding-block: 32px 48px; }
main > .container { display: flex; flex-direction: column; gap: 28px; }

/* ---------- Footer ---------- */
.site-foot { border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.site-foot .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 18px calc(18px + env(safe-area-inset-bottom, 0px));
}
.site-foot a { color: var(--muted); }

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: center; }
.hero-text { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; min-width: 0; }
.hero-text p { color: var(--muted); max-width: 46ch; font-size: 1.05rem; }
.hero { align-items: start; }

.old-logo { margin: 4px 0 0; display: flex; flex-direction: column; gap: 4px; width: 100%; max-width: 420px; }
.old-logo img { width: 100%; border-radius: 4px; border: 1px solid var(--line); display: block; }

/* Photo collage: wide shop photo on top, trials bike and back yard side by side below */
.hero-photos { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.hero-photos figure { margin: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hero-photos img {
  width: 100%;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
  display: block;
  box-shadow: var(--shadow);
  aspect-ratio: 2 / 3;
}
.hero-photos .hp-main { grid-column: 1 / -1; }
.hero-photos .hp-main img { aspect-ratio: 16 / 9; object-position: center 30%; }
.hero-photos figure:last-child img { aspect-ratio: 4 / 3; }
.hero-photos figure:nth-child(2) img { flex: 1; min-height: 0; aspect-ratio: auto; }

.group { display: flex; flex-direction: column; gap: 14px; }
.group-head { display: flex; align-items: baseline; gap: 12px; border-bottom: 2px solid var(--ink); padding-bottom: 6px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--ink);
}
.card:hover { border-color: var(--ink); }
.card-photo { position: relative; display: block; }
.card-photo img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; }
.card-photo .plate { position: absolute; left: 8px; bottom: 8px; font-size: .9rem; }
.card-text { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.card-text b { font-weight: 600; line-height: 1.3; }

/* ---------- Gallery ---------- */
.crumbs { font-family: var(--mono); font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.crumbs a { color: var(--muted); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 18px; }
.intro { max-width: 65ch; display: flex; flex-direction: column; gap: 10px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.thumbs a { display: block; border-radius: 3px; overflow: hidden; background: var(--line); }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; transition: transform .2s; }
.thumbs a:hover img { transform: scale(1.04); outline: none; }
/* the zoomed thumbnail is clipped at its edges, so the hover edge goes on the tile instead */
.thumbs a:hover { outline: 2px solid var(--steel); outline-offset: 0; }
.count { font-family: var(--mono); font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Single photo ---------- */
.photo { margin: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.photo img {
  max-height: 78vh;
  width: auto;
  border-radius: 4px;
  border: 1px solid var(--line);
  display: block;
  box-shadow: var(--shadow);
}
.photo figcaption { max-width: 70ch; text-align: center; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; max-width: 720px; margin: 0 auto; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 6px 14px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: .95rem;
  background: var(--surface);
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn[aria-disabled="true"] { visibility: hidden; }

/* ---------- Story pages ---------- */
.story { display: flex; flex-direction: column; gap: 28px; max-width: 980px; }
.story > h2 { border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-top: 16px; }
.story > p { max-width: 65ch; }
.story-fig { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.story-fig .row {
  display: flex;
  gap: 8px;
  /* rows never taller than ~560px: width is capped by the photos' combined shape */
  max-width: min(100%, calc(var(--rsum, 1) * var(--rowh, 560px)));
}
.story-fig .row a, .story-fig .row .pic { display: block; min-width: 0; border-radius: 3px; overflow: hidden; background: var(--line); }
.story-fig .row img { width: 100%; height: auto; display: block; }
.story-fig figcaption { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: 65ch; }
.story-fig .more { margin-top: 4px; }
.quote {
  margin: 0;
  padding: 4px 0 4px 20px;
  border-left: 4px solid var(--plate);
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 62ch;
  font-style: italic;
}
.story > .note { font-size: .88rem; color: var(--muted); }
.story > .cards { margin-top: 4px; }
.tracks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-width: 640px; }
.tracks li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 14px;
}
.track-title { font-weight: 600; }
.tracks audio { height: 36px; max-width: 100%; }
.quote footer { font-style: normal; font-family: var(--mono); font-size: .8rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }

/* ---------- Lightbox (galleries and story pages) ---------- */
.lightbox {
  border: 0;
  padding: 0;
  margin: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  background: rgba(14, 16, 18, .97);
  color: #E9ECEE;
  overflow: hidden;
}
.lightbox::backdrop { background: rgba(14, 16, 18, .6); }
.lightbox[open] { display: grid; grid-template-rows: auto 1fr; }
.lb-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
}
.lb-count { font-family: var(--mono); font-size: .85rem; letter-spacing: .05em; font-variant-numeric: tabular-nums; }
.lb-stage {
  margin: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 64px calc(20px + env(safe-area-inset-bottom, 0px));
}
.lb-stage img {
  max-width: 100%;
  max-height: calc(100dvh - 130px);
  width: auto;
  height: auto;
  border-radius: 3px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .8);
  transition: opacity .15s;
}
.lightbox.loading .lb-stage img { opacity: .35; }
.lb-stage figcaption { max-width: 70ch; text-align: center; font-size: .95rem; }
.lb-btn {
  font: inherit;
  color: #E9ECEE;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 4px;
  cursor: pointer;
}
.lb-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .18); }
.lb-btn:disabled { opacity: 0; pointer-events: none; }
.lb-close { padding: 6px 12px; font-size: .9rem; }
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 64px;
  font-size: 1.5rem;
}
.lb-prev { left: max(8px, env(safe-area-inset-left, 0px)); }
.lb-next { right: max(8px, env(safe-area-inset-right, 0px)); }

@media (max-width: 720px) {
  .lb-stage { padding-left: 8px; padding-right: 8px; }
  .lb-nav { top: auto; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); transform: none; width: 56px; height: 44px; }
  .lb-stage img { max-height: calc(100dvh - 160px); }
  .lb-close span { display: none; }
}

@media (max-width: 720px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .hero-photos { order: -1; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .thumbs { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .wordmark { font-size: 1.35rem; }
  .nav-links { gap: 2px 14px; }
  .nav-links a { font-size: .88rem; }
}

@media (prefers-reduced-motion: reduce) {
  .thumbs img { transition: none; }
  .thumbs a:hover img { transform: none; }
}

/* ---- Forum thread page (h2r/) ---- */
.year-jump { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.year-jump .label { margin-right: 4px; }
.year-jump a.plate { text-decoration: none; }
.year-jump a.plate:hover { background: var(--ink); color: var(--bg); }
.thread { display: flex; flex-direction: column; gap: 12px; max-width: 860px; }
.thread-page { border-bottom: 2px solid var(--ink); padding: 18px 0 6px; }
.thread-page:first-child { padding-top: 0; }
.post {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-margin-top: 16px;
}
.post-op { border-left: 5px solid var(--plate); }
.post:target { outline: 2px solid var(--steel); outline-offset: 2px; }
.post-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.post-author { font-weight: 600; }
.op-tag { background: var(--plate); color: var(--plate-ink); padding: 2px 6px; border-radius: 3px; margin-left: 4px; font-size: .68rem; }
.post-date { text-decoration: none; font-variant-numeric: tabular-nums; }
.post-date:hover { color: var(--steel); }
.post-body { line-height: 1.6; overflow-wrap: anywhere; }
.post-body blockquote {
  margin: 4px 0 8px;
  padding: 8px 12px;
  border-left: 4px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  font-size: .92rem;
  border-radius: 0 4px 4px 0;
}
.post-pic { display: inline-block; vertical-align: top; margin: 6px 6px 6px 0; max-width: 100%; border-radius: 3px; overflow: hidden; background: var(--line); }
.post-pic img { display: block; width: auto; max-width: 100%; max-height: 460px; height: auto; }
.pic-missing {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  vertical-align: top;
  width: 260px;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  margin: 6px 6px 6px 0;
  padding: 12px;
  border: 2px dashed var(--line);
  border-radius: 4px;
  color: var(--muted);
  text-align: center;
  line-height: 1.35;
}
.pic-missing-name { font-family: var(--mono); font-size: .8rem; color: var(--ink); overflow-wrap: anywhere; }
.pic-missing-host { font-size: .8rem; }
@media (max-width: 720px) {
  .post { padding: 12px 14px 14px; }
  .post-pic img { max-height: none; }
}
