@layer reset, base, components, responsive;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, ul, ol, figure, dl, dd { margin: 0; }
  ul, ol { padding: 0; list-style: none; }
  button, input, select { font: inherit; }
  img, video { display: block; max-width: 100%; }
  [hidden] { display: none !important; }
}

@layer base {
  html { scroll-padding-top: 24px; }
  body { background: var(--color-bg); color: var(--color-text); font-family: var(--font-ui); line-height: 1.5; }
  a { color: inherit; text-decoration: none; }
  a:hover { color: var(--color-accent); }
  button, select { cursor: pointer; }
  :focus-visible { outline: 2px solid var(--color-accent); outline-offset: 4px; }
  ::selection { color: var(--color-on-accent); background: var(--color-accent); }
  h1 { font-size: var(--text-display); line-height: 1.15; letter-spacing: -.035em; overflow-wrap: anywhere; }
  h2 { font-size: var(--text-lg); line-height: 1.3; letter-spacing: -.015em; }
  h3 { font-size: var(--text-base); }
  .container { width: min(100% - 32px, var(--content-max)); margin-inline: auto; }
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  .skip-link { position: absolute; left: 16px; top: -100px; z-index: 10; padding: 12px 20px; background: var(--color-accent); color: var(--color-on-accent); border-radius: var(--radius-sm); }
  .skip-link:focus { top: 12px; color: var(--color-on-accent); }
  .muted { color: var(--color-muted); }
  .eyebrow { color: var(--color-accent); font-size: var(--text-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 10px; }
  .text-link { color: var(--color-accent); text-decoration: underline; text-underline-offset: 4px; }
  .icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
}

@layer components {
  .site-top { border-bottom: 1px solid var(--color-line); }
  .top-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-block: 16px; }
  .wordmark { display: inline-flex; align-items: center; gap: 9px; font-size: 1.625rem; font-weight: 850; letter-spacing: -.055em; line-height: 1; }
  .wordmark:hover { color: var(--color-text); }
  .brand-mark { width: 29px; height: 29px; border-radius: 7px; display: grid; place-items: center; color: var(--color-on-accent); background: var(--color-accent); }
  .brand-mark .icon { width: 16px; height: 16px; fill: currentColor; stroke-width: 0; }
  .age-label { color: var(--color-muted); font-size: var(--text-xs); border: 1px solid var(--color-line); border-radius: var(--radius-sm); padding: 3px 6px; }
  .search-form { width: 100%; display: flex; align-items: stretch; border: 1px solid var(--color-line); background: var(--color-surface); border-radius: var(--radius-sm); }
  .search-form:focus-within { border-color: var(--color-accent); }
  .search-form input { min-width: 0; width: 100%; color: var(--color-text); background: var(--color-clear); border: 0; padding: 11px 12px; font-size: var(--text-sm); }
  .search-form input::placeholder { color: var(--color-muted); opacity: 1; }
  .search-form button { color: var(--color-accent); background: var(--color-clear); border: 0; display: grid; place-items: center; width: 48px; min-height: 44px; flex: none; }
  .primary-nav { display: flex; flex-wrap: wrap; gap: 0 24px; font-size: var(--text-sm); }
  .primary-nav a { display: flex; align-items: center; min-height: 48px; color: var(--color-secondary); position: relative; }
  .primary-nav a:hover, .primary-nav a[aria-current] { color: var(--color-text); }
  .primary-nav a[aria-current]::after { content: ""; position: absolute; bottom: -1px; inset-inline: 0; height: 3px; border-radius: 2px 2px 0 0; background: var(--color-accent); }
  .site-main { padding-top: 20px; padding-bottom: 48px; min-height: 60vh; }
  .breadcrumbs ol { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--color-muted); font-size: var(--text-xs); margin-bottom: 24px; }
  .breadcrumbs li + li::before { content: "/"; padding-right: 8px; color: var(--color-muted); }
  .breadcrumbs [aria-current] { color: var(--color-secondary); }
  .page-heading { margin-bottom: 22px; }
  .page-heading p:not(.eyebrow) { color: var(--color-muted); margin-top: 10px; font-size: var(--text-sm); max-width: 65ch; }
  .heading-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; }
  .heading-count { color: var(--color-muted); font-size: var(--text-sm); font-weight: 400; letter-spacing: 0; white-space: nowrap; }
  .quick-links, .tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
  .quick-links { flex-wrap: nowrap; overflow-x: auto; padding: 4px 4px 8px; margin: -4px -4px 12px; max-width: calc(100% + 8px); scrollbar-width: thin; }
  .quick-links li { flex: none; }
  .chip { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; font-size: var(--text-sm); color: var(--color-secondary); border: 1px solid var(--color-line); border-radius: var(--radius-pill); background: var(--color-surface); }
  .chip:hover { color: var(--color-accent); border-color: var(--color-accent); background: var(--color-accent-soft); }
  .chip[aria-current] { color: var(--color-accent); border-color: var(--color-accent); background: var(--color-accent-soft); }
  .listing-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 24px 0 16px; }
  .listing-tools .muted { font-size: var(--text-xs); }
  .sort-control { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--color-muted); }
  .sort-control select { max-width: 180px; min-height: 44px; padding: 8px; border: 1px solid var(--color-line); border-radius: var(--radius-sm); color: var(--color-text); background: var(--color-surface); }
  .video-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 12px; }
  .video-card { min-width: 0; }
  .thumb { display: block; position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius-sm); background: var(--color-raised); }
  .thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; }
  .thumb video.is-playing { opacity: 1; }
  .thumb img { width: 100%; height: 100%; object-fit: cover; }
  .quality, .duration { position: absolute; padding: 2px 5px; border-radius: 3px; font-size: .6875rem; font-weight: 650; line-height: 1.5; background: var(--color-overlay); color: var(--color-text); }
  .quality { left: 6px; top: 6px; color: var(--color-accent); }
  .duration { right: 6px; bottom: 6px; font-variant-numeric: tabular-nums; }
  .card-title { margin-top: 9px; font-size: var(--text-sm); line-height: 1.4; font-weight: 600; }
  .card-title a { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .card-meta { display: flex; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; margin-top: 5px; font-size: var(--text-xs); color: var(--color-muted); }
  .card-meta a { color: var(--color-secondary); }
  .card-stats { color: var(--color-muted); font-size: .6875rem; margin-top: 3px; }
  .pagination { display: flex; justify-content: center; align-items: center; gap: 8px; padding-top: 32px; }
  .pagination a, .pagination span { display: inline-flex; justify-content: center; align-items: center; min-width: 44px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--color-line); border-radius: var(--radius-sm); font-size: var(--text-sm); }
  .pagination [aria-current] { color: var(--color-on-accent); background: var(--color-accent); border-color: var(--color-accent); font-weight: 700; }
  .pagination .page-gap { border: 0; min-width: 12px; padding-inline: 0; }
  .section { margin-top: 40px; }
  .section-top { display: flex; gap: 16px; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
  .section-top a { color: var(--color-accent); font-size: var(--text-sm); min-height: 44px; display: inline-flex; align-items: center; flex-shrink: 0; }
  .related-section { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--color-line); }
  .related-section > p { margin-top: 8px; margin-bottom: 18px; color: var(--color-muted); font-size: var(--text-sm); }
  .related-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
  .related-grid a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding-block: 10px; border-bottom: 1px solid var(--color-line); font-size: var(--text-sm); color: var(--color-secondary); overflow-wrap: anywhere; }
  .related-grid a::after { content: "↗"; color: var(--color-muted); flex: none; font-size: var(--text-xs); }
  .related-grid a:hover, .related-grid a:hover::after { color: var(--color-accent); }
  .placement { display: grid; place-items: center; position: relative; background: var(--color-surface); border: 1px dashed var(--color-line); border-radius: var(--radius-sm); color: var(--color-muted); margin-inline: auto; text-align: center; }
  .placement p { font-size: var(--text-xs); }
  .placement small { display: block; font-size: .6875rem; margin-top: 6px; letter-spacing: .08em; }
  .placement-wide { display: none; width: 728px; height: 90px; }
  .placement-compact { width: 300px; height: 250px; }
  .placement-group { margin-block: 32px; }
  .category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
  .category-card { display: block; position: relative; isolation: isolate; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius-sm); background: var(--color-surface); }
  .category-card img { width: 100%; height: 100%; object-fit: cover; }
  .category-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, var(--color-clear), var(--color-overlay) 65%); z-index: 1; }
  .category-label { position: absolute; inset: auto 12px 10px; z-index: 2; color: var(--color-text); }
  .category-label strong { display: block; font-size: var(--text-base); }
  .category-label small { font-size: var(--text-xs); color: var(--color-secondary); }
  .category-card:hover { outline: 2px solid var(--color-accent); outline-offset: 2px; }
  .directory-filter { margin: 22px 0 24px; display: flex; flex-wrap: wrap; gap: 6px; }
  .directory-filter a { min-width: 40px; min-height: 44px; padding: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: var(--text-sm); color: var(--color-secondary); border: 1px solid var(--color-line); border-radius: var(--radius-sm); }
  .directory-filter a[aria-current] { color: var(--color-on-accent); background: var(--color-accent); border-color: var(--color-accent); }
  .performer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 12px; }
  .performer-image { display: block; aspect-ratio: 4 / 5; border-radius: var(--radius-sm); overflow: hidden; background: var(--color-surface); }
  .performer-image img { width: 100%; height: 100%; object-fit: cover; }
  .performer-card h2 { font-size: var(--text-base); margin: 10px 0 3px; }
  .performer-card p { font-size: var(--text-xs); color: var(--color-muted); }
  .profile { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 16px; margin-bottom: 28px; align-items: center; }
  .profile-photo { width: 88px; height: auto; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius-md); background: var(--color-surface); }
  .profile-copy { grid-column: 1 / -1; color: var(--color-secondary); font-size: var(--text-sm); max-width: 68ch; }
  .profile .eyebrow { margin-bottom: 6px; }
  .profile-facts { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-top: 12px; font-size: var(--text-sm); }
  .profile-facts div { display: flex; gap: 6px; }
  .profile-facts dt { color: var(--color-muted); }
  .profile-facts dd { color: var(--color-text); }
  .watch-layout { display: grid; gap: 32px; }
  .watch-main, .watch-side { min-width: 0; }
  .watch-main { container: watch-column / inline-size; }
  .player-shell { overflow: hidden; border: 1px solid var(--color-line); border-radius: var(--radius-md); background: var(--color-player); }
  .player-shell video { width: 100%; height: auto; aspect-ratio: 16 / 9; background: var(--color-player); object-fit: contain; }
  .player-caption { padding: 8px 12px; font-size: var(--text-xs); color: var(--color-muted); border-top: 1px solid var(--color-line); }
  .video-heading { font-size: clamp(1.375rem, 2.4vw, 2rem); margin-top: 22px; }
  .watch-stats { margin-top: 10px; font-size: var(--text-sm); color: var(--color-muted); }
  .video-details { display: grid; gap: 16px; padding-block: 20px; margin-block: 20px; border-block: 1px solid var(--color-line); font-size: var(--text-sm); }
  .video-details > div { display: grid; grid-template-columns: 80px minmax(0, 1fr); align-items: baseline; gap: 12px; }
  .video-details dt { color: var(--color-muted); }
  .video-details a { color: var(--color-accent); }
  .watch-description { font-size: var(--text-sm); color: var(--color-secondary); max-width: 65ch; }
  .watch-side h2 { margin-bottom: 18px; }
  .watch-side .video-grid { gap: 22px 12px; }
  .notice { padding: 20px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-md); color: var(--color-secondary); font-size: var(--text-sm); }
  .notice summary { color: var(--color-text); cursor: pointer; min-height: 28px; }
  .notice p { margin-top: 12px; }
  .site-footer { border-top: 1px solid var(--color-line); padding-block: 28px; }
  .footer-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px 24px; }
  .footer-row p { color: var(--color-muted); font-size: var(--text-xs); }
  .footer-nav { display: flex; flex-wrap: wrap; gap: 20px; font-size: var(--text-xs); color: var(--color-secondary); }
  .footer-nav a { min-height: 44px; display: flex; align-items: center; }
  .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; background: var(--color-accent); color: var(--color-on-accent); font-size: var(--text-sm); font-weight: 700; border-radius: var(--radius-sm); }
  .button:hover { background: var(--color-accent-hover); color: var(--color-on-accent); }
  .button-secondary { color: var(--color-text); background: var(--color-surface); border: 1px solid var(--color-line); }
  .button-secondary:hover { color: var(--color-accent); background: var(--color-raised); }
  .empty-state { max-width: 640px; padding: 32px 0 48px; }
  .error-code { color: var(--color-accent); font-size: clamp(5rem, 16vw, 9rem); font-weight: 850; letter-spacing: -.08em; line-height: 1; margin-bottom: 24px; }
  .empty-state p:not(.error-code) { color: var(--color-muted); margin-top: 16px; }
  .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
  .preview-intro { max-width: 760px; margin-bottom: 32px; }
  .preview-intro p:not(.eyebrow) { margin-top: 16px; color: var(--color-secondary); }
  .preview-grid { display: grid; gap: 16px; }
  .preview-card { display: flex; flex-direction: column; gap: 12px; padding: 24px; border: 1px solid var(--color-line); border-radius: var(--radius-md); background: var(--color-surface); }
  .preview-card:hover { border-color: var(--color-accent); color: var(--color-text); }
  .preview-card.is-featured { border-color: var(--color-accent); background: var(--color-accent-soft); }
  .preview-card small { color: var(--color-accent); font-size: var(--text-xs); font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
  .preview-card h2 { font-size: var(--text-xl); }
  .preview-card p { font-size: var(--text-sm); color: var(--color-secondary); }
  .preview-card code { color: var(--color-muted); font-size: var(--text-xs); margin-top: auto; overflow-wrap: anywhere; }
}

