:root {
  --ink: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --paper: #f8fafc;
  --card: #ffffff;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --amber-line: #fde68a;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 12px 32px rgba(15, 23, 42, 0.06);
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 1.1rem;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(145deg, #0f172a, #334155);
  color: #fbbf24;
  display: grid;
  place-items: center;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
  font-weight: 700;
}

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

.icon-btn, .view-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 10px;
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.view-toggle {
  display: flex;
  padding: 3px;
  background: #f1f5f9;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.view-toggle .view-btn {
  border: 0;
  background: transparent;
  height: 30px;
}

.view-toggle .view-btn.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.hero {
  padding: 40px 0 28px;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #92400e;
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.hero p {
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.6;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
}

.search {
  flex: 1 1 240px;
  position: relative;
}

.search input {
  width: 100%;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0 14px 0 38px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

.search input:focus {
  outline: 2px solid #fde68a;
  border-color: #f59e0b;
}

.search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
}

.meta-count {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.tag {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.tag.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  padding-bottom: 48px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 48px;
}

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

.card:hover,
.card:focus-visible {
  transform: translateY(-3px);
  border-color: #cbd5e1;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.1);
  outline: none;
}

.card:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

.card-top {
  display: block;
  height: 5px;
  flex-shrink: 0;
  background: var(--accent, var(--amber));
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 22px 22px;
  flex: 1;
  min-height: 0;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 22px;
}

.card-meta time {
  font-size: 12px;
  color: #94a3b8;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  white-space: nowrap;
}

.badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #92400e;
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
  padding: 3px 8px;
  border-radius: 6px;
}

.card h2 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
  line-height: 1.3;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 6px;
}

.card-tags span {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 999px;
}

.list .card {
  flex-direction: row;
  align-items: stretch;
}

.list .card:hover,
.list .card:focus-visible {
  transform: none;
}

.list .card-top {
  width: 5px;
  height: auto;
}

.list .card-body {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  column-gap: 24px;
  row-gap: 6px;
  padding: 16px 20px;
  align-items: center;
}

.list .card-meta {
  grid-column: 2;
  grid-row: 1;
  justify-content: flex-end;
}

.list .card-meta .badge { display: none; }

.list h2 {
  grid-column: 1;
  grid-row: 1;
  font-size: 1.05rem;
}

.list p {
  grid-column: 1;
  grid-row: 2;
  -webkit-line-clamp: 1;
}

.list .card-tags {
  grid-column: 1 / -1;
  grid-row: 3;
  margin-top: 2px;
  padding-top: 0;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 22px 0;
  color: var(--muted);
  font-size: 13px;
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .list .card {
    flex-direction: column;
  }
  .list .card-top {
    width: 100%;
    height: 5px;
  }
  .list .card-body {
    display: flex;
  }
  .list .card-meta .badge { display: inline-flex; }
}
