html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: max(12px, env(safe-area-inset-top, 0px));
}

:root {
  color-scheme: dark;
  --bg0: #070910;
  --bg1: #0f1420;
  --card: #12192a;
  --card-inner: #151d30;
  --border: #273047;
  --text: #eef2fb;
  --muted: #94a0bd;
  --accent: #6b9dff;
  --accent2: #45e0a8;
  --warn: #f0c14b;
  --glow: rgba(107, 157, 255, 0.22);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.55);
  --shadow-hover: 0 28px 70px rgba(0, 0, 0, 0.65);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: rgba(107, 157, 255, 0.15);
  background:
    radial-gradient(ellipse 900px 500px at 15% -5%, rgba(107, 157, 255, 0.12), transparent 50%),
    radial-gradient(ellipse 700px 400px at 95% 20%, rgba(69, 224, 168, 0.06), transparent 45%),
    var(--bg0);
  color: var(--text);
  line-height: 1.55;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
  color: #cfe0ff;
}

.layout {
  max-width: 1240px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  padding-top: max(20px, env(safe-area-inset-top, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-bottom: max(48px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(12px, 3vw, 18px);
  margin-bottom: clamp(16px, 4vw, 24px);
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #a78bfa 52%, var(--accent2));
  box-shadow: var(--shadow), 0 0 40px var(--glow);
}

h1 {
  margin: 0 0 6px;
  font-size: clamp(1.45rem, 2.6vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 54ch;
  font-size: 0.95rem;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pill {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--muted);
}

.pill-warn {
  border-color: rgba(240, 193, 75, 0.4);
  color: #ffecc4;
}

.intro {
  border: 1px solid var(--border);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.05) 0%, transparent 55%), var(--bg1);
  border-radius: var(--radius);
  padding: clamp(16px, 4vw, 22px) clamp(14px, 4vw, 22px) 10px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

.intro h2 {
  margin: 0 0 12px;
  font-size: 1.08rem;
  font-weight: 600;
}

.intro p {
  margin: 0 0 14px;
  color: #d4ddf5;
  font-size: 0.95rem;
}

.intro--legal {
  border-color: rgba(240, 193, 75, 0.28);
  background: linear-gradient(165deg, rgba(240, 193, 75, 0.07) 0%, transparent 50%), var(--bg1);
}

.intro--legal p:last-child {
  margin-bottom: 4px;
}

.case-spotlight {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(107, 157, 255, 0.28);
  background: rgba(0, 0, 0, 0.22);
}

.case-spotlight h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
  font-weight: 600;
}

.case-spotlight p {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: #d0d9f0;
}

.case-spotlight p:last-child {
  margin-bottom: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 22px;
}

.search {
  display: block;
  flex: 1 1 280px;
  min-width: 0;
}

.search input {
  width: min(560px, 100%);
  max-width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  outline: none;
  font-size: 0.95rem;
}

.search input:focus {
  border-color: rgba(107, 157, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(107, 157, 255, 0.2);
}

.stats {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: clamp(14px, 3vw, 20px);
  align-items: start;
}

.card {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

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

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(107, 157, 255, 0.35);
  }
}

.card:focus-within {
  border-color: rgba(107, 157, 255, 0.35);
  outline: none;
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(145deg, #1a2540, #0d121f);
}

.card-media__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-media__fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: rgba(238, 242, 251, 0.35);
  background: linear-gradient(160deg, #1e2d4a, #0f1624);
}

.card-media__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(7, 9, 16, 0.92) 0%, rgba(7, 9, 16, 0.2) 45%, transparent 100%);
  pointer-events: none;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 12px;
}

.card-year-badge {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(107, 157, 255, 0.25);
  border: 1px solid rgba(107, 157, 255, 0.45);
  color: #e8f0ff;
  backdrop-filter: blur(8px);
}

.card-media__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 8px 12px 10px;
  font-size: 0.68rem;
  line-height: 1.35;
  color: rgba(200, 210, 235, 0.82);
  background: linear-gradient(to top, rgba(7, 9, 16, 0.95), transparent);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  background: linear-gradient(180deg, var(--card-inner), var(--card));
}

.card h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #c5d2f0;
  background: rgba(255, 255, 255, 0.04);
}

.summary {
  margin: 0;
  color: #dbe3f8;
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.summary--lead {
  font-weight: 500;
  color: #f0f4ff;
}

.detail {
  margin: 0;
  color: #aeb9d8;
  font-size: 0.86rem;
  line-height: 1.58;
  flex: 1;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
  padding-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(107, 157, 255, 0.4);
  color: #f4f7ff;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  background: rgba(107, 157, 255, 0.14);
  transition: background 0.15s ease, border-color 0.15s ease;
  touch-action: manipulation;
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    border-color: rgba(107, 157, 255, 0.75);
    background: rgba(107, 157, 255, 0.24);
  }
}

.btn-secondary {
  border-color: rgba(69, 224, 168, 0.38);
  background: rgba(69, 224, 168, 0.1);
}

@media (hover: hover) and (pointer: fine) {
  .btn-secondary:hover {
    border-color: rgba(69, 224, 168, 0.6);
    background: rgba(69, 224, 168, 0.18);
  }
}

.footer {
  margin-top: 32px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

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

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

@media (max-width: 639px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .search input {
    width: 100%;
    font-size: 16px;
    min-height: 48px;
  }

  .stats {
    text-align: left;
    order: 1;
  }

  .search {
    order: 0;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions .btn {
    width: 100%;
    justify-content: center;
  }

  .brand {
    gap: 12px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }

  .subtitle {
    font-size: 0.9rem;
  }

  .card-body {
    padding: 14px 14px 16px;
  }

  .card-media__overlay {
    padding: 10px;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search input {
    width: min(100%, 560px);
  }
}

@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  }
}
