/*
Theme Name: Roger Comella
Theme URI: https://rogercomella.com
Description: Tema minimalista per a portfoli audiovisual. Mostra feines/projectes amb vídeos de YouTube i Vimeo.
Version: 1.0.0
Author: Roger Comella
Author URI: https://rogercomella.com
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: roger-comella
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 8.0
Tags: portfolio, video, minimal, responsive, classic-editor
*/

/* ============================================
   VARIABLES
   ============================================ */
:root {
  --color-bg: #0c0c0e;
  --color-bg-card: #141416;
  --color-bg-hover: #1a1a1e;
  --color-text: #e8e8ec;
  --color-text-muted: #888892;
  --color-accent: #ff4d4d;
  --color-border: #2a2a30;
  --color-overlay: rgba(0, 0, 0, 0.6);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 8px;
  --radius-sm: 4px;
  --transition-speed: 0.25s;
  --max-width: 1280px;
  --gap: 1.5rem;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg);
  background-image:
    radial-gradient(ellipse 90% 46% at 50% -8%, rgba(75, 98, 114, 0.2), transparent 72%),
    radial-gradient(circle at 8% 35%, rgba(117, 38, 45, 0.09), transparent 34%),
    linear-gradient(125deg, rgba(255, 255, 255, 0.012) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.012) 50%, rgba(255, 255, 255, 0.012) 75%, transparent 75%);
  background-size: auto, auto, 5px 5px;
  background-attachment: fixed;
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
}

/* ============================================
   FOCUS VISIBLE (Accessibilitat)
   ============================================ */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ============================================
   LAYOUT
   ============================================ */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1rem;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
  width: 100%;
  padding: 2.5rem 1rem 2rem;
  text-align: center;
  position: relative;
  isolation: isolate;
}

/* Resplendor subtil: profunditat cinematogràfica sense restar protagonisme a les feines. */
.site-header::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: min(20rem, 48vw);
  background: radial-gradient(ellipse at 50% 0%, rgba(126, 151, 164, 0.12), transparent 68%);
  pointer-events: none;
}

.site-header .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.site-title {
  font-size: clamp(1.75rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.site-title a {
  color: var(--color-text);
  transition: color var(--transition-speed) ease;
}

.site-title a:hover {
  color: var(--color-accent);
}

.site-description {
  font-size: clamp(0.875rem, 2vw, 1rem);
  color: var(--color-text-muted);
  max-width: 80ch;
  line-height: 1.5;
  font-weight: normal;
}

/* ============================================
   NAV
   ============================================ */
.main-nav {
  margin-top: 1.25rem;
}

.main-nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.5rem;
}

.main-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-speed), border-color var(--transition-speed);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  color: var(--color-text);
  border-bottom-color: var(--color-accent);
}

/* ============================================
   BIOGRAPHY / PRESENTACIÓ
   ============================================ */
.rc-biography {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--color-border);
  border-top: 1px solid var(--color-border);
  margin-bottom: 4rem;
  text-align: center;
}

.rc-biography__content {
  max-width: 720px;
  color: var(--color-text);
  font-size: 1.05rem;
  line-height: 1.75;
}

.rc-biography__content p {
  margin: 0 0 1em;
}

.rc-biography__content p:last-child {
  margin-bottom: 0;
}

.rc-biography__content strong,
.rc-biography__content b {
  color: #fff;
  font-weight: 600;
}

.rc-biography__content em,
.rc-biography__content i {
  font-style: italic;
}

.rc-biography__content a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rc-biography__content a:hover {
  opacity: 0.8;
}

/* ============================================
   FEINES GRID
   ============================================ */
.feines-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  padding: 0;
}

@media (min-width: 480px) {
  .feines-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .feines-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1200px) {
  .feines-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
}

/* ============================================
   FEINA CARD
   ============================================ */
.feina-card {
  display: block;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.feina-card:focus-within {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Thumbnail */
.feina-thumbnail {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-border);
}

.feina-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.feina-card:hover .feina-thumbnail img {
  transform: scale(1.04);
}

/* Overlay play icon */
.feina-thumbnail-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-overlay);
  opacity: 0;
  transition: opacity var(--transition-speed) ease;
}

.feina-card:hover .feina-thumbnail-overlay,
.feina-card:focus-within .feina-thumbnail-overlay {
  opacity: 1;
}

.play-icon {
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.play-icon svg {
  width: 22px;
  height: 22px;
  fill: #fff;
  margin-left: 4px;
}

/* Platform badge */
.feina-platform-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
  line-height: 1.4;
  display: none;
}

.feina-platform-badge.youtube {
  background: #ff0000;
  color: #fff;
}

.feina-platform-badge.vimeo {
  background: #1ab7ea;
  color: #fff;
}

/* Card body */
.feina-body {
  padding: 1rem 1.125rem 1.25rem;
}

.feina-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.375rem;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feina-excerpt {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  /*
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  */
  overflow: hidden;
}

.feina-excerpt p {
  margin-bottom:  0.625rem;
}

.feina-excerpt p:last-child {
  margin-bottom: 0;    
}
.feina-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.625rem;
  opacity: 0.7;
  display: none;
}

/* ============================================
   PLACEHOLDER (sense miniatura)
   ============================================ */
.feina-thumbnail-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-border);
  color: var(--color-text-muted);
}

.feina-thumbnail-placeholder svg {
  width: 48px;
  height: 48px;
  opacity: 0.4;
}

/* ============================================
   LOADING SPINNER (infinite scroll)
   ============================================ */
.feines-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem 0;
  min-height: 60px;
}

.feines-loader.is-hidden {
 display: none;
  pointer-events: none;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.feines-end-message {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  padding: 1.5rem 0;
  display: none;
}

.feines-end-message.is-visible {
  display: none;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.feines-empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--color-text-muted);
  font-size: 1rem;
}

/* ============================================
   SINGLE FEINA
   ============================================ */
.single-feina-header {
  max-width: 800px;
  margin: 0 auto 2rem;
}

.single-feina-title {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.single-feina-thumbnail {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  margin-bottom: 2rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.single-feina-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.single-feina-content {
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.75;
  color: var(--color-text);
}

.single-feina-video-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-accent);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 2rem;
  transition: opacity var(--transition-speed);
}

.single-feina-video-link:hover {
  opacity: 0.85;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  padding: 1.5rem 0.5rem 2.5rem 0.5rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}

.site-footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1rem;
}

.footer-nav a {
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  transition: color var(--transition-speed);
}

.footer-nav a:hover {
  color: var(--color-text);
}

.footer-text {
  font-size: clamp(0.875rem, 2vw, 1rem);
  font-weight: bold;
}

/* ============================================
   404
   ============================================ */
.error-404 {
  text-align: center;
  padding: 5rem 1rem;
}

.error-404 h1 {
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 800;
  color: var(--color-accent);
  line-height: 1;
  margin-bottom: 1rem;
}

.error-404 p {
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

.btn-back {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  transition: border-color var(--transition-speed);
}

.btn-back:hover {
  border-color: var(--color-accent);
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .feina-card {
    opacity: 1;
    transform: none;
  }

  .feina-card.is-visible {
    opacity: 1;
    transform: none;
    transition: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ============================================
   UTILITY
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
