/* === Design tokens === */
:root {
  --background: hsl(210, 20%, 98%);
  --foreground: hsl(220, 25%, 10%);
  --card: hsl(0, 0%, 100%);
  --primary: hsl(0, 85%, 50%);
  --primary-foreground: hsl(0, 0%, 100%);
  --secondary: hsl(220, 20%, 95%);
  --muted: hsl(220, 15%, 92%);
  --muted-foreground: hsl(220, 10%, 45%);
  --accent: hsl(220, 60%, 20%);
  --accent-foreground: hsl(0, 0%, 100%);
  --border: hsl(220, 15%, 88%);
  --news-overlay: hsl(220, 25%, 10%);
  --radius: 0.375rem;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Source Sans 3', sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: 'Playfair Display', serif;
}

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

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

ul {
  list-style: none;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width:768px) {
  .container {
    padding: 0 2rem;
  }
}

/* === Navbar === */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.logo-red {
  color: var(--primary);
}

.logo-dark {
  color: var(--foreground);
}

.logo-light {
  color: var(--accent-foreground);
}

.nav-desktop {
  display: none;
  gap: 1.5rem;
}

.nav-desktop a {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted-foreground);
  transition: color .2s;
}

.nav-desktop a:hover {
  color: var(--primary);
}

@media (min-width:768px) {
  .nav-desktop {
    display: flex;
  }
}

.nav-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.icon-btn {
  padding: 0.5rem;
  border-radius: var(--radius);
  font-size: 1.1rem;
  color: var(--muted-foreground);
  transition: background .2s;
}

.icon-btn:hover {
  background: var(--secondary);
}

.nav-burger,
.nav-close {
  display: inline-flex;
}

.nav-close {
  display: none;
}

@media (min-width:768px) {

  .nav-burger,
  .nav-close {
    display: none !important;
  }
}

.nav-mobile {
  display: none;
  flex-direction: column;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 0 1rem 1rem;
}

.nav-mobile a {
  display: block;
  padding: 0.875rem 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
  transition: color .2s;
}

.nav-mobile a:last-child {
  border-bottom: 0;
}

.nav-mobile a:hover {
  color: var(--primary);
}

/* CSS-only mobile menu via :target */
#menu:target {
  display: flex;
}

#menu:target~* .nav-burger,
.navbar:has(#menu:target) .nav-burger {
  display: none;
}

.navbar:has(#menu:target) .nav-close {
  display: inline-flex;
}

/* === Ticker === */
.ticker {
  background: var(--primary);
  color: var(--primary-foreground);
  overflow: hidden;
}

.ticker-inner {
  display: flex;
  align-items: center;
  height: 36px;
}

.ticker-label {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--accent);
  color: var(--accent-foreground);
  padding: 0.25rem 0.75rem;
  border-radius: 2px;
  margin-right: 1rem;
}

.ticker-mask {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.ticker-track {
  display: flex;
  white-space: nowrap;
  animation: ticker 30s linear infinite;
}

.ticker-item {
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0 2rem;
}

@keyframes ticker {
  0% {
    transform: translateX(0)
  }

  100% {
    transform: translateX(-50%)
  }
}

/* === Hero === */
.hero {
  position: relative;
  height: 500px;
  overflow: hidden;
}

@media (min-width:768px) {
  .hero {
    height: 600px;
  }
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .7s;
}

.hero:hover .hero-img {
  transform: scale(1.05);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--news-overlay), hsla(220, 25%, 10%, 0.6) 50%, transparent);
}

.hero-content {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 2.5rem;
}

@media (min-width:768px) {
  .hero-content {
    padding-bottom: 4rem;
  }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  width: fit-content;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.75rem;
  border-radius: 2px;
  margin-bottom: 1rem;
}

.hero-badge .dot {
  width: 8px;
  height: 8px;
  background: currentColor;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: .5
  }
}

.hero h1 {
  font-size: 1.875rem;
  font-weight: 900;
  line-height: 1.15;
  color: var(--primary-foreground);
  max-width: 800px;
  margin-bottom: 1rem;
}

@media (min-width:768px) {
  .hero h1 {
    font-size: 3rem;
  }
}

.hero p {
  color: hsla(0, 0%, 100%, 0.8);
  font-size: 1rem;
  max-width: 700px;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

@media (min-width:768px) {
  .hero p {
    font-size: 1.125rem;
  }
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  color: hsla(0, 0%, 100%, 0.6);
  font-size: 0.875rem;
  font-weight: 500;
}

.hero-meta .read-more {
  margin-left: auto;
  color: var(--primary-foreground);
  font-weight: 600;
}

/* === News section === */
.news-section {
  padding: 2.5rem 1rem;
}

.cat-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: none;
}

.cat-tabs::-webkit-scrollbar {
  display: none;
}

.cat-tab {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--secondary);
  color: var(--foreground);
  transition: background .2s, color .2s;
}

.cat-tab:hover {
  background: var(--muted);
}

/* Active tab via :target — section id matches */
.news-section:target .cat-tab {
  background: var(--secondary);
  color: var(--foreground);
}

#cat-all:target~* .cat-tab[href="#cat-all"],
.cat-tab[href="#cat-all"] {
  /* default highlight when nothing targeted handled below */
}

