/* ============================================================
   compact.css — minimal component library with theme support
   ============================================================ */

/* ─── 1. RESET ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; line-height: 1.6; -webkit-font-smoothing: antialiased; }
img, video, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
h1, h2, h3, h4, h5, h6 { line-height: 1.1; }

/* ─── 2. THEMES (CSS variables) ─────────────────────────────── */

/* Default / "mai" theme (light) */
:root, [data-theme="mai"] {
  --base-100: oklch(97% 0 0);
  --base-200: oklch(92% 0 0);
  --base-300: oklch(87% 0 0);
  --base-content: oklch(20% 0 0);
  --base-content-muted: oklch(45% 0 0);

  --primary: #0066ff;
  --primary-content: #ffffff;
  --secondary: #ffffff;
  --secondary-content: #000000;
  --accent: #7e9bfc;
  --accent-content: #ffffff;
  --neutral: #000000;
  --neutral-content: #ffffff;

  --info:    oklch(78% 0.154 211.53);
  --success: oklch(72% 0.219 149.58);
  --warning: oklch(76% 0.188 70.08);
  --error:   oklch(63% 0.237 25.33);
  --info-content:    #ffffff;
  --success-content: #ffffff;
  --warning-content: oklch(26% 0.079 36.26);
  --error-content:   #ffffff;

  --radius-sm:  0.5rem;
  --radius:     1rem;
  --radius-lg:  2rem;
  --radius-full: 9999px;

  --border-width: 1px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow:    0 1px 6px 0 rgb(0 0 0 / 0.06);
  --shadow-lg: 0 4px 24px 0 rgb(0 0 0 / 0.08);

  --font-sans: "Archivo", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;

  --nav-height: 4rem;
  --nav-width: 80%;
  --content-width: 72rem;
  --prose-width: 48rem;

  color-scheme: light;
}

/* Dark theme */
[data-theme="dark"] {
  --base-100: oklch(14% 0.01 250);
  --base-200: oklch(18% 0.01 250);
  --base-300: oklch(22% 0.01 250);
  --base-content: oklch(92% 0 0);
  --base-content-muted: oklch(60% 0 0);

  --primary: #3d8eff;
  --primary-content: #ffffff;
  --secondary: #1e1e2e;
  --secondary-content: #ffffff;
  --accent: #7e9bfc;
  --accent-content: #ffffff;
  --neutral: #ffffff;
  --neutral-content: #000000;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow:    0 1px 6px 0 rgb(0 0 0 / 0.4);
  --shadow-lg: 0 4px 24px 0 rgb(0 0 0 / 0.5);

  color-scheme: dark;
}

/* ─── 3. BASE STYLES ─────────────────────────────────────────── */
body {
  font-family: var(--font-sans);
  background: var(--base-100);
  color: var(--base-content);
}

h1 { font-size: 1.8rem;     font-weight: 500; letter-spacing: -0.03em; }
h2 { font-size: 1.4rem;   font-weight: 500; letter-spacing: -0.02em; }
h3 { font-size: 1.2rem;  font-weight: 500; letter-spacing: -0.01em; }
h4 { font-size: 1.1rem; font-weight: 500; }
h5 { font-size: 1rem;     font-weight: 500; }
h6 { font-size: 0.875rem; font-weight: 500; }

p { color: var(--base-content); }

a { text-decoration: none; text-underline-offset: 3px; transition: text-decoration 0.15s; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--base-200);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
}

pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--base-200);
  border: var(--border-width) solid var(--base-300);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  line-height: 1.7;
}
pre code { background: none; padding: 0; font-size: inherit; }

blockquote {
  border-left: 3px solid var(--primary);
  padding: 0.75rem 1.25rem;
  background: var(--base-200);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--base-content);
  font-style: italic;
}

hr {
  border: none;
  border-top: var(--border-width) solid var(--base-300);
}

::selection {
  background: var(--primary);
  color: var(--primary-content);
}

/* ─── 4. LAYOUT ──────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.prose {
  max-width: var(--prose-width);
  margin-inline: auto;
}
.prose h1, .prose h2, .prose h3,
.prose h4, .prose h5, .prose h6 { margin-top: 2em; margin-bottom: 0.6em; }
.prose p { margin-bottom: 1.25em; line-height: 1.75; color: var(--base-content); }
.prose a { color: var(--primary); }
.prose ul, .prose ol { padding-left: 1.5em; margin-bottom: 1.25em; }
.prose li { margin-bottom: 0.4em; }
.prose img { border-radius: var(--radius); }
.prose blockquote { margin: 1.5em 0; }
.prose pre { margin: 1.5em 0; }
.prose hr { margin: 2.5em 0; }
.prose > :first-child { margin-top: 0; }

/* ─── 5. NAVBAR ──────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in oklch, var(--base-100) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.navbar .navbar-inner {
  width: var(--nav-width);
  max-width: var(--content-width);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding-inline: 1rem;
}
.navbar-brand {
  display: flex;
  align-items: center;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-decoration: none;
}
.navbar-brand:hover { color: var(--primary); }

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}
.navbar-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--base-content);
  transition: color 0.15s;
}
.navbar-nav a:hover,
.navbar-nav a.active { color: var(--base-content); }

/* Hamburger button */
.navbar-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  color: var(--base-content);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.navbar-hamburger:hover { background: var(--base-200); }

