:root {
  --navy: #102A43;
  --navy-2: #163B5C;
  --accent: #00A8D8;
  --accent-soft: #CFF4FF;
  --line: #D8E6F0;
  --soft: #F5F7FA;
  --soft-blue: #EAF4FB;
  --ink: #132B3F;
  --muted: #5E7284;
  --white: #FFFFFF;
  --shadow: 0 24px 60px rgba(16, 42, 67, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  font-family: Inter, Avenir, "Avenir Next", "Segoe UI", Arial, sans-serif;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--white);
  line-height: 1.6;
}

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

a {
  color: inherit;
}

.container {
  width: min(100% - 48px, 1180px);
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  border-bottom: 1px solid rgba(16, 42, 67, 0.1);
  background: rgba(255, 255, 255, 0.94);
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  width: 158px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 30px;
  color: var(--muted);
  font-weight: 700;
}

.site-nav a {
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--navy);
}

.nav-cta {
  border-radius: 999px;
  background: var(--navy);
  color: white !important;
  padding: 12px 20px;
}

.library-hero {
  background: var(--navy);
  color: white;
  padding: 68px 0 58px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(460px, 1.05fr);
  gap: 72px;
  align-items: center;
}

.section-kicker {
  margin: 0;
  color: var(--accent-soft);
  font-family: "Roboto Mono", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  max-width: 900px;
  margin: 16px 0 0;
  font-size: clamp(3.2rem, 6.8vw, 5.8rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 850px;
  margin: 28px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(0.84rem, 1.24vw, 1.02rem);
}

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

.topic-filter {
  position: relative;
  display: grid;
  justify-items: center;
  padding-left: 56px;
  border-left: 1px solid rgba(207, 244, 255, 0.22);
}

.topic-circle {
  position: relative;
  width: min(100%, 590px);
  aspect-ratio: 1;
  border: 1px solid rgba(207, 244, 255, 0.17);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(0, 168, 216, 0.08), rgba(255, 255, 255, 0.02) 54%, transparent 72%);
}

.topic-word {
  position: absolute;
  left: var(--desktop-left);
  top: var(--desktop-top);
  border: 0;
  background: transparent;
  color: var(--topic-color);
  cursor: pointer;
  font: inherit;
  font-size: var(--desktop-size);
  font-weight: 800;
  line-height: 1.04;
  max-width: 210px;
  padding: 0;
  text-align: center;
  text-wrap: balance;
  transform: translate(-50%, -50%);
  transition: transform 180ms ease, opacity 180ms ease, color 180ms ease;
}

.topic-word:hover,
.topic-word:focus-visible {
  outline: none;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.16em;
  transform: translate(-50%, -50%) scale(1.05);
}

.topic-word:focus-visible {
  border-radius: 4px;
  box-shadow: 0 0 0 4px rgba(207, 244, 255, 0.16);
}

.topic-word.is-muted {
  opacity: 0.34;
}

.topic-word.is-active {
  color: var(--accent-soft);
  opacity: 1;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.16em;
  transform: translate(-50%, -50%) scale(1.08);
}

.clear-filter {
  margin-top: 22px;
  border: 1px solid rgba(207, 244, 255, 0.28);
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  padding: 9px 14px;
}

.clear-filter:hover,
.clear-filter:focus-visible {
  border-color: var(--accent-soft);
  color: white;
  outline: none;
}

.clear-filter[hidden] {
  display: none;
}

.library-content {
  padding: 58px 0 90px;
  background: var(--white);
}

.library-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 34px;
}

.result-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.article-card {
  display: flex;
  height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.article-card:hover,
.article-card:focus-visible {
  border-color: rgba(0, 168, 216, 0.46);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.article-inner {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 26px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-topic {
  color: var(--accent);
}

.article-card h2 {
  margin: 24px 0 0;
  color: var(--navy);
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  line-height: 1.08;
}

.article-card p {
  display: -webkit-box;
  flex: 0 0 calc(1.6em * 3);
  max-height: calc(1.6em * 3);
  margin: 18px 0 0;
  color: var(--muted);
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  line-height: 1.6;
  text-overflow: ellipsis;
}

.hashtags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 28px;
}

.hashtags span {
  color: var(--navy-2);
  background: var(--soft-blue);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 9px;
}

body.modal-open {
  overflow: hidden;
}

.article-modal[hidden] {
  display: none;
}

.article-modal {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.article-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 29, 52, 0.68);
  backdrop-filter: blur(5px);
}

.article-modal-dialog {
  position: relative;
  display: flex;
  width: min(760px, 100%);
  max-height: min(82vh, 760px);
  flex-direction: column;
  overflow-y: auto;
  border: 1px solid rgba(0, 168, 216, 0.48);
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 24px 70px rgba(5, 29, 52, 0.3);
  padding: 42px;
}

.article-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--soft-blue);
  color: var(--navy);
  cursor: pointer;
  font: inherit;
  font-size: 1.8rem;
  line-height: 1;
}

.article-modal-close:hover,
.article-modal-close:focus-visible {
  background: var(--accent);
  color: var(--white);
}

.article-modal-dialog h2 {
  margin: 24px 42px 0 0;
  color: var(--navy);
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  line-height: 1.08;
}

.article-modal-text {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.75;
  white-space: pre-line;
}

.article-modal-tags {
  margin-top: 4px;
}

.article-modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.article-modal-footer a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.article-modal-footer a::after {
  content: " ↗";
}

.article-modal-footer a:hover,
.article-modal-footer a:focus-visible {
  text-decoration: underline;
}

.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 40px;
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

.empty-state p {
  margin-top: 10px;
  color: var(--muted);
}

.site-footer {
  background: var(--navy);
  color: white;
  padding: 34px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.footer-inner p {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
}

.footer-inner p:first-child {
  color: white;
  font-weight: 800;
}

@media (max-width: 980px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
    padding-block: 14px;
  }

  .site-nav {
    flex-wrap: wrap;
    gap: 16px 22px;
  }

  .hero-grid,
  .library-toolbar {
    grid-template-columns: 1fr;
  }

  .topic-filter {
    padding: 38px 0 0;
    border-top: 1px solid rgba(207, 244, 255, 0.22);
    border-left: 0;
  }

  .topic-circle {
    width: min(620px, calc(100vw - 48px));
  }

  .article-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .container {
    width: min(100% - 30px, 1180px);
  }

  .site-header {
    min-height: 0;
  }

  .brand {
    width: 136px;
  }

  .site-nav {
    font-size: 0.9rem;
  }

  .nav-cta {
    width: 100%;
    text-align: center;
  }

  .library-hero {
    padding: 46px 0 42px;
  }

  .topic-circle {
    width: min(100%, calc(100vw - 32px));
  }

  .topic-word {
    left: var(--mobile-left);
    top: var(--mobile-top);
    font-size: var(--mobile-size);
    max-width: 120px;
  }

  .topic-word[data-slug="digitalization"],
  .topic-word[data-slug="machine-learning"] {
    display: none;
  }

  .library-content {
    padding: 38px 0 64px;
  }

  .article-grid {
    grid-template-columns: 1fr;
  }

  .article-card {
    height: 420px;
  }

  .article-modal {
    padding: 14px;
  }

  .article-modal-dialog {
    max-height: 88vh;
    padding: 34px 24px 26px;
  }

  .footer-inner {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .article-card,
  .topic-word {
    transition: none;
  }
}
