:root {
  --bg: #f8f9fb;
  --paper: #ffffff;
  --ink: #17191c;
  --muted: #6f747b;

  --line: rgba(0, 0, 0, 0.08);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.06);

  --accent: #ff7a1a;
  --accent-hover: #ff6200;

  --hdr-h: 56px;

  --gap: 16px;

  /* SNAP-SIZE SYSTEM: exactly two sizes */
  --size-large: 620px; /* Large tile width */
  --size-small: 240px; /* Small box/thumb width */
}

/* Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  height: var(--hdr-h);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Make brand a neutral button (never blue) */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  appearance: none;
  color: var(--ink);
  text-decoration: none;
}

.brand:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.2);
  outline-offset: 2px;
}

.brand-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* Partner / opposite-side logo (oologo) */
.partner {
  margin-left: auto; /* push to far right of header */
  display: inline-flex;
  align-items: center;
}

.partner-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit; /* inherit the rgb color we set on children */
}

.partner-link:focus-visible {
  outline: 3px solid rgba(23,25,28,0.12);
  outline-offset: 3px;
  border-radius: 6px;
}

.partner-by {
  font-size: 10px;
  color: rgb(23,25,28);
  margin-right: 8px;
  font-weight: 700;
}

/* partner-logo is now a masked element so we can color it exactly */
.partner-logo {
  display: inline-block;
  width: auto;
  height: 28px; /* increased so logo isn't too small */
  min-width: 60px;
  background-color: rgb(23,25,28); /* this paints the masked area */
  -webkit-mask-image: url('/oologo.png');
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  -webkit-mask-position: center;
  mask-image: url('/oologo.png');
  mask-repeat: no-repeat;
  mask-size: contain;
  mask-position: center;
  margin-left: -2px;
  margin-top: 2px;
}

.header-inner h1 {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
}

/* Filters (sticky bar) */
.filters-wrap {
  position: sticky;
  top: var(--hdr-h);
  z-index: 9;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

/* Mobile: collapsible header for filters */
.filters-head {
  display: none;
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 16px;
  align-items: center;
  justify-content: center;
}

.filters-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  cursor: pointer;
}

.filters-toggle .chev {
  transition: transform .2s ease;
  display: inline-block;
}

.filters-toggle[aria-expanded="true"] .chev {
  transform: rotate(180deg);
}

/* Pills container */
.filters {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
}

.pill {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}

.pill:hover {
  background: #fff1e7;
  border-color: rgba(0, 0, 0, 0.12);
}

.pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-hover);
}

.pill.pill--clear {
  background: #fff;
  color: var(--muted);
}

/* Hide/show pills on mobile via class */
@media (max-width: 640px) {
  .filters-head {
    display: flex;
  }

  .filters {
    display: none;
  }

  .filters-wrap.is-open .filters {
    display: flex;
  }
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 16px;
}

/* Row layout */
.tile-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: stretch;
  margin-bottom: calc(var(--gap) * 3.2);
}

/* Big tile (square) */
.tile {
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  overflow: hidden;
  background: #f2f4f8;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .38s ease, box-shadow .38s ease;
}

.tile:hover {
  transform: translateY(-1px);
}

/* SNAP: Large tile only takes Large or Small token widths */
.tile.large {
  aspect-ratio: 1 / 1;
  width: var(--size-large);
  max-width: 100%;
  justify-self: center; /* center by default */
  margin-left: auto;
  margin-right: auto;
}

/* Avoid right-edge anchoring on 'right' rows */
.tile-row.right .tile.large {
  justify-self: center; /* was: end */
}

.tile img,
.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.0);
  transition: transform .6s ease;
}

.tile:hover img,
.tile:hover video {
  transform: scale(1.012);
}

/* Overlay on big tile */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.00) 55%, rgba(0, 0, 0, 0.5) 100%);
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.t {
  font-weight: 900;
  letter-spacing: .01em;
  font-size: 14px;
  line-height: 1.2;
}

.d {
  font-size: 12.5px;
  opacity: .95;
  max-width: 60ch;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chips span {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 10.5px;
}

.actions {
  display: flex;
  gap: 8px;
}

.btn,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn {
  background: var(--accent);
  color: #fff;
  border-color: #ea6f17;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: rgba(42, 41, 41, 0.77);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.24);
}

.btn-ghost:hover {
  background: rgba(7, 5, 5, 0.518);
}

/* Small grid (2×2) */
.small-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
  justify-content: center; /* keep grid centered under its column */
}

/* Small cell with outside caption */
.small-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* SNAP: Small box only uses Small token width */
.small-box {
  width: var(--size-small);
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  overflow: hidden;
  background: #f2f4f8;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .38s ease, box-shadow .38s ease;
}

.small-box:hover {
  transform: translateY(-1px);
}

.small-box img,
.small-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.0);
  transition: transform .6s ease;
}

.small-box:hover img,
.small-box:hover video {
  transform: scale(1.01);
}

/* Match caption width to Small token so text aligns with box */
.small-caption {
  width: var(--size-small);
  text-align: center;
}

.small-title {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .01em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.small-chips {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.small-chips span {
  font-size: 10.5px;
  color: var(--ink);
  background: #fff;
  border: 1px dashed rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  padding: 2px 6px;
}

/* No media */
.no-media {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #98a0aa;
  font-size: 13px;
}

/* ===== Details page ===== */
.details-hero {
  padding: 30px 16px 0;
}

.details-hero-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
  grid-template-columns: 2fr 1fr;
  align-items: stretch;
}

@media (max-width: 980px) {
  .details-hero-inner {
    grid-template-columns: 1fr;
  }
}

/* Strict 16:9 cover block for 1920×1080 imagery */
.details-cover {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #f2f4f8;
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 9;
  width: 100%;
  max-height: 720px;
}

.details-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.details-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.details-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.details-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.details-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: .01em;
}

.details-sub {
  color: var(--muted);
  font-size: 14px;
}

.details-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.details-meta {
  margin-top: 6px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.meta-row span {
  color: var(--muted);
}

.meta-row b {
  font-weight: 800;
}

.details-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.details-chip {
  font-size: 11.5px;
  letter-spacing: .01em;
  color: var(--ink);
  background: #fff;
  border: 1px dashed rgba(0, 0, 0, 0.12);
  padding: 4px 8px;
  border-radius: 999px;
}

/* Responsive (layout only — sizes still snap to tokens) */
@media (max-width: 1080px) {
  .tile-row {
    grid-template-columns: 1fr;
  }

  /* Keep Large centered */
  .tile.large {
    justify-self: center;
  }
}

/* ===== Mobile: keep two sizes, Large > Small, and show filter menu ===== */
@media (max-width: 640px) {
  /* Override tokens on mobile so Large remains visually larger */
  :root {
    /* Large spans the content width minus side padding */
    --size-large: calc(100vw - 32px);   /* matches .container padding 16px */
    /* Small remains smaller by ratio */
    --size-small: calc(var(--size-large) * 0.78);
  }

  /* Mobile filters UX is handled via .filters-head visibility + .is-open above */

  /* Ensure the large tile uses the large token and centers */
  .tile.large {
    width: var(--size-large);
    max-width: 100%;
    justify-self: center;
    margin-left: auto;
    margin-right: auto;
  }

  /* Stack smalls and center them so fixed width looks good */
  .small-grid {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  /* Captions match the small token width */
  .small-caption {
    width: var(--size-small);
  }

  .small-title {
    font-size: 12.8px;
  }
}
