/* ============================================================
   Thoughts of a Servant — Design System
   ============================================================ */

/* — Google Fonts — */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Lora:wght@500;600;700&display=swap');

/* — Color Tokens — */
:root {
  --color-bg: #FFF9F0;
  --color-surface: #FFFFFF;
  --color-lavender: #E8E0F0;
  --color-sky: #D6EAF8;
  --color-rose: #FAD4D4;
  --color-mint: #D5F5E3;
  --color-steel: #D0DCF0;
  --color-text: #2C2C2C;
  --color-text-muted: #6B7280;
  --color-accent: #8B5CF6;
  --color-accent-hover: #7C3AED;
  --color-border: #E5E7EB;
  --color-code-bg: #F3F0FF;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .10);
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 780px;
  --transition: .25s ease;
}

/* — Reset / Base — */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition);
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
}

/* — Typography — */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Lora', Georgia, serif;
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
}

h1 {
  font-size: 2.25rem;
  margin-bottom: .75rem;
}

h2 {
  font-size: 1.625rem;
  margin-top: 2rem;
  margin-bottom: .5rem;
}

h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: .4rem;
}

p {
  margin-bottom: 1.25rem;
}

ul,
ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: .35rem;
}

blockquote {
  border-left: 4px solid var(--color-accent);
  padding: .75rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--color-lavender);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--color-text-muted);
}

/* — Container — */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ============================================================
   Header / Navigation
   ============================================================ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 249, 240, .9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  padding: .9rem 0;
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.site-header.scrolled {
  transform: translateY(0);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 1.5rem;
  line-height: 1;
}

.site-logo {
  font-family: 'Lora', serif;
  font-weight: 700;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--color-text);
  letter-spacing: -.02em;
  white-space: nowrap;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
  margin-bottom: 0;
  padding-left: 0;
}

.nav-links li {
  margin-bottom: 0;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  font-size: .85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  transition: width var(--transition);
}

.nav-links a:hover {
  color: var(--color-text);
}

.nav-links a:hover::after {
  width: 100%;
}

/* Hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .25rem;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  margin: 5px 0;
  transition: var(--transition);
  border-radius: 2px;
}

/* ============================================================
   Main Content
   ============================================================ */
.site-main {
  flex: 1;
}

body:not(.home-page) .site-main {
  padding-top: 4.5rem;
}

/* — Hero Section — */
.hero {
  height: 100vh;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #D6EAF8 0%, #EBF5FB 60%, #F0F8FF 100%);
  background-size: cover;
  background-position: center;
  text-align: center;
  margin-bottom: 4rem;
}

.hero::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
}

.hero-content {
  position: relative;
  z-index: 10;
}

.hero-title {
  font-family: 'Lora', serif;
  font-size: 3.5rem;
  font-weight: 700;
  font-style: italic;
  color: #1a3a5c;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  animation: fadeUp 1s ease;
}

.hero-title em {
  font-style: inherit;
}

.hero-scroll {
  position: absolute;
  bottom: 2.75rem;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
}

.hero-scroll::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-left: 2px solid var(--color-text);
  border-bottom: 2px solid var(--color-text);
  transform: rotate(-45deg) translateY(-1px);
  animation: chevronBounce 1.8s ease-in-out infinite;
}

.hero-scroll:hover::before {
  animation-play-state: paused;
  transform: rotate(-45deg) translateY(3px);
}

@keyframes chevronBounce {
  0%, 100% { transform: rotate(-45deg) translateY(-1px); opacity: .9; }
  50%       { transform: rotate(-45deg) translateY(4px);  opacity: 1; }
}

/* — Section Heading & Subhint (Home) — */
.section-heading {
  font-size: 2rem;
  margin-bottom: .5rem;
  margin-top: 0;
}

.section-subhint {
  font-size: .92rem;
  color: var(--color-text-muted);
  margin-top: .25rem;
  margin-bottom: 0;
}

/* — Contact Section — */
.contact-section {
  padding: 4rem 0;
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  margin-top: 4rem;
}

