/* ==========================================================================
   TRULY VIRAL STORIES — MEDIUM-INSPIRED CLEAN DESIGN SYSTEM
   ========================================================================== */

:root {
  --font-serif: 'Merriweather', Georgia, Cambria, 'Times New Roman', Times, serif;
  --font-sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  --bg-main: #ffffff;
  --bg-subtle: #faf9f6;
  --text-main: #191919;
  --text-muted: #6b6b6b;
  --text-light: #8e8e8e;
  
  --border-color: #e6e6e6;
  --border-light: #f2f2f2;
  
  --accent-green: #1a8917;
  --accent-green-hover: #156d12;
  --accent-dark: #0f0f0f;
  
  --max-width-feed: 1192px;
  --max-width-article: 680px;
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

.container {
  max-width: var(--max-width-feed);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== TOP BANNER ===== */
.topbar {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  padding: 8px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}
.topbar-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}
.topbar-divider {
  color: var(--border-color);
}

/* ===== MEDIUM NAVBAR ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-light);
  height: 65px;
  display: flex;
  align-items: center;
}
.nav-wrap {
  width: 100%;
  max-width: var(--max-width-feed);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}
.nav-links {
  display: flex;
  list-style: none;
  gap: 24px;
  align-items: center;
}
.nav-links a {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 400;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text-main);
  font-weight: 600;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.search-btn {
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.search-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}
.btn-write {
  background: var(--accent-green);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  transition: background 0.2s ease;
}
.btn-write:hover {
  background: var(--accent-green-hover);
}
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
}
.hamburger span {
  width: 20px;
  height: 2px;
  background: var(--text-main);
  border-radius: 2px;
}

/* ===== MEDIUM HERO FEATURED ===== */
.medium-hero {
  border-bottom: 1px solid var(--border-light);
  padding: 40px 0 50px;
}
.medium-hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: center;
}
.hero-main-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-green);
}
.hero-main-title {
  font-family: var(--font-serif);
  font-size: 2.25rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}
.hero-main-title a:hover {
  color: #404040;
}
.hero-main-excerpt {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-muted);
}
.meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.author-img {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  object-fit: cover;
}
.dot {
  color: var(--text-light);
}

.hero-main-img-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.hero-main-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.hero-main-img-wrap:hover .hero-main-img {
  transform: scale(1.02);
}

/* ===== CATEGORY PILL NAV ===== */
.cat-pills-sec {
  border-bottom: 1px solid var(--border-light);
  padding: 16px 0;
  background: var(--bg-main);
  position: sticky;
  top: 65px;
  z-index: 90;
}
.cat-pills-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-pills-wrap::-webkit-scrollbar {
  display: none;
}
.pill {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.pill:hover {
  color: var(--text-main);
  border-color: var(--border-color);
}
.pill.active {
  background: var(--text-main);
  color: #ffffff;
}

/* ===== MEDIUM STORY FEED ===== */
.feed-sec {
  padding: 48px 0 60px;
}
.feed-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 64px;
}
.story-list {
  display: flex;
  flex-direction: column;
  gap: 36px;
}
.story-item {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 24px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--border-light);
  align-items: start;
}
.story-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.story-author-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.825rem;
  color: var(--text-muted);
}
.story-cat-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-green);
  background: rgba(26, 137, 23, 0.08);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}
.story-item-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-main);
}
.story-item-title a:hover {
  color: #404040;
}
.story-item-excerpt {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.story-footer-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-light);
}
.story-footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.clap-btn, .bookmark-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-light);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.clap-btn:hover, .bookmark-btn:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}
.clap-btn.clapped {
  color: var(--accent-green);
}

.story-thumb-link {
  display: block;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.story-thumb-img {
  width: 160px;
  height: 107px;
  object-fit: cover;
  transition: transform 0.25s ease;
}
.story-thumb-link:hover .story-thumb-img {
  transform: scale(1.03);
}

/* Sidebar */
.feed-sidebar {
  display: flex;
  flex-direction: column;
  gap: 36px;
}
.sidebar-section {
  background: var(--bg-subtle);
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}
.sidebar-title {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-main);
  margin-bottom: 20px;
}
.sidebar-story-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  list-style: none;
}
.sidebar-story-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--border-color);
  line-height: 1;
}
.sidebar-story-title {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-main);
}
.sidebar-story-title a:hover {
  color: var(--accent-green);
}

