/* ============================================================
   CricAsylum — Main Stylesheet
   ============================================================
   HOW TO CUSTOMIZE:
   - Change colors in the :root section at the top
   - Change fonts by updating the Google Fonts link in HTML
     and the --font-serif / --font-sans variables below
   - All spacing uses CSS variables for easy tweaking
   ============================================================ */

/* ── Google Fonts are loaded in each HTML file ── */

/* ============================================================
   1. CSS VARIABLES (Change colors & fonts here)
   ============================================================ */
:root {
  /* Colors */
  --color-bg:        #faf9f7;       /* Page background — warm off-white */
  --color-text:      #1a1a1a;       /* Main body text */
  --color-muted:     #6b6b6b;       /* Captions, dates, secondary text */
  --color-accent:    #1d4e2a;       /* Brand green — used for hover, links */
  --color-accent-lt: #e8f0eb;       /* Light green tint — tag backgrounds */
  --color-border:    #e0ddd8;       /* Divider lines */
  --color-nav-bg:    #faf9f7;       /* Navbar background */
  --color-footer-bg: #111111;       /* Footer background */
  --color-footer-tx: #c8c4be;       /* Footer text */

  /* Dark mode overrides (toggled via JS) */
  --dm-bg:           #111111;
  --dm-text:         #e8e4de;
  --dm-muted:        #888;
  --dm-border:       #2a2a2a;
  --dm-nav-bg:       #111111;
  --dm-accent-lt:    #1a2e1e;

  /* Typography */
  --font-serif:   'Playfair Display', Georgia, serif;   /* Article titles & hero */
  --font-sans:    'DM Sans', Arial, sans-serif;          /* UI, nav, captions     */
  --font-body:    'Lora', Georgia, serif;                /* Article body text     */

  /* Spacing */
  --max-width:       1160px;
  --content-width:   720px;   /* Ideal reading column width */
  --nav-height:      64px;

  /* Transitions */
  --ease:            0.22s ease;
}

/* ============================================================
   2. DARK MODE
   ============================================================ */
body.dark-mode {
  --color-bg:        var(--dm-bg);
  --color-text:      var(--dm-text);
  --color-muted:     var(--dm-muted);
  --color-border:    var(--dm-border);
  --color-nav-bg:    var(--dm-nav-bg);
  --color-accent-lt: var(--dm-accent-lt);
  --color-footer-bg: #000;
}

/* ============================================================
   3. RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

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

ul, ol {
  list-style: none;
}

/* ============================================================
   4. UTILITY CLASSES
   ============================================================ */
.container {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

/* ============================================================
   5. NAVIGATION
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background-color: var(--color-nav-bg);
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Scrolled state — subtle shadow added via JS */
.nav.scrolled {
  box-shadow: 0 1px 12px rgba(0,0,0,0.07);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

/* Logo */
.nav__logo {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
  transition: color var(--ease);
}

.nav__logo span {
  color: var(--color-accent);
}

.nav__logo:hover {
  color: var(--color-accent);
}

/* Nav links */
.nav__links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav__links a {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
  transition: color var(--ease);
}

.nav__links a:hover,
.nav__links a.active {
  color: var(--color-text);
}

/* Dark mode toggle button */
.nav__toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--color-muted);
  transition: all var(--ease);
  white-space: nowrap;
}

.nav__toggle:hover {
  border-color: var(--color-text);
  color: var(--color-text);
}

/* Mobile hamburger (hidden on desktop) */
.nav__hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}

.nav__hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  transition: all var(--ease);
}

/* Mobile menu open state */
.nav__hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav__hamburger.open span:nth-child(2) {
  opacity: 0;
}
.nav__hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile nav overlay */
.nav__mobile {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background-color: var(--color-nav-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 24px;
  flex-direction: column;
  gap: 20px;
  z-index: 99;
}

.nav__mobile.open {
  display: flex;
}

.nav__mobile a {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}

/* ============================================================
   6. HERO SECTION (Homepage featured article)
   ============================================================ */
.hero {
  padding: 64px 0 56px;
  border-bottom: 1px solid var(--color-border);
}

.hero__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}

.hero__tag {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  background: var(--color-accent-lt);
  padding: 4px 10px;
  border-radius: 3px;
  margin-bottom: 20px;
}

.hero__title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  color: var(--color-text);
}

.hero__title a {
  transition: color var(--ease);
}

.hero__title a:hover {
  color: var(--color-accent);
}

