/*
Theme Name: TT5 Sociocultural Child
Template: twentytwentyfive
Version: 1.0
Text Domain: tt5-sociocultural-child
*/

/* =========================================================
   Sociocultural Lab — Global CSS (child theme)
   Clean, consolidated, and override-safe
   ========================================================= */

/* -------------------------
   CSS Variables
   ------------------------- */
:root {
  --scl-oxford-blue: #002147;
  --scl-button-radius: 8px;
  --scl-button-pad-y: 6px;
  --scl-button-pad-x: 12px;
}

/* -------------------------
   Typography: headings
   ------------------------- */
h1,
.wp-block-post-title {
  font-size: 2.2rem !important;
  line-height: 1.18 !important;
}

h2 {
  font-size: 1.6rem !important;
  line-height: 1.22 !important;
}

h3 {
  font-size: 1.3rem !important;
  line-height: 1.25 !important;
}

@media (max-width: 600px) {
  h1,
  .wp-block-post-title {
    font-size: 1.85rem !important;
    line-height: 1.2 !important;
  }
}

/* -------------------------
   Links: underline by default on all pages except homepage
   ------------------------- */
/* Default for all pages: underlined */
:root :where(a, a:visited) {
  text-decoration: underline !important;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

:root :where(a:hover, a:focus-visible) {
  text-decoration: underline !important;
  text-decoration-thickness: 2px;
}

/* Homepage override: no underline by default, underline on hover */
.home :where(a, a:visited) {
  text-decoration: none !important;
}

.home :where(a:hover, a:focus-visible) {
  text-decoration: underline !important;
  text-decoration-thickness: 1px;
}

/* Homepage content links: add ↗ arrow after links (exclude buttons, nav, header, footer) */
body.home main a:not(.wp-element-button):not(.wp-block-button__link):not(.wp-block-navigation-item__content):not(.pub-pdf-mini):not(.pub-inline-action)::after,
body.home article a:not(.wp-element-button):not(.wp-block-button__link):not(.wp-block-navigation-item__content):not(.pub-pdf-mini):not(.pub-inline-action)::after,
body.home .latest-publications a:not(.pub-inline-action)::after,
body.home .latest-news a::after,
body.home .latest-research-notes a::after,
body.home .people-grid a::after,
body.home .lab-director-hero a::after {
  content: " 🔗" !important;
  color: #E97451 !important;
  font-size: 0.95em !important;
  display: inline !important;
  margin-left: 0.25em !important;
  text-decoration: none !important;
  font-weight: 800 !important;
}

/* Ensure arrow doesn't get underlined when parent link is hovered */
body.home main a:not(.wp-element-button):not(.wp-block-button__link):not(.wp-block-navigation-item__content):not(.pub-pdf-mini):not(.pub-inline-action):hover::after,
body.home article a:not(.wp-element-button):not(.wp-block-button__link):not(.wp-block-navigation-item__content):not(.pub-pdf-mini):not(.pub-inline-action):hover::after,
body.home .latest-publications a:not(.pub-inline-action):hover::after,
body.home .latest-news a:hover::after,
body.home .latest-research-notes a:hover::after,
body.home .people-grid a:hover::after,
body.home .lab-director-hero a:hover::after {
  text-decoration: none !important;
}

/* -------------------------
   Navigation spacing (global)
   ------------------------- */
.wp-block-navigation .wp-block-navigation__container {
  gap: 24px !important;
}

/* =========================================================
   Buttons — Unified system with high specificity override
   
   Why high specificity?
   - WordPress themes/plugins often inject button styles
   - Twenty Twenty-Five parent theme has aggressive defaults
   - We need :is() instead of :where() to win specificity battles
   - The -webkit-text-fill-color is needed to override gradient text
   
   Applies to: Button block, File block, wp-element-button class
   ========================================================= */

/* Prevent forced full-width on button links */
.wp-block-buttons .wp-block-button__link {
  width: auto !important;
}

/* Base button appearance: filled Oxford Blue with white text */
body .wp-site-blocks :is(
  .wp-block-button__link,
  a.wp-element-button,
  .wp-element-button,
  .wp-block-file__button,
  a.pub-pdf-mini
):not(.wp-block-navigation-item__content) {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: #002147 !important;
  background-color: #002147 !important;
  background-image: none !important;
  
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;

  border: 1px solid #002147 !important;
  border-radius: 8px !important;

  padding: 6px 12px !important;
  font-size: 0.95rem !important;
  line-height: 1.2 !important;
  font-weight: 600 !important;

  text-decoration: none !important;
  box-shadow: none !important;

  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

/* Hover/focus: transparent background with Oxford Blue text (outline style) */
body .wp-site-blocks :is(
  .wp-block-button__link,
  a.wp-element-button,
  .wp-element-button,
  .wp-block-file__button,
  a.pub-pdf-mini
):not(.wp-block-navigation-item__content):is(:hover, :focus, :focus-visible, :active) {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  
  color: #002147 !important;
  -webkit-text-fill-color: #002147 !important;
  
  border-color: #002147 !important;
  text-decoration: none !important;
  outline: none;
}

/* Ensure visited state maintains white text on filled buttons */
body .wp-site-blocks :is(
  .wp-block-button__link,
  a.wp-element-button,
  .wp-element-button,
  .wp-block-file__button,
  a.pub-pdf-mini
):not(.wp-block-navigation-item__content):visited {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* Force child elements to inherit button colours */
body .wp-site-blocks :is(
  .wp-block-button__link,
  a.wp-element-button,
  .wp-element-button,
  .wp-block-file__button,
  a.pub-pdf-mini
):not(.wp-block-navigation-item__content) :is(span, strong, em) {
  color: inherit !important;
  -webkit-text-fill-color: inherit !important;
}

/* Explicit outline style in editor: start as outline, still follows hover rules */
body :where(.wp-block-button.is-style-outline) > .wp-block-button__link,
body :where(.wp-block-button.is-style-outline) > .wp-block-button__link.wp-element-button {
  background: transparent !important;
  background-color: transparent !important;
  color: #002147 !important;
  border-color: #002147 !important;
}

/* Mini PDF button sizing (inherits global colours/hover behaviour) */
a.pub-pdf-mini {
  padding: 2px 8px !important;
  font-size: 0.8rem !important;
  line-height: 1.2 !important;
  border-radius: 6px !important;
}

/* =========================================================
   Mobile navigation panel (responsive)
   ========================================================= */

.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close {
  padding: 10px 12px !important;
  border-radius: 6px !important;
}

.wp-block-navigation__responsive-container {
  padding: 14px 14px !important;
}

.wp-block-navigation__responsive-container.is-menu-open {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  border-radius: 10px !important;
  margin: 10px !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12) !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
  gap: 10px !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
  padding: 8px 10px !important;
  border-radius: 6px !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:hover,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:focus-visible {
  background: rgba(0, 0, 0, 0.06) !important;
}

/* =========================================================
   Header: masthead navigation refinement (scoped)
   ========================================================= */

.wp-site-blocks header .wp-block-navigation .wp-block-navigation__container {
  gap: 1.35rem !important;
}

.wp-site-blocks header .wp-block-navigation a,
.wp-site-blocks header .wp-block-navigation a:visited {
  text-decoration: none !important;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}

.wp-site-blocks header .wp-block-navigation a:hover,
.wp-site-blocks header .wp-block-navigation a:focus-visible {
  text-decoration: none !important;
  color: var(--wp--preset--color--accent-earth) !important;
  border-bottom-color: var(--wp--preset--color--accent-earth);
}

.wp-site-blocks header .wp-block-navigation .current-menu-item > a,
.wp-site-blocks header .wp-block-navigation .current_page_item > a,
.wp-site-blocks header .wp-block-navigation .current-menu-ancestor > a {
  text-decoration: none !important;
  color: var(--wp--preset--color--accent-earth) !important;
  border-bottom-color: var(--wp--preset--color--accent-earth);
}

.wp-site-blocks header .wp-block-navigation__responsive-container.is-menu-open a:hover,
.wp-site-blocks header .wp-block-navigation__responsive-container.is-menu-open a:focus-visible {
  color: inherit !important;
  border-bottom-color: transparent;
}

/* =========================================================
   Homepage Publications: remove forced bold from <strong> wrapper
   ========================================================= */
:root ul.latest-publications a strong {
  font-weight: 400 !important;
}

/* =========================================================
   Person pages: standardise portrait image presentation
   ========================================================= */
.single-person .wp-block-post-featured-image img {
  width: 100% !important;
  max-width: 260px !important;
  aspect-ratio: 4 / 5;
  height: auto;
  object-fit: cover;
  object-position: 50% 25%;
  border-radius: 8px;
  display: block;
}

.single-person .wp-block-post-featured-image {
  max-width: 260px !important;
}

/* =========================================================
   Publications archive: two-column rows
   ========================================================= */
.pub-archive {
  list-style: none;
  margin: 1.2rem 0 0;
  padding: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.pub-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  align-items: start;
}

.pub-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pub-year {
  font-weight: 700;
  line-height: 1.1;
}

.pub-title a,
.pub-title a:visited {
  text-decoration: underline !important;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

.pub-title a:hover,
.pub-title a:focus-visible {
  text-decoration-thickness: 2px;
}

.pub-venue {
  margin-top: 4px;
  color: rgba(0, 0, 0, 0.75);
}

.pub-excerpt {
  margin-top: 8px;
  color: rgba(0, 0, 0, 0.85);
}

/* NOTE: .pub-inline-action is used in latest_publications shortcode.
   Currently only appears once but kept for consistency. */
.pub-inline-action {
  font-size: 0.85rem;
  opacity: 0.75;
  margin-left: 0.4rem;
}

/* Pagination */
.pub-pagination-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .pub-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .pub-meta {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
}

/* =========================================================
   Homepage shortcode styles
   Extracted from inline styles for maintainability
   ========================================================= */

/* Latest publications list */
.latest-publications {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

/* Latest news list */
.latest-news {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

/* Latest research notes list */
.latest-research-notes {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

/* Lab director hero section */
.lab-director-hero {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
  margin: 1rem 0 1.5rem 0;
}

.lab-director-hero img {
  border-radius: 8px;
  width: 180px;
  height: 180px;
  object-fit: cover;
}

.lab-director-hero p:first-of-type {
  margin: 0 0 0.25rem 0;
  font-size: 1.25rem;
}

.lab-director-hero p:last-of-type {
  margin: 0.25rem 0 0 0;
  color: #333333;
}

/* People grid (homepage and general use) */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.people-grid-card {
  text-align: center;
}

.people-grid-card img {
  border-radius: 8px;
  width: 120px;
  height: 120px;
  object-fit: cover;
  margin: 0 auto 0.5rem;
}

.people-grid-card p {
  margin: 0.25rem 0 0 0;
}

/* People list (used in people_by_role shortcode) */
.people-list {
  display: grid;
  gap: 1rem;
}

.people-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.people-card img {
  border-radius: 6px;
  width: 120px;
  height: 120px;
  object-fit: cover;
}

.people-text p:first-child {
  margin: 0 0 0.25rem 0;
}

.people-text p:last-child {
  margin: 0.25rem 0 0 0;
}

/* Year display in lists (used across news, research notes, publications) */
.year-display {
  color: #555555;
}