/* =========================================================
   CodeOrCry — minimal black & white developer blog
   ========================================================= */

/* ----- Reset & base ----- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html,
body {
  overflow-x: clip;
  max-width: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
textarea {
  font-family: inherit;
}

/* ----- Theme tokens ----- */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f6f6;
  --surface: #ffffff;
  --text: #0a0a0a;
  --text-soft: #4a4a4a;
  --muted: #6b6b6b;
  --border: #e6e6e6;
  --border-strong: #0a0a0a;
  --accent: #0a0a0a;
  --accent-contrast: #ffffff;
  --code-bg: #0f0f0f;
  --code-text: #f1f1f1;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  --header-bg: rgba(255, 255, 255, 0.78);
  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 1200px;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-soft: #131313;
  --surface: #0f0f0f;
  --text: #f5f5f5;
  --text-soft: #c9c9c9;
  --muted: #8a8a8a;
  --border: #1f1f1f;
  --border-strong: #f5f5f5;
  --accent: #f5f5f5;
  --accent-contrast: #0a0a0a;
  --code-bg: #050505;
  --code-text: #f1f1f1;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
  --header-bg: rgba(10, 10, 10, 0.72);
}

/* ----- Typography ----- */
h1,
h2,
h3,
h4,
h5 {
  font-family: "Manrope", system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 0.6em;
  color: var(--text);
}

h1 {
  font-size: clamp(2rem, 4.5vw, 3.5rem);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
}

h3 {
  font-size: 1.25rem;
}

p {
  margin: 0 0 1em;
  color: var(--text-soft);
}

small,
.small {
  font-size: 0.85rem;
  color: var(--muted);
}

code,
pre,
kbd {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
}

/* ----- Layout ----- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 72px 0;
}


.section-head {
  text-align: center;
  margin-bottom: 40px;
}

.section-head p {
  max-width: 640px;
  margin: 0 auto;
  color: var(--muted);
}

/* ----- Header ----- */
#header-mount,
#footer-mount {
  display: contents;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  will-change: box-shadow;
}

.site-header.scrolled {
  box-shadow: 0 1px 0 var(--border), 0 6px 20px -12px rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .site-header.scrolled {
  box-shadow: 0 1px 0 var(--border), 0 6px 24px -12px rgba(0, 0, 0, 0.6);
}

.scroll-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--text);
  z-index: 1;
  transition: width 0.08s linear;
  pointer-events: none;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 24px;
}

.logo {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.logo span {
  color: var(--muted);
}

.nav-desktop {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-desktop a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-soft);
  position: relative;
  padding: 6px 0;
  transition: color 0.18s ease;
}

.nav-desktop a:hover,
.nav-desktop a.active {
  color: var(--text);
}

.nav-desktop a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--text);
  transition: background 0.18s ease, transform 0.18s ease;
}

.icon-btn:hover {
  background: var(--bg-soft);
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.nav-toggle {
  display: none;
}

/* ----- Mobile nav ----- */
.nav-mobile {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--bg);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s ease;
}

.nav-mobile.open {
  display: block;
  max-height: 480px;
}

.nav-mobile a {
  display: block;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  color: var(--text);
}

.nav-mobile a:last-child {
  border-bottom: none;
}

.nav-mobile a:hover {
  background: var(--bg-soft);
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  border-color: var(--border-strong);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ----- Hero ----- */
.main-hero{
  padding: 96px 0 64px;
}
.hero {
  padding: 56px 0 64px;
  text-align: center;
}

.hero-eyebrow {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  margin-bottom: 24px;
}

.hero h1 {
  max-width: 880px;
  margin-left: auto;
  margin-right: auto;
}

.hero p {
  max-width: 640px;
  margin: 0 auto 32px;
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ----- Grid ----- */
.grid {
  display: grid;
  gap: 28px;
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {

  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ----- Cards ----- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}

.card-media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-soft);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.card:hover .card-media img {
  transform: scale(1.04);
}

.card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-cat {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  margin: 0;
}

.card-desc {
  font-size: 0.92rem;
  color: var(--text-soft);
  margin: 0;
}

.card-meta {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
  flex-wrap: wrap;
}

.card-meta span::before {
  content: "·";
  margin-right: 12px;
  color: var(--muted);
}

.card-meta span:first-child::before {
  content: "";
  margin: 0;
}

.card-foot {
  margin-top: auto;
  padding-top: 8px;
}

/* ----- Note card (no image) ----- */

.note-body {
  gap: 7px;
  display: flex;
  flex-direction: column;
}

.note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.note-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}

.note-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  border: 1px solid var(--border);
}

