/*
 * Pirate Deck responsive and density layer.
 *
 * This file intentionally loads after main.css. It keeps breakpoint-specific
 * decisions isolated so future components can extend the base design without
 * reopening the full visual stylesheet.
 */

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

img,
video,
iframe {
  max-width: 100%;
}

.topbar {
  grid-template-areas: "left brand right";
}

.topbar__drawer {
  display: contents;
}

.topbar__group--left {
  grid-area: left;
}

.topbar__group {
  width: 100%;
  min-width: 0;
  gap: clamp(12px, 1.7vw, 28px);
}

.topbar__group--left {
  padding-right: clamp(8px, 1.4vw, 22px);
}

.brand {
  grid-area: brand;
}

.topbar__group--right {
  grid-area: right;
  padding-left: clamp(8px, 1.4vw, 22px);
}

.topbar__group ul {
  min-width: 0;
  flex: 1 1 auto;
  justify-content: space-evenly;
}

.topbar__group li > a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  line-height: 1.12;
}

.topbar--balanced-menu .topbar__group--left ul {
  justify-content: space-around;
}

.topbar--balanced-menu .topbar__group--right ul {
  justify-content: space-around;
}

.topbar__menu-toggle,
.topbar__mobile-search {
  display: none;
}

.home-feature {
  padding-block: clamp(76px, 7vw, 108px);
}

.home-feature__image,
.home-feature__image img {
  min-height: 0;
}

.home-feature__image {
  aspect-ratio: 16 / 10;
}

.home-latest {
  padding-block: clamp(58px, 4.6vw, 76px) clamp(34px, 2.8vw, 46px);
}

.home-latest > .content-grid > .content-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.home-categories {
  padding-block: clamp(34px, 2.8vw, 46px) clamp(58px, 4.8vw, 78px);
}

.home-categories .section-heading {
  margin-bottom: clamp(28px, 2.5vw, 38px);
}

.category-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid rgba(221, 167, 59, 0.28);
  background: rgba(221, 167, 59, 0.24);
}

.category-list > a {
  min-height: 112px;
  padding: 18px 20px;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 18px;
  border: 0;
  background: #080807;
}

.category-list > a:hover {
  padding-left: 24px;
}

.category-list > a:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.category-list__icon {
  width: 48px;
  height: 48px;
}

