/* ═══════════════════════════════════════════
    TOKENS
═══════════════════════════════════════════ */
:root {
  --primary:       #1a1a1a;
  --accent:        #d4a574;
  --accent-light:  #f0e0cc;
  --accent-dark:   #b8864e;
  --text:          #2d2d2d;
  --text-muted:    #5c5c5c;
  --text-subtle:   #9a9a9a;
  --surface:       #faf9f7;
  --surface-warm:  #f5f2ed;
  --surface-card:  #ffffff;
  --border:        #e8e4de;
  --border-strong: #cec9c1;
  --font-serif:    'Lora', Georgia, serif;
  --font-sans:     'DM Sans', system-ui, sans-serif;
  --radius:        8px;
  --radius-lg:     14px;
  --layout-w:      1140px;
  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--surface);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ═══════════════════════════════════════════
    HEADER
═══════════════════════════════════════════ */
.site-header {
  position: sticky; top: 0;
  background: rgba(250,249,247,0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  padding: 0 1.5rem;
}
.site-header__inner {
  max-width: var(--layout-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
}
.site-logo {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.site-logo__mark {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.site-nav a {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s;
}
.site-nav a:hover { color: var(--primary); }
.site-nav a.active { color: var(--primary); font-weight: 600; }
.nav-cta {
  background: var(--primary);
  color: #fff !important;
  padding: 0.45rem 1.15rem;
  border-radius: var(--radius);
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  transition: background 0.15s;
}
.nav-cta:hover { background: var(--accent-dark) !important; }

/* ═══════════════════════════════════════════
    PAGE HERO
═══════════════════════════════════════════ */
.page-hero {
  background: var(--primary);
  padding: 3.5rem 1.5rem 3rem;
}
.page-hero__inner {
  max-width: var(--layout-w);
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}
.hero-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.65rem;
}
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.6rem;
}
.hero-sub {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.6;
  max-width: 440px;
}
.hero-count {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  text-align: center;
  flex-shrink: 0;
}
.hero-count__num {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.2rem;
}
.hero-count__label {
  font-size: 0.74rem;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════════
    CONTROLS BAR (search + filters)
═══════════════════════════════════════════ */
.controls-bar {
  background: var(--surface-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 62px;
  z-index: 90;
}
.controls-bar__inner {
  max-width: var(--layout-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* Search */
.search-wrap {
  position: relative;
  flex-shrink: 0;
  width: 240px;
}
.search-icon {
  position: absolute;
  left: 0.85rem; top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
  font-size: 0.9rem;
}
#search-input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 0.85rem 0 2.25rem;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  color: var(--text);
  background: var(--surface-warm);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
#search-input:focus {
  border-color: var(--accent);
  background: #fff;
}
#search-input::placeholder { color: var(--text-subtle); }

/* Category pills */
.filter-pills {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.85rem 0;
  scrollbar-width: none;
  flex: 1;
}
.filter-pills::-webkit-scrollbar { display: none; }
.pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 1rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
  user-select: none;
}
.pill:hover { border-color: var(--accent); color: var(--accent-dark); }
.pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Results summary */
.results-bar {
  max-width: var(--layout-w);
  margin: 0 auto;
  padding: 1.25rem 1.5rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.results-count {
  font-size: 0.8rem;
  color: var(--text-subtle);
}
.results-count strong { color: var(--text-muted); font-weight: 600; }

/* Sort select */
.sort-select {
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--surface-warm);
  outline: none;
  cursor: pointer;
}
.sort-select:focus { border-color: var(--accent); }

/* ═══════════════════════════════════════════
    ARTICLE GRID
═══════════════════════════════════════════ */
.articles-wrap {
  max-width: var(--layout-w);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 5rem;
}

#articles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

/* ── Article Card ── */
.article-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.65rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s var(--ease-out);
  cursor: pointer;
  animation: cardIn 0.35s var(--ease-out) both;
}
.article-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  transform: translateY(-2px);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.card-category {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-dark);
  background: var(--accent-light);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
}
.card-read-time {
  font-size: 0.72rem;
  color: var(--text-subtle);
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.35;
  letter-spacing: -0.015em;
  margin-bottom: 0.65rem;
  transition: color 0.15s;
}
.article-card:hover .card-title { color: var(--accent-dark); }

.card-excerpt {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
  flex: 1;
  margin-bottom: 0.3rem;

  /* Clamp to 3 lines */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.card-author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.card-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--accent-dark);
  flex-shrink: 0;
  overflow: hidden;
}
.card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.card-author-name {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-muted);
}
.card-date {
  font-size: 0.72rem;
  color: var(--text-subtle);
}
.card-arrow {
  font-size: 0.82rem;
  color: var(--accent-dark);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.15s, transform 0.15s;
}
.article-card:hover .card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ═══════════════════════════════════════════
    SKELETON CARDS (loading state)