.note-card h3 {
  font-size: 1.05rem;
  margin: 2px 0 0;
}

.note-card p {
  font-size: 0.9rem;
  margin: 0;
  flex: 1;
  line-height: 1.55;
}

.note-foot {
  margin-top: 8px;
}

.note-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--text);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
  white-space: nowrap;
}

.note-download:hover {
  background: var(--text);
  color: var(--bg);
  transform: translateY(-1px);
}

.note-download-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.note-download-icon svg {
  width: 14px;
  height: 14px;
}

/* ----- Testimonial ----- */
.testimonial {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.testimonial .stars {
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 2px;
}

.testimonial-quote {
  font-size: 0.98rem;
  color: var(--text-soft);
  flex: 1;
  margin: 0;
}

.testimonial-user {
  display: flex;
  gap: 12px;
  align-items: center;
}

.testimonial-user img {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  object-fit: cover;
}

.testimonial-user .name {
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
}

.testimonial-user .role {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ----- Footer ----- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 64px 0 32px;
  background: var(--bg);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
}

.footer-grid h4 {
  font-size: 0.95rem;
  margin-bottom: 14px;
  color: var(--text);
}

.footer-grid a {
  display: block;
  font-size: 0.9rem;
  color: var(--text-soft);
  padding: 4px 0;
  transition: color 0.18s ease;
}

.footer-grid a:hover {
  color: var(--text);
}

.footer-about p {
  font-size: 0.92rem;
  max-width: 320px;
}

.footer-socials {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.footer-socials a {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: border-color 0.18s, transform 0.18s;
}

.footer-socials a:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.footer-socials svg {
  width: 18px;
  height: 18px;
}

.footer-bottom {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* ----- Category filter ----- */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 24px 0 40px;
}

.filter-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.18s ease;
}

.filter-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.filter-btn.active {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

/* ----- Pagination ----- */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 48px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.page-btn:hover:not([disabled]):not(.active) {
  border-color: var(--border-strong);
}

.page-btn.active {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

.page-btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ----- Search modal ----- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 16px 24px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s ease;
}

[data-theme="dark"] .modal {
  background: rgba(0, 0, 0, 0.7);
}

.modal.open {
  display: flex;
  opacity: 1;
}

.modal-panel {
  width: 100%;
  max-width: 700px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  transform: translateY(-12px) scale(0.98);
  opacity: 0;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
}

.modal.open .modal-panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.search-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.search-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  padding: 0 14px 0 40px;
  height: 46px;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.search-field:focus-within {
  border-color: var(--border-strong);
  background: var(--surface);
}

.search-field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  color: var(--muted);
  pointer-events: none;
}

.search-field-icon svg {
  width: 16px;
  height: 16px;
}

.search-field input {
  flex: 1;
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.95rem;
  color: var(--text);
  height: 100%;
  padding: 0;
}

.search-field input::placeholder {
  color: var(--muted);
}

.search-results {
  margin-top: 14px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}

.search-results .empty {
  padding: 28px 12px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.search-result {
  display: block;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.search-result:hover {
  background: var(--bg-soft);
  border-color: var(--border);
}

.search-result-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.search-result-cat {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.search-result-type {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}

.search-result:hover .search-result-type {
  background: var(--surface);
}

.search-result-title {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 4px;
}

.search-result-desc {
  font-size: 0.85rem;
  color: var(--text-soft);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Scrollbar polish for results */
.search-results::-webkit-scrollbar {
  width: 8px;
}

.search-results::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
}

.search-results::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

@media (max-width: 560px) {
  .modal {
    padding-top: 56px;
  }

  .modal-panel {
    padding: 16px;
    border-radius: 12px;
  }

  .search-field {
    height: 44px;
  }
}

/* ----- Blog page ----- */
.post-header {
  padding: 56px 0 20px;
  text-align: left;
  max-width: 760px;
  margin: 0 auto;
}

.post-header .meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.post-header .meta>span:first-child {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
}

.post-header h1 {
  font-size: clamp(1.85rem, 3.5vw, 2.6rem);
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}

.post-header>p {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0;
}

.post-thumb {
  max-width: 760px;
  margin: 28px auto 36px;
}

.post-thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px -8px rgba(0, 0, 0, 0.12),
    0 2px 6px -2px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .post-thumb img {
  box-shadow: 0 4px 24px -8px rgba(0, 0, 0, 0.6),
    0 2px 6px -2px rgba(0, 0, 0, 0.4);
}

.post-body {
  max-width: 760px;
  margin: 0 auto;
  font-size: 1.06rem;
  line-height: 1.78;
  color: var(--text);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.post-body h2 {
  margin-top: 2.4em;
  margin-bottom: 0.7em;
  font-size: 1.6rem;
  letter-spacing: -0.015em;
  scroll-margin-top: 96px;
}

.post-body h3 {
  margin-top: 1.8em;
  margin-bottom: 0.5em;
  font-size: 1.22rem;
  scroll-margin-top: 96px;
}

.post-body p {
  color: var(--text-soft);
  margin: 0 0 1.25em;
}

.post-body ul,
.post-body ol {
  padding-left: 24px;
  margin: 0 0 1.4em;
  color: var(--text-soft);
}

.post-body li {
  margin-bottom: 10px;
  line-height: 1.7;
}

.post-body li::marker {
  color: var(--muted);
}

.post-body blockquote {
  border-left: 3px solid var(--text);
  margin: 1.8em 0;
  padding: 6px 0 6px 20px;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--text);
}

.post-body img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin: 1.4em 0;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 0.95rem;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.post-body th,
.post-body td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}

.post-body th {
  font-weight: 700;
  color: var(--text);
}

/* ----- Code blocks ----- */
.post-body p code,
.post-body li code {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.9em;
}

.code-block {
  position: relative;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--radius-sm);
  margin: 1.4em 0;
  border: 1px solid #1a1a1a;
  overflow: scroll;
  height: 500px;
}

.code-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #0a0a0a;
  border-bottom: 1px solid #1a1a1a;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: #b0b0b0;
  letter-spacing: 0.04em;
}

.code-block pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 0.88rem;
  line-height: 1.6;
  max-width: 100%;
}

