/* =========================
   Root variables
   ========================= */

:root {
  --bg: #121212;
  --fg: #f2f2f2;
  --muted: #c8c8c8;
  --border: #2a2a2a;
  --pad: 1.5rem;
  --maxw: 1200px;
}

/* =========================
   Global reset
   ========================= */

html {
  /* 1. Force a larger base size (18px is the modern standard for readability) */
  font-size: 18px; 
  /* 2. Prevent iOS Safari from ignoring text size adjustments in landscape */
  -webkit-text-size-adjust: 100%; 
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  /* 3. Increase line-height slightly for the larger text */
  line-height: 1.7; 
}

/* =========================
   Top navigation
   ========================= */

.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;

  padding: 1rem var(--pad);
  display: flex;
  justify-content: center;
  gap: 2rem;

  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;

  /* opaque enough to block content */
  background: rgba(18, 18, 18, 0.95);
}

.topnav a {
  color: var(--fg);
  text-decoration: none;
}

.topnav a:hover {
  text-decoration: underline;
}

/* =========================
   Hero / banner
   ========================= */

.hero {
  position: relative;
  min-height: 30vh;

  background: center / cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;

  padding-top: 4rem; /* space for nav */
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.hero h1 {
  position: relative;
  margin: 0;

  font-size: clamp(2.2rem, 2.8vw, 3.5rem);
  letter-spacing: 0.15em;
  font-weight: 600;

  color: var(--fg);
}

/* Hero without image (Writing index, etc.) */
.hero-plain {
  min-height: 20vh;
  background: none;
}

.hero-plain::before {
  display: none;
}

/* =========================
   Main content
   ========================= */

.content {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 6.5rem var(--pad) 4.5rem;
  padding-bottom: 1.0rem;
}

/* Body text */
.content p,
.content li {
    color: var(--muted);
    line-height: 1.45;
}

/* Section headings (calm, not hero-white) */
.content h2,
.content h3,
.content h4 {
  color: var(--muted);
  letter-spacing: 0.12em;
  margin-top: 2rem;
}

/* Slight emphasis for top-level sections */
.content h2 {
  color: #e0e0e0;
}

/* Lists */
.content ul {
  padding-left: 1.2rem;
}

.content li {
  margin: 0.4rem 0;
}

/* Links */
.content a {
  color: var(--fg);
  text-decoration: underline;
}

.content a:hover {
  text-decoration: none;
}

/* =========================
   Meta line (date / tags)
   ========================= */
/* =========================
   Article Header & Meta
   ========================= */

/* The new standard Title */
.content h1 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--fg);
}

/* The Meta Row (Date ... Tags) */
.meta {
  display: flex;
  justify-content: space-between; /* Pushes content to edges */
  align-items: baseline;          /* Aligns text baselines */
  
  margin-bottom: 2.5rem;          /* Space before body text starts */
  
  color: #888;                    /* Muted grey */
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  
  /* Optional: Adds a subtle separator line below the header area */
  border-bottom: 1px solid #333; 
  padding-bottom: 1rem;
}

.meta-tags {
  text-align: right;
}


/* =========================
   Footer
   ========================= */

.footer {
  /* 1. Stop the footer from "creeping up" next to images */
  clear: both;
  width: 100%;

  /* 2. Center it to match the main content width */
  max-width: var(--maxw);
  margin: 0 auto;
  
  padding: 1rem var(--pad) 3rem;
  box-sizing: border-box;
}

.footer p {
  margin: 0.1rem 0;
  color: var(--muted);
  font-weight: 400;
}

.footer .copyright {
  margin-top: 0.1rem;
  font-weight: 400;
  opacity: 0.7;
}

/* =========================
   Image Handling
   ========================= */

/* DEFAULT: Standard Markdown images are FULL WIDTH */
/* Usage: ![Description](image.jpg) */
.content img {
  display: block;
  width: 100%;        /* Forces image to fill the column */
  max-width: 100%;
  height: auto;       /* Maintains aspect ratio */
  margin: 2.5rem 0;   /* Healthy vertical spacing */
  border-radius: 4px; /* Optional: slight polish */
}

/* OPTION: Left-aligned images */
/* Usage: <img src="image.jpg" class="left"> */
.content img.left {
  width: 340px;       /* Increased size (was ~240px) */
  max-width: 45%;     /* Cap width to ensure text fits next to it */
  float: left;
  margin: 0.6rem 2.2rem 1.5rem 0; /* Generous spacing on the right */
}

/* MOBILE OVERRIDE (Stacking) */
@media (max-width: 600px) {
  .content img.left {
    float: none;        /* Stop floating */
    display: block;     
    margin: 0 auto 2rem auto; /* Center the image with space below it */
    width: 240px;       /* A nice balanced size for phone screens */
  }
}


/* =========================
   Responsive tweaks
   ========================= */

@media (max-width: 800px) {
  .topnav {
    gap: 1rem;
    font-size: 0.7rem;
    padding: 0.75rem var(--pad);
  }

  .content {
    padding-top: 6rem; /* nav clearance */
  }

  .hero h1 {
    font-size: 2rem;
  }
}

/* Writing index tiles */
.year {
  margin-top: 3.5rem;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fg);
  border-bottom: 1px solid #333; /* Adds a subtle separator for the year */
  padding-bottom: 0.5rem;
}

.writing-grid {
  display: grid;
  /* Creates a strict grid of cards */
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 3rem; 
  align-items: start;
  margin-bottom: 4rem;
}

.writing-card {
  background: transparent;
  display: flex;
  flex-direction: column;
}

.card-link {
  display: block; 
  text-decoration: none !important;
  color: inherit;
}

.card-media {
  margin: 0;
  padding: 0;
  line-height: 0;
  /* Fixes the image container size */
  width: 100%;
  height: 220px; 
  background-color: #1a1a1a; /* Subtle background for loading/transparent images */
  border-radius: 4px;
  overflow: hidden; /* Ensures image stays inside the rounded corners */
}

.card-media img {
  width: 100%;
  height: 100% !important; /* Forces image to fill the container height */
  object-fit: cover;       /* CROPS the image to fill the box evenly */
  display: block;
  transition: transform 0.3s ease;
}

/* Optional: Slight zoom effect on hover */
.writing-card:hover .card-media img {
  transform: scale(1.03);
}

.card-body {
  margin-top: 0.2rem;
}

.card-title {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.0;
  font-weight: 400; /* NON-BOLD text */
  color: var(--fg);
}

.card-readmore {
  display: none;
}

/* Wrapper for Tags and Date */
.card-meta {
  margin-top: 0.5rem;
  font-size: 0.6rem;
  line-height: 0.85;
  color: #666; /* MUTED color */
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-tags {
  display: block;
  margin-bottom: 0.2rem;
  color: #555; /* Even more muted for tags */
}


.tagbar-label {
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.85rem;
  margin-right: 0.6rem;
}

.tagpill {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg);
  text-decoration: none;
  font-size: 0.95rem;
}

.tagpill:hover {
  text-decoration: underline;
}
