/*
 * Work pages: the project archive (/projects/) and single projects.
 * Page layout and page-specific pieces only; cards, rows, chips, icons and
 * venue buttons come from base.css.
 *
 * Note: base.css resets lists with ul[class] (specificity 0,1,1), so list
 * rules that set margin or padding here are qualified by a parent class.
 */

/* ------------------------------------------------------------ archive head */
.work-head {
  padding-top: clamp(2.25rem, 1.25rem + 4vw, 4.5rem);
}
.work-head__title {
  font-size: clamp(2.5rem, 1.6rem + 3.6vw, 4rem);
  font-weight: 790;
  line-height: 1.02;
  letter-spacing: -0.038em;
}
.work-head__lede {
  max-width: 40rem;
  margin: var(--s-4) 0 0;
  color: var(--ink-2);
  font-size: clamp(1.0625rem, 0.95rem + 0.6vw, var(--fs-md));
  line-height: 1.5;
}

/* Filter pills wrap onto new lines; they never scroll sideways */
.work-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-6);
}
.work-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.4rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 650;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.work-filter[data-cat]::before {
  content: "";
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 2px;
  background: var(--cat);
}
.work-filter:hover { border-color: var(--line-strong); }
.work-filter__count {
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.work-filter[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.work-filter[aria-pressed="true"] .work-filter__count {
  color: color-mix(in srgb, var(--bg) 72%, var(--ink));
}
.work-filter[aria-pressed="true"][data-cat]::before {
  background: color-mix(in srgb, var(--cat) 55%, var(--bg));
}
@media (max-width: 480px) {
  .work-filters { gap: 0.4rem; margin-top: var(--s-5); }
  .work-filter { gap: 0.4rem; padding-inline: 0.8rem; font-size: 0.875rem; }
}

/* ------------------------------------------------------------ groups */
.work-group { margin-top: clamp(3rem, 2rem + 3vw, 4.5rem); }
.work-group[hidden] { display: none; }

.work-group__title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.6rem;
  margin-bottom: var(--s-5);
  font-size: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);
  font-weight: 760;
  letter-spacing: -0.022em;
  line-height: 1.15;
}
.work-group__title::before {
  content: "";
  flex: none;
  align-self: center;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 3px;
  background: var(--cat);
}
.work-group__count {
  color: var(--muted);
  font-size: 0.6em;
  font-weight: 600;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: var(--s-4);
}

/* Smaller and earlier releases: a quiet two-column list under the cards */
.work-tail { margin-top: var(--s-6); }
.work-tail__title {
  margin-bottom: var(--s-2);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0;
}
.work-rows {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: clamp(1.5rem, 1rem + 3vw, 3.5rem);
  border-top: 1px solid var(--line);
}
@media (min-width: 900px) {
  .work-rows {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 0;
  }
  .work-rows > :nth-child(-n + 2) { border-top: 1px solid var(--line); }
}

.work-empty { margin-top: var(--s-6); color: var(--muted); }

/* ------------------------------------------------------------ breadcrumb */
.crumbs-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 var(--s-4);
  padding-block: var(--s-3);
}
.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}
.crumbs li {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
}
.crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.3rem;
  border-radius: var(--r-xs);
  color: var(--ink-2);
  text-decoration: none;
}
.crumbs li:first-child a { padding-left: 0; }
.crumbs a:hover { color: var(--teal); text-decoration: underline; }
.crumbs__sep {
  padding: 0 0.2rem;
  color: var(--muted);
  font-size: 1.15em;
  line-height: 1;
}
.crumbs [aria-current="page"] {
  padding: 0.6rem 0.3rem;
  color: var(--muted);
}

