/*
Theme Name: Carnivore Project
Theme URI: https://carnivoreproject.org/
Author: Carnivore Project
Description: A custom block theme for Carnivore Project, built for accessible wildlife research, public information, and community resources.
Version: 0.1.11
Requires at least: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: carnivore-project
*/

:root {
  --cp-shadow-soft: 0 12px 34px rgba(21, 31, 25, 0.09);
  --cp-shadow-card: 0 8px 24px rgba(21, 31, 25, 0.08);
}

html {
  scroll-behavior: smooth;
}

body {
  text-wrap: pretty;
}

a {
  text-underline-offset: 0.16em;
  text-decoration-thickness: 0.08em;
}

:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 3px solid var(--wp--preset--color--gold);
  outline-offset: 3px;
}

.wp-site-blocks {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wp-site-blocks > main {
  flex: 1;
  margin-block-start: 0 !important;
}

.wp-site-blocks > .wp-block-template-part {
  margin-block-start: 0 !important;
}

.cp-front-page,
.cp-front-page > .wp-block-post-content,
.cp-front-page > .wp-block-post-content > :first-child {
  margin-block-start: 0 !important;
}

/* The homepage header and hero are intentionally locked together. */
body.home .wp-site-blocks,
body.home .cp-home-shell,
body.home .cp-home-main,
body.home .cp-home-content {
  gap: 0 !important;
  margin-block: 0 !important;
  padding-block: 0 !important;
}

body.home .cp-home-shell > *,
body.home .cp-home-main > *,
body.home .cp-home-content > :first-child {
  margin-block-start: 0 !important;
}

body.home .cp-home-header + .cp-home-main {
  margin-top: 0 !important;
}

/* Remove saved editor spacing only at the homepage's top boundary. */
body.home .cp-home-content > .wp-block-spacer:first-child,
body.home .cp-home-content > p:empty:first-child,
body.home .cp-home-content > .wp-block-group:empty:first-child {
  display: none !important;
}

body.home .cp-home-main > :first-child,
body.home .cp-home-content > :first-child,
body.home .cp-home-content > :first-child > :first-child,
body.home .cp-home-content > :first-child > :first-child > :first-child {
  border-top: 0 !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
}

body.home .cp-home-content > :first-child::before {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
}

/* The homepage Custom HTML starts with a zero-height STYLE node. */
body.home .cp-home-content > style:first-child + .cp-home {
  margin-top: 0 !important;
}

/* Header */
.cp-site-header {
  position: relative;
  z-index: 20;
  border-bottom: 1px solid var(--wp--preset--color--mist);
  box-shadow: 0 2px 12px rgba(16, 44, 40, 0.05);
}

.cp-brand-logo {
  flex: 0 0 48px;
  line-height: 0;
  margin: 0;
}

.cp-brand-logo img {
  display: block;
  height: 48px;
  object-fit: contain;
  width: 48px;
}

.cp-site-header .wp-block-site-title a,
.cp-site-header .wp-block-navigation-item__content {
  text-decoration: none;
}

.cp-site-header .wp-block-navigation-item__content {
  padding-block: 0.45rem;
}

.cp-site-header .wp-block-navigation-item__content:hover {
  color: var(--wp--preset--color--pine);
}

/* Page hero */
.cp-page-hero {
  overflow: hidden;
  position: relative;
}

.cp-page-hero .wp-block-post-featured-image {
  margin: 0;
  max-height: 34rem;
  overflow: hidden;
}

.cp-page-hero .wp-block-post-featured-image img {
  aspect-ratio: 16 / 6;
  object-fit: cover;
  width: 100%;
}

.cp-page-title-band {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.cp-page-title-band h1 {
  max-width: 18ch;
}

/* Main content */
.cp-entry-content {
  min-height: 24rem;
}

.cp-entry-content > :where(h2, h3, h4) {
  scroll-margin-top: 2rem;
}

.cp-entry-content :where(h2, h3) + p {
  margin-top: 0.65rem;
}

.cp-entry-content :where(ul, ol) {
  padding-left: 1.35em;
}

.cp-entry-content img {
  border-radius: var(--wp--custom--radius--medium);
}

.cp-entry-content .wp-block-image figcaption {
  color: var(--wp--preset--color--slate);
  font-size: var(--wp--preset--font-size--small);
}

/* Reusable visual utilities */
.cp-card {
  border: 1px solid var(--wp--preset--color--mist);
  border-radius: var(--wp--custom--radius--medium);
  box-shadow: var(--cp-shadow-card);
  height: 100%;
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.cp-card:hover {
  box-shadow: var(--cp-shadow-soft);
  transform: translateY(-2px);
}

.cp-notice {
  border-left: 5px solid var(--wp--preset--color--gold);
  border-radius: 0 var(--wp--custom--radius--small) var(--wp--custom--radius--small) 0;
}

.cp-safety-notice {
  border-left-color: var(--wp--preset--color--rust);
}

.wp-block-button .wp-block-button__link {
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.wp-block-button .wp-block-button__link:hover {
  transform: translateY(-1px);
}

.is-style-outline > .wp-block-button__link:hover {
  background: var(--wp--preset--color--forest);
  color: var(--wp--preset--color--white);
}

/* Lists and query cards */
.cp-post-list .wp-block-post {
  border-bottom: 1px solid var(--wp--preset--color--mist);
  padding-bottom: var(--wp--preset--spacing--50);
}

.wp-block-query-pagination a {
  text-decoration: none;
}

/* Footer */
.cp-site-footer a {
  color: inherit;
}

.cp-site-footer a:hover {
  color: var(--wp--preset--color--gold);
}

.cp-social-links {
  display: grid;
  gap: 0.7rem;
}

.cp-social-links p {
  margin: 0;
}

.cp-social-links a {
  display: block;
  text-decoration: none;
}

.cp-social-links strong {
  color: var(--wp--preset--color--gold);
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Reusable photographic hero for the standard Page template. */
.cp-template-hero {
  margin-block: 0 !important;
  min-height: 620px;
}

.cp-template-hero .wp-block-cover__image-background {
  object-position: center;
}

.cp-template-hero .wp-block-cover__background {
  background: linear-gradient(
    90deg,
    rgba(10, 38, 33, 0.92) 0%,
    rgba(10, 38, 33, 0.76) 44%,
    rgba(10, 38, 33, 0.3) 76%,
    rgba(10, 38, 33, 0.12) 100%
  ) !important;
  opacity: 1 !important;
}

.cp-template-hero__content {
  padding-block: clamp(64px, 8vw, 104px);
}

.cp-template-hero .wp-block-post-title {
  color: var(--wp--preset--color--white) !important;
  font-family: var(--wp--preset--font-family--body);
  font-size: clamp(3rem, 5vw, 5rem) !important;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.02;
  margin: 0;
  max-width: 760px;
}

.cp-template-hero__description {
  margin-top: 22px !important;
  max-width: 680px;
}

.cp-template-hero__description .wp-block-post-excerpt__excerpt {
  color: rgba(255, 255, 255, 0.9) !important;
  font-family: var(--wp--preset--font-family--body);
  font-size: clamp(1.05rem, 1.7vw, 1.3rem);
  line-height: 1.6;
  margin: 0;
}

.cp-template-hero__description .wp-block-post-excerpt__more-text {
  display: none;
}

@media (max-width: 700px) {
  .cp-template-hero {
    min-height: 430px;
  }

  .cp-template-hero .wp-block-cover__background {
    background: linear-gradient(
      rgba(10, 38, 33, 0.78),
      rgba(10, 38, 33, 0.92)
    ) !important;
  }

  .cp-template-hero .wp-block-post-title {
    font-size: clamp(2.7rem, 13vw, 4rem) !important;
  }
}


/* Full-screen map template. */
body.page-template-page-map,
body.cp-map-template-active {
  background: #030808;
  overflow: hidden;
}

.cp-map-page {
  background: #030808;
  margin-block-start: 0 !important;
  min-height: calc(100vh - var(--cp-map-header-height, 96px));
}

.cp-map-frame-wrap {
  height: calc(100vh - var(--cp-map-header-height, 96px));
  margin: 0 !important;
  max-width: none !important;
  min-height: calc(100vh - var(--cp-map-header-height, 96px));
  padding: 0 !important;
  width: 100% !important;
}

.cp-map-frame {
  background: #030808;
  border: 0;
  display: block;
  height: calc(100vh - var(--cp-map-header-height, 96px));
  width: 100%;
}

body.admin-bar .cp-map-page,
body.admin-bar .cp-map-frame-wrap,
body.admin-bar .cp-map-frame {
  height: calc(100vh - var(--cp-map-header-height, 96px) - 32px);
  min-height: calc(100vh - var(--cp-map-header-height, 96px) - 32px);
}

@media (max-width: 782px) {
  body.admin-bar .cp-map-page,
  body.admin-bar .cp-map-frame-wrap,
  body.admin-bar .cp-map-frame {
    height: calc(100vh - var(--cp-map-header-height, 96px) - 46px);
    min-height: calc(100vh - var(--cp-map-header-height, 96px) - 46px);
  }
}

@media (max-width: 781px) {
  .cp-site-header .wp-block-site-title {
    font-size: 0.95rem !important;
  }

  .cp-brand-logo {
    flex-basis: 40px;
  }

  .cp-brand-logo img {
    height: 40px;
    width: 40px;
  }

  .cp-page-hero .wp-block-post-featured-image img {
    aspect-ratio: 4 / 3;
  }

  .cp-page-title-band h1 {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
