@font-face {
  font-family: 'Radio Canada';
  src: url(/fonts/radiocanada-webfont.woff);
  font-display: swap;
}

@font-face {
  font-family: 'Solway';
  src: url(/fonts/solway-bold-webfont.woff);
  font-display: swap;
}

.solway-regular {
  font-family: 'Solway', Georgia, 'Times New Roman', Times, serif;
  font-weight: 700;
  font-style: normal;
}

html,
.radio-canada {
  font-family: 'Radio Canada', 'Trebuchet MS', Helvetica, Arial, sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  font-variation-settings: 'wdth' 100;
}

/* Paleta constante */
:root {
  color-scheme: light dark;

  /* Colores base */
  --color-background: #0f0e17;
  --color-text-base: #fffffe;
  --color-text-muted: #959899;
  --color-accent: #ff8906;
  --color-card: #0f0e17;
  --color-card-muted: #959899;
  --color-border: #475682;
  --color-button-primary: #0f0e17;
  --color-button-primary-hover: #ff8906;
  --color-button-border: #ff8906;

  --color-list-video: #c12b05;
  --color-list-article: #f47d3c;
  --color-list-website: #a601fe;
  --color-list-book: #58aa9c;

  --color-link: #ff8906;
  --color-link-bg: #475682;

  --step--2: clamp(0.7813rem, 0.7747rem + 0.0326vw, 0.8rem);
  --step--1: clamp(0.9375rem, 0.9158rem + 0.1087vw, 1rem);
  --step-0: clamp(1.125rem, 1.0815rem + 0.2174vw, 1.25rem);
  --step-1: clamp(1.35rem, 1.2761rem + 0.3696vw, 1.5625rem);
  --step-2: clamp(1.62rem, 1.5041rem + 0.5793vw, 1.9531rem);
  --step-3: clamp(1.944rem, 1.771rem + 0.8651vw, 2.4414rem);
  --step-4: clamp(2.3328rem, 2.0827rem + 1.2504vw, 3.0518rem);
  --step-5: clamp(2.7994rem, 2.4462rem + 1.7658vw, 3.8147rem);

  --max-width: 1000px;
  --col-width: 100%;
  --threshold: calc(var(--max-width) - 100px);
  --gap: clamp(1rem, 2.5vw, 2rem);
}

*,
:after,
:before {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 10rem;
}

body {
  transition: none;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-background);
  color: var(--color-text-base);
  font-family:
    'Inter',
    system-ui,
    -apple-system,
    sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Container queries support */
@supports (container-type: inline-size) {
  .container {
    container-type: inline-size;
  }
}

/* Modern scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-background);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

/* Focus styles for better accessibility */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Selection styles */
::selection {
  background: var(--color-accent);
  color: white;
}

::-moz-selection {
  background: var(--color-accent);
  color: white;
}

main {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--gap) var(--gap) 4rem;
  flex: 1;
  font-size: var(--step-0);
  font-weight: 400;
}

a {
  color: var(--color-link);
  padding: 0;
  background-image: linear-gradient(var(--color-link-bg) 0 0);
  background-size: 0;
  background-repeat: no-repeat;
  text-decoration: none;
  transition: 0.4s;
}

a:hover {
  color: var(--color-link);
  background-size: 100%;
  text-decoration: underline;
}

main h2 a {
  text-decoration: none;
  color: var(--color-text-base);
  opacity: 0;
  transition: 0.218s ease;
}

main h2 a:before {
  content: '#';
  margin-inline-end: 0.25em;
}

main h2:hover a {
  opacity: 1;
}

main img {
  max-width: 150px;
  display: block;
  margin-bottom: 1rem;
}

.button-primary {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 2px solid var(--color-button-border);
  border-radius: 0.25rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease-in-out;
  background-color: var(--color-button-primary);
  color: var(--color-button-border);
}

.button-primary:hover {
  background-color: var(--color-button-border);
  color: var(--color-button-primary-hover);
  text-decoration: none;
}

h1,
h2,
h3 {
  font-family: 'Solway', Georgia, 'Times New Roman', Times, serif;
  font-weight: 700;
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

h1 {
  font-size: var(--step-4);
}

h2 {
  font-size: var(--step-2);
}

h3 {
  font-size: var(--step-1);
}

p,
li {
  font-size: var(--step-0);
}

main > hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  height: 0;
  width: 100%;
  max-width: 100%;
  margin: calc(var(--gap) / 2) 0;
}