═══════════════════════════════════════════ */
.skeleton-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.65rem;
}
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.skel {
  background: linear-gradient(90deg, var(--surface-warm) 25%, #ede9e3 50%, var(--surface-warm) 75%);
  background-size: 1200px 100%;
  animation: shimmer 1.6s infinite;
  border-radius: 4px;
}
.skel-pill  { height: 18px; width: 90px; margin-bottom: 0.8rem; }
.skel-h2    { height: 22px; width: 85%; margin-bottom: 0.5rem; }
.skel-h2b   { height: 22px; width: 60%; margin-bottom: 0.8rem; }
.skel-line  { height: 13px; width: 100%; margin-bottom: 0.4rem; }
.skel-line2 { height: 13px; width: 75%; margin-bottom: 0; }
.skel-foot  { height: 1px; background: var(--border); margin: 1rem 0; }
.skel-meta  { height: 13px; width: 120px; }

/* ═══════════════════════════════════════════
    EMPTY / END STATES
═══════════════════════════════════════════ */
.state-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-subtle);
}
.state-empty__icon { font-size: 2.5rem; margin-bottom: 1rem; }
.state-empty__title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.state-empty__sub { font-size: 0.84rem; line-height: 1.6; }

.state-end {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1rem 1rem;
}
.state-end__line {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 0.85rem;
}
.state-end__line::before,
.state-end__line::after {
  content: '';
  flex: 1;
  max-width: 80px;
  height: 1px;
  background: var(--border);
}
.state-end__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.state-end__text {
  font-size: 0.78rem;
  color: var(--text-subtle);
}

/* ═══════════════════════════════════════════
    SENTINEL + LOADER SPINNER
═══════════════════════════════════════════ */
#sentinel {
  grid-column: 1 / -1;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent-dark);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#sentinel.hidden { display: none; }

/* ═══════════════════════════════════════════
    FOOTER
═══════════════════════════════════════════ */
.site-footer {
  background: var(--primary);
  padding: 3rem 1.5rem;
}
.site-footer__inner {
  max-width: var(--layout-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1.5rem 3rem;
}
.footer-logo {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}
.footer-nav {
  display: flex;
  gap: 1.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.footer-nav a {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
  transition: color 0.15s;
}
.footer-nav a:hover { color: var(--accent); }
.footer-copy {
  grid-column: 1 / -1;
  font-size: 0.74rem;
  color: rgba(255,255,255,0.22);
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  text-align: center;
}

/* ═══════════════════════════════════════════
    RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 780px) {
  #articles-grid { grid-template-columns: 1fr; }
  .search-wrap { width: 100%; }
  .controls-bar__inner { flex-wrap: wrap; padding-top: 0.75rem; padding-bottom: 0; }
  .filter-pills { padding-bottom: 0.75rem; }
}
@media (max-width: 580px) {
  .site-nav .nav-hide { display: none; }
  .hero-count { display: none; }
  .page-hero { padding: 2.5rem 1.25rem 2rem; }
}