/* Mobile drawer */
.navbar-drawer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
}
.navbar-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.3);
}
.navbar-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(280px, 80vw);
  background: var(--base-100);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.navbar-drawer-close {
  align-self: flex-end;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  color: var(--base-content);
  margin-bottom: 1rem;
}
.navbar-drawer-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.navbar-drawer-nav a {
  display: block;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--base-content);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.navbar-drawer-nav a:hover { background: var(--base-200); color: var(--primary); }
.navbar-drawer-nav a.active { color: var(--primary); font-weight: 700; }
.navbar-drawer.is-open { display: block; }

/* ─── 6. BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
  border: var(--border-width) solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.4;
  user-select: none;
}
.btn:active { transform: scale(0.97); }

.btn-primary   { background: var(--primary);  color: var(--primary-content);  border-color: var(--primary); }
.btn-secondary { background: var(--secondary); color: var(--secondary-content); border-color: var(--base-300); }
.btn-neutral   { background: var(--neutral);   color: var(--neutral-content);   border-color: var(--neutral); }
.btn-accent    { background: var(--accent);    color: var(--accent-content);    border-color: var(--accent); }
.btn-ghost     { background: transparent;      color: var(--base-content);      border-color: transparent; }
.btn-outline   { background: transparent;      color: var(--primary);           border-color: var(--primary); }

.btn-primary:hover   { filter: brightness(1.12); }
.btn-secondary:hover { background: var(--base-200); }
.btn-neutral:hover   { filter: brightness(1.15); }
.btn-ghost:hover     { background: var(--base-200); }
.btn-outline:hover   { background: var(--primary); color: var(--primary-content); }

.btn-sm { padding: 0.3rem 0.9rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 1rem; }

/* ─── 7. BADGE ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2em 0.7em;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  border: var(--border-width) solid var(--base-300);
  background: var(--base-200);
  color: var(--base-content);
  text-decoration: none;
}
.badge-primary   { background: var(--primary);  color: var(--primary-content);  border-color: var(--primary); }
.badge-accent    { background: var(--accent);    color: var(--accent-content);   border-color: var(--accent); }
.badge-neutral   { background: var(--neutral);   color: var(--neutral-content);  border-color: var(--neutral); }

/* ─── 8. CARD ────────────────────────────────────────────────── */
.card {
  background: var(--base-100);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-body { padding: 1.5rem; }
.card-title { font-size: 1.125rem; font-weight: 700; margin-bottom: 0.5rem; }
.card-actions { padding: 1rem 1.5rem; border-top: var(--border-width) solid var(--base-200); display: flex; gap: 0.5rem; }

/* ─── 9. DIVIDER ─────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--base-content);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: var(--border-width);
  background: var(--base-300);
}

/* ─── 10. ARTICLE LISTING ────────────────────────────────────── */
.article-list { list-style: none; }
.article-item {
  padding-block: 2rem;
}
.article-item:first-child { border-top: none; }

/* ─── 11. HERO ARTICLE ───────────────────────────────────────── */
.article-hero {
  padding-bottom: 3rem;
  margin-bottom: 0.5rem;
}



/* ─── 13. PAGINATION ─────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-block: 2rem;
}
.pagination-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--base-content);
  transition: color 0.15s;
}
.pagination-link:hover { color: var(--primary); }
.pagination-info { font-size: 0.7rem; color: var(--base-content); letter-spacing: 0.1em; }

/* ─── 14. FOOTER ─────────────────────────────────────────────── */
.footer {
  padding-block: 1.5rem;
  background: var(--base-100);
}
.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}
.footer-brand { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.03em; }
.footer-tagline { margin-top: 0.5rem; font-size: 0.875rem; color: var(--base-content); }
.footer-col-title {
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--base-content); margin-bottom: 1rem;
}
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.footer-links a { font-size: 0.875rem; color: var(--base-content); text-decoration: none; transition: color 0.15s; }
.footer-links a:hover { color: var(--base-content); }
.footer-bottom {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--base-content);
}
.footer-bottom a { color: inherit; text-decoration: none; }
.footer-bottom a:hover { color: var(--primary); }

/* ─── 15. TAG / CATEGORY CHIPS ───────────────────────────────── */
.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }



/* ─── 17. PREV / NEXT ────────────────────────────────────────── */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  padding-block: 3rem;
}
.post-nav-link { text-decoration: none; display: block; }
.post-nav-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--base-content); margin-bottom: 0.4rem; }
.post-nav-title { font-weight: 700; font-size: 1rem; line-height: 1.3; transition: color 0.15s; }
.post-nav-link:hover .post-nav-title { color: var(--primary); }
.post-nav-next { text-align: right; }

