/* =========================================
   SEBASTIAN MANIAK - Terminal/Code Theme
   Inspired by opencode.ai aesthetic
   ========================================= */

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

:root {
  --bg: #0a0a0a;
  --bg-surface: #111111;
  --bg-hover: #1a1a1a;
  --border: #1e1e1e;
  --text: #e0e0e0;
  --text-dim: #666;
  --text-muted: #444;
  --accent: #22c55e;
  --accent-dim: #16a34a;
  --accent-glow: rgba(34, 197, 94, 0.15);
  --white: #f0f0f0;
  --max-width: 1080px;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Code", monospace;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: 8px;
}

/* --- Light Theme --- */
[data-theme="light"] {
  --bg: #fafafa;
  --bg-surface: #ffffff;
  --bg-hover: #f0f0f0;
  --border: #e5e5e5;
  --text: #1a1a1a;
  --text-dim: #666;
  --text-muted: #999;
  --accent: #16a34a;
  --accent-dim: #15803d;
  --accent-glow: rgba(22, 163, 74, 0.1);
  --white: #1a1a1a;
}

[data-theme="light"] .site-header {
  background: rgba(250, 250, 250, 0.9);
}

[data-theme="light"] .article-card {
  background: var(--bg-surface);
  border-color: var(--border);
}

[data-theme="light"] .article-card:hover {
  background: var(--bg-hover);
}

[data-theme="light"] .article-single .content p,
[data-theme="light"] .about-content p,
[data-theme="light"] .about-content li,
[data-theme="light"] .article-single .content ul,
[data-theme="light"] .article-single .content ol {
  color: #444;
}

[data-theme="light"] .article-single .content code {
  background: #f0f0f0;
  border-color: #ddd;
}

[data-theme="light"] .article-single .content pre {
  background: #f5f5f5;
  border-color: #ddd;
}

[data-theme="light"] .nav-toggle span {
  background: var(--text);
}

[data-theme="light"] .feed-column {
  background: var(--bg-surface);
}

/* --- Theme Toggle --- */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: border-color 0.2s, background 0.2s;
  margin-left: 1rem;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: inline;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: inline;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

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

img {
  max-width: 100%;
  height: auto;
}

/* --- Header --- */
.site-header {
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.header-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}

.site-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.site-title::before {
  content: "~/";
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 0.25rem;
}

.site-nav a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-dim);
  transition: color 0.2s, background 0.2s;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--accent);
  background: var(--accent-glow);
}

.site-nav a::after {
  display: none;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  margin: 4px 0;
  border-radius: 1px;
}

/* --- Main --- */
.site-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 2rem;
}

.first-section {
  padding-top: 0;
}

/* --- Section Headers --- */
.section-header {
  margin-bottom: 2rem;
}

.section-header h2 {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.section-header h2::before {
  content: "# ";
  color: var(--accent);
}

.section-header p {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  font-weight: 400;
}

/* --- Article Cards --- */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.article-card {
  background: var(--bg-surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  position: relative;
}

.article-card::before {
  display: none;
}

.article-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateY(-2px);
}

.article-card a {
  display: block;
}

.article-card .meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 400;
}

.article-card h3 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.article-card .summary {
  font-family: var(--font-sans);
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.5;
  font-weight: 400;
}

.article-card .read-more {
  display: inline-block;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent);
  transition: opacity 0.2s;
}

.article-card .read-more::before {
  content: "→ ";
}

.article-card:hover .read-more {
  opacity: 0.8;
}

/* --- Single Article --- */
.article-single {
  max-width: 700px;
  margin: 0 auto;
}

.article-single header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.article-single header .meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.article-single header h1 {
  font-family: var(--font-sans);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 0.75rem;
  letter-spacing: -0.03em;
  color: var(--white);
}

.article-single .content {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.8;
  font-weight: 400;
}

.article-single .content h2 {
  font-family: var(--font-sans);
  font-size: 1.3rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
  letter-spacing: -0.02em;
  color: var(--white);
}

.article-single .content h3 {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 2rem 0 0.5rem;
  color: var(--white);
}

.article-single .content p {
  margin-bottom: 1.25rem;
  color: var(--text-dim);
}

.article-single .content strong {
  color: var(--text);
  font-weight: 600;
}

.article-single .content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-dim);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.2s;
}