.code-block pre code {
  color: inherit;
}

.copy-btn {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  color: #cfcfcf;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #2a2a2a;
  transition: background 0.15s, color 0.15s;
}

.copy-btn:hover {
  background: #1a1a1a;
  color: #fff;
}

.copy-btn.copied {
  color: #87efac;
  border-color: #2b6b3e;
}

/* ----- Table of contents ----- */
.toc {
  max-width: 760px;
  margin: 0 auto 40px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-soft);
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.toc:hover {
  border-color: var(--border-strong);
}

.toc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  background: transparent;
  border: none;
  text-align: left;
  transition: background 0.18s ease;
}

.toc-head:hover {
  background: var(--surface);
}

.toc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  flex-shrink: 0;
}

.toc-icon svg {
  width: 16px;
  height: 16px;
}

.toc-head .label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.toc-head .label-title {
  font-size: 0.78rem;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.toc-head .label-sub {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.toc-head .chev {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--muted);
  transition: transform 0.3s ease, color 0.2s ease, background 0.2s ease;
}

.toc-head:hover .chev {
  color: var(--text);
  background: var(--bg-soft);
}

.toc.open .toc-head .chev {
  transform: rotate(180deg);
}

.toc-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  background: var(--surface);
  border-top: 1px solid transparent;
}

