/* ============================================================
   Sidebar layout.
   A persistent project list on the left, content on the right.
   Loaded after style.css and overrides the top-nav layout on
   pages that opt in with <body class="has-sidebar">.
   ============================================================ */

:root {
  --sidebar-w:     264px;
  --content-max:   860px;   /* every project reads at this width */
}

/* ---------- SIDEBAR ------------------------------------------------------ */

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  z-index: 100; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 40px;
  padding: 40px 32px;
  background: var(--bg);
  border-right: 1px solid var(--divider);
}

.sidebar-name {
  font-family: var(--heading-font);
  font-size: 22px; font-weight: 400; letter-spacing: 0.04em;
  color: var(--text-primary); text-decoration: none; line-height: 1.2;
}
.sidebar-role {
  display: block; margin-top: 6px;
  font-family: var(--body-font);
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-group + .sidebar-group { margin-top: 32px; }

.sidebar-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.sidebar-list a {
  display: block; padding: 7px 0;
  font-size: 14px; font-weight: 300; line-height: 1.35;
  color: var(--text-secondary); text-decoration: none;
  border-left: 2px solid transparent; padding-left: 12px; margin-left: -14px;
  transition: color 0.18s, border-color 0.18s;
}
.sidebar-list a:hover { color: var(--text-primary); }
.sidebar-list a[aria-current="page"] {
  color: var(--accent); border-left-color: var(--accent);
}

.sidebar-foot { margin-top: auto; padding-top: 32px; }
.sidebar-foot a {
  display: block; padding: 5px 0;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted); text-decoration: none; transition: color 0.18s;
}
.sidebar-foot a:hover { color: var(--text-primary); }

/* mobile toggle lives in the sidebar header, hidden on desktop */
.sidebar-toggle { display: none; }

/* ---------- CONTENT ------------------------------------------------------ */

.has-sidebar #navbar { display: none; }
.has-sidebar main { padding-top: 0; margin-left: var(--sidebar-w); }

.sheet { max-width: var(--content-max); margin: 0 auto; padding: 72px 40px 96px; }

/* Uniform scaling: one width for every image on every project. Images
   narrower than the column stay their own size and centre, so nothing is
   ever enlarged. */
.sheet figure { margin: 40px 0; }
.sheet figure img,
.sheet figure video {
  width: auto; max-width: 100%; height: auto; margin: 0 auto;
}
.sheet figure.wide { margin-left: 0; margin-right: 0; }

.sheet .media-grid { gap: 20px; }
.sheet .media-grid img { width: 100%; max-width: 100%; }

.sheet figcaption {
  font-size: 12px; line-height: 1.6; color: var(--text-muted);
  margin-top: 10px; text-align: left;
}

/* ---------- PROJECT HEAD -------------------------------------------------- */

.sheet-head { text-align: center; margin-bottom: 16px; }
.sheet-head h1 {
  font-family: var(--heading-font);
  font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 400;
  line-height: 1.05; letter-spacing: -0.01em; margin-bottom: 10px;
}
.sheet-head h1 em { font-style: italic; color: var(--accent); }
.sheet-role {
  font-family: var(--heading-font);
  font-size: clamp(1.1rem, 2.2vw, 1.4rem); font-weight: 300;
  color: var(--text-secondary); line-height: 1.3;
}
.sheet-tools {
  font-size: 12px; letter-spacing: 0.12em;
  color: var(--text-muted); margin-top: 8px;
}
.sheet-rule {
  width: 180px; height: 0; margin: 30px auto 0;
  border: 0; border-top: 1px solid var(--divider);
}

.sheet-body h2 {
  font-family: var(--heading-font);
  font-size: clamp(1.5rem, 3vw, 1.9rem); font-weight: 300;
  margin: 56px 0 16px;
}
.sheet-body h3 {
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); font-weight: 500; margin: 36px 0 12px;
}
.sheet-body p {
  font-size: 16px; font-weight: 300; line-height: 1.8;
  color: var(--text-secondary); margin-bottom: 18px;
}
.sheet-body ul, .sheet-body ol { margin: 0 0 18px 1.2em; }
.sheet-body li {
  font-size: 16px; font-weight: 300; line-height: 1.8;
  color: var(--text-secondary); margin-bottom: 7px;
}
.sheet-body a { color: var(--accent); text-underline-offset: 3px; }

/* ---------- RESPONSIVE --------------------------------------------------- */

@media (max-width: 900px) {
  .sidebar {
    position: static; width: auto; height: auto; bottom: auto;
    flex-direction: column; gap: 0;
    padding: 20px 24px; border-right: 0;
    border-bottom: 1px solid var(--divider);
  }
  .sidebar-head { display: flex; justify-content: space-between; align-items: center; }
  .sidebar-toggle {
    display: block; background: none; border: 0; cursor: pointer; padding: 8px; margin: -8px;
  }
  .sidebar-toggle span {
    display: block; width: 22px; height: 1.5px; background: var(--text-primary);
    transition: transform 0.3s, opacity 0.2s;
  }
  .sidebar-toggle span + span { margin-top: 5px; }
  .sidebar-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .sidebar-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .sidebar-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

  .sidebar-panel {
    display: none; padding-top: 24px;
  }
  .sidebar-panel.open { display: block; }
  .sidebar-foot { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

  .has-sidebar main { margin-left: 0; }
  .sheet { padding: 40px 24px 64px; }
}

/* ---------- HOME GRID ---------------------------------------------------- */

.home-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 40px 28px; margin-top: 56px;
}
.home-card { display: block; text-decoration: none; }
.home-card-img {
  display: block; aspect-ratio: 4 / 3; overflow: hidden;
  background: var(--bg-surface); margin-bottom: 14px;
}
.home-card-img img {
  width: 100%; height: 100%; object-fit: cover; object-position: center;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.home-card:hover .home-card-img img { transform: scale(1.04); }
.home-card-title {
  display: block; font-family: var(--heading-font);
  font-size: 1.25rem; font-weight: 400; color: var(--text-primary);
  line-height: 1.25;
}
.home-card-note {
  display: block; margin-top: 4px;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .home-grid { grid-template-columns: 1fr; gap: 32px; }
}

/* The old full-bleed rule breaks out to 100vw with a negative offset, which
   assumed a centred wrap. With a fixed sidebar the viewport is wider than the
   content area, so it drags images left. Neutralise it inside the sheet. */
.sheet figure.full {
  width: auto; max-width: 100%;
  margin-left: 0; margin-right: 0; transform: none;
}
.sheet figure.full img { margin-left: auto; margin-right: auto; }

/* A case study uploaded as several boards. The boards are pieces of one long
   document, so they sit flush and share a width instead of reading as four
   separate pictures. max-height has to be lifted here: the global 76vh cap in
   style.css keeps a tall photograph from filling the screen, but applied to a
   tall board it shrinks the board until it is narrower than the ones above it.
   width:100% cannot upscale these, because the sheet is capped well below the
   2400px the boards are saved at. */
.sheet .board-stack { margin: 40px 0; }
.sheet .board-stack figure { margin: 0; }
.sheet .board-stack figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: none;
  margin: 0;
}

/* Covers whose subject sits at the top of the frame. A 4/3 crop of a tall
   magazine cover centres onto the middle of the page and loses the masthead. */
.home-card-img.from-top img { object-position: top; }
