/* Gloss - Blog Platform */

:root,
[data-theme="light"] {
  --bg: #f2f1ef;
  --surface: #ffffff;
  --green: #1a3a2a;
  --green-mid: #2d5a3d;
  --green-soft: #e8ede9;
  --coral: #c4674a;
  --coral-soft: #f5ede9;
  --text: #1a1a18;
  --text-muted: #6b6b67;
  --text-light: #9b9b97;
  --border: #e2e0dc;
  --tag-bg: #efefed;
  --accent: #c4674a;
}

[data-theme="dark"] {
  --bg: #131311;
  --surface: #1e1e1c;
  --green: #3a7a50;
  --green-mid: #6aad7a;
  --green-soft: #1c2e22;
  --coral: #e09878;
  --coral-soft: #2e2119;
  --text: #ededea;
  --text-muted: #b0b0ab;
  --text-light: #8a8a85;
  --border: #353532;
  --tag-bg: #2a2a27;
  --accent: #e09878;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* NAV */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 40px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.05em;
  color: var(--text);
  text-decoration: none;
}

.nav-logo-mark {
  width: 22px;
  height: 22px;
  background: var(--green);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-logo-mark svg { width: 12px; height: 12px; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.nav-links a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }

.nav-cta {
  background: var(--green);
  color: #fff !important;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px !important;
  letter-spacing: 0.04em;
  transition: background 0.2s !important;
}
.nav-cta:hover { background: var(--green-mid) !important; color: #fff !important; }

.nav-user {
  font-family: 'DM Mono', monospace;
  font-size: 11px !important;
  letter-spacing: 0.04em;
  opacity: 0.7;
}

.zoom-control {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}

.zoom-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s;
}
.zoom-btn:hover { color: var(--text); background: var(--tag-bg); }

.zoom-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-light);
  letter-spacing: 0.04em;
  min-width: 36px;
  text-align: center;
  user-select: none;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-muted); }

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

