/* ==========================================================================
   Kevin Andrews (kevandrews.uk)
   Modern, Responsive Technical Blog & Portfolio Stylesheet
   ========================================================================== */

:root {
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-code: #0f172a;
  --bg-code-header: #1e293b;
  --bg-inline-code: #e2e8f0;
  --text-primary: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-code: #e2e8f0;
  --brand-dark: #0f172a;
  --brand-slate: #1e293b;
  --accent-primary: #0284c7;
  --accent-hover: #0369a1;
  --accent-cyan: #38bdf8;
  --accent-soft: #e0f2fe;
  --accent-border: #bae6fd;
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.07), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 30px -10px rgba(15, 23, 42, 0.12);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --container-max: 1180px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  line-height: 1.7;
  color: var(--text-body);
  background-color: var(--bg-page);
  background-image: radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.08) 0%, transparent 65%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Accessibility Skip Link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--brand-dark);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
  z-index: 1000;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 12px;
}

.page-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.site-header {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-slate) 100%);
  border-bottom: 3px solid var(--accent-cyan);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.branding {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-link {
  display: inline-flex;
  flex-shrink: 0;
  border-radius: 12px;
  transition: transform 0.15s ease;
}

.logo-link:hover {
  transform: translateY(-1px) scale(1.03);
}

.site-logo {
  width: 48px;
  height: 48px;
  display: block;
}

.branding-text {
  display: flex;
  flex-direction: column;
}

.site-title {
  margin: 0;
  font-size: clamp(1.25rem, 2.2vw, 1.55rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.site-title a {
  color: #ffffff;
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-title a:hover,
.site-title a:focus {
  color: var(--accent-cyan);
}

.site-slogan {
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #94a3b8;
  letter-spacing: 0.02em;
}

.nav-card {
  display: flex;
  align-items: center;
}

.nav-title {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.menu-list a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  color: #cbd5e1;
  text-decoration: none;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.menu-list a:hover,
.menu-list a:focus {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(56, 189, 248, 0.3);
}

.menu-list a.active {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border-color: rgba(56, 189, 248, 0.45);
}

/* ==========================================================================
   Main Two-Column Layout (Content + Profile Sidebar)
   ========================================================================== */

.layout-columns {
  flex: 1;
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 36px 24px 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: start;
}

.main-content {
  min-width: 0;
}

/* ==========================================================================
   Sidebar Cards (Profile, Tags, Recent Posts)
   ========================================================================== */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 96px;
}

.sidebar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.profile-card {
  text-align: center;
  border-top: 4px solid var(--accent-primary);
}

.profile-avatar-wrap {
  width: 128px;
  height: 128px;
  margin: 0 auto 16px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-primary));
  box-shadow: var(--shadow-md);
}

.profile-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  border: 3px solid #ffffff;
}

.profile-name {
  margin: 0 0 4px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.profile-role {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-primary);
}

.profile-bio {
  margin: 0 0 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.profile-link {
  display: inline-block;
  width: 100%;
  padding: 9px 14px;
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  text-decoration: none;
  transition: all 0.15s ease;
}

.profile-link:hover,
.profile-link:focus {
  background: var(--accent-soft);
  color: var(--accent-hover);
  border-color: var(--accent-border);
}

.sidebar-heading {
  margin: 0 0 14px;
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--bg-subtle);
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recent-list li {
  line-height: 1.4;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--bg-subtle);
}

.recent-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.recent-list a {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-body);
  text-decoration: none;
  transition: color 0.15s ease;
}

.recent-list a:hover,
.recent-list a:focus,
.recent-list a.active {
  color: var(--accent-primary);
}

.recent-date {
  display: block;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Tags & Tag Cloud */
.tag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent-hover);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  text-decoration: none;
  transition: all 0.15s ease;
}

a.tag-badge:hover,
a.tag-badge:focus {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

/* ==========================================================================
   Home Page Hero & Article Feed Cards
   ========================================================================== */

.hero-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
}

.hero-subtitle {
  margin: 0;
  font-size: 0.96rem;
  color: var(--text-muted);
}

.search-bar {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 220px;
  padding: 10px 14px;
  font-size: 0.94rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-page);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
  background: #ffffff;
}

.filter-status {
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.reset-filter-btn {
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-hover);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: none;
}

