/* Anthropic-inspired palette — warm dark + copper accent */
:root {
  --bg: #141413;
  --bg-elevated: #1a1917;
  --panel: #1d1916;
  --panel-2: #241f1b;
  --copper: #c96442;
  --copper-2: #d97757;
  --copper-glow: rgba(201, 100, 66, 0.35);
  --cream: #f5f4ed;
  --cream-soft: rgba(245, 244, 237, 0.92);
  --muted: #b9afa4;
  --muted-2: #8a8076;
  --line: rgba(245, 244, 237, 0.12);
  --line-strong: rgba(201, 100, 66, 0.45);
  --success: #6b9e78;
  --radius: 14px;
  --radius-sm: 10px;
  --font-ui: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-display: "Playfair Display", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --header-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --max-content: 720px;
  --ad-bg: rgba(245, 244, 237, 0.04);
  --ad-border: rgba(245, 244, 237, 0.08);
}

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

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

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  color: var(--cream-soft);
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, var(--copper-glow), transparent 55%),
    radial-gradient(circle at 100% 0%, rgba(217, 119, 87, 0.08), transparent 40%),
    var(--bg);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--copper-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--cream);
}

/* —— Layout —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--header-h);
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(20, 20, 19, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--cream);
  min-width: 0;
}

.brand-mark {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--copper), var(--copper-2));
  display: grid;
  place-items: center;
  color: var(--bg);
}

.brand-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--cream);
}

.brand-sub {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
}

.header-link {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.header-link:hover {
  color: var(--cream);
  border-color: var(--line-strong);
}

.shell {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: calc(24px + var(--safe-bottom));
}

@media (min-width: 768px) {
  .shell {
    padding: 24px 28px 40px;
  }

  .site-header {
    padding-left: 28px;
    padding-right: 28px;
  }
}

/* —— Google Ad placeholders —— */
.ad-slot {
  margin: 16px 0;
  border-radius: var(--radius-sm);
  background: var(--ad-bg);
  border: 1px dashed var(--ad-border);
  overflow: hidden;
}

.ad-slot__label {
  display: block;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  text-align: center;
  border-bottom: 1px dashed var(--ad-border);
}

.ad-slot__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  color: var(--muted-2);
  font-size: 0.75rem;
}

.ad-slot--banner .ad-slot__inner {
  min-height: 90px;
}

.ad-slot--rectangle .ad-slot__inner {
  min-height: 250px;
}

.ad-slot--leaderboard {
  display: none;
}

@media (min-width: 768px) {
  .ad-slot--mobile-only {
    display: none;
  }

  .ad-slot--leaderboard {
    display: block;
  }

  .ad-slot--leaderboard .ad-slot__inner {
    min-height: 90px;
  }
}

/* —— Index: hero + filters —— */
.hero {
  margin-bottom: 20px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 2.1rem);
  font-weight: 700;
  color: var(--cream);
  margin: 0 0 8px;
  line-height: 1.2;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 36em;
}

.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 0 12px;
  margin-bottom: 8px;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  min-height: 44px;
}

.filter-btn:hover,
.filter-btn:focus-visible {
  color: var(--cream);
  border-color: var(--line-strong);
  outline: none;
}

.filter-btn.is-active {
  background: linear-gradient(135deg, rgba(201, 100, 66, 0.25), rgba(217, 119, 87, 0.15));
  border-color: var(--copper);
  color: var(--cream);
}

.layout-with-sidebar {
  display: block;
}

@media (min-width: 900px) {
  .layout-with-sidebar {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 28px;
    align-items: start;
  }

  .sidebar-ads {
    position: sticky;
    top: calc(var(--header-h) + 16px);
  }
}

/* —— Post cards —— */
.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 540px) {
  .post-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.post-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
  min-height: 44px;
}

.post-card:hover,
.post-card:focus-visible {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  outline: none;
}

.post-card__visual {
  aspect-ratio: 1 / 1;
  background: linear-gradient(145deg, var(--panel-2), var(--bg));
  position: relative;
  overflow: hidden;
}

.post-card__visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(20, 20, 19, 0.85));
  pointer-events: none;
}

.post-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-card__emoji {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 3.5rem;
  opacity: 0.9;
}

.post-card__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(20, 20, 19, 0.75);
  border: 1px solid var(--line);
  color: var(--copper-2);
}

.post-card__body {
  padding: 14px 16px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.post-card__date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted-2);
  letter-spacing: 0.04em;
}

.post-card__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--cream);
  margin: 0;
  line-height: 1.25;
}

.post-card__excerpt {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__cta {
  margin-top: auto;
  padding-top: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--copper-2);
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  grid-column: 1 / -1;
}

/* —— Detail page —— */
.back-bar {
  margin-bottom: 12px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 10px 0;
  min-height: 44px;
}

.back-link:hover {
  color: var(--cream);
}

.article-wrap {
  width: 100%;
}

.article-hero {
  margin-bottom: 24px;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 7;
}

.article-hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 12px;
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(201, 100, 66, 0.15);
  border: 1px solid var(--line-strong);
  color: var(--copper-2);
  display: inline-block;
  width: fit-content;
  align-self: flex-start;
}

.chip--sm {
  font-size: 0.63rem;
  padding: 4px 8px;
}

.chip--xs {
  font-size: 0.6rem;
  padding: 3px 7px;
}

.article-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-2);
}

.article-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5.5vw, 2rem);
  font-weight: 700;
  color: var(--cream);
  margin: 0 0 16px;
  line-height: 1.2;
}

.article-lede {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0 0 24px;
  border-left: 3px solid var(--copper);
  padding-left: 16px;
}

.article-content {
  font-size: 1rem;
}

.article-content h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--cream);
  margin: 28px 0 12px;
}

