/*
Theme Name: Periodisme.cat
Theme URI: https://periodisme.cat
Author: Laboratori del periodisme català
Author URI: https://periodisme.cat
Description: Tema brutalist per al blog d'articles de Periodisme.cat. Disseny amb tipografia forta, vores negres i colors vibrants. Header, footer i cookie banner carregats des de l'API de la web principal.
Version: 2.3.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: periodisme-cat
Tags: blog, news, brutalism, journalism, catalan
*/

@font-face {
  font-family: 'Special Gothic Expanded One';
  src: url('https://periodisme.cat/fonts/special-gothic-expanded-one.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --crema: #FFFFE5;
  --black-text: #050505;
  --orange-vibrant: #FF5E1A;
  --blue-electric: #0066ff;
  --pink-vibrant: #FF5E1A;
  --purple-vibrant: #9966ff;
  --yellow-vibrant: #ffcc00;
  --deep-green: #006633;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--crema);
  color: var(--black-text);
  line-height: 1.6;
  font-size: 18px;
}

.site-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 1.5rem);
}

/* Header and Footer styles removed - loaded from API */

/* Hero / Archive Header */
.archive-header {
  background-color: var(--orange-vibrant);
  border-bottom: 4px solid var(--black-text);
  padding: 3rem 0;
  margin-bottom: 3rem;
}