/* Highlight the matching tab inside its target section */
.news-section[id="cat-all"]:target .cat-tab[href="#cat-all"],
.news-section[id="cat-aktualnosci"]:target .cat-tab[href="#cat-aktualnosci"],
.news-section[id="cat-swiat"]:target .cat-tab[href="#cat-swiat"],
.news-section[id="cat-polityka"]:target .cat-tab[href="#cat-polityka"],
.news-section[id="cat-sport"]:target .cat-tab[href="#cat-sport"],
.news-section[id="cat-technologia"]:target .cat-tab[href="#cat-technologia"],
.news-section[id="cat-ciekawostki"]:target .cat-tab[href="#cat-ciekawostki"] {
  background: var(--primary);
  color: var(--primary-foreground);
}

.news-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width:1024px) {
  .news-grid {
    grid-template-columns: 2fr 1fr;
  }
}

.grid-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

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

/* === Cards === */
.card-main {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s;
  cursor: pointer;
}

.card-main:hover {
  box-shadow: var(--shadow-md);
}

.card-img-wrap {
  position: relative;
  height: 224px;
  overflow: hidden;
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s;
}

.card-main:hover .card-img-wrap img {
  transform: scale(1.05);
}

.badge-cat {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.625rem;
  border-radius: 2px;
}

.card-body {
  padding: 1.25rem;
}

.card-body h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  transition: color .2s;
}

.card-main:hover .card-body h3 {
  color: var(--primary);
}

.card-body p {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* Sidebar */
.grid-side {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.25rem;
}

.grid-side h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.card-side {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.card-side:last-child {
  border-bottom: 0;
}

.side-img {
  width: 112px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
}

.side-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s;
}

.card-side:hover .side-img img {
  transform: scale(1.05);
}

.side-body {
  flex: 1;
  min-width: 0;
}

.side-cat {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.side-body h4 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  transition: color .2s;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-side:hover .side-body h4 {
  color: var(--primary);
}

.side-body .meta {
  margin-top: 0.5rem;
}

/* === CSS-only category filtering via :target ===
   When section has id matching a category, hide non-matching cards. */
#cat-aktualnosci:target .grid-main .card-main:not(.cat-aktualnosci) {
  display: none;
}

#cat-swiat:target .grid-main .card-main:not(.cat-swiat) {
  display: none;
}

#cat-polityka:target .grid-main .card-main:not(.cat-polityka) {
  display: none;
}

#cat-sport:target .grid-main .card-main:not(.cat-sport) {
  display: none;
}

#cat-technologia:target .grid-main .card-main:not(.cat-technologia) {
  display: none;
}

#cat-ciekawostki:target .grid-main .card-main:not(.cat-ciekawostki) {
  display: none;
}

/* === Footer === */
.footer {
  background: var(--accent);
  color: var(--accent-foreground);
  margin-top: 3rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding: 2.5rem 1rem;
}

@media (min-width:768px) {
  .footer-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.footer-about {
  font-size: 0.875rem;
  color: hsla(0, 0%, 100%, 0.7);
  line-height: 1.6;
  margin-top: 1rem;
}

.footer h4 {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

.footer ul li {
  margin-bottom: 0.5rem;
}

.footer ul a {
  font-size: 0.875rem;
  color: hsla(0, 0%, 100%, 0.7);
  transition: color .2s;
}

.footer ul a:hover {
  color: var(--primary);
}

.footer-bottom {
  border-top: 1px solid hsla(0, 0%, 100%, 0.2);
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: hsla(0, 0%, 100%, 0.5);
}

/* === README === */

/* === Article page === */
.article-page {
  padding: 2rem 0 4rem;
}

.article-container {
  max-width: 960px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted-foreground);
  margin-bottom: 2rem;
}

.breadcrumb a {
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color .2s;
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb .crumb-current {
  color: var(--foreground);
  font-weight: 600;
}

.article-header {
  margin-bottom: 2rem;
}

.article-category {
  display: inline-block;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  border-radius: 2px;
  margin-bottom: 1.25rem;
}

.article-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 900;
  line-height: 1.15;
  color: var(--foreground);
  margin-bottom: 1rem;
}

.article-lead {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--muted-foreground);
  margin-bottom: 1.75rem;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.author-name {
  font-weight: 600;
  color: var(--foreground);
  font-size: 0.95rem;
}

.author-role {
  font-size: 0.8rem;
  color: var(--muted-foreground);
}

.article-meta-info {
  display: flex;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted-foreground);
}

.article-figure {
  margin: 2rem 0;
}

.article-figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
}

.article-figure figcaption {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  margin-top: 0.5rem;
  font-style: italic;
}

.article-body {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--foreground);
}

.article-body>*+* {
  margin-top: 1.25rem;
}

.article-body h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.65rem;
  font-weight: 800;
  margin-top: 2.25rem;
  line-height: 1.25;
}

.article-body ul {
  padding-left: 1.5rem;
}

.article-body li {
  margin-bottom: 0.5rem;
}

.article-body strong {
  color: var(--foreground);
  font-weight: 700;
}

.article-body blockquote {
  border-left: 4px solid var(--primary);
  padding: 1rem 1.5rem;
  background: var(--secondary);
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-style: italic;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.article-body blockquote cite {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  font-style: normal;
  color: var(--muted-foreground);
  font-family: 'Source Sans 3', sans-serif;
}

.article-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

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

.tag {
  background: var(--secondary);
  color: var(--foreground);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

.back-link {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

/* Related */
.related {
  margin-top: 4rem;
}

.related-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 800;
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--primary);
}

.related-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.related-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .2s, transform .2s;
}

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

.related-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.related-body {
  padding: 1rem;
}

.related-cat {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.related-card h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  margin-top: 0.5rem;
}

.related-card:hover h3 {
  color: var(--primary);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted-foreground);
}