/* ─── 18. UTILITIES ──────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Typography */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-md { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: clamp(1rem, 3vw, 1.25rem); }
.text-2xl { font-size: clamp(1.25rem, 4vw, 1.5rem); }
.text-3xl { font-size: clamp(1.5rem, 4vw, 2rem); }
.text-4xl { font-size: clamp(1.75rem, 5vw, 2.5rem); }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.tracking-tight { letter-spacing: -0.04em; }
.tracking-normal { letter-spacing: 0; }
.tracking-wide { letter-spacing: 0.1em; }
.tracking-widest { letter-spacing: 0.2em; }

.leading-none { line-height: 1; }
.leading-tight { line-height: 1.1; }
.leading-snug { line-height: 1.3; }
.leading-normal { line-height: 1.5; }
.leading-relaxed { line-height: 1.75; }

.uppercase { text-transform: uppercase; }

/* Colors */
.text-muted   { color: var(--base-content-muted); }
.text-primary { color: var(--primary); }

/* Spacing */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-auto      { margin-top: auto; }

/* Flexbox and Layout */
.block        { display: block; }
.hidden       { display: none; }
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm       { gap: 0.5rem; }
.gap-md       { gap: 1rem; }
.gap-lg       { gap: 2rem; }
.w-full       { width: 100%; }
.max-w-2xl    { max-width: 42rem; }
.shrink-0     { flex-shrink: 0; }
.min-w-40     { min-width: 10rem; }
.flex-1       { flex: 1; }
.ml-auto      { margin-left: auto; }

/* Sizing */
.w-1 { width: 0.25rem; }
.h-1 { height: 0.25rem; }
.w-10 { width: 2.5rem; }
.h-10 { height: 2.5rem; }

/* Border Radius */
.rounded-full { border-radius: 9999px; }

/* Backgrounds & Borders */
.bg-base-200 { background-color: var(--base-200); }
.bg-base-300 { background-color: var(--base-300); }
.border-t    { border-top: var(--border-width) solid transparent; }
.border-base-300 { border-color: var(--base-300); }

/* Padding */
.py-1  { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2  { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-6  { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.px-4  { padding-left: 1rem; padding-right: 1rem; }

/* Display & Misc */
.inline-block { display: inline-block; }
.whitespace-nowrap { white-space: nowrap; }
.no-underline { text-decoration: none; }
.text-right { text-align: right; }
.list-none { list-style: none; }

/* Transitions & Interactions */
.transition-colors { transition: color 0.15s, background-color 0.15s, border-color 0.15s; }
.transition-all    { transition: all 0.15s; }
.opacity-0         { opacity: 0; }
.opacity-100       { opacity: 1; }
.-translate-x-1    { transform: translateX(-4px); }
.translate-x-0     { transform: translateX(0); }
.translate-x-1     { transform: translateX(4px); }

/* Hover States */
.hover\:text-primary:hover { color: var(--primary); }
.hover\:bg-base-200:hover  { background-color: var(--base-200); color: var(--base-content); }

/* Group Hover (Simulating Tailwind's .group) */
.group:hover .group-hover\:text-primary { color: var(--primary); }
.group:hover .group-hover\:text-base-content { color: var(--base-content); }
.group:hover .group-hover\:translate-x-0 { transform: translateX(0); }
.group:hover .group-hover\:translate-x-1 { transform: translateX(4px); }
.group:hover .group-hover\:opacity-100 { opacity: 1; }

/* ─── 19. RESPONSIVE TWEAKS ─────────────────────────────────── */
@media (max-width: 640px) {
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.5rem; }
}

@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:flex-nowrap { flex-wrap: nowrap; }
  .sm\:block { display: block; }
  .sm\:gap-lg { gap: 2rem; }
  .sm\:gap-md { gap: 1rem; }
}

@media (max-width: 768px) {
  :root { --nav-width: 100%; }
  .navbar-nav { display: none; }
  .navbar-hamburger { display: flex; align-items: center; justify-content: center; }
}

/* ─── 20. HOMEPAGE ───────────────────────────────────────────── */

/* Hero */
.home-hero {
  padding-block: 1.5rem 1rem;
  max-width: 52rem;
}
.home-hero-grid {
  width: 100%;
  aspect-ratio: 32 / 7;
  background: transparent;
  display: grid;
  grid-template-columns: repeat(32, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 2px;
  padding: 2px;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
.home-hero-grid-cell {
  background: #000;
  border-radius: 1px;
  transition: background 0.1s ease, box-shadow 0.1s ease;
}
.home-hero-grid-cell.on {
  background: transparent;
  box-shadow: none;
}

/* ─── 21. PROJECT SHOWCASE ────────────────────────────────────── */

.project-list {
    display: flex;
    flex-direction: column;
    gap: 5rem;
    margin-top: 4rem;
}

.project-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
}

@media (max-width: 640px) {
    .project-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.project-name {
    font-weight: 800;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--base-content);
}

.project-desc {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
    max-width: 42rem;
}

.project-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.project-stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.project-links .badge {
    padding: 0.35em 1em;
    font-size: 0.75rem;
    background: var(--base-200);
    border-color: transparent;
    color: var(--base-content);
    font-weight: 600;
    border-radius: 4px;
}

.project-links .badge:hover {
    background: var(--base-300);
    text-decoration: none;
}