.article-single .content a:hover {
  text-decoration-color: var(--accent);
}

.article-single .content blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.25rem;
  margin: 2rem 0;
  color: var(--text-dim);
  font-style: italic;
}

.article-single .content code {
  font-family: var(--font-mono);
  background: var(--bg-surface);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
  border: 1px solid var(--border);
  color: var(--accent);
}

.article-single .content pre {
  background: var(--bg-surface);
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.article-single .content pre code {
  background: none;
  padding: 0;
  border: none;
  color: var(--text);
}

.article-single .content ul,
.article-single .content ol {
  margin: 1rem 0 1.5rem 1.5rem;
  color: var(--text-dim);
}

.article-single .content li {
  margin-bottom: 0.4rem;
}

/* --- About Page --- */
.about-page {
  max-width: 700px;
  margin: 0 auto;
}

.about-hero {
  display: flex;
  align-items: center;
  gap: 3rem;
  margin-bottom: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--border);
}

.about-photo {
  flex-shrink: 0;
}

.about-photo img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--accent);
}

.about-intro h1 {
  font-family: var(--font-sans);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.about-intro .divider {
  width: 40px;
  height: 2px;
  background: var(--accent);
  margin: 1rem 0;
}

.about-intro .about-tagline {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 400;
}

.about-content {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.8;
  font-weight: 400;
}

.about-content h2 {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
  color: var(--accent);
}

.about-content h2::before {
  content: "## ";
  opacity: 0.5;
}

.about-content p {
  color: var(--text-dim);
  margin-bottom: 1.25rem;
}

.about-content strong {
  color: var(--text);
  font-weight: 600;
}

.about-content ul {
  list-style: none;
  margin: 1rem 0 1.5rem;
}

.about-content li {
  color: var(--text-dim);
  margin-bottom: 0.4rem;
  padding-left: 1.5rem;
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.about-content li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

.about-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-dim);
  text-underline-offset: 2px;
}

.about-content a:hover {
  text-decoration-color: var(--accent);
}

/* --- YouTube Section --- */
.youtube-section {
  padding: 2rem 0;
}

.youtube-embed-wrapper {
  margin-bottom: 2rem;
}

.youtube-embed-wrapper h3 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1rem;
  color: var(--text-dim);
}

.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: var(--bg-surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.channel-link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.channel-link:hover {
  background: var(--accent);
  color: var(--bg);
}

/* --- Social Feed --- */
.social-feed {
  padding: 4rem 0 0;
}

.social-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.feed-column {
  background: var(--bg-surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.feed-column h3 {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 1rem;
  padding: 1.25rem 1.25rem 0;
}

.feed-column .feed-embed {
  min-height: 400px;
  padding: 0.75rem 1.25rem 1.25rem;
}

.twitter-embed-wrapper {
  min-height: 500px;
}

.connect-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem 1.25rem;
}

.connect-panel p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.connect-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 240px;
}

/* --- Posts / Twitter Section --- */
.posts-section {
  padding: 2rem 0;
}

.posts-section .embed-container {
  max-width: 600px;
  margin: 0 auto;
}

/* --- Footer --- */
.site-footer {
  padding: 2rem 0;
  text-align: center;
  margin-top: 4rem;
  border-top: 1px solid var(--border);
}

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

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.footer-links a {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  transition: color 0.2s;
}

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

.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* --- Homepage Sections --- */
.home-section {
  padding: 4rem 0;
}

.home-section + .home-section {
  border-top: 1px solid var(--border);
}

.section-link {
  display: inline-block;
  margin-top: 2rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.section-link:hover {
  background: var(--accent);
  color: var(--bg);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .section-header h2 {
    font-size: 1.1rem;
  }

  .social-grid {
    grid-template-columns: 1fr;
  }

  .articles-grid {
    grid-template-columns: 1fr;
  }

  .about-hero {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
  }

  .about-intro .divider {
    margin: 1rem auto;
  }

  .about-intro h1 {
    font-size: 1.6rem;
  }

  .site-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.98);
    padding: 1.5rem;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
  }

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

  .nav-toggle {
    display: block;
  }

  .article-single header h1 {
    font-size: 1.5rem;
  }

  .site-title {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .site-main {
    padding: 2rem 1rem;
  }

  .article-card {
    padding: 1.25rem;
  }
}
