/* ───── Software ─────
   The frame and the header come from page.css. */

/* The index sits directly under the header rule, so it takes only a bottom
   rule of its own — two hairlines a few pixels apart read as a mistake. */
.sw-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: -1.25rem 0 2.5rem;
  border-bottom: 1px solid var(--rule);
  padding: 0 0 0.7rem;
}

.sw-index-item {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  text-decoration: none;
  padding: 0.25rem 0.7rem;
  border: 1px solid transparent;
  transition: border-color var(--ease), background var(--ease);
}

.sw-index-item:is(:hover, .is-hover) {
  border-color: var(--rule-strong);
  background: var(--wash);
}

.sw-index-num {
  font-size: var(--t-label);
  color: var(--ink-faint);
}

.sw-index-name {
  font-size: var(--t-small);
  letter-spacing: 0.1em;
  color: rgba(var(--fg-rgb), 0.85);
}

/* ───── Panels ───── */
.sw-panel {
  margin-bottom: 4rem;
  scroll-margin-top: 1.5rem;
}

.sw-panel-head {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.sw-panel-num {
  font-size: var(--t-label);
  color: var(--ink-faint);
  letter-spacing: 0.18em;
}

.sw-panel-name {
  font-size: var(--t-sect);
  letter-spacing: 0.12em;
  color: var(--fg);
  text-shadow: 0 0 10px rgba(var(--fg-rgb), 0.4);
  margin: 0;
}

.sw-panel-kind {
  font-size: var(--t-label);
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin-left: auto;
  text-transform: uppercase;
}

.sw-panel-body {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(0, 1.35fr);
  gap: 2.5rem;
  align-items: start;
}

/* Shot-less panels put their links in a right-hand column, stacked like a
   menu, so the options read as a list of choices rather than a wrapped row. */
.sw-panel-body--menu {
  grid-template-columns: minmax(300px, 1fr) minmax(260px, 0.62fr);
}

.sw-menu-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sw-menu-col .sw-links {
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  margin-bottom: 0;
}

.sw-menu-col .sw-links a {
  justify-content: space-between;
  padding: 0.65rem 1rem;
  font-size: var(--t-small);
}

/* The arrow slides on hover, the way a selected menu row does. */
.sw-menu-col .sw-arrow {
  transition: transform 0.18s ease;
  margin-left: 1rem;
}

.sw-menu-col .sw-links a:is(:hover, .is-hover) .sw-arrow {
  transform: translateX(4px);
}

.sw-meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 1rem;
  font-size: var(--t-small);
  color: rgba(var(--fg-rgb), 0.85);
}

.sw-meta-key {
  display: inline-block;
  min-width: 4.5em;
  color: var(--ink-faint);
  letter-spacing: 0.14em;
  font-size: var(--t-label);
}

.sw-blurb {
  font-size: var(--t-body);
  line-height: 1.7;
  color: rgba(var(--fg-rgb), 0.9);
  margin: 0 0 1.1rem;
}

.sw-bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 1.2rem;
}

.sw-bullets li {
  position: relative;
  padding-left: 1.2rem;
  margin-bottom: 0.5rem;
  font-size: var(--t-small);
  line-height: 1.6;
  color: rgba(var(--fg-rgb), 0.72);
}

.sw-bullets li::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--ink-faint);
}

.sw-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.sw-chip {
  border: 1px solid var(--rule);
  padding: 0.22rem 0.6rem;
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}

.sw-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}

/* These are the calls to action on the page — they earn real weight rather
   than sitting as underlined text among the body copy. Shape and behaviour
   are the shared .btn; only the first-child emphasis is local. */
.sw-links a {
  display: inline-flex;
  align-items: center;
  color: var(--fg);
  text-decoration: none;
  font-family: var(--font);
  font-size: var(--t-small);
  letter-spacing: 0.1em;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--rule-strong);
  background: var(--wash);
  transition: background var(--ease), color var(--ease),
              border-color var(--ease), box-shadow var(--ease);
}

.sw-links a:is(:hover, .is-hover) {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
  text-shadow: none;
  box-shadow: 0 0 18px rgba(var(--fg-rgb), 0.5);
}

/* The first link on a panel is the primary one. */
.sw-links a:first-child {
  border-color: var(--fg);
  background: rgba(var(--fg-rgb), 0.14);
}

.sw-note {
  font-size: var(--t-label);
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}

/* ───── Detail fold ─────
   Above the phone breakpoint there is no fold: the body is shown and the
   toggle does not exist. */
.sw-fold-toggle {
  display: none;
}

/* ───── Shot carousel ───── */
.sw-carousel {
  border: 1px solid var(--rule);
  background: rgba(var(--bg-rgb), 0.6);
}

/* One fixed frame; every shot is letterboxed into it so stepping through
   never shifts the layout. */
.sw-carousel-frame {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg);
}

.sw-slide {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease;
  cursor: zoom-in;
}

.sw-slide.is-active {
  opacity: 1;
  visibility: visible;
}

.sw-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sw-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 52px;
  background: rgba(var(--bg-rgb), 0.78);
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: #ffffff;
  font-family: inherit;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.55;
  text-shadow: 0 0 6px rgba(var(--bg-rgb), 0.9);
  transition: all 0.2s ease;
  z-index: 2;
}