.toc.open .toc-body {
  max-height: 800px;
  border-top-color: var(--border);
}

.toc-body ol {
  list-style: none;
  padding: 14px 8px;
  margin: 0;
  counter-reset: toc;
}

.toc-body li {
  counter-increment: toc;
  padding: 0;
}

.toc-body li::before {
  content: counter(toc, decimal-leading-zero);
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  margin-right: 4px;
}

.toc-body li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.94rem;
  transition: background 0.15s ease;
}

.toc-body li:hover {
  background: var(--bg-soft);
}

.toc-body a {
  color: var(--text-soft);
  flex: 1;
  transition: color 0.15s;
}

.toc-body li:hover a {
  color: var(--text);
}

/* ----- About page ----- */
.about-hero {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 40px;
  align-items: center;
  margin-bottom: 56px;
}

.about-hero img {
  width: 100%;
  max-width: 240px;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

@media (max-width: 720px) {
  .about-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .about-hero img {
    margin: 0 auto;
  }
}

.skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.skill-chips span {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
}

.about-section {
  margin-bottom: 48px;
}

/* ----- Contact cards ----- */
.contact-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.25s, transform 0.25s;
}

.contact-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
}

.contact-card .icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.contact-card .icon svg {
  width: 22px;
  height: 22px;
}

.contact-card h3 {
  margin: 0;
}

.contact-card p {
  margin: 0;
  flex: 1;
  font-size: 0.92rem;
}

/* ----- Legal pages ----- */
.legal {
  max-width: 760px;
  margin: 0 auto;
}

.legal h2 {
  margin-top: 1.8em;
}

.legal p,
.legal li {
  color: var(--text-soft);
}

/* ----- Responsive header ----- */
@media (max-width: 860px) {
  .nav-desktop {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
  }
}

/* ----- Entrance animation ----- */
.fade-up {
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp 0.5s ease forwards;
}

.fade-up:nth-child(2) {
  animation-delay: 0.05s;
}

.fade-up:nth-child(3) {
  animation-delay: 0.1s;
}

.fade-up:nth-child(4) {
  animation-delay: 0.15s;
}

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ----- Utility ----- */
.text-center {
  text-align: center;
}

.mt-32 {
  margin-top: 32px;
}

.mt-48 {
  margin-top: 48px;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-radius: 6px;
}


/* ----- Related posts (single blog page) ----- */
.post-tags {
  max-width: 760px;
  margin: 56px auto 0;
  padding-top: 36px;
  border-top: 1px solid var(--border);
}

.post-tags-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
  font-weight: 600;
}

.post-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.post-tags-list a {
  display: inline-flex;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.post-tags-list a:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  transform: translateY(-1px);
}

.related-posts {
  max-width: 1000px;
  margin: 96px auto 0;
  padding-top: 56px;
  border-top: 1px solid var(--border);
}

.related-posts h2 {
  text-align: center;
  margin-bottom: 36px;
  font-size: 1.6rem;
  letter-spacing: -0.015em;
}

@media (max-width: 640px) {
  .post-tags {
    margin-top: 40px;
    padding-top: 28px;
  }

  .related-posts {
    margin-top: 64px;
    padding-top: 40px;
  }

  .related-posts h2 {
    margin-bottom: 24px;
    font-size: 1.4rem;
  }
}

/* =========================================================
   Responsive overrides
   ========================================================= */

/* Tablet and below */
@media (max-width: 768px) {
  .section {
    padding: 56px 0;
  }

  .section-tight {
    padding: 36px 0;
  }

  .hero {
    padding: 64px 0 40px;
  }

  .hero p {
    font-size: 1rem;
  }

  .footer-bottom {
    text-align: center;
    justify-content: center;
  }
}

