/* ============================================================
   tetraedron.com — stylesheet
   Clean, minimal, fast. No frameworks.
   ============================================================ */

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

/* Variables */
:root {
  --bg: #ffffff;
  --surface: #f7f8fa;
  --border: #e5e7eb;
  --text: #1f2328;
  --muted: #57606a;
  --accent: #3b82d4;
  --tag-bg: #eef2ff;
  --tag-text: #3730a3;
  --tag-aws-bg: #fff7ed;
  --tag-aws-text: #c2410c;
  --tag-infra-bg: #f0fdf4;
  --tag-infra-text: #166534;
  --font: -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", "Fira Code", "Consolas", monospace;
  --max: 760px;
  --nav-h: 56px;
}

/* Base */
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ============================================================
   HEADER / NAV
   ============================================================ */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
}

nav {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.logo:hover { text-decoration: none; color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.nav-links a {
  font-size: 0.875rem;
  color: var(--muted);
  transition: color 0.15s;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text);
  text-decoration: none;
}

.lang-toggle {
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: color 0.15s, border-color 0.15s;
}
.lang-toggle:hover { color: var(--text); border-color: var(--muted); }

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem;
  flex: 1;
  width: 100%;
}

.page-main { padding-top: 3rem; padding-bottom: 4rem; }

/* ============================================================
   HERO (index)
   ============================================================ */
.hero {
  padding: 4rem 0 3.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 520px;
  margin-bottom: 1.5rem;
}

.btn {
  display: inline-block;
  background: var(--text);
  color: var(--bg);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.8; text-decoration: none; }

/* ============================================================
   POST GRID (homepage)
   ============================================================ */
.posts-section { margin-bottom: 3.5rem; }
.posts-section h2,
.projects-preview h2 { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); margin-bottom: 1.25rem; }

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.post-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.post-card.coming-soon { opacity: 0.5; }
.post-card h3 { font-size: 0.9rem; font-weight: 600; line-height: 1.4; }
.post-card h3 a { color: var(--text); }
.post-card h3 a:hover { color: var(--accent); text-decoration: none; }
.post-card p { font-size: 0.8rem; color: var(--muted); flex: 1; }

.all-posts-link { font-size: 0.875rem; color: var(--accent); }

/* ============================================================
   TAGS
   ============================================================ */
.tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
}
.tag-active { background: #f0fdf4; color: #166534; }
.tag-paused { background: #fff7ed; color: #c2410c; }

/* Dynamic tag colors by context */
.post-card .tag, .blog-entry .tag { background: var(--tag-bg); color: var(--tag-text); }

/* ============================================================
   PROJECTS PREVIEW (homepage)
   ============================================================ */
.project-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.25rem; }
.project-item { display: flex; gap: 0.75rem; align-items: flex-start; }
.project-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 0.35rem; flex-shrink: 0; }
.project-dot.active { background: #22c55e; }
.project-dot.paused { background: #f59e0b; }
.project-item strong { font-size: 0.9rem; display: block; }
.project-item p { font-size: 0.8rem; color: var(--muted); }
.project-status { font-size: 0.7rem; color: var(--muted); margin-left: 0.5rem; }

/* ============================================================
   PAGE HEADER (blog, projects, about)
   ============================================================ */
.page-header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.page-header h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.4rem; }
.page-header p { color: var(--muted); font-size: 0.95rem; }

/* ============================================================
   BLOG FILTERS
   ============================================================ */
.blog-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.filter-btn {
  font-family: var(--font);
  font-size: 0.8rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--muted); color: var(--text); }
.filter-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ============================================================
   BLOG LIST
   ============================================================ */
.blog-list { display: flex; flex-direction: column; gap: 0; }
.blog-entry {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}
.blog-entry.coming-soon { opacity: 0.5; }
.blog-entry-meta { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.6rem; }
.blog-entry h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.4rem; line-height: 1.35; }
.blog-entry h2 a { color: var(--text); }
.blog-entry h2 a:hover { color: var(--accent); text-decoration: none; }
.blog-entry p { font-size: 0.875rem; color: var(--muted); margin-bottom: 0.75rem; }
.read-more { font-size: 0.8rem; color: var(--accent); }

.date { font-size: 0.75rem; color: var(--muted); }

/* ============================================================
   PROJECTS FULL PAGE
   ============================================================ */
.projects-full { display: flex; flex-direction: column; gap: 1.5rem; }
.project-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  background: var(--surface);
}
.project-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; }
.project-card h2 { font-size: 1rem; font-weight: 700; margin-bottom: 0.3rem; }
.project-year { font-size: 0.8rem; color: var(--muted); flex-shrink: 0; }
.project-card p { font-size: 0.875rem; color: var(--muted); margin-bottom: 1rem; }
.project-tech { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.project-tech span {
  font-size: 0.7rem;
  background: var(--border);
  color: var(--muted);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-weight: 500;
}

/* ============================================================
   PROSE (about, posts)
   ============================================================ */
.prose {
  max-width: 640px;
  font-size: 0.95rem;
  line-height: 1.75;
}
.prose p { margin-bottom: 1.2rem; }
.prose h2 { font-size: 1.1rem; font-weight: 700; margin: 2rem 0 0.75rem; letter-spacing: -0.01em; }
.prose h3 { font-size: 0.95rem; font-weight: 700; margin: 1.5rem 0 0.5rem; }
.prose ul, .prose ol { margin: 0 0 1.2rem 1.3rem; }
.prose li { margin-bottom: 0.35rem; }
.prose a { color: var(--accent); }
.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}
.prose pre {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  margin: 0 0 1.2rem;
  font-size: 0.82rem;
  line-height: 1.6;
}
.prose pre code { background: none; border: none; padding: 0; font-size: inherit; color: inherit; }

/* ============================================================
   POST PAGE
   ============================================================ */
.post-page { padding-top: 2rem; }
.post-meta-top { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; }
.back-link { font-size: 0.875rem; color: var(--muted); }
.back-link:hover { color: var(--text); text-decoration: none; }
.post-page h1 { font-size: clamp(1.4rem, 4vw, 1.9rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; margin-bottom: 2rem; }

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  border-top: 1px solid var(--border);
  margin-top: auto;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .nav-links { gap: 0.75rem; }
  .nav-links a { font-size: 0.8rem; }
  .post-grid { grid-template-columns: 1fr; }
  .project-card-header { flex-direction: column; gap: 0.25rem; }
}