/* ===== MEDIUM ARTICLE DETAIL PAGE ===== */
.article-container {
  max-width: var(--max-width-article);
  margin: 40px auto 80px;
  padding: 0 20px;
}
.article-header {
  margin-bottom: 32px;
}
.article-category {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-green);
  margin-bottom: 12px;
}
.article-main-title {
  font-family: var(--font-serif);
  font-size: 2.6rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 20px;
}
.article-author-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}
.author-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  object-fit: cover;
}
.author-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.author-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.author-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}
.btn-follow {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-green);
  border: 1px solid var(--accent-green);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  transition: all 0.15s ease;
}
.btn-follow:hover {
  background: var(--accent-green);
  color: #ffffff;
}
.article-read-time {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.article-hero-cover {
  width: 100%;
  border-radius: var(--radius-md);
  margin: 24px 0 36px;
  object-fit: cover;
}

.article-content {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  line-height: 1.8;
  color: #242424;
}
.article-content p {
  margin-bottom: 1.8rem;
}
.article-content blockquote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.3rem;
  line-height: 1.5;
  border-left: 3px solid var(--text-main);
  padding-left: 20px;
  margin: 32px 0;
  color: var(--text-main);
}

/* Medium Action Floating/Static Bar */
.article-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  margin: 48px 0;
}
.action-left, .action-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.action-clap-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  transition: all 0.2s ease;
}
.action-clap-btn:hover {
  background: rgba(26, 137, 23, 0.1);
  color: var(--accent-green);
}

/* Related Stories Grid */
.recommended-sec {
  background: var(--bg-subtle);
  padding: 50px 0;
  border-top: 1px solid var(--border-light);
}
.recommended-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
}
.recommended-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.recommended-card {
  background: var(--bg-main);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.recommended-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}
.recommended-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.recommended-card-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
}

/* ===== MEDIUM FOOTER ===== */
.footer {
  background: var(--bg-main);
  border-top: 1px solid var(--border-light);
  padding: 40px 0 30px;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.footer-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-logo {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}
.footer-nav {
  display: flex;
  gap: 20px;
  list-style: none;
}
.footer-nav a:hover {
  color: var(--text-main);
}

/* ===== SEARCH MODAL OVERLAY ===== */
.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
}
.search-modal.active {
  display: flex;
}
.search-box-wrap {
  width: 100%;
  max-width: 600px;
  padding: 0 20px;
  position: relative;
}
.search-input {
  width: 100%;
  font-size: 1.5rem;
  font-family: var(--font-serif);
  border: none;
  border-bottom: 2px solid var(--text-main);
  padding: 12px 40px 12px 0;
  background: transparent;
  outline: none;
}
.search-close-btn {
  position: absolute;
  right: 20px;
  top: 12px;
  font-size: 1.5rem;
  color: var(--text-muted);
}
.search-results {
  margin-top: 24px;
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.search-result-item {
  padding: 12px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.search-result-item:hover {
  background: var(--bg-subtle);
}
.search-result-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
}

/* ===== ARTICLE 2-COLUMN SIDEBAR LAYOUT ===== */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 48px;
  max-width: 1192px;
  margin: 0 auto;
  padding: 0 24px;
  align-items: start;
}
.article-main-col {
  max-width: 720px;
  width: 100%;
}
.article-sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 90px;
}

/* ===== GLOBAL MOBILE OVERFLOW PREVENTER ===== */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
}
iframe, video, img, [data-type="_mgwidget"] {
  max-width: 100% !important;
  box-sizing: border-box;
}
[data-type="_mgwidget"] {
  width: 100% !important;
  margin: 16px auto !important;
  overflow: hidden !important;
}

/* ===== RESPONSIVE MEDIA QUERIES ===== */
@media (max-width: 992px) {
  .medium-hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .feed-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .article-layout {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 16px !important;
    gap: 24px !important;
  }
  .article-main-col {
    max-width: 100% !important;
    width: 100% !important;
  }
  .feed-sidebar,
  .article-sidebar {
    display: flex !important;
    flex-direction: column;
    gap: 24px;
    width: 100% !important;
    max-width: 100% !important;
    position: static !important;
    margin-top: 24px;
  }
}

@media (max-width: 768px) {
  .logo {
    font-size: 1.35rem !important;
    letter-spacing: -0.02em;
  }
  .nav-wrap {
    padding: 10px 16px;
  }
  .nav-right .btn-write {
    display: none !important;
  }
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 999;
  }
  .nav-links.active {
    display: flex !important;
  }
  .nav-links a {
    font-size: 1.05rem;
    font-weight: 600;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    display: block;
    width: 100%;
  }
  .hamburger {
    display: flex !important;
  }
  .hero-main-title {
    font-size: 1.5rem !important;
  }
  .story-item {
    grid-template-columns: 1fr;
  }
  .story-thumb-img {
    width: 100%;
    height: 180px;
  }
  .article-main-title {
    font-size: 1.65rem !important;
    line-height: 1.35 !important;
  }
  .footer-wrap {
    flex-direction: column;
    text-align: center;
  }
  .container {
    padding: 0 16px;
  }
  .cat-pills-wrap {
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }
}


