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

:root {
  --bg: #F2F2F7;
  --text: #111111;
  --muted: #6B6B6B;
  --accent: #2563EB;
  --radius: 16px;
  --gap: 16px;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  padding-bottom: 40px;
}

/* Header */
.header {
  padding: 32px var(--gap) 16px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.header h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.header .subtitle {
  font-size: 14px;
  color: var(--muted);
  font-weight: 400;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  padding: 0 var(--gap);
  margin-bottom: 16px;
}

.tab {
  padding: 8px 20px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  background: var(--accent);
  color: #FFFFFF;
}

/* Grid — 2 columns everywhere, scales up at larger screens */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px 12px;
  padding: 0 var(--gap);
}

@media (min-width: 640px) {
  .grid { gap: 32px 16px; padding: 0 var(--gap); }
}

@media (min-width: 1024px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  :root { --gap: 24px; }
  .header, .tabs, .grid { max-width: 1200px; margin-left: auto; margin-right: auto; }
}

@media (min-width: 1440px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  :root { --gap: 28px; }
  .header, .tabs, .grid { max-width: 1440px; }
}

/* Card */
.card {
  display: block;
  background: #FFFFFF;
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s;
}

.card:hover {
  transform: translateY(-2px);
}

.card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #E8E8E8;
  overflow: hidden;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-thumb .views-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  font-size: 13px;
  font-weight: 600;
  color: white;
}

.views-badge svg {
  width: 14px;
  height: 14px;
}

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

.card-caption {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
  color: var(--text);
}

.card-meta {
  font-size: 14px;
  color: var(--muted);
}

.card-meta .brand {
  color: var(--accent);
  font-weight: 700;
}


@media (min-width: 640px) {
  .card-caption { font-size: 17px; margin-bottom: 8px; }
  .card-meta { font-size: 15px; }
}

/* Empty / loading states */
.empty-state {
  text-align: center;
  padding: 80px var(--gap);
  color: var(--muted);
}

.empty-state h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.empty-state p {
  font-size: 14px;
}

.loader {
  display: flex;
  justify-content: center;
  padding: 60px 0;
}

.loader .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  margin: 0 4px;
  animation: pulse 1.2s infinite;
}

.loader .dot:nth-child(2) { animation-delay: 0.2s; }
.loader .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* Week selector (archive) */
.week-selector {
  display: none;
  padding: 0 var(--gap);
  margin-bottom: 16px;
}

.week-selector.visible {
  display: block;
}

.week-selector select {
  width: auto;
  min-width: 200px;
  padding: 10px 36px 10px 14px;
  border-radius: 10px;
  border: 1px solid #D4D4D4;
  background: #FFFFFF;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236B6B6B' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

@media (min-width: 1024px) {
  .week-selector { max-width: 1200px; margin-left: auto; margin-right: auto; }
}

@media (min-width: 1440px) {
  .week-selector { max-width: 1440px; }
}