main p {
  margin-top: 0;
  margin-bottom: var(--gap);
  line-height: 1.6;
}

main code {
  padding: 0.25em 0.5em;
  line-height: 1;
  background: var(--color-background-accent);
  border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
}

main blockquote {
  font-size: var(--step-0);
  line-height: 1.5;
  font-style: italic;
}

.page-content {
  max-width: 100ch;
  margin: 0 auto;
  padding: var(--gap);
}

.page-content h1 {
  font-size: var(--step-4);
  margin-bottom: var(--gap);
  width: 100%;
}

.page-content h2 {
  font-size: var(--step-2);
  margin: var(--gap) 0 calc(var(--gap) / 2);
}

.page-content h3 {
  font-size: var(--step-1);
  margin: calc(var(--gap) / 2) 0 calc(var(--gap) / 3);
}

.page-content p {
  margin-bottom: 1.5em;
  line-height: 1.6;
}

.page-content ul,
.page-content ol {
  margin: 1em 0;
  padding-left: 1.5em;
}

.page-content li {
  line-height: 1.6;
  margin-bottom: calc(var(--gap) / 4);
}

.page-content hr {
  border: none;
  border-top: 2px solid var(--color-border);
  margin: var(--gap) 0;
  width: 100%;
}

.page-content blockquote {
  border-left: 3px solid var(--color-accent);
  margin: 1.5em 0;
  padding-left: 1em;
  font-style: italic;
  color: var(--color-text-muted);
}

.page-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1.5em 0;
}

.page-content code {
  background: var(--color-card);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
  color: var(--color-text-base);
}

.page-content pre {
  background: var(--color-card);
  padding: 1em;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.5em 0;
}

.page-content pre code {
  background: none;
  padding: 0;
  font-size: var(--step--1);
}

/* ===== HEADER ===== */
.header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--color-background);
  color: var(--color-text-base);
  box-shadow: 2px 9px 24px 0px rgba(0, 0, 0, 0.5);
  padding: 10px 20px;
  z-index: 1000;
  border-bottom: 2px solid var(--color-border);
}

.logo {
  display: flex;
  align-items: center;
  color: var(--color-text-base);
}

.logo a {
  display: flex;
  align-items: center;
  padding: 0 0.25em;
  text-decoration: none;
}

.logo #home:hover {
  color: var(--color-link);
}

.nav {
  display: flex;
  align-items: center;
  position: relative;
  z-index: 900;
}

.menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu li {
  margin-left: 20px;
}

.menu li a {
  color: var(--color-text-base);
  text-decoration: none;
  padding: 0 0.25em;
}

.menu li a:hover {
  color: var(--color-link);
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 2000;
  position: relative;
  margin-left: auto;
}

.hamburger .line {
  width: 100%;
  height: 2px;
  background-color: var(--color-text-base);
  transition: all 0.3s ease;
}

@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--color-background);
    flex-direction: column;
    padding: 1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--color-border);
    z-index: 1500;
  }

  .menu.active {
    display: flex;
  }

  .menu li {
    margin: 0.5rem 0;
    text-align: right;
  }
}

/* ===== FOOTER ===== */
footer {
  margin-top: auto;
  width: 100%;
  min-height: 200px;
  border-top: 1px solid var(--color-border);
}

.footer-content {
  max-width: var(--max-width);
  color: var(--color-text-muted);
  margin: 0 auto;
  padding: 2rem var(--gap);
}

/* ===== POST CARD ===== */
.post-card {
  position: relative;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-card);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  border-color: var(--color-accent);
}

.post-link {
  display: block;
  text-decoration: none;
  color: inherit;
  position: relative;
  background-image: none !important;
  background-size: initial !important;
}

.post-link:hover {
  background-image: none !important;
  background-size: initial !important;
  text-decoration: none;
}

.post-link:focus {
  outline: none !important;
  outline-offset: 2px;
  border-radius: 8px;
}

.post-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  align-items: center;
}

