/* ==========================================================================
   K00 — Cover & Index (index.html)
   Start page of the kit: own header with theme switch, hero with the
   "Signature remix" card, and the contact sheet of all 33 pages in three
   views (sheet · list · gallery), switched via .contact-sheet[data-view].
   ========================================================================== */

/* ---- Segmented control (theme / preset / view switches) ----------------- */
.segmented {
  display: flex;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
}

.segmented__btn {
  padding: 7px 14px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: 13px;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}

.segmented__btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--canvas);
}

.segmented--presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.segmented--presets .segmented__btn {
  min-height: 44px;
  padding: 10px 4px;
  border-right: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: .02em;
}

.segmented--views .segmented__btn {
  min-height: 44px;
  padding: 10px 16px;
  transition: none;
}

/* ---- Header ------------------------------------------------------------- */
.cover-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  padding: 22px clamp(20px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
}

.cover-header__brand {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 16px;
}

.cover-header__logo {
  font-family: var(--f-display);
  font-weight: var(--d-weight);
  font-size: 28px;
  letter-spacing: .02em;
  text-transform: uppercase;
  line-height: 1;
}

.cover-header__tagline {
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: .04em;
  color: var(--muted);
}

.cover-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
}

.cover-header__version {
  font-family: var(--f-mono);
  font-size: 13px;
  color: var(--muted);
}

/* ---- Hero --------------------------------------------------------------- */
.cover-hero {
  max-width: 1480px;
  margin: 0 auto;
  padding: clamp(40px, 7vw, 96px) clamp(20px, 4vw, 56px) 0;
}

.cover-hero__eyebrow {
  margin-bottom: 24px;
  font-size: 13px;
}

.cover-hero__title {
  font-size: clamp(64px, 13.5vw, 236px);
  line-height: .88;
  text-wrap: balance;
  font-optical-sizing: auto;
}

.cover-hero__em {
  font-style: var(--em-style);
}

.cover-hero__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 48px clamp(32px, 6vw, 96px);
  align-items: start;
  margin-top: clamp(40px, 6vw, 80px);
}

.cover-hero__intro {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.cover-hero__lead {
  max-width: 36em;
}

/* How-to steps */
.steps {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--ink);
}

.steps__item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.steps__no {
  padding-top: 4px;
  font-family: var(--f-mono);
  font-size: 13px;
  color: var(--muted);
}

.steps__title {
  margin-bottom: 4px;
  font-family: var(--f-display);
  font-weight: var(--d-weight);
  font-size: 24px;
  line-height: 1.2;
}

.steps__body {
  max-width: 40em;
  color: var(--muted);
  text-wrap: pretty;
}

/* ---- Signature remix card ----------------------------------------------- */
.remix {
  position: relative;
  margin: 12px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: background-color var(--dur) var(--ease);
}

/* Crop marks: a zero-size anchor per corner, two hairlines each */
.remix__crop {
  position: absolute;
}

.remix__crop--tl { top: 0; left: 0; }
.remix__crop--tr { top: 0; right: 0; }
.remix__crop--bl { bottom: 0; left: 0; }
.remix__crop--br { bottom: 0; right: 0; }

.remix__crop::before,
.remix__crop::after {
  content: "";
  position: absolute;
  background: var(--ink);
}

.remix__crop::before {
  width: 16px;
  height: 1px;
}

.remix__crop::after {
  width: 1px;
  height: 16px;
}

.remix__crop--tl::before { top: -1px; left: -26px; }
.remix__crop--tl::after  { left: -1px; top: -26px; }
.remix__crop--tr::before { top: -1px; right: -26px; }
.remix__crop--tr::after  { right: -1px; top: -26px; }
.remix__crop--bl::before { bottom: -1px; left: -26px; }
.remix__crop--bl::after  { left: -1px; bottom: -26px; }
.remix__crop--br::before { bottom: -1px; right: -26px; }
.remix__crop--br::after  { right: -1px; bottom: -26px; }

.remix__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  font-family: var(--f-mono);
  font-size: 13px;
  color: var(--muted);
}

.remix__kicker {
  letter-spacing: .08em;
  text-transform: uppercase;
}

.remix__count {
  font-variant-numeric: tabular-nums;
}

.remix__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 18px 0 22px;
}

.remix__name {
  font-family: var(--f-display);
  font-weight: var(--d-weight);
  text-transform: var(--d-case);
  font-size: clamp(44px, 4.6vw, 68px);
  line-height: .95;
  letter-spacing: var(--d-track);
}

.remix__who {
  margin-top: 8px;
  font-size: 15px;
  color: var(--muted);
}

