/* ==========================================================================
   Mohammed Noufal — Personal Site
   Minimal, dark-only. Tokens follow the Cashevide dark palette.
   ========================================================================== */

:root {
  /* Base */
  --background: #0d0d0d;
  --foreground: #f2f2f0;

  /* Surfaces */
  --card: #141414;
  --card-foreground: #f2f2f0;

  /* Brand / links */
  --brand: #377aff;
  --link: #5b9dff;

  /* Muted */
  --muted: #141414;
  --muted-foreground: #a3a3a0;

  /* UI */
  --border: #232323;

  /* Type */
  --font-sans:
    "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, Helvetica,
    sans-serif;
}

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

html {
  height: 100%;
  color-scheme: dark;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
}

img,
picture,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--brand);
  color: #ffffff;
}

/* Layout — content never stretches wide, even on 4K/8K screens */
.container {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 24px;
}

.container--wide {
  max-width: 720px;
}

.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 96px 0;
}

.page--top {
  align-items: flex-start;
}

.blogs-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 192px);
}

.blogs-page .footer {
  margin-top: auto;
}

@media (max-width: 640px) {
  .blogs-page {
    min-height: calc(100vh - 96px);
  }
}

@media (max-width: 640px) {
  .page {
    align-items: flex-start;
    padding: 48px 0;
  }
}

/* Home */
.profile {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 40px;
}

.avatar {
  width: 68px;
  height: 68px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}

.profile-role {
  font-size: 14px;
  color: var(--muted-foreground);
  margin: 0;
}

.bio {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 40px;
}

.bio p {
  font-size: 15px;
  line-height: 1.75;
  color: var(--muted-foreground);
  margin: 0;
  max-width: 52ch;
}

.bio strong {
  color: var(--foreground);
  font-weight: 500;
}

.bio a {
  color: var(--foreground);
  text-decoration: underline;
  text-decoration-color: var(--foreground);
  text-underline-offset: 3px;
  transition: opacity 0.15s ease;
}

.bio a:hover {
  opacity: 0.8;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 12px 22px;
  margin-bottom: 56px;
  font-size: 15px;
  font-weight: 500;
  color: var(--foreground);
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.btn:hover {
  background: #1a1a1a;
  border-color: #2e2e2e;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
}

.footer a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted-foreground);
  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}

.footer a:hover {
  color: var(--foreground);
  background: var(--card);
}

.footer svg {
  width: 14px;
  height: 14px;
}

/* === Back link === */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted-foreground);
  margin-bottom: 32px;
  transition: color 0.15s ease;
}

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

.back-link svg {
  width: 14px;
  height: 14px;
  transition: transform 0.15s ease;
}

.back-link:hover svg {
  transform: translateX(-3px);
}

/* === Blogs page header === */
.blogs-header {
  margin-bottom: 32px;
}

.blogs-header h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}

.blogs-header p {
  font-size: 14px;
  color: var(--muted-foreground);
  margin: 0;
}

/* === Search + category filter === */
.blogs-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.search-input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--foreground);
}

.search-input::placeholder {
  color: var(--muted-foreground);
}

.search-input:focus {
  outline: none;
  border-color: #3a3a3a;
}

.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-pill {
  border: 1px solid transparent;
  border-radius: 9999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-foreground);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.category-pill:hover {
  color: var(--foreground);
}

.category-pill.is-active {
  background: var(--card);
  color: var(--foreground);
  border-color: var(--border);
}

/* === Blog cards === */
.blog-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

@media (max-width: 640px) {
  .blog-list {
    grid-template-columns: 1fr;
  }
}

.blog-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease;
}

.blog-card:hover {
  border-color: #2e2e2e;
  background: #171717;
}

.blog-card-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--muted);
}

.blog-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 16px;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted-foreground);
}

.blog-card-body h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--foreground);
  margin: 0;
  line-height: 1.4;
}

.blog-card-desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted-foreground);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* === Empty state === */
.blogs-empty {
  padding: 32px 0;
  text-align: center;
  font-size: 14px;
  color: var(--muted-foreground);
}

/* === Pagination === */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 48px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.page-btn:hover:not(:disabled) {
  color: var(--foreground);
  border-color: #2e2e2e;
}

.page-btn.is-active {
  background: var(--foreground);
  color: var(--background);
  border-color: var(--foreground);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* === Blog detail page === */
.blog-detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  width: fit-content;
}

.author-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
}

.author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
  margin: 0 0 2px;
}

.author-date {
  display: block;
  font-size: 13px;
  color: var(--muted-foreground);
}

.blog-detail-header h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 0 0 12px;
}

.blog-detail-desc {
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted-foreground);
  margin: 0 0 24px;
}

.blog-detail-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 32px;
}

.blog-detail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* === Blog content (rendered markdown) === */
.blog-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--muted-foreground);
  margin-bottom: 48px;
}

.blog-content > *:first-child {
  margin-top: 0;
}

.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4 {
  color: var(--foreground);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 36px 0 14px;
}

.blog-content h1 {
  font-size: 22px;
}
.blog-content h2 {
  font-size: 19px;
}
.blog-content h3 {
  font-size: 16px;
}
.blog-content h4 {
  font-size: 15px;
}

.blog-content p {
  margin: 0 0 18px;
}

.blog-content a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: rgba(91, 157, 255, 0.35);
  text-underline-offset: 3px;
}

.blog-content a:hover {
  text-decoration-color: var(--link);
}

.blog-content strong {
  color: var(--foreground);
  font-weight: 600;
}

.blog-content ul,
.blog-content ol {
  margin: 0 0 18px;
  padding-left: 22px;
}

.blog-content li {
  margin-bottom: 6px;
}

.blog-content li::marker {
  color: #5a5a57;
}

.blog-content blockquote {
  border-left: 2px solid var(--border);
  color: #b3b3b0;
  font-style: italic;
  margin: 20px 0;
  padding: 2px 0 2px 16px;
}

.blog-content code {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--foreground);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 5px;
}

.blog-content pre {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 20px 0;
  overflow-x: auto;
}

.blog-content pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.6;
}

.blog-content img {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 24px 0;
}

.blog-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}
