:root {
  --bg-color: #f5f7fb;
  --accent-blue: #2a75bb;
  --accent-light-blue: #5da9e9;
  --accent-gold: #ffd966;
  --card-bg: #ffffff;
  --card-border: rgba(42, 117, 187, 0.4);
  --text-main: #1d1d1f;
  --text-muted: #4f5b76;
  --shadow: 0 20px 35px rgba(20, 43, 80, 0.18);
  --container-width: min(1100px, 92vw);
  --rounded-lg: 16px;
  --rounded-xl: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  font-family: "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
}

a {
  color: inherit;
}

.container {
  width: var(--container-width);
  margin: 0 auto;
}

.site-header {
  background: linear-gradient(135deg, #182848 0%, #4b6cb7 100%);
  color: #fff;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 0;
}

.site-branding .site-label {
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0;
}

.site-branding .site-title {
  font-size: 1.4rem;
  margin: 0.2rem 0 0;
  font-weight: 700;
}

.site-nav {
  display: flex;
  gap: 0.8rem;
}

.nav-link {
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.3s ease;
}

.nav-link:hover,
.nav-link:focus {
  background: rgba(255, 255, 255, 0.25);
}

.hero {
  padding: 3.5rem 0 2.5rem;
  background: radial-gradient(circle at 0% 0%, rgba(93, 169, 233, 0.28), transparent 60%),
    radial-gradient(circle at 100% 0%, rgba(255, 217, 102, 0.25), transparent 65%),
    var(--bg-color);
}

.hero .container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  align-items: center;
}

.hero-content .hero-title {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  margin: 0 0 1rem;
}

.hero-description {
  margin: 0;
  color: var(--text-muted);
  max-width: 540px;
}

.hero-visual {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(140deg, rgba(42, 117, 187, 0.15), rgba(93, 169, 233, 0.4));
  border-radius: var(--rounded-xl);
  border: 2px solid rgba(42, 117, 187, 0.25);
  position: relative;
  overflow: hidden;
}

.hero-visual::after,
.hero-visual::before {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  filter: blur(0.4px);
}

.hero-visual::before {
  width: 180px;
  height: 180px;
  top: 15%;
  right: 12%;
  opacity: 0.35;
}

.hero-visual::after {
  width: 220px;
  height: 220px;
  bottom: -10%;
  left: 5%;
  opacity: 0.2;
}

.filters {
  background: #fff;
  padding: 1.8rem 0;
  box-shadow: var(--shadow);
  margin-bottom: 2.5rem;
}

.filters .container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
}

.filter-group {
  flex: 1 1 220px;
}

.filter-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.filter-button {
  border: 1px solid rgba(29, 29, 31, 0.12);
  background: #fff;
  color: var(--text-main);
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-button:hover,
.filter-button:focus {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.filter-button.is-active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
  box-shadow: 0 8px 16px rgba(42, 117, 187, 0.2);
}

.search-group {
  max-width: 320px;
}

.search-wrapper {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.55rem 2.5rem 0.55rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(29, 29, 31, 0.12);
  font-size: 0.95rem;
  transition: border 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(93, 169, 233, 0.2);
}

.search-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
}

.article-section {
  padding-bottom: 4rem;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.8rem;
  align-items: stretch;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 2.5rem auto 0;
}

.pagination.is-hidden {
  display: none;
}

.pagination__button {
  border: 1px solid rgba(29, 29, 31, 0.16);
  background: #fff;
  color: var(--text-main);
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 2.5rem;
}

.pagination__button:hover,
.pagination__button:focus {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.pagination__button.is-active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
  box-shadow: 0 8px 16px rgba(42, 117, 187, 0.2);
  cursor: default;
}

.pagination__button[disabled],
.pagination__button[aria-disabled='true'] {
  cursor: not-allowed;
  opacity: 0.6;
}

.article-card {
  perspective: 1600px;
  position: relative;
  height: 100%;
  transition: transform 0.25s ease;
}

.article-card:hover,
.article-card:focus-within {
  transform: translateY(-6px);
}