.remix__action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* Grease-pencil annotation */
.remix__note {
  font-family: var(--f-hand);
  font-size: 24px;
  line-height: 1;
  color: var(--accent-text);
  transform: rotate(-3deg);
}

.remix__btn {
  flex: none;
  padding: 14px 26px;
  transition: transform 120ms ease;
}

.remix__btn:active {
  transform: scale(.97);
}

.remix__spec {
  margin: 22px 0 0;
  border-top: 1px solid var(--line);
}

.remix__row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.remix__row dt {
  padding-top: 2px;
  font-family: var(--f-mono);
  font-size: 13px;
  color: var(--muted);
}

.remix__row dd {
  margin: 0;
}

.remix__sample {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  margin-top: 22px;
}

.remix__aa {
  font-family: var(--f-display);
  font-weight: var(--d-weight);
  font-size: 64px;
  line-height: 1;
}

.remix__swatches {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-width: 220px;
}

.swatch {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.swatch__chip {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--swatch);
  transition: background-color var(--dur) var(--ease);
}

.swatch__name {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--muted);
}

/* ---- Index head --------------------------------------------------------- */
.cover-index {
  max-width: 1480px;
  margin: 0 auto;
  padding: clamp(72px, 9vw, 128px) clamp(20px, 4vw, 56px) 40px;
}

.cover-index__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 28px;
}

.cover-index__eyebrow {
  margin-bottom: 10px;
  font-size: 13px;
}

.cover-index__title {
  font-size: var(--t-h1);
  line-height: 1;
}

.cover-index__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
}

.cover-index__hint {
  max-width: 30em;
  font-size: 15px;
  color: var(--muted);
}

/* ---- Frame (shared by all views) ---------------------------------------- */
.frame {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  outline-offset: 6px;
  transition: transform var(--dur) var(--ease);
}

.frame:hover {
  color: inherit;
}

.frame__head {
  display: flex;
  justify-content: space-between;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--edge);
  font-variant-numeric: tabular-nums;
}

.frame__media {
  position: relative;
  display: block;
  aspect-ratio: var(--frame-ratio);
  padding: var(--frame-pad);
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  transition: padding var(--dur) var(--ease);
}

.frame__ph {
  display: flex;
  align-items: flex-end;
  height: 100%;
  padding: 12px;
  overflow: hidden;
  border-radius: var(--radius);
  background: repeating-linear-gradient(135deg, var(--ph) 0 10px, var(--ph-stripe) 10px 11px);
  filter: var(--img-filter);
}

/* "You are here" stamp on the K00 frame */
.frame__here {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 8px;
  border: 2px solid var(--accent);
  background: var(--surface);
  color: var(--accent-text);
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  transform: rotate(-7deg);
}

.frame__body {
  display: block;
}

.frame__title {
  display: block;
  font-family: var(--f-display);
  font-weight: var(--d-weight);
  text-transform: var(--d-case);
  font-size: 21px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.frame__desc {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--sheet-muted);
  text-wrap: pretty;
}

.frame__status {
  display: none;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--accent-text);
}

/* Loupe that follows the pointer over a frame (sheet view, fine pointers).
   Position and background offset are set by cover.js. */
.loupe {
  position: absolute;
  z-index: 3;
  width: 140px;
  height: 140px;
  margin: -70px 0 0 -70px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: repeating-linear-gradient(135deg, var(--ph) 0 25px, var(--ph-stripe) 25px 27.5px);
  filter: var(--img-filter);
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .55);
  pointer-events: none;
}

/* Hero + selection marks draw slightly faster than the default stroke */
.cover-hero__em .mark path,
.frame .mark path {
  animation-duration: 650ms;
}

/* ---- View: sheet (film strips) ------------------------------------------ */
.contact-sheet[data-view="sheet"] {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.strip {
  padding: 14px clamp(16px, 2.4vw, 32px) 18px;
  border-radius: var(--radius);
  background: var(--sheet);
  color: var(--sheet-ink);
  transition: background-color var(--dur) var(--ease);
}

/* Sprocket holes */
.strip__perf {
  height: 12px;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--sheet-ink) 0 12px, transparent 12px 30px);
  opacity: .8;
}

.strip__edge {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 22px;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--edge);
}

.strip__frames {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--frame-min)), 1fr));
  gap: var(--sheet-gap);
}

/* Playful preset tilts the frames on the sheet */
[data-preset="playful"] .contact-sheet[data-view="sheet"] .frame {
  transform: rotate(var(--tilt, 0deg));
}

