* {
  box-sizing: border-box;
}

:root {
  --bg: #d4d3cf;
  --text: #161616;
  --muted: #747168;
  --rule: #cbc7ba;
  --hover: #dfdbcf;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 15px;
  line-height: 1.7;
}

::selection {
  background: var(--text);
  color: var(--bg);
}

.page {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 72px 0 48px;
}

.page.wide {
  width: min(1080px, calc(100% - 40px));
}

.site-header {
  margin-bottom: 42px;
}

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

h1 {
  margin-bottom: 8px;
  font-size: 1rem;
  font-weight: 600;
}

h2 {
  margin-bottom: 14px;
  font-size: 0.95rem;
  font-weight: 600;
}

.tagline,
.muted,
.note {
  color: var(--muted);
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

a:hover,
a:focus-visible {
  background: var(--hover);
  outline: none;
}

.tree {
  margin: 24px 0 48px;
  white-space: nowrap;
}

.tree div {
  min-height: 1.7em;
}

.section {
  margin-top: 58px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}

.entries {
  display: grid;
  gap: 8px;
}

.entry {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  padding: 4px 6px;
  margin-left: -6px;
  text-decoration: none;
}

.date {
  color: var(--muted);
}

.back {
  margin-bottom: 44px;
}

.prose {
  max-width: 650px;
}

.prose p {
  margin-bottom: 22px;
}

.photo-section {
  margin-top: 54px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 20px;
}

.section-heading span {
  color: var(--muted);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px 18px;
}

figure {
  margin: 0;
}

.placeholder-box {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  color: var(--muted);
  background:
    linear-gradient(to bottom right, transparent 49.5%, var(--rule) 50%, transparent 50.5%),
    linear-gradient(to top right, transparent 49.5%, var(--rule) 50%, transparent 50.5%);
}

figcaption {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.85rem;
}

code {
  font-family: inherit;
  background: var(--hover);
  padding: 1px 4px;
}

footer {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 72px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 700px) {
  body {
    font-size: 14px;
  }

  .page,
  .page.wide {
    width: min(100% - 28px, 760px);
    padding-top: 42px;
  }

  .tree {
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .entry {
    grid-template-columns: 95px 1fr;
    gap: 10px;
  }

  .photo-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    display: block;
  }
}

.more-link {
  margin-top: 18px;
}

.log-year {
  margin-top: 54px;
}

.log-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 24px;
  padding: 22px 0;
  border-top: 1px solid var(--rule);
}

.log-item h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 500;
}

.log-date {
  color: var(--muted);
}

.log-photo-placeholder {
  margin-top: 14px;
  width: min(100%, 520px);
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  color: var(--muted);
}

@media (max-width: 700px) {
  .log-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.photo-grid img {
  width: 100%;
  height: auto;
  display: block;
}

.photo-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  font: inherit;
}

.collection-link {
  margin-top: 26px;
}

.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.94);
  z-index: 9999;
}

.lightbox.is-open {
  display: flex;
}

.lightbox-figure {
  margin: 0;
  max-width: min(92vw, 1600px);
  max-height: 92vh;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.lightbox img {
  max-width: 92vw;
  max-height: 86vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.lightbox figcaption {
  color: #d4d3cf;
  text-align: center;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: fixed;
  border: 0;
  background: transparent;
  color: #d4d3cf;
  font: inherit;
  cursor: pointer;
  z-index: 10000;
}

.lightbox-close {
  top: 18px;
  right: 22px;
  font-size: 2rem;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
}

.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }

@media (max-width: 700px) {
  .lightbox-prev,
  .lightbox-next {
    display: none;
  }
}

.photo-category-link {
  margin: 28px 0 46px;
}

.collection-block {
  margin-top: 54px;
}

.collection-block h2 {
  margin-bottom: 14px;
}

.collection-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.collection-preview-photo {
  display: block;
  text-decoration: none;
}

.collection-preview-photo img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border: 1px solid var(--rule);
}

.collection-preview-photo span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 700px) {
  .collection-preview-grid {
    grid-template-columns: 1fr;
  }
}

.year-section {
  margin-top: 58px;
}

.year-heading {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 28px;
}

.collection-block {
  margin-top: 38px;
}

.collection-block h2 {
  margin-bottom: 14px;
}

.section-title-link {
  display: inline-block;
  color: inherit;
  text-decoration: none;
  padding: 2px 5px;
  margin-left: -5px;
}

.section-title-link:hover,
.section-title-link:focus-visible {
  background: var(--hover);
  text-decoration: none;
}

.preview-photo-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.preview-photo-link:hover,
.preview-photo-link:focus-visible {
  background: transparent;
}

.preview-photo-link figure {
  margin: 0;
}

.collection-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.collection-preview-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border: 1px solid var(--rule);
}

.collection-preview-grid figcaption {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.85rem;
}

.cars-section {
  margin-top: 58px;
}

.cars-section > h2 {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 20px;
}

@media (max-width: 700px) {
  .collection-preview-grid {
    grid-template-columns: 1fr;
  }
}


.photo-compendia {
  margin: 24px 0 52px;
}

.country-section {
  margin-top: 62px;
}

.country-heading {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 30px;
}

.place-section {
  margin-top: 42px;
}

.place-section h3 {
  margin: 0 0 18px;
  font-size: 0.95rem;
  font-weight: 500;
}

.place-section h3 .muted {
  font-weight: 400;
  margin-left: 8px;
}



.photo-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  color: var(--muted);
  background:
    linear-gradient(to bottom right, transparent 49.7%, var(--rule) 50%, transparent 50.3%),
    linear-gradient(to top right, transparent 49.7%, var(--rule) 50%, transparent 50.3%);
  font-size: 0.8rem;
}

.collection-preview-grid .photo-placeholder {
  aspect-ratio: 4 / 3;
}

/* Featured gallery photos span two columns on larger screens. */
.photo-grid > .photo-wide {
  grid-column: span 2;
  min-width: 0;
}

@media (max-width: 700px) {
  .photo-grid > .photo-wide {
    grid-column: span 1;
  }
}

/* Explicit Autoshow panel positions preserve the numbered reading order. */
.photo-grid > .photo-positioned {
  grid-column: var(--photo-column) / span var(--photo-columns);
  grid-row: var(--photo-row) / span var(--photo-rows);
  min-width: 0;
}

@media (max-width: 700px) {
  .photo-grid > .photo-positioned {
    grid-column: auto;
    grid-row: auto;
  }
}

/* Keep Autoshow single and double-width panels at the same image height. */
.photo-grid[data-gallery-secondary="cars.torontoAutoshow"] {
  container-type: inline-size;
}

@media (min-width: 701px) {
  .photo-positioned > .photo-button {
    height: calc((100cqw - 36px) / 4);
  }

  .photo-positioned > .photo-button > img {
    height: 100%;
    object-fit: cover;
  }

  .photo-positioned.photo-tall {
    display: flex;
    flex-direction: column;
  }

  .photo-positioned.photo-tall > .photo-button {
    flex: 1;
    height: 0;
    min-height: 0;
  }
}