@layer responsive {
  @media (min-width: 600px) {
    .video-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 16px; }
    .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
    .performer-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 16px; }
    .related-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 24px; }
    .preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .profile { grid-template-columns: 144px minmax(0, 1fr); gap: 8px 24px; align-items: start; }
    .profile-photo { width: 144px; grid-row: 1 / 3; }
    .profile-copy { grid-column: 2; }
    .profile-facts { margin-top: 16px; }
    .watch-side .video-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .quick-links { flex-wrap: wrap; overflow: visible; margin-bottom: 20px; }
  }
  @media (min-width: 768px) {
    .container { width: min(100% - 64px, var(--content-max)); }
    .top-row { flex-wrap: nowrap; gap: 32px; padding-block: 20px; }
    .search-form { margin-inline: auto; max-width: 580px; }
    .age-label { order: 1; }
    .primary-nav { gap: 32px; }
    .site-main { padding-top: 24px; padding-bottom: 64px; }
    .page-heading { margin-bottom: 26px; }
    .card-title { font-size: .9375rem; }
  }
  /* 728px creative + 2 × 32px gutters must fit without shrinking. */
  @media (min-width: 800px) {
    .placement-wide { display: grid; }
    .placement-group > .placement-compact { display: none; }
  }
  @media (min-width: 1024px) {
    .video-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 30px 20px; }
    .category-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
    .performer-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 28px 20px; }
    .related-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 32px; }
    .watch-layout { grid-template-columns: minmax(0, 1fr) 300px; }
    .watch-side .video-grid { grid-template-columns: 1fr; }
    .watch-side .video-card { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 10px; align-items: start; }
    .watch-side .card-title { margin-top: 0; font-size: var(--text-sm); }
    .watch-side .card-stats { display: none; }
    .watch-side .quality, .watch-side .duration { font-size: .625rem; }
    .watch-side .card-meta { font-size: .6875rem; }
    .preview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .preview-card.is-featured { grid-column: span 2; }
  }
  .watch-main .placement-wide { display: none; }
  .watch-main .placement-group > .placement-compact { display: grid; }
  @container watch-column (min-width: 728px) {
    .watch-main .placement-wide { display: grid; }
    .watch-main .placement-group > .placement-compact { display: none; }
  }
  @media (prefers-reduced-motion: no-preference) {
    a, button { transition: color .15s ease, background-color .15s ease, border-color .15s ease; }
  }
  @media (forced-colors: active) {
    .primary-nav a[aria-current] { text-decoration: underline; }
    .thumb, .category-card, .brand-mark { border: 1px solid currentColor; }
  }
}

@layer components {
  .sort-control { flex-wrap: wrap; }
  .sort-apply { min-height: 44px; padding: 8px 12px; border: 1px solid var(--color-line); border-radius: var(--radius-sm); color: var(--color-text); background: var(--color-surface); font-size: var(--text-sm); }
  .sort-apply:hover { border-color: var(--color-accent); color: var(--color-accent); }
  .performer-card h3 { font-size: var(--text-base); margin: 10px 0 3px; }
  .pagination { flex-wrap: wrap; }
  .video-grid > .notice { grid-column: 1 / -1; }
  .video-details dd { min-width: 0; overflow-wrap: anywhere; }
  .performer-card { min-width: 0; overflow-wrap: anywhere; }
}