.contact-section__inner {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.contact-section__title {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
}

.contact-section__text {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 2rem;
}

/* — Post back-link — */
.post-back-link {
  display: inline-block;
  font-size: .85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 1.75rem;
  margin-top: 1rem;
  transition: color var(--transition);
}

.post-back-link:hover {
  color: var(--color-accent);
}

/* — Reading time — */
.post-meta__reading-time {
  color: var(--color-text-muted);
}

/* — Page Header — */
.page-header {
  text-align: center;
  margin-bottom: 3rem;
}

.page-header h1 {
  font-size: 2.5rem;
  margin-bottom: .5rem;
}

.page-header p {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  max-width: 560px;
  margin: 0 auto;
}

/* ============================================================
   Post Cards (Index)
   ============================================================ */
.post-grid {
  display: grid;
  gap: 2rem;
}

.post-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  animation: fadeUp .5s ease both;
  text-decoration: none;
  color: inherit;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.post-card__cover {
  width: 100%;
  height: 210px;
  object-fit: cover;
}

.post-card__cover--fallback {
  background: linear-gradient(135deg, var(--color-sky), var(--color-lavender));
}

.post-card__body {
  padding: 1.5rem;
}

.post-card__category {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .2rem .65rem;
  border-radius: 999px;
  margin-bottom: .65rem;
}

.post-card__category--projects {
  background: var(--color-sky);
  color: #1a5276;
}

.post-card__category--life {
  background: var(--color-rose);
  color: #922b1e;
}

.post-card__category--cybersecurity {
  background: var(--color-steel);
  color: #1a3060;
}

.post-card__category--opinion {
  background: #e8e0f0;
  color: #4a1a6e;
}

.post-card__title {
  font-family: 'Lora', serif;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: .35rem;
  color: var(--color-text);
}

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

.post-card__meta {
  font-size: .8rem;
  color: var(--color-text-muted);
  margin-bottom: .65rem;
}

.post-card__excerpt {
  font-size: .92rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* ============================================================
   Single Post
   ============================================================ */
.post-cover {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.post-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.post-header .post-card__category {
  margin-bottom: .75rem;
}

.post-header h1 {
  font-size: 2.5rem;
  margin-bottom: .5rem;
}

.post-subtitle {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-bottom: .75rem;
}

.post-meta {
  font-size: .85rem;
  color: var(--color-text-muted);
}

.post-abstract {
  background: var(--color-lavender);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  font-size: .95rem;
  line-height: 1.7;
  color: var(--color-text);
}

.post-content h2 {
  padding-bottom: .35rem;
  border-bottom: 2px solid var(--color-border);
}

/* — Code Blocks — */
.post-content pre {
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: .88rem;
  line-height: 1.6;
}

.post-content code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .88em;
}

.post-content p code,
.post-content li code {
  background: var(--color-code-bg);
  padding: .15rem .4rem;
  border-radius: 4px;
}

/* ============================================================
   Social Share
   ============================================================ */
.share-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2.5rem 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.share-bar span {
  font-size: .85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  font-weight: 500;
  padding: .4rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.share-btn:hover {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

/* ============================================================
   Comments
   ============================================================ */
.comments-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.comments-section h2 {
  font-size: 1.35rem;
  border: none;
  margin-bottom: 1rem;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 2rem 0;
  text-align: center;
  font-size: .85rem;
  color: var(--color-text-muted);
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: .75rem;
  list-style: none;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem 1.05rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: .85rem;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.footer-social a:hover {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.back-to-top {
  display: inline-block;
  margin-top: .75rem;
  font-size: .8rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-accent);
  font-family: inherit;
  padding: 0;
}

.back-to-top:hover {
  color: var(--color-accent-hover);
}

/* ============================================================
   Posts Page Helpers
   ============================================================ */
.posts-footer-cta {
  margin: 3.5rem auto 0;
  padding: 2rem 1.75rem;
  max-width: 640px;
  text-align: center;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.posts-footer-cta__text {
  margin-bottom: 1.25rem;
  color: var(--color-text-muted);
}

.posts-footer-cta__button {
  display: inline-block;
  padding: .7rem 1.6rem;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
  font-weight: 500;
  font-size: .9rem;
  border: none;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.posts-footer-cta__button:hover {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.posts-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.posts-count {
  font-size: .9rem;
  color: var(--color-text-muted);
  padding-bottom: .25rem;
}

.posts-filters {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.posts-filter-select,
.posts-search-input {
  font-size: .9rem;
  padding: .45rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text);
  outline: none;
  min-width: 150px;
}

.posts-search-input {
  min-width: 220px;
}

.posts-filter-select:focus,
.posts-search-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.25);
}

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

/* ============================================================
   About Page
   ============================================================ */
.about-content {
  max-width: 640px;
  margin: 0 auto;
}

.about-content p {
  font-size: 1.05rem;
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post-card:nth-child(2)  { animation-delay: .08s; }
.post-card:nth-child(3)  { animation-delay: .16s; }
.post-card:nth-child(4)  { animation-delay: .24s; }
.post-card:nth-child(5)  { animation-delay: .32s; }
.post-card:nth-child(6)  { animation-delay: .40s; }
.post-card:nth-child(7)  { animation-delay: .48s; }
.post-card:nth-child(8)  { animation-delay: .56s; }
.post-card:nth-child(9)  { animation-delay: .64s; }
.post-card:nth-child(10) { animation-delay: .72s; }
.post-card:nth-child(11) { animation-delay: .80s; }
.post-card:nth-child(12) { animation-delay: .88s; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 1.5rem;
    gap: .75rem;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .page-header h1,
  .post-header h1 {
    font-size: 1.85rem;
  }

  h1 {
    font-size: 1.85rem;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 1.35rem;
  }

  .post-cover {
    max-height: 260px;
  }

  .post-card__cover {
    height: 170px;
  }
}

@media (min-width: 769px) {
  .post-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================
   Rouge Syntax Highlighting — Pastel Theme
   ============================================================ */
.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr {
  color: #7C3AED;
  font-weight: 600;
}

.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sb,
.highlight .sc,
.highlight .se,
.highlight .sh,
.highlight .sx {
  color: #059669;
}

.highlight .c,
.highlight .c1,
.highlight .cm,
.highlight .cs {
  color: #9CA3AF;
  font-style: italic;
}

.highlight .nf,
.highlight .nb {
  color: #2563EB;
}

.highlight .nn,
.highlight .nc {
  color: #DB2777;
}

.highlight .mi,
.highlight .mf,
.highlight .mh,
.highlight .mo {
  color: #D97706;
}

.highlight .o,
.highlight .ow {
  color: #6B7280;
}

.highlight .p {
  color: #374151;
}