/* ------------------------------------------------------------ product hero */
.product-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(1.25rem, 0.5rem + 2.6vw, 2.75rem);
  align-items: start;
  padding: clamp(1.5rem, 0.8rem + 2.6vw, 3rem);
  border-radius: 30px;
  background: var(--cat-tint, var(--surface-2));
}
.product-hero__body { min-width: 0; }
.product-hero__name {
  font-size: clamp(2.25rem, 1.5rem + 2.8vw, 3.5rem);
  font-weight: 790;
  line-height: 1.02;
  letter-spacing: -0.034em;
  overflow-wrap: anywhere;
}
.product-hero__tagline {
  max-width: 38rem;
  margin: var(--s-3) 0 0;
  color: var(--ink-2);
  font-size: clamp(1.1875rem, 1rem + 0.75vw, 1.5rem);
  font-weight: 500;
  line-height: 1.4;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.15rem;
  margin-top: var(--s-5);
}
.product-meta__item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.35;
}
.product-meta__item .glyph { color: var(--muted); }

.product-hero .venues { margin-top: var(--s-5); }

.product-hero__metric {
  margin: var(--s-4) 0 0;
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 650;
}
.product-hero__metric [title] {
  text-decoration: underline dotted var(--line-strong);
  text-underline-offset: 0.3em;
  cursor: help;
}

@media (max-width: 640px) {
  .product-hero { grid-template-columns: minmax(0, 1fr); }
  .product-hero .app-icon { --size: 88px !important; }
}

/* ------------------------------------------------------------ screenshots */
/* The one horizontal scroller on the site. It bleeds to the viewport edge and
   lines its first image up with the content column. */
.product-gallery { margin-top: clamp(1.5rem, 1rem + 2vw, 2.5rem); }
.product-gallery .gallery {
  --shot-h: clamp(340px, 180px + 26vw, 560px);
  --edge: max(var(--gutter), calc((100% - var(--container)) / 2));
  display: flex;
  gap: clamp(0.75rem, 0.5rem + 1vw, 1.25rem);
  margin: 0;
  padding: 0.5rem var(--edge) 1.5rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--edge);
  list-style: none;
}
.gallery__item {
  flex: none;
  scroll-snap-align: start;
}
.gallery__item figure { margin: 0; }
.gallery__item a {
  /* Contains the visually hidden label, which would otherwise escape the
     scroller and widen the page */
  position: relative;
  display: block;
  border-radius: 12px;
}
.gallery__item img {
  display: block;
  width: auto;
  max-width: none;
  /* Full height, unless a wide shot would not fit the phone screen */
  height: min(var(--shot-h), calc((100vw - 2 * var(--gutter) - 2rem) / var(--ar, 1)));
  border-radius: 12px;
  background: var(--surface-2);
  /* The hairline keeps dark shots from melting into the dark theme */
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent),
    0 1px 2px rgb(20 32 43 / 0.12),
    0 24px 48px -24px rgb(20 32 43 / 0.45);
}

/* A visible scrollbar on desktop; touch screens keep their own */
@media (hover: hover) and (pointer: fine) {
  .product-gallery .gallery {
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
  }
  @supports selector(::-webkit-scrollbar) {
    .product-gallery .gallery {
      scrollbar-width: auto;
      scrollbar-color: auto;
    }
    .product-gallery .gallery::-webkit-scrollbar { height: 10px; }
    .product-gallery .gallery::-webkit-scrollbar-track {
      /* Line the rail up with the content column */
      margin-inline: max(var(--gutter), calc((100vw - var(--container)) / 2));
      background: var(--surface-2);
      border-radius: 999px;
    }
    .product-gallery .gallery::-webkit-scrollbar-thumb {
      background: var(--line-strong);
      border: 2px solid var(--surface-2);
      border-radius: 999px;
    }
    .product-gallery .gallery::-webkit-scrollbar-thumb:hover { background: var(--muted); }
  }
}

/* ------------------------------------------------------------ product body */
.product-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17.5rem, 22.5rem);
  gap: clamp(2rem, 1rem + 4vw, 5rem);
  align-items: start;
  margin-top: clamp(2.5rem, 1.5rem + 3vw, 4rem);
}
.product-main { min-width: 0; }