.hero__desc {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--color-muted);
  line-height: 1.75;
  margin-bottom: 28px;
  max-width: 480px;
}

.hero__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--color-muted);
}

.hero__meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-muted);
}

.hero__image {
  position: relative;
  overflow: hidden;
  border-radius: 3px;
  aspect-ratio: 4/3;
}

.hero__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.hero__image:hover img {
  transform: scale(1.03);
}

/* ============================================================
   7. SECTION HEADERS
   ============================================================ */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 40px;
  padding-top: 56px;
}

.section-header h2 {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.section-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ============================================================
   8. ARTICLE GRID (Homepage)
   ============================================================ */
.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 32px;
  padding-bottom: 72px;
  border-bottom: 1px solid var(--color-border);
}

/* Individual article card */
.card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.card__image {
  overflow: hidden;
  border-radius: 2px;
  aspect-ratio: 16/10;
  margin-bottom: 18px;
}

.card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.card:hover .card__image img {
  transform: scale(1.05);
}

.card__tag {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 8px;
}

.card__title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
  color: var(--color-text);
  transition: color var(--ease);
}

.card:hover .card__title {
  color: var(--color-accent);
}

.card__excerpt {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--color-muted);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 14px;
}

.card__meta {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card__meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-muted);
}

/* "Read more" link arrow */
.card__read-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-accent);
  margin-top: 4px;
  transition: gap var(--ease);
}

.card:hover .card__read-more {
  gap: 10px;
}

/* ============================================================
   9. NEWSLETTER STRIP (Homepage)
   ============================================================ */
.newsletter {
  padding: 56px 0;
  border-bottom: 1px solid var(--color-border);
  text-align: center;
}

.newsletter__label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 12px;
}

.newsletter__title {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 2.5vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.newsletter__sub {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  color: var(--color-muted);
  margin-bottom: 28px;
}

.newsletter__form {
  display: flex;
  justify-content: center;
  gap: 0;
  max-width: 440px;
  margin: 0 auto;
}

.newsletter__input {
  flex: 1;
  padding: 12px 18px;
  border: 1px solid var(--color-border);
  border-right: none;
  border-radius: 3px 0 0 3px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  background: var(--color-bg);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--ease);
}

.newsletter__input:focus {
  border-color: var(--color-accent);
}

.newsletter__btn {
  padding: 12px 22px;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: 0 3px 3px 0;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: opacity var(--ease);
}

.newsletter__btn:hover {
  opacity: 0.85;
}

/* ============================================================
   10. FOOTER
   ============================================================ */
.footer {
  background: var(--color-footer-bg);
  color: var(--color-footer-tx);
  padding: 48px 0 32px;
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  margin-bottom: 40px;
}

.footer__brand {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
}

.footer__brand span {
  color: var(--color-accent);
}

.footer__tagline {
  font-size: 0.85rem;
  color: var(--color-footer-tx);
  max-width: 220px;
  line-height: 1.6;
}

.footer__nav h4 {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 14px;
}

.footer__nav ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer__nav a {
  font-size: 0.88rem;
  color: var(--color-footer-tx);
  transition: color var(--ease);
}

.footer__nav a:hover {
  color: #fff;
}

.footer__social {
  display: flex;
  gap: 12px;
  margin-top: 14px;
}

.footer__social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #333;
  border-radius: 50%;
  font-size: 0.8rem;
  color: var(--color-footer-tx);
  transition: all var(--ease);
}

.footer__social a:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.footer__bottom {
  border-top: 1px solid #222;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer__copy {
  font-size: 0.8rem;
  color: #555;
}

.footer__links {
  display: flex;
  gap: 20px;
}

.footer__links a {
  font-size: 0.8rem;
  color: #555;
  transition: color var(--ease);
}

.footer__links a:hover {
  color: #888;
}

/* ============================================================
   11. ARTICLE PAGE
   ============================================================ */
.article-page {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 56px 24px 80px;
}

/* Back link */
.article__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 40px;
  transition: color var(--ease);
}

.article__back:hover {
  color: var(--color-accent);
}

.article__tag {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  background: var(--color-accent-lt);
  padding: 4px 10px;
  border-radius: 3px;
  margin-bottom: 20px;
}

.article__title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: 24px;
  color: var(--color-text);
}

/* Author + date row */
.article__byline {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--color-border);
}

.article__author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.article__author-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.article__author-name {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
}

.article__meta {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--color-muted);
  display: flex;
  gap: 10px;
}