.reset-filter-btn.visible {
  display: inline-block;
}

.article-feed {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.article-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 28px 32px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.article-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

.article-card-title {
  margin: 0 0 8px;
  font-size: clamp(1.2rem, 2.2vw, 1.45rem);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.article-card-title a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.article-card-title a:hover,
.article-card-title a:focus {
  color: var(--accent-primary);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.article-excerpt p {
  margin: 0 0 12px;
}

.article-card-footer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.read-more-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.15s ease, transform 0.15s ease;
}

.read-more-link:hover,
.read-more-link:focus {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ==========================================================================
   Full Article / Page View
   ========================================================================== */

.article-full {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-top: 4px solid var(--accent-primary);
  border-radius: var(--radius-lg);
  padding: 40px 44px;
  box-shadow: var(--shadow-md);
}

.breadcrumb {
  margin: 0 0 16px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 600;
}

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

.page-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--bg-subtle);
}

.page-title {
  margin: 0 0 12px;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.content-body {
  font-size: 1.02rem;
  color: var(--text-body);
}

.content-body p {
  margin: 0 0 1.2rem;
}

.content-body p:last-child {
  margin-bottom: 0;
}

.content-body h2 {
  margin: 2.2rem 0 0.9rem;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.content-body h3 {
  margin: 1.8rem 0 0.75rem;
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-primary);
}

.content-body ul,
.content-body ol {
  margin: 0 0 1.4rem;
  padding-left: 1.5rem;
}

.content-body li {
  margin-bottom: 0.55rem;
}

.content-body li ul {
  margin-top: 0.45rem;
  margin-bottom: 0.45rem;
}

.content-body a {
  color: var(--accent-primary);
  text-decoration: underline;
  text-decoration-color: var(--accent-border);
  text-underline-offset: 3px;
  font-weight: 600;
  word-break: break-word;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.content-body a:hover,
.content-body a:focus {
  color: var(--accent-hover);
  text-decoration-color: var(--accent-primary);
}

.content-body strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* Code Blocks & Inline Code */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-inline-code);
  color: var(--text-primary);
  padding: 2px 6px;
  border-radius: 4px;
}

pre {
  margin: 1.25rem 0 1.5rem;
  padding: 18px 22px;
  background: var(--bg-code);
  color: var(--text-code);
  border-radius: var(--radius-md);
  border: 1px solid #334155;
  border-left: 4px solid var(--accent-cyan);
  overflow-x: auto;
  line-height: 1.55;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25);
}

pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 0.86rem;
  border-radius: 0;
  white-space: pre;
}

/* Article Images & Figures */
.content-body img,
.article-figure img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-md);
  margin: 1.25rem 0;
}

figure.caption {
  margin: 1.6rem 0;
  background: var(--bg-subtle);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  text-align: center;
}

figure.caption img {
  margin: 0 auto 10px;
}

figure.caption figcaption {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.article-tags-section {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.article-tags-label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

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

.site-footer {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-slate) 100%);
  border-top: 3px solid var(--accent-cyan);
  color: #cbd5e1;
  padding: 44px 24px 28px;
  font-size: 0.92rem;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--container-max);
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1.2fr;
  gap: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.footer-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.footer-heading {
  margin: 0 0 12px;
  font-size: 1.02rem;
  font-weight: 700;
  color: #ffffff;
}

.footer-brand .footer-heading {
  margin: 0;
}

.footer-col p {
  margin: 0 0 8px;
  color: #94a3b8;
  line-height: 1.55;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links li {
  margin-bottom: 7px;
}

.footer-links a {
  color: #cbd5e1;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.footer-links a:hover,
.footer-links a:focus {
  color: var(--accent-cyan);
  text-decoration: underline;
}

.footer-bottom {
  padding-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: #94a3b8;
}

.footer-bottom p {
  margin: 0;
}

.site-footer a {
  color: var(--accent-cyan);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

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

@media (max-width: 960px) {
  .layout-columns {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .sidebar {
    position: static;
  }

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

@media (max-width: 640px) {
  .header-inner {
    padding: 14px 16px;
  }

  .layout-columns {
    padding: 20px 14px 40px;
  }

  .article-card {
    padding: 22px 18px;
  }

  .article-full {
    padding: 24px 18px;
  }

  pre {
    padding: 14px 16px;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}
