/* ========== Reset ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ========== Base ========== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.4;
    background-color: white;
    color: #000;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* sticky footer support */
}

/* Improve accessibility for keyboard users */
a:focus-visible,
button:focus-visible {
    outline: 3px solid #9dd1ff;
    outline-offset: 2px;
    border-radius: 6px;
}

/* Safe defaults for media */
img, svg, video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== Header & Navigation (brand left, nav right; mobile-first) ===== */
header {
  background: #1E2A47;           /* Dark blue */
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  padding: 6px 0;                /* compact header height */
  display: flex;
  flex-direction: column;        /* mobile: stack brand above nav */
  align-items: stretch;
  gap: 6px;
}

/* Brand (left on desktop, first row on mobile) */
.brand {
  font-weight: 600;
  font-size: clamp(1.3rem, 2.2vw, 1.25rem);
  letter-spacing: .2px;
  color: #fff;
  text-decoration: none;
  padding: 6px 10px;             /* comfortable mobile padding */
}

/* Nav list: vertical on mobile */
.nav {
  list-style: none;
  display: flex;
  flex-direction: column;        /* mobile: vertical */
  align-items: stretch;
  gap: 6px;
  padding: 0 10px 6px;
  margin: 0;
  width: 100%;
}

.nav li a {
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  font-size: 1.1rem;
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  text-underline-offset: 5px;
}
.nav li a.active { color: #4DB6A1; }
.nav li a:hover { color: #fff; text-decoration: underline; }
.nav li a.active:hover { color: #4DB6A1; text-decoration: underline; }

/* ===== Breakpoints ===== */

/* Tablets / small laptops */
@media (min-width: 640px) {
  header {
    flex-direction: row;             /* brand + nav on one line */
    align-items: center;
    justify-content: space-between;  /* brand left, nav right */
  }
  .brand {
    padding: 0 0 0 16px;
  }
  .nav {
    flex-direction: row;             /* horizontal nav */
    width: auto;                     /* IMPORTANT: stop stretching full width */
    justify-content: flex-end;       /* right-justify */
    gap: 18px;
    padding: 0 16px 0 0;             /* right-edge buffer */
  }
  .nav li a { padding: 9px 11px; border-radius: 8px; }
}

/* Desktops */
@media (min-width: 1024px) {
  header {
    flex-direction: row;         /* brand and nav on one line */
    align-items: center;
    gap: 0;
    padding: 8px 0;              /* compact desktop height */
  }
  .brand {
    padding: 0 0 0 16px;
    margin-right: auto;          /* pushes nav to the right */
  }
  .nav {
    flex-direction: row;
    justify-content: flex-end;   /* right-justify nav */
    gap: 20px;
    padding: 0 16px 0 0;         /* right-edge buffer */
    width: auto;                 /* shrink to content */
  }
  .nav li a { padding: 8px 10px; border-radius: 8px; }
}



/* ========== Main Content ========== */
main {
    padding: clamp(16px, 4vw, 40px);
    margin: 0 auto;
    max-width: 1000px;  /* readable line length on desktop */
    flex-grow: 1;       /* push footer down */
}

h1 {
    font-size: clamp(1.75rem, 5.5vw, 2.5rem);
    margin-bottom: 20px;
}

.intro p {
    font-size: clamp(1rem, 3.5vw, 1.1rem);
    margin-bottom: 15px;
    color: #333;
    line-height: 1.4;
}

/* Sections */
section { margin-top: 40px; }

h2 {
    font-size: clamp(1.25rem, 4.2vw, 2rem);
    margin-bottom: 20px;
}

/* ========== Featured Posts (responsive grid) ========== */
/* Mobile: single column; scale up with media queries below */
.featured-posts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 20px;
}

/* Each individual card */
.card {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    padding: 20px;
    width: 100%; /* grid controls width */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-in-out;
    border-radius: 0;  /* keep your square style */
}

/* Hover effect for cards */
.card:hover { transform: translateY(-5px); }

/* Card Title */
.card h3 {
    font-size: clamp(1.05rem, 3.5vw, 1.2rem);
    margin-bottom: 10px;
    color: #3A4A6A;
}

.card h3 a { color: #3A4A6A; }

/* Card Description */
.card p {
    color: #555;
    margin-bottom: 15px;
    font-size: 1rem;
}

/* Read More link */
.read-more {
    color: #4DB6A1;
    text-decoration: none;
    font-weight: bold;
}
.read-more:hover { text-decoration: underline; }

/* ========== Blog Directory ========== */
.blog-directory ul { list-style-type: none; padding-left: 0; }
.blog-directory li { margin-bottom: 20px; }
.blog-directory li a {
    font-size: 1.2rem;
    color: #1E2A47;
    text-decoration: none;
}
.blog-directory li a:hover { text-decoration: underline; }
.blog-directory li span { color: #888; font-size: 0.9rem; }
.blog-directory li p { color: #555; }

/* ========== About ========== */
.about { margin-top: 60px; font-size: 1.2rem; }
.about h2 { font-size: clamp(1.25rem, 4.2vw, 2rem); margin-bottom: 20px; }
.about p { line-height: 1.5; }

/* ========== Footer ========== */
footer {
    background: #1E2A47; /* Dark blue */
    color: white;
    text-align: center;
    padding: 12px 0;
    margin-top: 40px;
    width: 100%;
    position: relative;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}
footer p { font-size: 1rem; }

.social-icons { display: flex; gap: 15px; }
.social-icons a { color: white; font-size: 1.5rem; text-decoration: none; }
.social-icons a:hover { color: #4DB6A1; }

/* ========== Resume Page ========== */
.resume h1 {
    font-size: clamp(1.75rem, 5.5vw, 2.5rem);
    margin-bottom: 20px;
    color: #1E2A47;
}
.resume p {
    font-size: 1rem;
    color: #333;
    margin-bottom: 10px;
}
.resume a { color: #4DB6A1; text-decoration: none; }
.resume a:hover { text-decoration: underline; }
.resume section { margin-bottom: 2.5rem; }
.resume h2 {
    font-size: clamp(1.25rem, 4.2vw, 1.8rem);
    color: #1E2A47;
    margin-bottom: 15px;
}
.resume h3 {
    font-size: clamp(1.1rem, 3.8vw, 1.5rem);
    color: #3A4A6A;
    margin-top: 1.7rem;
}

/* Ensure the list style is applied correctly for resume */
.resume ul {
    list-style-type: disc;
    margin-left: 20px;
    padding-left: 20px;
}
.resume ul li {
    font-size: 1rem;
    color: #555;
    margin-bottom: 10px;
}

/* Skills list: 1 column on mobile, 2+ on larger screens */
.skills-list {
    display: grid;
    grid-template-columns: 1fr;   /* mobile */
    gap: 0.3rem 1.5rem;
}
.skills-list li {
    font-size: 1rem;
    color: #555;
    margin-bottom: 0.3rem;
}

/* ========== Blog Post Page ========== */
.blog {
    max-width: 760px;              /* narrower than main page width for readability */
    margin: 0 auto;
    padding: 0 0 2.5rem;           /* let global <main> handle top padding */
}

/* Headings */
.blog h1 { font-size: clamp(1.5rem, 5vw, 2rem); color: #1E2A47; margin: 0 0 1rem; }
.blog h2 { font-size: clamp(1.25rem, 4.5vw, 1.6rem); color: #1E2A47; margin: 1.6rem 0 0.6rem; }
.blog h3 { font-size: clamp(1.05rem, 4vw, 1.25rem); color: #3A4A6A; margin: 1.2rem 0 0.5rem; }

/* Text, lists, links */
.blog p { margin: 0 0 1rem; color: #000; }
.blog ul, .blog ol { margin: 0 0 1rem 1.4rem; }
.blog li { margin: 0.35rem 0; }
.blog a { color: #4DB6A1; text-decoration: none; }
.blog a:hover { text-decoration: underline; }

/* Images & figures */
.blog img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1rem auto;
    border-radius: 8px;
}
.blog figure { margin: 1.2rem 0; }
.blog figcaption {
    font-size: 0.9rem;
    color: #555;
    text-align: center;
    margin-top: 0.4rem;
}

/* Blockquotes */
.blog blockquote {
    margin: 1.2rem 0;
    padding: 0.8rem 1rem;
    border-left: 4px solid #4DB6A1;
    background: #f7fbfa;
    color: #3A4A6A;
    border-radius: 6px;
}

/* Code blocks & inline code */
.blog code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    background: #f0f2f6;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.95rem;
}
.blog pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 1rem;
    overflow: auto;
    border-radius: 10px;
    margin: 1rem 0;
    line-height: 1.4;
}
.blog pre code { background: transparent; padding: 0; color: inherit; }

/* Tables */
.blog table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.98rem;
    display: block;          /* allow horizontal scrolling on narrow screens */
    overflow-x: auto;
}
.blog th, .blog td {
    border: 1px solid #e6e9ef;
    padding: 0.6rem 0.7rem;
    text-align: left;
    white-space: nowrap;     /* prevent squish on small screens */
}
.blog thead th {
    background: #f4f7fb;
    color: #1E2A47;
    font-weight: 700;
}

/* Horizontal rule */
.blog hr {
    border: 0;
    border-top: 2px solid #f0f2f6;
    margin: 1.5rem 0;
}

/* Optional post meta */
.blog .post-meta {
    color: #555;
    font-size: 0.95rem;
    margin: -0.4rem 0 1.2rem; /* tucks under h1 nicely */
}

/* ========== Progressive Enhancement (breakpoints) ========== */
/* ≥640px (tablets & small laptops) */
@media (min-width: 640px) {
    /* Nav back to a row (tighter spacing) */
    .nav {
        flex-direction: row;
        justify-content: center;
        gap: 18px;           /* reduced from 24px */
        padding: 8px 14px;   /* slightly tighter */
    }
    .nav li a {
        width: auto;
        padding: 9px 11px;   /* reduced from 10px 12px */
        border-radius: 8px;
    }

    /* Featured posts to 2 columns */
    .featured-posts {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 18px;
    }

    /* Skills list to 2 columns */
    .skills-list {
        grid-template-columns: 1fr 1fr;
    }
}

/* ≥1024px (desktops) */
@media (min-width: 1024px) {
    header { padding-block: 8px; }  /* reduced from 12px */
    .nav { gap: 20px; }             /* reduced from 30px */

    /* Featured posts: exactly one row, three columns; hide extras */
    .featured-posts {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 20px;
    }
    .featured-posts > *:nth-child(n+4) {
        display: none;              /* ensure one-row layout on desktop */
    }

    main { padding: 36px; }
}

/* ========== Motion preferences ========== */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
