/* Desktop layout measured from the original Cargo site (1280x720).
   Phones (<= 768px) get a vertical layout. */
:root {
  --pad: 80px;        /* left/right page margin */
  --top: 110px;       /* top of content */
  --media-gap: 30px;  /* gap between images/videos in a project */
  --text-w: 410px;    /* project text column */
  --text-gap: 80px;   /* space between text column and first image */
  --ink: #333;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: #fff; }
body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 12px;
  line-height: 1.6;
  color: #000;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.body a { text-decoration: underline; }
img { display: block; border: 0; }

/* Header */
.site-header { position: absolute; top: 0; left: 0; right: 0; height: 0; z-index: 10; }
.menu { position: absolute; top: 28px; left: var(--pad); white-space: nowrap; font-size: 14px; line-height: 17px; }
.menu a { color: rgba(0, 0, 0, .8); margin-right: 15px; }
.menu a:hover, .menu a.active { text-decoration: underline; text-underline-offset: 3px; }
.logo { position: fixed; top: 25px; right: var(--pad); }
.menu-toggle { display: none; }

/* Horizontal track: the whole page scrolls sideways */
.track {
  position: absolute;
  top: var(--top);
  left: var(--pad);
  display: flex;
  align-items: flex-start;
  padding-right: var(--pad);
}

/* Project / page */
.entry { display: flex; align-items: flex-start; flex: none; margin-right: 101px; }
.text { width: var(--text-w); flex: none; margin-right: var(--text-gap); color: var(--ink); }
.title { font-size: 20px; line-height: 28px; font-weight: 700; margin: -5px 0 17px; }
.body { font-size: 13px; line-height: 21px; }
.body p { margin: 0 0 21px; }
.entry.no-text .text { width: auto; max-width: var(--text-w); margin-right: 50px; }  /* project with only a title */
.body h1, .body h2, .body h3, .body h4 { font-size: 15px; line-height: 21px; margin: 0 0 21px; break-after: avoid; }
.body ul, .body ol { margin: 0 0 21px; padding-left: 18px; }
.body blockquote { margin: 0 0 21px; padding-left: 12px; border-left: 2px solid #ccc; color: #555; }
.body blockquote p:last-child { margin-bottom: 0; }
.body hr { border: 0; border-top: 1px solid #ddd; margin: 0 0 21px; }
/* Long text flows into extra columns to the right (set by site.js), like Cargo */
.body.cols { column-gap: 40px; column-fill: auto; }
.media-row { display: flex; align-items: flex-start; flex: none; }
.media { flex: none; margin-right: var(--media-gap); }
.media img, .media iframe { display: block; width: 100%; height: 100%; }

/* Thumbnail grid (positions set by site.js: horizontal masonry, rows of equal height) */
.thumbs { position: relative; flex: none; }
.thumb { position: absolute; display: block; background: #f2f2f2; }
.thumb img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s; }
.thumb img.loaded { opacity: 1; }
.thumb:hover img.loaded { opacity: .85; }
.off-badge { position: absolute; top: 8px; left: 8px; padding: 2px 8px; background: #d9d8d3; color: #fff; font: 700 11px/16px Helvetica, Arial, sans-serif; border-radius: 10px; }  /* local preview only */

/* ---------- Phones: vertical layout ---------- */
@media (max-width: 768px) {
  .site-header { position: relative; height: 64px; }
  .logo { position: absolute; top: 14px; left: 15px; right: auto; }
  .logo img { width: auto; height: 36px; }
  .menu { display: none; }
  .menu-toggle {
    display: block; position: fixed; top: 12px; right: 12px; width: 40px; height: 40px;
    border: 0; border-radius: 4px; padding: 13px 10px; background: #222; cursor: pointer; z-index: 30;
  }
  .menu-toggle span { display: block; height: 2px; background: #fff; margin-bottom: 4px; transition: transform .2s, opacity .2s; }
  .menu-toggle span:last-child { margin-bottom: 0; }
  body.menu-open .menu-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  body.menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
  body.menu-open .menu-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  body.menu-open { overflow: hidden; }
  body.menu-open .menu {
    display: flex; flex-direction: column; position: fixed; inset: 0; padding: 90px 24px;
    background: #fff; font-size: 24px; line-height: 2.1; z-index: 20;
  }
  body.menu-open .menu a { margin: 0; }

  .track { position: static; display: block; padding: 8px 15px 40px; }

  .entry { display: block; margin: 0 0 40px; }
  .text { width: auto; margin: 0 0 24px; }
  .title { font-size: 22px; line-height: 1.3; margin: 0 0 14px; }
  .body { font-size: 16px; line-height: 1.6; }
  .body p { margin: 0 0 1em; }
  .media-row { display: block; }
  .media { width: 100% !important; height: auto !important; margin: 0 0 15px; }
  .media img { height: auto; }
  .media.video { aspect-ratio: 16 / 9; }
  .media.video iframe { height: 100%; }

  .thumbs {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    width: auto !important; height: auto !important;
  }
  .thumb { position: static; width: auto !important; height: auto !important; aspect-ratio: 3 / 2; }
  .entry + .thumbs { border-top: 1px solid #eee; padding-top: 30px; }
}