.category-list strong {
  margin-top: 3px;
  font-size: clamp(30px, 2.8vw, 42px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.category-list p {
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.45;
}

.home-video {
  padding-block: clamp(68px, 6vw, 94px);
}

.post-related {
  padding-block: clamp(42px, 3.6vw, 58px);
}

.post-related .section-heading {
  margin-bottom: clamp(28px, 2.5vw, 38px);
}

.post-hero {
  min-height: min(700px, 88svh);
}

.post-hero__content {
  padding-block: 54px 72px;
}

.post-back {
  margin-bottom: 32px;
}

.post-hero h1 {
  font-size: clamp(64px, 7.2vw, 108px);
  overflow-wrap: anywhere;
}

.post-layout {
  padding-block: clamp(38px, 3.2vw, 52px);
  gap: clamp(48px, 6vw, 78px);
}

.post-fact-band {
  margin-bottom: clamp(34px, 3vw, 44px);
}

.post-fact-band > span {
  min-height: 96px;
}

.post-article > section,
.post-project-gallery,
.post-video-section {
  margin-top: 76px;
}

.post-share {
  margin-top: 72px;
}

.author-card {
  margin-top: 56px;
}

.post-comments {
  margin-top: 76px;
}

.archive-hero {
  min-height: clamp(380px, 44svh, 500px);
  padding-bottom: 0;
  grid-template-rows: 92px minmax(0, 1fr);
}

.archive-hero__copy {
  padding-top: clamp(26px, 3.4vh, 42px);
  padding-bottom: 28px;
}

.archive-hero__copy > h1 {
  font-size: clamp(68px, 8vw, 116px);
  overflow-wrap: anywhere;
}

.archive-layout {
  width: min(100% - 8vw, 1280px);
}

.archive-content {
  margin-top: 0;
}

.archive-sidebar {
  margin-top: 28px;
}

.entry-content {
  max-width: 820px;
}

.entry-content,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content a {
  overflow-wrap: anywhere;
}

.entry-content pre,
.entry-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.entry-content pre {
  padding: 18px;
  border: 1px solid rgba(221, 167, 59, 0.22);
  background: #0b0b09;
  white-space: pre;
}

.entry-content iframe,
.entry-content video,
.entry-content embed,
.entry-content object {
  width: 100%;
}

@media (min-width: 761px) and (max-width: 1100px) {
  .story-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .story,
  .story:first-child,
  .story:last-child {
    padding: 12px 16px;
    grid-template-columns: 1fr;
    align-content: start;
    border-right: 1px solid rgba(221, 167, 59, 0.22);
    border-bottom: 0;
  }

  .story:first-child {
    padding-left: 0;
  }

  .story:last-child {
    padding-right: 0;
    border-right: 0;
  }

  .story__description {
    display: none;
  }

  .story strong {
    font-size: clamp(22px, 2.7vw, 30px);
  }

  .home-feature__image {
    aspect-ratio: 16 / 9;
  }

  .home-feature__image,
  .home-feature__image img {
    min-height: 0;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .content-card {
    grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.2fr);
  }

  .content-card__image {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .content-card__body {
    padding: 28px 32px;
  }

  .content-card__body strong {
    font-size: clamp(34px, 4.6vw, 48px);
  }
}

@media (max-width: 920px) {
  .hero {
    grid-template-rows: 76px minmax(500px, 1fr) auto;
  }

  .topbar {
    width: calc(100% - 32px);
    min-height: 76px;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "menu brand search";
  }

  .topbar__menu-toggle,
  .topbar__mobile-search {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    color: var(--bone);
    border: 0;
    background: transparent;
    font-family: "Bebas Neue", Impact, sans-serif;
    font-size: 16px;
    letter-spacing: 0.14em;
    cursor: pointer;
  }

  .topbar__menu-toggle {
    grid-area: menu;
    justify-self: start;
  }

  .topbar__mobile-search {
    grid-area: search;
    justify-self: end;
    justify-content: flex-end;
  }

  .brand {
    width: 62px;
    height: 62px;
  }

  .brand img {
    width: 54px;
    height: 54px;
  }

  .topbar__drawer {
    position: absolute;
    z-index: 20;
    top: calc(100% + 1px);
    left: 0;
    width: 100%;
    padding: 18px;
    display: none;
    gap: 0;
    border: 1px solid rgba(221, 167, 59, 0.35);
    background: rgba(7, 7, 6, 0.98);
    box-shadow: 0 24px 52px rgba(0, 0, 0, 0.58);
  }

  .topbar.is-menu-open .topbar__drawer {
    display: grid;
  }

  .topbar__group,
  .topbar__group--left,
  .topbar__group--right {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    font-size: 18px;
    padding-inline: 0;
  }

  .topbar__group ul {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .topbar__group a,
  .topbar__group li > a {
    min-height: 48px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(221, 167, 59, 0.16);
  }

  .topbar__group > span,
  .topbar__group--right [data-search-toggle] {
    display: none;
  }

  .search-panel {
    position: fixed;
    top: 84px;
  }

  .post-hero {
    grid-template-rows: 76px 1fr;
  }

  .archive-hero {
    min-height: clamp(390px, 48svh, 480px);
    grid-template-rows: 76px minmax(0, 1fr);
  }

  .archive-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .archive-content {
    padding-bottom: 64px;
  }

  .archive-content-shell::before {
    background: linear-gradient(
      90deg,
      rgba(5, 5, 5, 0.28),
      rgba(5, 5, 5, 0.93) 12%,
      rgba(5, 5, 5, 0.96) 50%,
      rgba(5, 5, 5, 0.93) 88%,
      rgba(5, 5, 5, 0.28)
    );
  }

  .archive-sidebar {
    position: static;
    margin: 0 0 80px;
    padding: 42px 0 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
    border-top: 1px solid rgba(221, 167, 59, 0.42);
    border-left: 0;
  }

  .archive-sidebar .archive-widget {
    min-width: 0;
    margin: 0;
  }
}

@media (max-width: 760px) {
  .hero {
    min-height: auto;
    grid-template-rows: 76px minmax(500px, calc(100svh - 76px)) auto;
  }

  .hero__copy {
    width: calc(100% - 32px);
    margin-bottom: 18px;
    padding: 20px 14px 22px;
  }

  .hero__copy h1 {
    font-size: clamp(54px, 17vw, 72px);
    line-height: 0.92;
    white-space: normal;
    text-wrap: balance;
  }

  .hero__subtitle {
    margin-block: 14px 20px;
  }

  .captains-log {
    padding: 16px;
  }

  .story-grid {
    grid-template-columns: 1fr;
  }

  .story,
  .story:first-child,
  .story:last-child {
    min-height: 104px;
    padding: 12px 0;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid rgba(221, 167, 59, 0.2);
  }

  .story:last-child {
    border-bottom: 0;
  }

  .story strong {
    font-size: 22px;
    overflow-wrap: anywhere;
  }

  .story__description {
    display: none;
  }

  .section-heading {
    margin-bottom: 30px;
  }

  .section-heading h2 {
    font-size: clamp(42px, 13vw, 58px);
  }

  .section-heading > span {
    margin-top: 12px;
    padding: 0;
    font-size: 14px;
    line-height: 1.55;
  }

  .home-feature {
    width: calc(100% - 32px);
    padding-block: 54px;
    gap: 30px;
  }

  .home-feature__image {
    min-height: 0;
    aspect-ratio: 4 / 3;
  }

  .home-feature__image img {
    min-height: 0;
  }

  .home-feature__copy h2,
  .home-video h2 {
    font-size: clamp(42px, 13vw, 58px);
    overflow-wrap: anywhere;
  }

  .home-latest {
    padding: 44px 16px 30px;
  }

  .post-related {
    padding: 40px 16px 48px;
  }

  .content-grid,
  .post-related .content-grid {
    grid-template-columns: 1fr;
  }

  .content-card,
  .post-related .content-card {
    grid-template-columns: 1fr;
  }

  .content-card__image,
  .post-related .content-card__image {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .content-card__body {
    padding: 22px 20px 24px;
  }

  .content-card__body strong {
    font-size: clamp(31px, 10vw, 40px);
    overflow-wrap: anywhere;
  }

  .content-card__action {
    margin-top: 18px;
  }

  .home-categories {
    width: calc(100% - 32px);
    padding-block: 34px 46px;
  }

  .category-list {
    grid-template-columns: 1fr;
  }

  .category-list > a {
    min-height: 90px;
    padding: 14px 12px;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 12px;
  }

  .category-list > a:hover {
    padding-left: 12px;
  }

  .category-list__icon {
    width: 42px;
    height: 42px;
  }

  .category-list strong {
    font-size: 31px;
  }

  .category-list p {
    display: none;
  }

  .home-video {
    padding: 54px 16px;
    gap: 30px;
  }

  .post-hero {
    min-height: auto;
    grid-template-rows: 76px auto;
    overflow: visible;
  }

  .post-hero__content {
    width: calc(100% - 32px);
    padding-block: 50px 46px;
  }

  .post-back {
    margin-bottom: 26px;
  }

  .post-hero h1 {
    font-size: clamp(46px, 15vw, 64px);
    line-height: 0.92;
  }

  .post-hero__content > span {
    margin-top: 18px;
    font-size: 16px;
    line-height: 1.5;
  }

  .post-hero__meta {
    margin-top: 24px;
  }

  .post-layout {
    width: calc(100% - 32px);
    padding-block: 32px 44px;
  }

  .post-fact-band {
    margin-bottom: 32px;
  }

  .post-article > section,
  .post-project-gallery,
  .post-video-section {
    margin-top: 58px;
  }

  .post-article h2,
  .post-comments h2,
  .entry-content h2 {
    font-size: clamp(40px, 12vw, 54px);
    line-height: 1;
  }

  .entry-content {
    font-size: 16px;
    line-height: 1.7;
  }

  .entry-content h3 {
    font-size: clamp(31px, 10vw, 42px);
  }

  .entry-content blockquote {
    padding: 18px 20px;
  }

  .post-share {
    margin-top: 58px;
  }

  .author-card {
    margin-top: 46px;
    padding: 20px;
  }

  .post-comments {
    margin-top: 58px;
  }

  .archive-hero {
    min-height: clamp(350px, 50svh, 440px);
    padding-bottom: 0;
    grid-template-rows: 76px minmax(0, 1fr);
  }

  .archive-hero__copy {
    width: calc(100% - 32px);
    padding-top: 28px;
    padding-bottom: 24px;
  }

  .archive-hero__copy > h1 {
    font-size: clamp(54px, 17vw, 76px);
  }

  .archive-hero__description {
    margin-top: 16px;
    font-size: 16px;
    line-height: 1.5;
  }

  .archive-layout {
    width: calc(100% - 32px);
    grid-template-columns: 1fr;
    gap: 0;
  }

  .archive-content {
    width: auto;
    padding-block: 24px 64px;
  }

  .archive-featured {
    margin-bottom: 24px;
  }

  .archive-featured__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
  }

  .archive-featured__item {
    min-height: 180px;
  }

  .archive-featured__item--lead {
    grid-column: 1 / -1;
    grid-row: auto;
    min-height: 300px;
  }

  .archive-featured__copy strong {
    font-size: clamp(22px, 5vw, 30px);
  }

  .archive-featured__item--lead .archive-featured__copy strong {
    font-size: clamp(34px, 9vw, 48px);
  }

  .archive-featured__item:not(.archive-featured__item--lead) .category-badge {
    width: 36px;
    height: 36px;
  }

  .archive-featured__item:not(.archive-featured__item--lead) .archive-featured__label {
    max-width: calc(100% - 58px);
  }

  .archive-content .content-card {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .archive-content .content-card__image {
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .archive-content .content-card__body {
    padding: 22px 20px 24px;
  }

  .archive-content .content-card__body strong {
    font-size: clamp(31px, 10vw, 40px);
  }

  .archive-sidebar {
    margin: 0 0 68px;
    padding-top: 38px;
    display: block;
  }

  .archive-sidebar .archive-widget {
    margin-bottom: 28px;
  }
}

@media (max-width: 390px) {
  .topbar {
    width: calc(100% - 24px);
  }

  .topbar__menu-toggle {
    font-size: 14px;
  }

  .brand,
  .brand img {
    width: 50px;
    height: 50px;
  }

  .hero__copy h1 {
    font-size: 52px;
  }

  .primary-cta {
    min-height: 52px;
    font-size: 17px;
  }

  .story,
  .story:first-child,
  .story:last-child {
    grid-template-columns: 98px minmax(0, 1fr);
  }

  .content-card__body {
    padding-inline: 18px;
  }

  .post-hero h1 {
    font-size: 44px;
  }

  .post-hero__content > p {
    font-size: 14px;
  }
}

/* Latest-posts layout breakpoints are isolated from the cards used by
 * archives and related-post sections.
 */
@media (max-width: 1180px) {
  .latest-header {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.7fr);
    gap: 40px;
  }

  .latest-posts--grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .latest-posts--deck,
  .latest-posts--staggered {
    grid-template-columns: 1fr;
  }

  .latest-deck-card {
    height: 230px;
  }
}

@media (max-width: 760px) {
  .home-latest {
    padding: 62px 18px;
  }

  .latest-header {
    margin-bottom: 22px;
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .latest-header h2 {
    font-size: clamp(48px, 15vw, 68px);
  }

  .latest-header > span {
    padding-bottom: 0;
    font-size: 14px;
  }

  .latest-filters {
    gap: 24px;
    margin-bottom: 18px;
  }

  .latest-filter-count {
    padding-left: 10px;
  }

  .latest-deck-card {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  }

  .latest-deck-card__copy {
    padding: 22px;
  }

  .latest-deck-card__copy p {
    display: none;
  }
}

@media (max-width: 540px) {
  .latest-posts--grid {
    grid-template-columns: 1fr;
  }

  .latest-grid-card strong {
    font-size: clamp(30px, 10vw, 42px);
  }

  .latest-deck-card {
    grid-template-columns: 1fr;
    height: auto;
  }

  .latest-deck-card__media {
    aspect-ratio: 16 / 9;
    min-height: 0;
  }

  .latest-deck-card__copy {
    min-height: 190px;
  }

  .latest-deck-card__copy p {
    display: block;
  }

  .latest-load__button {
    width: 100%;
    min-width: 0;
  }
}