.category {
  text-transform: capitalize;
  color: var(--color-accent);
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  background: var(--color-link-bg);
  border-radius: 20px;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.post-title {
  margin: 0;
  margin-bottom: 0.75rem;
  font-weight: 700;
  font-size: var(--step-1);
  line-height: 1.3;
  color: var(--color-text-base);
  transition: color 0.3s ease;
}

.post-card:hover .post-title {
  color: var(--color-accent);
}

.post-description {
  margin: 0;
  color: var(--color-text-muted);
  line-height: 1.6;
  font-size: var(--step--1);
}

.post-arrow {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease;
  color: var(--color-accent);
}

.post-card:hover .post-arrow {
  opacity: 1;
  transform: translateX(0);
}

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

@media (prefers-reduced-motion: reduce) {
  .post-card,
  .post-card::before,
  .post-title,
  .post-arrow {
    transition: none;
  }
}

@container (min-width: 400px) {
  .post-card {
    padding: 2rem;
  }

  .post-arrow {
    top: 2rem;
    right: 2rem;
  }
}

/* ===== LINK CARD ===== */
.link-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  padding: 1rem;
  transition: all 0.3s ease;
  text-decoration: none;
  color: var(--color-text-base);
  background-color: var(--color-card);
  border-radius: 0.5rem;
  border: 1px solid var(--color-border);
}

.icon-container {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.5s ease;
}

.link-card:hover .icon-container {
  transform: rotate(360deg);
}

.icon-container.video {
  background-color: var(--color-list-video);
  color: white;
}

.icon-container.article {
  background-color: var(--color-list-article);
  color: white;
}

.icon-container.website {
  background-color: var(--color-list-website);
  color: white;
}

.icon-container.book {
  background-color: var(--color-list-book);
  color: white;
}

.type-icon {
  width: 24px;
  height: 24px;
}

.content {
  flex: 1;
  min-width: 0;
}

.title {
  margin: 0 0 0.25rem 0;
  font-size: var(--step-0);
  font-weight: 600;
  color: var(--color-text-base);
}

.description {
  margin: 0 0 0.5rem 0;
  font-size: var(--step--1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--color-text-muted);
}

time {
  font-size: var(--step--1);
  color: var(--color-text-muted);
}