/* Description: the one place on a product page set in the serif */
.product-prose {
  max-width: 40rem;
  color: var(--ink);
  font-family: var(--font-serif);
}
.product-prose p,
.product-prose li {
  font-size: 1.15rem;
  line-height: 1.7;
}
.product-prose p { margin: 0 0 1.1em; }
.product-prose p:last-child { margin-bottom: 0; }
.product-prose h2,
.product-prose h3,
.product-prose h4 {
  margin: 1.6em 0 0.5em;
  font-family: var(--font-sans);
  font-weight: 720;
  letter-spacing: -0.015em;
}
.product-prose h2 { font-size: var(--fs-lg); }
.product-prose h3,
.product-prose h4 { font-size: var(--fs-md); }
.product-prose ul,
.product-prose ol { margin: 0 0 1.1em; padding-left: 1.3em; }
.product-prose li + li { margin-top: 0.35em; }
.product-prose a { color: var(--teal); }
.product-prose a:hover { color: var(--teal-hi); }
.product-prose img { border-radius: var(--r-md); }
.product-prose blockquote {
  margin: 1.4em 0;
  padding-left: 1.1em;
  border-left: 3px solid var(--cat, var(--line-strong));
  color: var(--ink-2);
}
.product-prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
}
.product-prose :not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: var(--r-xs);
  background: var(--inline-code-bg);
  color: var(--inline-code-ink);
}
.product-prose pre {
  margin: 1.4em 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  border-radius: var(--r-md);
  background: var(--code-bg);
  color: var(--code-ink);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* What it does */
.product-does {
  max-width: 40rem;
  margin-top: clamp(2rem, 1.5rem + 2vw, 3rem);
}
.product-main > .product-does:first-child { margin-top: 0; }
.product-section-title {
  font-size: var(--fs-lg);
  font-weight: 740;
  letter-spacing: -0.02em;
}
.product-does .product-does__list {
  display: grid;
  gap: var(--s-4);
  margin: var(--s-4) 0 0;
}
.product-does__list li {
  position: relative;
  padding-left: 1.5rem;
  color: var(--ink-2);
  line-height: 1.6;
}
.product-does__list li::before {
  content: "";
  position: absolute;
  top: calc(0.8em - 0.25rem);
  left: 0.1rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 2px;
  background: var(--cat);
}

/* ------------------------------------------------------------ facts aside */
.product-aside {
  display: grid;
  gap: var(--s-4);
  min-width: 0;
}
.product-card {
  padding: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.product-card__title {
  margin-bottom: var(--s-2);
  font-size: var(--fs-base);
  font-weight: 720;
  letter-spacing: -0.01em;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--s-4);
  margin: 0;
}
.fact {
  grid-column: 1 / -1;
  min-width: 0;
  padding-block: var(--s-4);
  border-top: 1px solid var(--line);
}
.fact--half { grid-column: auto; }
.facts > .fact:first-child,
.facts > .fact--half:first-child + .fact--half {
  padding-top: 0;
  border-top: 0;
}
.facts > .fact:last-child { padding-bottom: 0; }
.fact dt {
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 650;
}
.fact dd {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.5;
}

.fact .tech-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tech-chips li {
  padding: 0.2rem 0.55rem;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.35;
}

.fact .fact-links { display: grid; margin-top: -0.3rem; }
.fact-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  padding-block: 0.3rem;
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
}
.fact-link .glyph {
  width: 18px;
  height: 18px;
  color: var(--muted);
}
.fact-link:hover { color: var(--teal); }
.fact-link:hover .glyph { color: var(--teal); }
.fact-link:hover .fact-link__label { text-decoration: underline; }
.fact-link__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}
.fact-link__detail {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* Editions of one product (e.g. Android and Mac) */
.product-editions .editions { margin: 0; }
.edition {
  padding-block: var(--s-3);
  border-top: 1px solid var(--line);
}
.edition:first-child { border-top: 0; padding-top: var(--s-1); }
.edition:last-child { padding-bottom: 0; }
.edition__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
}
.edition__label {
  font-size: var(--fs-sm);
  font-weight: 700;
}
.edition__tagline {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

@media (max-width: 900px) {
  .product-body { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------------ more + writing */
.product-more { margin-top: clamp(3rem, 2rem + 3vw, 5rem); }
/* The footer brings its own top margin */
.work-single > .section:last-child { padding-bottom: 0; }
.product-writing__list { max-width: 52rem; }
.product-writing__list .post-row:first-child { padding-top: 0; }
.product-writing__list .post-row:last-child { border-bottom: 0; }