/* Phones */
@media (max-width: 640px) {
  .section {
    padding: 48px 0;
  }

  .section-tight {
    padding: 28px 0;
  }

  .section-head {
    margin-bottom: 28px;
  }

  .hero {
    padding: 48px 0 32px;
  }

  .hero p {
    font-size: 0.98rem;
  }

  .hero-actions {
    width: 100%;
  }

  .hero-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
  }

  .header-inner {
    height: 60px;
    gap: 12px;
  }

  .logo {
    font-size: 1.1rem;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }

  .header-actions {
    gap: 2px;
  }

  .btn {
    padding: 11px 18px;
    font-size: 0.9rem;
  }

  .btn-sm {
    padding: 8px 14px;
  }

  .grid {
    gap: 18px;
  }

  .post-header {
    padding: 40px 0 16px;
  }

  .post-header h1 {
    font-size: 1.75rem;
  }

  .post-body {
    font-size: 1rem;
  }

  .post-body h2 {
    font-size: 1.35rem;
  }

  .post-body h3 {
    font-size: 1.12rem;
  }

  .code-block pre {
    padding: 14px;
    font-size: 0.82rem;
  }

  .code-block-head {
    padding: 6px 10px;
    font-size: 0.7rem;
  }

  .toc-head {
    padding: 12px 14px;
    font-size: 0.9rem;
  }

  .toc-body ol {
    padding: 10px 14px;
  }

  .filters {
    gap: 6px;
    margin: 16px 0 28px;
  }

  .filter-btn {
    padding: 7px 13px;
    font-size: 0.82rem;
  }

  .pagination {
    gap: 4px;
    margin-top: 32px;
  }

  .page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    font-size: 0.85rem;
  }

  .card-body {
    padding: 16px;
  }

  .card-title {
    font-size: 1.02rem;
  }

  .note-card {
    padding: 18px;
  }

  .note-icon {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
  }

  .testimonial {
    padding: 22px;
  }

  .testimonial-quote {
    font-size: 0.94rem;
  }

  .footer-grid {
    gap: 28px;
  }

  .legal {
    padding: 0;
  }

  .legal h2 {
    margin-top: 1.4em;
    font-size: 1.25rem;
  }

  .about-hero {
    gap: 24px;
    margin-bottom: 36px;
  }

  .about-hero img {
    max-width: 180px;
  }

  .contact-card {
    padding: 22px;
  }
}

/* Small phones — comfortable side breathing room */
@media (max-width: 480px) {
  .container {
    padding-left: 20px;
    padding-right: 20px;
  }

  .modal {
    padding-left: 20px;
    padding-right: 20px;
  }

  .post-thumb {
    padding-left: 0;
    padding-right: 0;
  }

  .hero h1 {
    font-size: 1.95rem;
  }

  .footer-bottom {
    font-size: 0.8rem;
  }
}

/* Very small phones */
@media (max-width: 360px) {
  .logo {
    font-size: 1rem;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .icon-btn svg {
    width: 18px;
    height: 18px;
  }

  .header-actions {
    gap: 0;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .post-header h1 {
    font-size: 1.55rem;
  }

  .hero-eyebrow {
    font-size: 0.7rem;
    padding: 5px 12px;
  }

  .filter-btn {
    padding: 6px 11px;
    font-size: 0.78rem;
  }

  .pagination {
    flex-wrap: wrap;
  }

  .footer-grid {
    gap: 24px;
  }
}

/* Allow long words/URLs to wrap */
.card-title,
.card-desc,
.search-result-title,
.search-result-desc,
.post-body p,
.post-body li,
.legal p,
.legal li,
.testimonial-quote,
.note-card p {
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

/* Prevent flex children from forcing parent wider than viewport */
.header-inner>*,
.footer-grid>*,
.grid>* {
  min-width: 0;
}