.sw-carousel:is(:hover, .is-hover) .sw-nav {
  opacity: 1;
}

.sw-nav:is(:hover, .is-hover) {
  background: #ffffff;
  color: var(--bg);
  border-color: #ffffff;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.5);
}

.sw-nav--prev { left: 8px; }
.sw-nav--next { right: 8px; }

.sw-carousel-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0.7rem;
  border-top: 1px solid var(--rule);
}

.sw-carousel-caption {
  font-size: var(--t-label);
  letter-spacing: 0.05em;
  color: var(--ink-dim);
  line-height: 1.4;
  flex: 1;
}

.sw-dots {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.sw-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sw-dot.is-active {
  background: var(--fg);
  box-shadow: 0 0 8px rgba(var(--fg-rgb), 0.7);
}

.sw-counter {
  font-size: var(--t-label);
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  margin-left: 0.35rem;
}

/* ───── Lightbox ───── */
body.sw-lightbox-open {
  overflow: hidden;
}

.sw-lightbox[hidden] {
  display: none;
}

.sw-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(var(--bg-rgb), 0.96);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  box-sizing: border-box;
  cursor: zoom-out;
}

.sw-lightbox img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border: 1px solid var(--rule-strong);
}

.sw-lightbox-caption {
  font-size: var(--t-small);
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  text-align: center;
}

.sw-lightbox-close {
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--ink-dim);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

@media (max-width: 900px) {
  .sw-panel-body,
  .sw-panel-body--menu {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }

  .sw-panel-kind {
    margin-left: 0;
    width: 100%;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   Phone.

   Six projects, each with a role, a status, five or six bullets and a row of
   stack chips, is a wall of text on a 390px screen. Each panel shows its name,
   its one-paragraph blurb and its links; everything else folds away behind a
   toggle. The index above them becomes a compact strip of numbered chips
   instead of six full-width rows.
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  /* One scrolling line of numbers rather than six stacked rows: the index is
     a jump list, not a table of contents to be read. */
  .sw-index {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.3rem;
    /* Bled to both screen edges so the strip reads as scrollable rather than
       as a row that happens to be clipped. */
    margin: -1rem calc(-1 * var(--page-pad-x)) 1.75rem;
    padding: 0 var(--page-pad-x) 0.6rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    /* Fades into the right margin, so it reads as a strip that continues
       rather than a row that was cut off. */
    -webkit-mask-image: linear-gradient(to right, #000 86%, transparent);
    mask-image: linear-gradient(to right, #000 86%, transparent);
  }

  .sw-index::-webkit-scrollbar {
    display: none;
  }

  .sw-index-item {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 0.3rem 0.6rem;
    border-color: var(--rule);
  }

  .sw-panel {
    margin-bottom: 2.5rem;
  }

  .sw-panel-head {
    gap: 0.5rem;
  }

  .sw-panel-body {
    gap: 1.1rem;
  }

  /* The screenshots lead on a phone: a picture of the thing says more in the
     space than six bullets do. */
  .sw-panel-body:not(.sw-panel-body--menu) .sw-carousel {
    order: -1;
  }

  .sw-blurb {
    margin-bottom: 0.9rem;
  }

  .sw-fold-body {
    display: none;
  }

  .sw-panel.is-open .sw-fold-body {
    display: block;
  }

  .sw-fold-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 0.9rem;
    padding: 0.45rem 0.7rem;
    font-family: var(--font);
    font-size: var(--t-label);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-dim);
    background: transparent;
    border: 1px solid var(--rule);
    cursor: pointer;
  }

  .sw-panel.is-open .sw-fold-toggle {
    color: var(--fg);
    border-color: var(--rule-strong);
  }

  .sw-fold-mark {
    font-size: 1.1em;
    line-height: 1;
  }

  /* The links are the point of each panel on a phone; give them the width. */
  .sw-links {
    gap: 0.4rem;
  }

  .sw-links a {
    flex: 1 1 auto;
    justify-content: center;
  }

  .sw-menu-col .sw-links a {
    justify-content: space-between;
  }
}

/* The site tints images green by default; screenshots of interfaces need to
   stay readable, so they sit lightly desaturated and come to full colour on
   hover — the same gesture, applied gently. */
.sw-slide img,
.sw-lightbox img {
  filter: saturate(0.62) brightness(0.72) contrast(1.06);
  border: none;
  transition: filter 0.2s ease;
}

.sw-carousel:is(:hover, .is-hover) .sw-slide img {
  filter: saturate(0.85) brightness(0.9) contrast(1.04);
}

.sw-lightbox img {
  filter: saturate(0.8) brightness(0.86) contrast(1.04);
}

/* JS-driven mirror of :hover — see js/components/hover.js. */
.sw-carousel.is-hover .sw-nav {
  opacity: 1;
}

.sw-carousel.is-hover .sw-slide img {
  filter: saturate(0.85) brightness(0.9) contrast(1.04);
}

.sw-index-item.is-hover {
  border-color: rgba(var(--fg-rgb), 0.4);
  background: rgba(var(--fg-rgb), 0.06);
}

.sw-links a.is-hover {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
  text-shadow: none;
  box-shadow: 0 0 18px rgba(var(--fg-rgb), 0.5);
}

@media (hover: none) {
  .sw-nav {
    opacity: 1;
  }
}