.archive-title {
  font-family: 'Special Gothic Expanded One', sans-serif;
  font-size: 2.5rem;
  font-weight: 400;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

.archive-description {
  font-size: 1.125rem;
  font-weight: 600;
  max-width: 700px;
}

/* Posts Grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.post-card {
  background-color: white;
  border: 4px solid var(--black-text);
  box-shadow: 8px 8px 0 0 var(--black-text);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 10px 10px 0 0 var(--black-text);
}

.post-thumbnail {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-bottom: 4px solid var(--black-text);
}

.post-card-content {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-category {
  display: inline-block;
  background-color: var(--crema);
  border: 3px solid var(--black-text);
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 1rem;
  text-decoration: none;
  color: var(--black-text);
}

.post-title {
  font-family: 'Special Gothic Expanded One', sans-serif;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.post-title a {
  text-decoration: none;
  color: var(--black-text);
}

.post-title a:hover {
  text-decoration: underline;
}

.post-excerpt {
  font-size: 0.938rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  flex: 1;
}

.post-meta {
  font-size: 0.813rem;
  font-weight: 600;
  color: rgba(5, 5, 5, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.read-more {
  display: inline-block;
  background-color: var(--blue-electric);
  color: white;
  border: 3px solid var(--black-text);
  padding: 0.75rem 1.5rem;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.813rem;
  text-decoration: none;
  box-shadow: 4px 4px 0 0 var(--black-text);
  transition: transform 0.2s, box-shadow 0.2s;
  align-self: flex-start;
}

.read-more:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 0 var(--black-text);
}

/* Single Post */
.single-post-header {
  background-color: var(--blue-electric);
  color: white;
  border-bottom: 4px solid var(--black-text);
  padding: 3rem 0;
  margin-bottom: 3rem;
}

.single-post-title {
  font-family: 'Special Gothic Expanded One', sans-serif;
  font-size: 3rem;
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 1rem;
  max-width: 900px;
}

.single-post-meta {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-content {
  max-width: 800px;
  margin: 0 auto 4rem;
  font-size: 1.125rem;
  line-height: 1.8;
  padding: 0 1rem;
}

@media (min-width: 769px) {
  .post-content {
    padding: 0;
  }
}

.post-content p {
  margin-bottom: 1.5rem;
}

.post-content h2 {
  font-family: 'Special Gothic Expanded One', sans-serif;
  font-size: 2rem;
  font-weight: 400;
  margin: 2.5rem 0 1rem;
}

.post-content h3 {
  font-family: 'Special Gothic Expanded One', sans-serif;
  font-size: 1.5rem;
  font-weight: 400;
  margin: 2rem 0 0.75rem;
}

.post-content blockquote,
.wp-block-quote {
  background-color: white;
  border: 4px solid var(--black-text);
  box-shadow: 8px 8px 0 0 var(--black-text);
  padding: 2rem;
  margin: 2rem 0;
  font-style: normal;
  position: relative;
}

.post-content blockquote p,
.wp-block-quote p {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  margin: 0 0 1rem 0;
  color: var(--black-text);
}

.post-content blockquote p:last-child,
.wp-block-quote p:last-child {
  margin-bottom: 0;
}

.post-content blockquote cite,
.wp-block-quote cite {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  font-style: normal;
  margin-top: 1rem;
  color: rgba(5, 5, 5, 0.7);
}

/* WordPress Editor Styles for blockquotes */
.wp-block-quote.is-style-large,
.wp-block-quote.is-large {
  padding: 2.5rem;
}

.wp-block-quote.is-style-large p,
.wp-block-quote.is-large p {
  font-size: 1.25rem;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border: 4px solid var(--black-text);
  box-shadow: 8px 8px 0 0 var(--black-text);
  margin: 2rem 0;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.5rem;
  padding-left: 2rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 4rem;
}

.pagination a,
.pagination span {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  border: 3px solid var(--black-text);
  background-color: white;
  color: var(--black-text);
  text-decoration: none;
  font-weight: 900;
  box-shadow: 4px 4px 0 0 var(--black-text);
  transition: transform 0.2s, box-shadow 0.2s;
}

.pagination a:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 0 var(--black-text);
}

.pagination .current {
  background-color: var(--black-text);
  color: var(--crema);
}

/* Footer */
.site-footer {
  background-color: var(--crema);
  border-top: 4px solid var(--black-text);
  padding: 3rem 0 2rem;
  margin-top: 4rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-logo img {
  width: 60px;
  height: 60px;
  border: 3px solid var(--black-text);
  box-shadow: 4px 4px 0 0 var(--black-text);
  margin-bottom: 1rem;
}

.footer-section h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 1rem;
}

.footer-section ul {
  list-style: none;
}

.footer-section a {
  color: var(--black-text);
  text-decoration: none;
  font-size: 0.938rem;
  display: block;
  margin-bottom: 0.5rem;
}

.footer-section a:hover {
  text-decoration: underline;
}

.footer-bottom {
  border-top: 4px solid var(--black-text);
  padding-top: 1.5rem;
  display: flex;
  gap: 1rem;
  font-size: 0.813rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Keep thumbnails in the DOM for SEO/systems but hide them visually in frontend */
.visually-hidden-thumbnail,
.visually-hidden-thumbnail img,
.post-featured-image.visually-hidden-thumbnail {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

/* Author link styling: no blue, no underline, inherit color */
.post-author-link {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.post-author-link:hover,
.post-author-link:focus {
  /* remove color change on hover; show a white underline instead */
  color: inherit;
  text-decoration: underline;
  text-decoration-color: white;
  text-underline-offset: 3px;
}

/* Featured image (single view) styling: smaller, centered, caption and spacing */
.post-featured-figure {
  /* Force the featured image to occupy its own row and sit above the text
     - clear floats so it doesn't let text wrap to the side
     - span full grid column if inside a grid layout
     - center via auto margins and text-align for fallback
  */
  clear: both;
  display: block;
  grid-column: 1 / -1;
  max-width: 820px;
  width: 100%;
  margin: 1.5rem auto 2.5rem;
  padding: 0;
  box-sizing: border-box;
  text-align: center;
}

.post-featured-figure img.post-featured-image-img {
  /* keep the image responsive and centered inside the block-level figure */
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  border: 3px solid var(--black-text);
  box-shadow: 6px 6px 0 0 rgba(0,0,0,0.12);
}

.post-featured-caption {
  margin-top: 0.6rem;
  font-size: 0.95rem;
  color: rgba(5,5,5,0.75);
  text-align: left;
  padding-left: 0.25rem;
}

/* If you want the image narrower like the article text (less side gap), set a smaller max-width */
@media (max-width: 1024px) {
  .post-featured-figure { max-width: 560px; }
}

@media (max-width: 768px) {
  .post-featured-figure { max-width: 100%; margin-left: 0.5rem; margin-right: 0.5rem; }
}

/* Responsive */
@media (max-width: 768px) {
  .site-header .site-container {
    flex-direction: column;
    gap: 1rem;
  }

  .main-navigation ul {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }

  .archive-title {
    font-size: 2rem;
  }

  .single-post-title {
    font-size: 2rem;
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .post-card {
    box-shadow: 6px 6px 0 0 var(--black-text);
  }

  .pagination {
    flex-wrap: wrap;
  }
}

/* ========================================
   REFERENCES & CITATIONS STYLES
   ======================================== */

/* Headings inside post content: use the same display font and larger sizes */
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  font-family: 'Special Gothic Expanded One', 'Space Grotesk', sans-serif;
  color: var(--black-text);
  /* more breathing room above and below headings */
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1.12;
  font-weight: 600; /* less heavy so headings remain readable */
  text-transform: uppercase; /* all headings in article uppercase */
  letter-spacing: 0.02em;
}

/* Slightly larger spacing for main headings */
.post-content h1 { font-size: 2.75rem; margin-top: 2.5rem; margin-bottom: 1.25rem; }
.post-content h2 { font-size: 2.25rem; }
.post-content h3 { font-size: 1.75rem; }
.post-content h4 { font-size: 1.35rem; }
.post-content h5 { font-size: 1.1rem; }
.post-content h6 { font-size: 0.95rem; }

@media (max-width: 768px) {
  .post-content h1 { font-size: 2rem; margin-top: 1.6rem; margin-bottom: 0.9rem; }
  .post-content h2 { font-size: 1.6rem; margin-top: 1.6rem; margin-bottom: 0.9rem; }
  .post-content h3 { font-size: 1.3rem; margin-top: 1.4rem; margin-bottom: 0.8rem; }
  .post-content h4 { font-size: 1.05rem; margin-top: 1.2rem; margin-bottom: 0.7rem; }
  .post-content h5 { font-size: 1rem; margin-top: 1.1rem; margin-bottom: 0.6rem; }
  .post-content h6 { font-size: 0.95rem; margin-top: 1rem; margin-bottom: 0.5rem; }
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Citation numbers (superscript) - Small boxes like Wikipedia */
.citation-number {
  display: inline;
  margin-left: 1px;
  font-size: 0.65em;
  line-height: 0;
  vertical-align: super;
  position: relative;
  top: -0.3em;
}

.citation-link {
  display: inline-block;
  padding: 2px 5px;
  background-color: white;
  color: var(--black-text);
  text-decoration: none;
  border: 2px solid var(--black-text);
  box-shadow: 2px 2px 0 0 rgba(0, 0, 0, 0.2);
  border-radius: 2px;
  font-weight: 700;
  transition: all 0.15s ease;
  min-width: 16px;
  text-align: center;
  font-size: 11px;
  line-height: 1.3;
}

.citation-link:hover {
  background-color: var(--orange-vibrant);
  color: var(--black-text);
  border-color: var(--black-text);
  box-shadow: 3px 3px 0 0 rgba(0, 0, 0, 0.3);
  transform: translate(-1px, -1px);
}

.citation-link:active {
  box-shadow: 1px 1px 0 0 rgba(0, 0, 0, 0.2);
  transform: translate(1px, 1px);
}

/* References section at the end of the article - Brutalist design */
.references-section {
  margin-top: 2rem;
  padding: 1.2rem 2rem 2.5rem 2rem; /* reduce top padding to bring title closer to box top */
  background-color: white;
  border: 5px solid var(--black-text);
  box-shadow: 12px 12px 0 0 rgba(0, 0, 0, 0.2);
}

.references-title {
  font-family: 'Special Gothic Expanded One', 'Space Grotesk', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  margin-top: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--black-text);
  border-bottom: 4px solid var(--black-text);
  padding-bottom: 0.75rem;
  position: relative;
}

.references-title::after {
  content: '↓';
  position: absolute;
  right: 0;
  bottom: 0.75rem;
  font-size: 1.5rem;
  color: var(--black-text);
}

.references-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.reference-card {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background-color: var(--crema);
  border: 3px solid var(--black-text);
  box-shadow: 5px 5px 0 0 rgba(0, 0, 0, 0.15);
  transition: all 0.25s ease;
  position: relative;
  scroll-margin-top: 2rem;
  text-decoration: none;
  color: var(--black-text);
  cursor: pointer;
}

.reference-card:hover {
  background-color: var(--orange-vibrant); /* card turns orange on hover */
  color: var(--black-text);
  box-shadow: 8px 8px 0 0 rgba(0, 0, 0, 0.25);
  transform: translate(-3px, -3px);
}

.reference-card:hover .reference-title {
  color: var(--black-text);
}

.reference-card.reference-highlight {
  animation: highlightPulse 2s ease;
  background-color: rgba(255, 94, 26, 0.15);
}

@keyframes highlightPulse {
  0%, 100% {
    background-color: var(--crema);
  }
  50% {
    background-color: rgba(255, 94, 26, 0.25);
    box-shadow: 10px 10px 0 0 var(--orange-vibrant);
  }
}

.reference-number {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: white;
  color: var(--black-text);
  border: 3px solid var(--black-text);
  box-shadow: 3px 3px 0 0 rgba(0, 0, 0, 0.25);
  font-weight: 700;
  font-size: 1.1rem;
  font-family: 'Space Grotesk', sans-serif;
}

.reference-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.reference-title {
  flex: 1;
  word-break: break-word;
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.5;
}

.reference-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--black-text);
  color: white;
  border: 2px solid var(--black-text);
  transition: all 0.25s ease;
}

.reference-icon svg {
  display: block;
}

.reference-card:hover .reference-icon {
  transform: translateX(4px);
}

/* Mobile responsive adjustments for references */
@media (max-width: 768px) {
  .references-section {
    padding: 1.5rem 1rem;
    margin-top: 3rem;
    box-shadow: 8px 8px 0 0 rgba(0, 0, 0, 0.2);
    border-width: 4px;
  }
  
  .references-title {
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
  }
  
  .references-title::after {
    font-size: 1.2rem;
  }
  
  .references-grid {
    gap: 1rem;
  }
  
  .reference-card {
    padding: 0.75rem;
    gap: 0.75rem;
    border-width: 2px;
    box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 0.15);
  }
  
  .reference-card:hover {
    box-shadow: 6px 6px 0 0 rgba(0, 0, 0, 0.2);
    transform: translate(-2px, -2px);
  }
  
  .reference-number {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
    border-width: 2px;
  }
  
  .reference-title {
    font-size: 0.9rem;
  }
  
  .reference-icon {
    width: 28px;
    height: 28px;
  }
  
  .reference-icon svg {
    width: 16px;
    height: 16px;
  }
  
  .citation-number {
    font-size: 0.6em;
  }
  
  .citation-link {
    padding: 1px 4px;
    min-width: 14px;
    font-size: 10px;
    border-width: 1.5px;
  }
}