/* GRADIENTS (for posts without images) */
.grad-teal { background: linear-gradient(135deg, #0a2a35 0%, #1a5a6a 50%, #2a9a8a 100%); }
.grad-purple { background: linear-gradient(135deg, #2a1a3a 0%, #5a3a7a 50%, #8a5ab0 100%); }
.grad-slate { background: linear-gradient(135deg, #1a2a3a 0%, #2a4a6a 50%, #4a7aaa 100%); }
.grad-green { background: linear-gradient(135deg, #1a3a2a 0%, #2d5a3d 50%, #4a8a5a 100%); }
.grad-warm { background: linear-gradient(135deg, #3a1a1a 0%, #7a3a2a 50%, #c4674a 100%); }
.grad-gold { background: linear-gradient(135deg, #2a2010 0%, #6a5020 50%, #c0962a 100%); }

/* ═══════════════════════════════════════════
   MAGAZINE LAYOUT - Wired-style homepage
   ═══════════════════════════════════════════ */

.magazine {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 40px 0;
}

/* Section badge (like "TODAY'S PICKS", "TRENDING STORIES") */
.mag-section-badge {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fff;
  background: var(--green);
  padding: 5px 12px;
  display: inline-block;
  margin-bottom: 20px;
}

/* ── HERO SECTION: 3-column layout ── */
.mag-hero-section {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  gap: 0;
  border-top: 2px solid var(--text);
  padding-top: 24px;
}

/* ── LEFT SIDEBAR ── */
.mag-sidebar-left {
  padding-right: 28px;
  border-right: 1px solid var(--border);
}

.mag-side-card {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  transition: opacity 0.2s;
}
.mag-side-card:first-of-type { padding-top: 0; }
.mag-side-card:last-child { border-bottom: none; }
.mag-side-card:hover { opacity: 0.75; }

.mag-side-thumb {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  overflow: hidden;
}
.mag-side-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mag-side-thumb-empty {
  background: var(--tag-bg);
}

.mag-side-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.mag-side-info h4 {
  font-family: 'DM Serif Display', serif;
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* ── CATEGORY LABEL ── */
.mag-category {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.mag-category-center {
  text-align: center;
  display: block;
}

.mag-category-light {
  color: rgba(255,255,255,0.8);
}

/* ── BYLINE ── */
.mag-byline {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--text-light);
}

.mag-byline-light {
  color: rgba(255,255,255,0.7);
}

/* ── CENTER HERO ── */
.mag-center {
  padding: 0 36px;
}

.mag-hero-story {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s;
}
.mag-hero-story:hover { opacity: 0.85; }

.mag-hero-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(28px, 3.5vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--text);
  margin: 10px 0 14px;
  max-width: 640px;
}

.mag-hero-subtitle {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 520px;
  margin-bottom: 10px;
}

.mag-hero-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  margin-top: 20px;
  transition: transform 0.4s;
}
.mag-hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mag-hero-story:hover .mag-hero-image {
  transform: scale(1.01);
}

/* ── SUB-STORIES below hero ── */
.mag-hero-sub {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-top: 24px;
  border-top: 1px solid var(--border);
}

.mag-sub-card {
  padding: 24px 24px 24px 0;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s;
}
.mag-sub-card:first-child {
  border-right: 1px solid var(--border);
  padding-right: 24px;
}
.mag-sub-card:last-child {
  padding-left: 24px;
  padding-right: 0;
}
.mag-sub-card:hover { opacity: 0.75; }

.mag-sub-card h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 8px 0 10px;
}

.mag-sub-card p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

/* ── RIGHT SIDEBAR ── */
.mag-sidebar-right {
  padding-left: 28px;
  border-left: 1px solid var(--border);
}

.mag-trending-item {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  transition: opacity 0.2s;
}
.mag-trending-item:first-of-type { padding-top: 0; }
.mag-trending-item:hover { opacity: 0.7; }

.mag-trending-item h4 {
  font-family: 'DM Serif Display', serif;
  font-size: 15px;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 6px;
}

/* ── OVERLAY CARD (right sidebar feature) ── */
.mag-overlay-card {
  display: block;
  text-decoration: none;
  color: inherit;
  margin-top: 20px;
  transition: opacity 0.2s;
}
.mag-overlay-card:hover { opacity: 0.85; }

.mag-overlay-img {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.mag-overlay-img > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mag-overlay-content {
  padding: 20px;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
  width: 100%;
}

.mag-overlay-content h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 17px;
  line-height: 1.25;
  color: #fff;
  margin: 8px 0 10px;
}

/* ── MORE STORIES SECTION ── */
.mag-more-section {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 2px solid var(--text);
}

.mag-more-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}

.mag-more-card {
  display: flex;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  padding: 0 20px 24px 0;
  border-right: 1px solid var(--border);
  transition: opacity 0.2s;
}
.mag-more-card:nth-child(4n) {
  border-right: none;
  padding-right: 0;
}
.mag-more-card:nth-child(4n+1) {
  padding-left: 0;
}
.mag-more-card:nth-child(n+5) {
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.mag-more-card:hover { opacity: 0.7; }

.mag-more-thumb {
  width: 100px;
  height: 80px;
  flex-shrink: 0;
  overflow: hidden;
}
.mag-more-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mag-more-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.mag-more-info h4 {
  font-family: 'DM Serif Display', serif;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text);
}

.mag-more-info p {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── TOPIC SECTIONS ── */
.mag-topic-section {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 2px solid var(--text);
}

.mag-topic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.mag-topic-more {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.2s, opacity 0.2s;
}
.mag-topic-more:hover {
  gap: 10px;
  opacity: 0.8;
}

.mag-topic-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
}

.mag-topic-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  padding-right: 24px;
  border-right: 1px solid var(--border);
  transition: opacity 0.2s;
}
.mag-topic-card:last-child {
  border-right: none;
  padding-right: 0;
}
.mag-topic-card:not(:first-child) {
  padding-left: 24px;
}
.mag-topic-card:hover { opacity: 0.7; }

.mag-topic-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  margin-bottom: 14px;
}
.mag-topic-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mag-topic-thumb-empty {
  background: var(--tag-bg);
}

.mag-topic-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mag-topic-info h4 {
  font-family: 'DM Serif Display', serif;
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text);
}

.mag-topic-info p {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── TAG FILTER BAR ── */
.mag-tags-bar {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 40px 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  margin-top: 48px;
}

.mag-tag-pill {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.18s;
}
.mag-tag-pill:hover {
  border-color: var(--text);
  color: var(--text);
}
.mag-tag-pill.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.mag-search-inline {
  margin-left: auto;
}

.mag-search-inline form {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  padding: 6px 14px;
  background: var(--surface);
  transition: border-color 0.2s;
}
.mag-search-inline form:focus-within {
  border-color: var(--text);
}

.mag-search-inline input {
  border: none;
  outline: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: var(--text);
  width: 120px;
}
.mag-search-inline input::placeholder { color: var(--text-light); }

/* ── FALLBACK LAYOUT (search/tag/few posts) ── */
.mag-fallback {
  border-top: 2px solid var(--text);
  padding-top: 24px;
}

.mag-hero-story-full {
  margin-bottom: 36px;
}

.mag-fallback .mag-more-grid {
  margin-top: 8px;
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  font-size: 16px;
}
.empty-state a {
  color: var(--green-mid);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ANIMATIONS */
@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* FOOTER */
footer {
  border-top: 1px solid var(--border);
  padding: 28px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

footer p {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-light);
  letter-spacing: 0.06em;
}

footer nav {
  position: static;
  backdrop-filter: none;
  border: none;
  background: transparent;
  height: auto;
  padding: 0;
  gap: 24px;
  display: flex;
}

footer nav a {
  font-size: 11px;
  color: var(--text-light);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.2s;
}
footer nav a:hover { color: var(--text); }

/* DARK MODE OVERRIDES */
[data-theme="dark"] .mag-section-badge {
  background: var(--green-mid);
  color: #111;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

@media (max-width: 1100px) {
  .mag-hero-section {
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }
  .mag-sidebar-left {
    display: none;
  }
  .mag-sidebar-right {
    border-left: 1px solid var(--border);
  }
  .mag-topic-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .mag-topic-card:nth-child(n+4) {
    display: none;
  }
  .mag-more-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .mag-more-card:nth-child(4n) {
    border-right: 1px solid var(--border);
    padding-right: 20px;
  }
  .mag-more-card:nth-child(3n) {
    border-right: none;
    padding-right: 0;
  }
  .mag-more-card:nth-child(n+4) {
    padding-top: 24px;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 800px) {
  .magazine { padding: 24px 20px 0; }
  .mag-tags-bar { padding: 24px 20px 36px; }

  .mag-hero-section {
    grid-template-columns: 1fr;
  }
  .mag-sidebar-right {
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 24px;
    margin-top: 24px;
  }
  .mag-center {
    padding: 0;
  }
  .mag-hero-sub {
    grid-template-columns: 1fr;
  }
  .mag-sub-card:first-child {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
  }
  .mag-sub-card:last-child {
    padding-left: 0;
  }
  .mag-topic-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .mag-topic-card {
    padding: 0 0 20px 0 !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
  }
  .mag-topic-card:nth-child(odd) {
    padding-right: 12px !important;
    border-right: 1px solid var(--border) !important;
  }
  .mag-topic-card:nth-child(even) {
    padding-left: 12px !important;
  }
  .mag-topic-card:nth-child(n+3) {
    padding-top: 20px;
  }
  .mag-topic-card:nth-child(n+4) {
    display: none;
  }
  .mag-more-grid {
    grid-template-columns: 1fr;
  }
  .mag-more-card {
    border-right: none !important;
    padding: 16px 0 !important;
    border-bottom: 1px solid var(--border);
  }
  .mag-more-card:nth-child(n+2) {
    border-top: none;
  }
  .mag-more-card:last-child {
    border-bottom: none;
  }
  nav { padding: 0 20px; }
  footer { padding: 20px; }
  .zoom-control { display: none; }
}

/* Legacy support for old card classes used on other pages */
.tag {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 10px;
  background: var(--tag-bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  text-decoration: none;
}
.tag.green { background: var(--green-soft); color: var(--green-mid); border-color: rgba(45,90,61,0.15); }
.tag.coral { background: var(--coral-soft); color: var(--coral); border-color: rgba(196,103,74,0.15); }