.external-link {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

/* ===== BREADCRUMBS ===== */
.breadcrumbs {
  margin: 1rem 0 2rem;
  font-size: 0.9rem;
}

.breadcrumbs ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.breadcrumbs li {
  display: flex;
  align-items: center;
}

.breadcrumbs li:not(:last-child)::after {
  content: '/';
  margin-left: 0.5rem;
  color: var(--color-text-muted);
}

.breadcrumbs a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumbs a:hover {
  color: var(--color-link);
  text-decoration: underline;
}

.breadcrumbs [aria-current='page'] {
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ===== PAGINATION ===== */
.pagination {
  margin: 2rem 0;
}

.pagination-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.prev,
.next {
  padding: 0.5rem 1rem;
  color: var(--color-text-base);
  text-decoration: none;
  border: 1px solid var(--color-border);
  border-radius: 0.25rem;
  transition: all 0.2s ease;
}

.prev:hover,
.next:hover {
  background-color: var(--color-border);
}

.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-info {
  color: var(--color-text-muted);
  font-size: var(--step--1);
}

@media (max-width: 640px) {
  .pagination-links {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* ===== THEME TOGGLE ===== */
.theme-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: var(--color-text-base);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle-btn:hover {
  background: var(--color-card);
  transform: scale(1.05);
}

.theme-toggle-btn:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.sun-icon,
.moon-icon {
  transition: all 0.3s ease;
}

.moon-icon {
  display: none;
}

[data-theme='light'] .sun-icon {
  display: none;
}

[data-theme='light'] .moon-icon {
  display: block;
}

/* ===== SCROLL TO TOP ===== */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-accent);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  opacity: 0;
  transform: translateY(20px);
}

.scroll-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-to-top:hover {
  background: var(--color-button-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.scroll-to-top:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.scroll-to-top:active {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .scroll-to-top {
    transition: none;
  }
}

@media (max-width: 768px) {
  .scroll-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
  }
}

/* ===== LAZY IMAGE ===== */
.lazy-image {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.lazy-image.loaded {
  opacity: 1;
}

.lazy-image[loading='eager'] {
  opacity: 1;
}

/* ===== LOADING SPINNER ===== */
.loading-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.loading-spinner--sm {
  width: 20px;
  height: 20px;
}

.loading-spinner--md {
  width: 32px;
  height: 32px;
}

.loading-spinner--lg {
  width: 48px;
  height: 48px;
}

.spinner-ring {
  position: absolute;
  border: 2px solid transparent;
  border-top: 2px solid var(--spinner-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner-ring:nth-child(1) {
  width: 100%;
  height: 100%;
  animation-delay: 0s;
}

.spinner-ring:nth-child(2) {
  width: 80%;
  height: 80%;
  animation-delay: 0.2s;
}

.spinner-ring:nth-child(3) {
  width: 60%;
  height: 60%;
  animation-delay: 0.4s;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ===== SKELETON ===== */
.skeleton {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.skeleton--text {
  width: 100%;
}

.skeleton--title {
  width: 100%;
}

.skeleton--card {
  padding: 1rem;
  border-radius: 8px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
}

.skeleton--avatar {
  align-items: center;
}

.skeleton-line {
  height: 1rem;
  background: linear-gradient(
    90deg,
    var(--color-card-muted) 25%,
    var(--color-border) 50%,
    var(--color-card-muted) 75%
  );
  background-size: 200% 100%;
  border-radius: 4px;
  animation: shimmer 1.5s infinite;
}

.skeleton-line--title {
  height: 1.5rem;
  width: 80%;
}

.skeleton-line--card-title {
  height: 1.25rem;
  width: 60%;
}

.skeleton-line--card-text {
  height: 1rem;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(
    90deg,
    var(--color-card-muted) 25%,
    var(--color-border) 50%,
    var(--color-card-muted) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ===== HOMEPAGE HERO ===== */
#hero {
  padding-bottom: 1.5rem;
  padding-top: 2rem;
}

#hero .subtitle {
  margin: 0.5rem;
  font-size: var(--step-1);
  line-height: 1.25rem;
}

#hero-title {
  display: flex;
  gap: 1rem;
  align-items: center;
}

#hero h1 {
  display: inline-block;
  margin: 0;
  font-size: var(--step-4);
  line-height: 2.25rem;
  font-weight: 700;
}

#hero img {
  border-radius: 9999px;
  border: 4px solid var(--color-button-border);
  width: 8rem;
  height: 8rem;
}

#hero p {
  margin-top: 1rem;
  margin-bottom: 1rem;
}

#action-links {
  display: flex;
  margin: 0.25rem;
  flex-wrap: wrap;
  list-style-type: none;
}

#action-links li a {
  display: block;
  padding: 0.25rem;
  margin-right: 0.5rem;
  font-weight: 700;
  border-color: var(--color-border);
}

.tag-list {
  display: flex;
  margin-top: 2rem;
  flex-wrap: wrap;
  list-style-type: none;
}

.tag-list li {
  margin: 0.5rem;
  font-size: var(--step--1);
  line-height: 1.25rem;
}

/* ===== SECTIONS ===== */
section {
  padding-bottom: 1.5rem;
  padding-top: 1.5rem;
}

section h2 {
  font-size: var(--step-2);
  line-height: 1rem;
  font-weight: 600;
  letter-spacing: 0.025em;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.finds-box {
  padding: 1em;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(1fr);
  gap: 2rem;
}

.finds-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.posts-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ===== POST SINGLE PAGE ===== */
.post-header {
  margin-bottom: 2rem;
}

.post-meta-single {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  color: var(--color-text-base);
  font-size: var(--step--1);
  align-items: center;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  border: 1px solid var(--color-accent);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  text-transform: capitalize;
  color: var(--color-accent);
  font-weight: 500;
  font-size: 0.8rem;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.tag:hover {
  background: var(--color-accent);
  color: var(--color-background);
}

.author {
  opacity: 0.8;
}

.page-content :global(strong),
.page-content :global(b) {
  color: var(--color-accent);
}

/* ===== HOMEPAGE SPECIFIC ===== */
#hero-title {
  display: flex;
  gap: 1rem;
  align-items: center;
}

#hero-title div[style*='font-weight'] {
  font-weight: 500;
}

.all-posts-btn-wrapper {
  text-align: center;
}