/* ---- Views: list & gallery (strips dissolve into one sequence) ---------- */
.contact-sheet:not([data-view="sheet"]) .strip,
.contact-sheet:not([data-view="sheet"]) .strip__frames,
.contact-sheet:not([data-view="sheet"]) .frame__head,
.contact-sheet:not([data-view="sheet"]) .frame__body {
  display: contents;
}

.contact-sheet:not([data-view="sheet"]) .strip__perf,
.contact-sheet:not([data-view="sheet"]) .strip__edge,
.contact-sheet:not([data-view="sheet"]) .frame__head > span:first-child,
.contact-sheet:not([data-view="sheet"]) .frame__here {
  display: none;
}

.contact-sheet:not([data-view="sheet"]) .frame {
  color: var(--ink);
}

.contact-sheet:not([data-view="sheet"]) .frame__code {
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: normal;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.contact-sheet:not([data-view="sheet"]) .frame__title {
  letter-spacing: normal;
}

.contact-sheet:not([data-view="sheet"]) .frame__status {
  display: block;
}

/* List */
.contact-sheet[data-view="list"] {
  border-top: 1px solid var(--ink);
}

.contact-sheet[data-view="list"] .frame {
  display: grid;
  grid-template-columns: 72px minmax(0, 1.2fr) minmax(0, 2fr) 150px;
  gap: 20px;
  align-items: baseline;
  padding: 18px 8px;
  border-bottom: 1px solid var(--line);
  transition: background-color var(--dur) var(--ease);
}

.contact-sheet[data-view="list"] .frame:hover {
  background: var(--surface);
}

.contact-sheet[data-view="list"] .frame__media {
  display: none;
}

.contact-sheet[data-view="list"] .frame__title {
  font-size: clamp(20px, 2vw, 28px);
}

.contact-sheet[data-view="list"] .frame__desc {
  margin-top: 0;
  font-size: 15px;
  line-height: inherit;
  color: var(--muted);
}

.contact-sheet[data-view="list"] .frame__status {
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: right;
}

/* Gallery */
.contact-sheet[data-view="gallery"] {
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 4vw, 48px);
}

.contact-sheet[data-view="gallery"] .frame {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0 16px;
  align-items: baseline;
  position: relative;
}

.contact-sheet[data-view="gallery"] .frame__media {
  grid-row: 1;
  grid-column: 1 / -1;
  aspect-ratio: 2.39 / 1;
  padding: 0;
  overflow: visible;
  border-radius: 0;
  background: none;
  filter: var(--img-filter);
}

.contact-sheet[data-view="gallery"] .frame__ph {
  padding: 16px;
  border-radius: 0;
  filter: none;
}

.contact-sheet[data-view="gallery"] .ph__label {
  line-height: inherit;
}

.contact-sheet[data-view="gallery"] .frame__code,
.contact-sheet[data-view="gallery"] .frame__title,
.contact-sheet[data-view="gallery"] .frame__status {
  grid-row: 2;
  margin-top: 12px;
}

.contact-sheet[data-view="gallery"] .frame__status {
  grid-column: 3;
}

.contact-sheet[data-view="gallery"] .frame__title {
  font-size: clamp(24px, 2.6vw, 36px);
  line-height: inherit;
}

.contact-sheet[data-view="gallery"] .frame__desc {
  display: none;
}

/* ---- Footer ------------------------------------------------------------- */
.cover-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px 40px;
  max-width: 1480px;
  margin: 0 auto;
  padding: 40px clamp(20px, 4vw, 56px) 120px;
  border-top: 1px solid var(--line);
  font-family: var(--f-mono);
  font-size: 13px;
  color: var(--muted);
}

/* ---- Selection bar ------------------------------------------------------ */
.select-bar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 75;
  display: flex;
  align-items: center;
  gap: 20px;
  width: min(640px, calc(100vw - 32px));
  padding: 18px 20px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 40px -24px rgba(0, 0, 0, .45);
  transform: translateX(-50%);
  animation: proofUp var(--dur) var(--ease) both;
}

.select-bar__text {
  flex: 1;
  min-width: 0;
}

.select-bar__meta {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--muted);
}

.select-bar__title {
  margin: 2px 0;
  font-family: var(--f-display);
  font-weight: var(--d-weight);
  text-transform: var(--d-case);
  font-size: 24px;
  line-height: 1.2;
}

.select-bar__note {
  font-size: 15px;
  color: var(--muted);
}

.select-bar__stamp {
  padding: 5px 9px;
  border: 2px solid var(--accent);
  color: var(--accent-text);
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  animation: proofStamp 380ms cubic-bezier(.2, 1.4, .4, 1) both;
}

.select-bar__close {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
