/* ============================================================
   SHARED EDITORIAL SCROLL LAYOUT — robotics.html, miscellaneous.html
   Every project is fully readable by scrolling, no clicking required.
   A sticky category filter narrows the set. Sits on top of theme.css.
   ============================================================ */

/* ---------- masthead ---------- */
.mast { max-width: var(--maxw); margin: 3.5rem auto 2rem; padding: 0 2rem; }
.mast h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(2.4rem, 6.5vw, 4.2rem);
  line-height: .98; letter-spacing: -.025em; margin-top: .8rem;
}
.mast p { color: var(--muted); font-size: 1rem; margin-top: .9rem; max-width: 60ch; }

/* ---------- sticky capability filter ---------- */
.filter {
  position: sticky; top: 58px; z-index: 15;
  background: rgba(11,12,13,.92); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  margin-bottom: 1px;
}
.filter .inner {
  max-width: var(--maxw); margin: 0 auto; padding: .7rem 2rem;
  display: flex; align-items: center; gap: .75rem;
}
.filter .tally { margin-left: auto; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* toggle button that reveals the filter options */
.dropdown { position: relative; }
.dropdown-toggle {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: .55rem;
  font-size: .82rem; color: var(--text);
  padding: .3rem .8rem; border: 1px solid var(--line-2);
  transition: border-color .18s ease, background-color .18s ease;
}
.dropdown-toggle:hover { border-color: var(--accent); }
.dropdown-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dropdown-toggle .chevron { font-size: .65rem; color: var(--muted); transition: transform .2s ease; }
.dropdown.open .dropdown-toggle { border-color: var(--accent); }
.dropdown.open .dropdown-toggle .chevron { transform: rotate(180deg); }

.dropdown-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 20;
  display: flex; flex-direction: column; min-width: 200px;
  background: rgba(17,18,20,.98); backdrop-filter: blur(10px);
  border: 1px solid var(--line-2);
  box-shadow: 0 12px 28px rgba(0,0,0,.5);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s;
}
.dropdown.open .dropdown-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
  transition: opacity .16s ease, transform .16s ease;
}
.dropdown-menu button {
  all: unset; cursor: pointer; text-align: left;
  font-size: .82rem; color: var(--muted);
  padding: .55rem .9rem; border-bottom: 1px solid var(--line);
  transition: color .15s ease, background-color .15s ease;
}
.dropdown-menu button:last-child { border-bottom: none; }
.dropdown-menu button:hover { color: var(--text); background: rgba(255,255,255,.05); }
.dropdown-menu button[aria-pressed="true"] { color: var(--on-accent); background: var(--accent); }
.dropdown-menu button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- project band ---------- */
.proj {
  max-width: var(--maxw); margin: 0 auto;
  padding: 4rem 2rem; border-bottom: 1px solid var(--line);
}
.proj[hidden] { display: none; }

.proj-head { display: grid; grid-template-columns: 92px 1fr; gap: 1.5rem; align-items: start; margin-bottom: 2rem; }
.proj-head .num {
  font-family: var(--display); font-weight: 700;
  font-size: 3.4rem; line-height: .8; color: var(--line-2);
  font-variant-numeric: tabular-nums;
}
.proj:target .proj-head .num,
.proj:hover .proj-head .num { color: var(--accent); transition: color .3s ease; }
.proj-head h2 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.6rem, 3.4vw, 2.35rem);
  line-height: 1.08; letter-spacing: -.01em;
}
.proj-head .where {
  font-size: .74rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-top: .5rem;
}
.proj-head .where .wip { color: var(--accent); }

/* alternating body: media / text, flipped on every other project */
.proj-body { display: grid; grid-template-columns: 1.05fr 1fr; gap: 2.5rem; align-items: start; }
.proj:nth-of-type(even) .media { order: 2; }

.media .main {
  background: #000; border: 1px solid var(--line);
  height: 340px; overflow: hidden;
}
.media .main img,
.media .main video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.media .cap { font-size: .78rem; color: var(--muted); margin-top: .55rem; min-height: 1.2em; }
.media .thumbs { display: flex; gap: 6px; margin-top: .6rem; flex-wrap: wrap; }
.media .thumbs button {
  all: unset; position: relative; cursor: pointer; width: 58px; height: 40px;
  border: 1px solid var(--line); background: #000; overflow: hidden; opacity: .5;
  transition: opacity .2s ease, border-color .2s ease;
}
.media .thumbs button img,
.media .thumbs button video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* play badge marks a video thumbnail */
.media .thumbs button[data-type="video"]::after {
  content: "▶";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: .62rem; color: #fff;
  background: rgba(0,0,0,.35); text-shadow: 0 1px 3px rgba(0,0,0,.9);
}
.media .thumbs button:hover { opacity: .85; }
.media .thumbs button[aria-selected="true"] { opacity: 1; border-color: var(--accent); }
.media .thumbs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.text p { color: #c3cbd3; font-size: .96rem; max-width: none; }
.text p + p { margin-top: .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; margin-top: 1.3rem; }
.chips li { font-size: .71rem; color: #c3cbd3; border: 1px solid var(--line-2); padding: .13rem .5rem; }
.out { margin-top: 1.1rem; font-size: .9rem; }
.out a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.out a:hover { color: var(--accent); text-decoration-color: var(--accent); }

.empty { max-width: var(--maxw); margin: 0 auto; padding: 4rem 2rem; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 880px) {
  .proj-body { grid-template-columns: 1fr; gap: 1.5rem; }
  .proj:nth-of-type(even) .media { order: 0; }
  .media .main { height: 260px; }
}
@media (max-width: 620px) {
  .mast { padding: 0 1.25rem; margin-top: 2.25rem; }
  .filter .inner { padding: .6rem 1.25rem; }
  .filter .tally { display: none; }
  .proj { padding: 2.75rem 1.25rem; }
  .proj-head { grid-template-columns: 56px 1fr; gap: 1rem; margin-bottom: 1.5rem; }
  .proj-head .num { font-size: 2.2rem; }
  .media .main { height: 210px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