.card-link-wrapper {
  display: block;
  position: relative;
  height: 100%;
  color: inherit;
  text-decoration: none;
  border-radius: var(--rounded-lg);
}

.card-link-wrapper:focus-visible {
  outline: 3px solid rgba(93, 169, 233, 0.6);
  outline-offset: 4px;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 280px;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
  border-radius: var(--rounded-lg);
}

.article-card:hover .card-inner,
.article-card:focus-within .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  padding: 1.6rem 1.4rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--card-background, var(--card-bg));
  border-radius: var(--rounded-lg);
  border: 2px solid transparent;
  box-shadow: var(--shadow);
  backface-visibility: hidden;
  transition: box-shadow 0.25s ease;
  overflow: hidden;
  z-index: 0;
}

.card-face::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 2px;
  border-radius: inherit;
  background: conic-gradient(
    from 0deg,
    rgba(255, 255, 255, 0.95) 0deg,
    #e9edf5 45deg,
    #c8cedd 120deg,
    #f7f8fb 180deg,
    #d0d7e6 240deg,
    rgba(255, 255, 255, 0.95) 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: border-shimmer 10s linear infinite;
  pointer-events: none;
  z-index: -1;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35));
  transform-origin: center;
}

.card-face::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  background-image:
    radial-gradient(circle at 18% 26%, rgba(255, 255, 255, 0.8) 0, rgba(255, 255, 255, 0) 55%),
    radial-gradient(circle at 78% 22%, rgba(202, 220, 255, 0.65) 0, rgba(202, 220, 255, 0) 50%),
    radial-gradient(circle at 62% 78%, rgba(255, 255, 255, 0.7) 0, rgba(255, 255, 255, 0) 55%),
    radial-gradient(circle at 28% 72%, rgba(210, 232, 255, 0.6) 0, rgba(210, 232, 255, 0) 50%);
  background-repeat: no-repeat;
  opacity: 0.45;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: -2;
  transition: opacity 0.3s ease;
  animation: sparkle-pulse 6s ease-in-out infinite;
}

.article-card:hover .card-face,
.article-card:focus-within .card-face {
  box-shadow: 0 32px 50px rgba(20, 43, 80, 0.28);
}

.article-card:hover .card-face::before,
.article-card:focus-within .card-face::before {
  animation-duration: 5s;
  filter: drop-shadow(0 0 10px rgba(240, 248, 255, 0.55));
}

.article-card:hover .card-face::after,
.article-card:focus-within .card-face::after {
  opacity: 0.8;
}

.card-face--back {
  transform: rotateY(180deg);
  justify-content: space-between;
  gap: 0.75rem;
}

.card-back-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-right: 0.25rem;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.card-title {
  font-size: 1.2rem;
  margin: 0;
  font-weight: 700;
  min-height: 3em;
  word-break: break-word;
}

.card-description {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
}

.tag {
  background: rgba(42, 117, 187, 0.12);
  color: var(--accent-blue);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.card-cta {
  margin-top: auto;
  font-size: 0.85rem;
  color: var(--accent-blue);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.card-cta::after {
  content: '↗';
  font-size: 0.8rem;
}

.card-title--back {
  font-size: 1.1rem;
  word-break: break-word;
}

.site-footer {
  background: #111827;
  color: rgba(255, 255, 255, 0.7);
  padding: 2rem 0 2.5rem;
  text-align: center;
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0.25rem 0;
}

.empty-message {
  grid-column: 1 / -1;
  text-align: center;
  background: rgba(93, 169, 233, 0.15);
  border: 2px dashed rgba(42, 117, 187, 0.35);
  border-radius: var(--rounded-lg);
  padding: 2rem;
  color: var(--accent-blue);
  font-weight: 600;
}

@media (max-width: 720px) {
  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .filters .container {
    flex-direction: column;
  }

  .search-group {
    max-width: unset;
  }
}

@keyframes border-shimmer {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes sparkle-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(1);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.015);
  }
}
