/*
 * rpots.net - Terminal-Inspired Minimalist Design
 * Pure CSS. No frameworks. Modern features.
 *
 * Design Philosophy:
 * - Monospace typography for that developer feel
 * - High contrast, easy on the eyes
 * - Subtle animations that don't distract
 * - Mobile-first, naturally responsive
 */

/* === CSS Custom Properties === */
:root {
  /* Colors - Dark Theme */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --success: #3fb950;
  --border: #30363d;

  /* Typography */
  --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', Consolas, monospace;
  --font-size-base: clamp(0.95rem, 2.5vw, 1.05rem);
  --line-height: 1.7;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 4rem;

  /* Layout */
  --max-width: 48rem;
  --content-padding: clamp(1rem, 5vw, 2rem);

  /* Effects */
  --transition: 150ms ease;
  --glow: 0 0 20px rgba(88, 166, 255, 0.15);
}

/* Light theme */
@media (prefers-color-scheme: light) {
  :root {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-tertiary: #eaeef2;
    --text-primary: #1f2328;
    --text-secondary: #59636e;
    --text-muted: #8c959f;
    --accent: #0969da;
    --accent-hover: #0550ae;
    --border: #d1d9e0;
    --glow: 0 0 20px rgba(9, 105, 218, 0.1);
  }
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }
h4, h5, h6 { font-size: 1rem; }

h1::before { content: '# '; color: var(--text-muted); }
h2::before { content: '## '; color: var(--text-muted); }
h3::before { content: '### '; color: var(--text-muted); }

p {
  margin-bottom: var(--space-md);
}

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

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

strong { color: var(--text-primary); }
em { font-style: italic; }

/* === Layout === */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--content-padding);
}

header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: var(--space-md) 0;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
}

.logo::before {
  content: '> ';
  color: var(--success);
}

.logo:hover {
  color: var(--accent);
  text-decoration: none;
}

nav {
  display: flex;
  gap: var(--space-md);
}

nav a {
  color: var(--text-secondary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: 4px;
  transition: all var(--transition);
}

nav a:hover {
  color: var(--accent);
  background: var(--bg-tertiary);
  text-decoration: none;
}

main {
  flex: 1;
  padding: var(--space-xl) 0;
}

footer {
  border-top: 1px solid var(--border);
  padding: var(--space-lg) 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

/* === Article Content === */
article {
  max-width: 100%;
}

article > *:first-child {
  margin-top: 0;
}

article ul, article ol {
  margin: var(--space-md) 0;
  padding-left: var(--space-lg);
}

article li {
  margin-bottom: var(--space-sm);
}

article li::marker {
  color: var(--text-muted);
}

article img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: var(--space-md) 0;
}

/* === Code === */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-tertiary);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: var(--space-md);
  overflow-x: auto;
  margin: var(--space-md) 0;
  position: relative;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Syntax highlighting via class */
pre code.language-python::before,
pre code.language-py::before { content: '# python\A'; color: var(--text-muted); }
pre code.language-javascript::before,
pre code.language-js::before { content: '// javascript\A'; color: var(--text-muted); }
pre code.language-bash::before,
pre code.language-sh::before { content: '# bash\A'; color: var(--text-muted); }

/* === Blockquote === */
blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-md);
  margin: var(--space-md) 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* === Horizontal Rule === */
hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: var(--space-xl) 0;
}

/* === Blog List === */
.post-preview {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: var(--space-xs) var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}

.post-preview:last-child {
  border-bottom: none;
}

.post-preview time {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.post-preview a {
  font-weight: 500;
}

.post-preview p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* === Page Header === */
.page-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  margin: 0 0 var(--space-sm) 0;
}

.page-header time {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.page-header p {
  color: var(--text-secondary);
  margin-top: var(--space-sm);
}

/* === Resume Specific === */
.resume-section {
  margin-bottom: var(--space-xl);
}

.experience-item {
  margin-bottom: var(--space-lg);
  padding-left: var(--space-md);
  border-left: 2px solid var(--border);
}

.experience-item:hover {
  border-left-color: var(--accent);
}

.experience-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.experience-header h3 {
  margin: 0;
}

.experience-header time {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* === Terminal Cursor Animation === */
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.cursor::after {
  content: '_';
  animation: blink 1s step-end infinite;
  color: var(--accent);
}

/* === Skill Tags === */
.skills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin: var(--space-md) 0;
}

.skill {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: 4px;
  font-size: 0.8rem;
}

/* === Utilities === */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* === Print Styles === */
@media print {
  :root {
    --bg-primary: white;
    --text-primary: black;
    --text-secondary: #333;
  }

  header, footer, nav { display: none; }

  main { padding: 0; }

  a { color: inherit; }
  a[href]::after { content: ' (' attr(href) ')'; font-size: 0.8em; }

  pre { border: 1px solid #ddd; }
}

/* === Responsive === */
@media (max-width: 640px) {
  header .container {
    flex-direction: column;
    align-items: flex-start;
  }

  nav {
    width: 100%;
    overflow-x: auto;
  }

  .post-preview {
    grid-template-columns: 1fr;
  }

  .post-preview time {
    order: 1;
  }

  .experience-header {
    flex-direction: column;
  }
}