.article__meta-dot {
  color: var(--color-border);
}

/* Featured image */
.article__featured-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 3px;
  margin-bottom: 12px;
}

.article__image-caption {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--color-muted);
  text-align: center;
  margin-bottom: 44px;
  font-style: italic;
}

/* Article body text */
.article__body {
  font-family: var(--font-body);
  font-size: 1.1rem;
  line-height: 1.85;
  color: var(--color-text);
}

.article__body p {
  margin-bottom: 1.6em;
}

.article__body h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 2em 0 0.6em;
  color: var(--color-text);
}

.article__body h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.8em 0 0.5em;
  color: var(--color-text);
}

/* Pull quote */
.article__body blockquote {
  margin: 2.2em 0;
  padding: 0 0 0 28px;
  border-left: 3px solid var(--color-accent);
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-style: italic;
  line-height: 1.6;
  color: var(--color-text);
}

.article__body a {
  color: var(--color-accent);
  border-bottom: 1px solid var(--color-accent-lt);
  transition: border-color var(--ease);
}

.article__body a:hover {
  border-color: var(--color-accent);
}

/* Share section */
.article__share {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 32px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  margin: 48px 0;
  flex-wrap: wrap;
}

.article__share-label {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  background: none;
  transition: all var(--ease);
}

.share-btn:hover {
  border-color: var(--color-text);
  background: var(--color-text);
  color: var(--color-bg);
}

/* ============================================================
   12. ABOUT PAGE
   ============================================================ */
.about-page {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 56px 24px 80px;
}

.about__tag {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 16px;
}

.about__title {
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 3.5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 32px;
}

.about__lead {
  font-family: var(--font-body);
  font-size: 1.2rem;
  line-height: 1.75;
  color: var(--color-muted);
  margin-bottom: 40px;
  border-left: 3px solid var(--color-accent);
  padding-left: 22px;
}

.about__body {
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--color-text);
}

.about__body p {
  margin-bottom: 1.6em;
}

.about__body h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2em 0 0.7em;
  letter-spacing: -0.01em;
}

.about__values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin: 40px 0;
}

.about__value {
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: 3px;
}

.about__value-icon {
  font-size: 1.4rem;
  margin-bottom: 12px;
}

.about__value h3 {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.about__value p {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--color-muted);
  line-height: 1.6;
  margin-bottom: 0;
}

/* ============================================================
   13. READING PROGRESS BAR (Article page)
   ============================================================ */
.progress-bar {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--color-accent);
  z-index: 200;
  transition: width 0.1s linear;
}

/* ============================================================
   14. RELATED ARTICLES (Article page)
   ============================================================ */
.related {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px 72px;
}

.related__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 24px;
}

/* ============================================================
   15. PAGE TRANSITIONS (fade-in on load)
   ============================================================ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeUp 0.55s ease both;
}

.fade-in--delay-1 { animation-delay: 0.1s; }
.fade-in--delay-2 { animation-delay: 0.2s; }
.fade-in--delay-3 { animation-delay: 0.3s; }

/* ============================================================
   16. RESPONSIVE — TABLET (≤900px)
   ============================================================ */
@media (max-width: 900px) {
  html { font-size: 17px; }

  .hero__inner {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .hero__image {
    order: -1;         /* Image first on tablet/mobile */
  }

  .article-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px 24px;
  }

  .about__values {
    grid-template-columns: 1fr;
  }

  .footer__inner {
    flex-direction: column;
    gap: 32px;
  }
}

/* ============================================================
   17. RESPONSIVE — MOBILE (≤600px)
   ============================================================ */
@media (max-width: 600px) {
  html { font-size: 16px; }

  :root {
    --nav-height: 58px;
  }

  /* Hide desktop nav links, show hamburger */
  .nav__links { display: none; }
  .nav__hamburger { display: flex; }

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

  .article-grid {
    grid-template-columns: 1fr;
  }

  .related__grid {
    grid-template-columns: 1fr;
  }

  .newsletter__form {
    flex-direction: column;
    border-radius: 3px;
  }

  .newsletter__input {
    border-right: 1px solid var(--color-border);
    border-bottom: none;
    border-radius: 3px 3px 0 0;
  }

  .newsletter__btn {
    border-radius: 0 0 3px 3px;
    padding: 13px;
  }

  .footer__bottom {
    flex-direction: column;
    align-items: flex-start;
  }

  .article__share {
    flex-wrap: wrap;
  }
}
