:root {
  --bg: #f7fbff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --faint: #94a3b8;
  --accent: #0ea5e9;
  --accent-bright: #38bdf8;
  --accent-soft: #bae6fd;
  --accent-tint: #e0f2fe;
  --border: rgba(14, 165, 233, 0.16);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 32px -12px rgba(14, 165, 233, 0.18);
  --shadow-hover: 0 2px 4px rgba(15, 23, 42, 0.05), 0 24px 48px -16px rgba(14, 165, 233, 0.38), 0 0 0 1px rgba(56, 189, 248, 0.35);
  --radius: 18px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Inter, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(60% 50% at 10% 0%, rgba(186, 230, 253, 0.7), transparent 70%),
    radial-gradient(50% 40% at 95% 20%, rgba(224, 242, 254, 0.9), transparent 70%);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.bg.is-ready {
  opacity: 1;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(56px, 9vw, 120px) clamp(20px, 4vw, 40px) 64px;
}

/* ---------- Hero ---------- */
.hero {
  max-width: 720px;
  margin-bottom: clamp(40px, 6vw, 72px);
}

.hero__eyebrow {
  margin: 0 0 12px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero__title {
  margin: 0 0 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hero__title-main {
  font-family: Inter, "Helvetica Neue", system-ui, sans-serif;
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  background: linear-gradient(100deg, #0f172a 0%, #0f172a 45%, #0ea5e9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__title-sub {
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 600;
  color: var(--muted);
}

.hero__lead {
  margin: 0 0 20px;
  font-size: 1rem;
  color: var(--muted);
  max-width: 60ch;
}

.hero__count {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.hero__count span {
  font-variant-numeric: tabular-nums;
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 28px;
}

.toolbar__row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.search {
  position: relative;
  flex: 1 1 260px;
  max-width: 420px;
}

.search__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}

.search__input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 42px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search__input::placeholder {
  color: var(--faint);
}

.search__input:focus-visible {
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.25);
}

.sort,
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  appearance: none;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  height: 36px;
  padding: 0 16px;
  color: var(--muted);
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s, border-color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s;
}

.chip:hover {
  color: var(--accent);
  border-color: var(--accent-soft);
  transform: translateY(-1px);
}

.chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.3);
}

.chip.is-active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  border-color: transparent;
  box-shadow: 0 8px 20px -8px rgba(14, 165, 233, 0.6);
}

/* ---------- Grid / Cards ---------- */
.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 100% 0%, rgba(186, 230, 253, 0.55), transparent 60%);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(56, 189, 248, 0.5);
  outline: none;
}

.card:hover::after,
.card:focus-visible::after {
  opacity: 1;
}

.card:focus-visible {
  box-shadow: var(--shadow-hover), 0 0 0 4px rgba(56, 189, 248, 0.35);
}

.card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.card__date {
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-tint);
  padding: 4px 10px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.card__tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--faint);
  letter-spacing: 0.04em;
}

.card__title {
  margin: 0 0 8px;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.card__desc {
  margin: 0;
  flex: 1;
  font-size: 0.9rem;
  color: var(--muted);
}

.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.card__open {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.card__open span {
  display: inline-block;
  transition: transform 0.3s var(--ease);
}

.card:hover .card__open span,
.card:focus-visible .card__open span {
  transform: translateX(4px);
}

.card__article {
  position: relative;
  z-index: 1;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.card__article--float {
  position: absolute;
  right: 24px;
  bottom: 24px;
}

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

.card__article:focus-visible {
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.3);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 0;
}

.footer {
  margin-top: 72px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--faint);
}

.footer a {
  color: inherit;
  text-decoration: none;
  letter-spacing: 0.04em;
}

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

/* ---------- Animations ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: reveal 0.9s var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * 90ms);
}

.grid > li {
  position: relative;
  opacity: 0;
  transform: translateY(22px);
  animation: reveal 0.8s var(--ease) forwards;
  animation-delay: calc(320ms + var(--i, 0) * 70ms);
}

.grid > li.is-leaving {
  animation: leave 0.25s ease forwards;
}

.grid.is-refiltering > li {
  animation-delay: calc(var(--i, 0) * 50ms);
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes leave {
  to {
    opacity: 0;
    transform: scale(0.97);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .grid > li {
    animation-duration: 0.01ms;
    animation-delay: 0ms;
  }

  .card,
  .chip,
  .card__open span {
    transition: none;
  }

  .card:hover {
    transform: none;
  }
}

@media (max-width: 640px) {
  .card {
    padding: 20px;
  }

  .card__article--float {
    right: 20px;
    bottom: 20px;
  }

  .card__foot {
    flex-wrap: wrap;
  }
}