.article-content h3 {
  font-size: 1rem;
  color: var(--cream);
  margin: 20px 0 8px;
}

.article-content p {
  margin: 0 0 14px;
}

.article-content ul,
.article-content ol {
  margin: 0 0 16px;
  padding-left: 1.25rem;
}

.article-content li {
  margin-bottom: 8px;
}

.article-content code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--panel-2);
  color: var(--copper-2);
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  white-space: nowrap;
}

/* Fenced code blocks */
.article-content pre {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 0 0 20px;
  line-height: 1.6;
}
.article-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--cream-soft);
  font-size: 0.85rem;
  white-space: pre;
}

/* Blockquote — styled callout */
.article-content blockquote {
  margin: 0 0 20px;
  padding: 1rem 1.25rem;
  background: var(--panel-2);
  border-left: 3px solid var(--copper);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--cream-soft);
  font-style: italic;
}
.article-content blockquote p {
  margin: 0 0 6px;
}
.article-content blockquote p:last-child {
  margin: 0;
}

/* Horizontal rule */
.article-content hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 28px 0;
}

/* Strikethrough */
.article-content del {
  opacity: 0.55;
  text-decoration: line-through;
}

/* Links inside content */
.article-content a {
  color: var(--copper-2);
  text-underline-offset: 3px;
}
.article-content a:hover { color: var(--cream); }

/* Tables */
.md-table-wrap {
  overflow-x: auto;
  margin: 0 0 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.article-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.article-content thead {
  background: var(--panel-2);
}
.article-content th {
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.article-content td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.5;
}
.article-content tbody tr:last-child td {
  border-bottom: none;
}
.article-content tbody tr:hover {
  background: rgba(245, 244, 237, 0.03);
}

.tool-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}

.tool-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  margin-bottom: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.tool-list strong {
  color: var(--cream);
  display: block;
  margin-bottom: 4px;
}

/* —— Download block —— */
.resource-box {
  margin: 28px 0;
  padding: 20px;
  background: linear-gradient(135deg, rgba(201, 100, 66, 0.12), rgba(36, 31, 27, 0.9));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.resource-box h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 8px;
  color: var(--cream);
}

.resource-box p {
  margin: 0 0 16px;
  font-size: 0.9rem;
  color: var(--muted);
}

.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 14px 20px;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  color: var(--bg);
  background: linear-gradient(135deg, var(--copper), var(--copper-2));
  border: none;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}

.btn-download:hover {
  filter: brightness(1.08);
  color: var(--bg);
  transform: translateY(-1px);
}

.resource-box--unavailable .btn-download {
  opacity: 0.45;
  pointer-events: none;
}

/* —— Share —— */
.share-section {
  margin: 32px 0 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.share-section h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin: 0 0 14px;
  color: var(--cream);
}

.share-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (min-width: 480px) {
  .share-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 72px;
  padding: 12px 8px;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  text-decoration: none;
}

.share-btn:hover,
.share-btn:focus-visible {
  border-color: var(--line-strong);
  color: var(--cream);
  outline: none;
}

.share-btn svg {
  width: 22px;
  height: 22px;
}

.share-btn.is-copied {
  border-color: var(--success);
  color: var(--success);
}

.share-toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 40px));
  visibility: hidden;
  opacity: 0;
  padding: 10px 22px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.875rem;
  color: var(--cream);
  z-index: 9999;
  transition: transform 0.22s ease, opacity 0.22s ease, visibility 0s linear 0.22s;
  pointer-events: none;
  white-space: nowrap;
}

.share-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  visibility: visible;
  opacity: 1;
  transition: transform 0.22s ease, opacity 0.22s ease, visibility 0s linear 0s;
}

/* —— Sidebar widget (related posts) —— */
.sidebar-widget {
  margin-top: 16px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.sidebar-widget__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--cream);
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.sidebar-post {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s;
}

.sidebar-post:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.sidebar-post:hover {
  opacity: 0.75;
}

.sidebar-post__title {
  font-size: 0.875rem;
  color: var(--cream-soft);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* —— Section heading —— */
.section-heading {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  font-weight: 700;
  color: var(--cream);
  margin: 0 0 16px;
}

/* —— Featured posts section —— */
.featured-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 600px) {
  .mini-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.mini-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}

.mini-card:hover,
.mini-card:focus-visible {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  outline: none;
}

.mini-card__img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.mini-card__img-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(145deg, var(--panel-2), var(--bg));
  display: grid;
  place-items: center;
  font-size: 1.8rem;
}

.mini-card__body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.mini-card__title {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--cream);
  margin: 0;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mini-card__date {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted-2);
  margin-top: auto;
  padding-top: 4px;
}

/* —— Footer —— */
.site-footer {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.footer-social {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.social-link svg {
  width: 19px;
  height: 19px;
}

.social-link:hover {
  color: var(--cream);
  border-color: rgba(245, 244, 237, 0.25);
  background: var(--panel);
}

.social-link--ig:hover {
  border-color: #e1306c;
  color: #e1306c;
  background: rgba(225, 48, 108, 0.08);
}

.social-link--li:hover {
  border-color: #0a66c2;
  color: #0a66c2;
  background: rgba(10, 102, 194, 0.08);
}

.social-link--gm:hover {
  border-color: #ff90e8;
  color: #ff90e8;
  background: rgba(255, 144, 232, 0.08);
}

.footer-tagline {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0 0 6px;
  line-height: 1.5;
}

.footer-note {
  font-size: 0.75rem;
  color: var(--muted-2);
  margin: 0;
}

.footer-note code {
  font-family: var(--font-mono);
  font-size: 0.72em;
  background: var(--panel-2);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.not-found {
  text-align: center;
  padding: 60px 20px;
}

.not-found h1 {
  font-family: var(--font-display);
  color: var(--cream);
}
