/* ============================================================
   Anatoly Volkhover — Personal Website
   Single stylesheet · All colors in :root · Mobile-first
   ============================================================ */

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  --bg-primary:       #0a0f1a;
  --bg-secondary:     #0d1424;
  --bg-card:          #111a2e;
  --bg-card-hover:    #162040;
  --grid-line:        rgba(40,80,160,0.08);
  --grid-line-major:  rgba(40,80,160,0.15);
  --accent:           #3b82f6;
  --accent-dim:       rgba(59,130,246,0.12);
  --accent-glow:      rgba(59,130,246,0.25);
  --text-primary:     #e2e8f0;
  --text-secondary:   #94a3b8;
  --text-muted:       #64748b;
  --border:           rgba(59,130,246,0.20);
  --border-subtle:    rgba(59,130,246,0.10);
  --button-bg:        #3b82f6;
  --button-fg:        #ffffff;
  --button-outline-fg:#3b82f6;
  --nav-active:       #3b82f6;
  --nav-hover:        rgba(59,130,246,0.40);
  --signature-color:  #94a3b8;
  --brands-text:      #64748b;
  --footer-text:      #475569;
  --max-width:        960px;
  --font-sans:        'Fira Code', monospace;
  --font-mono:        'Fira Code', monospace;
}

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

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
  background-color: var(--bg-primary);
  background-image: url('assets/bg-03-network-topology.svg');
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
  background-repeat: no-repeat;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Skip to content (accessibility) */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--accent);
  color: var(--button-fg);
  padding: 8px 16px;
  z-index: 1000;
  font-size: 14px;
}
.skip-link:focus {
  top: 0;
}

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 28px; margin-bottom: 12px; }
h2 { font-size: 22px; margin-bottom: 10px; }
h3 { font-size: 18px; margin-bottom: 8px; }

p { margin-bottom: 16px; }

/* Terminal prompt ornament in page headings */
.prompt {
  color: var(--text-muted);
  font-weight: 400;
}
.cmd {
  color: var(--text-muted);
  font-weight: 400;
}

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

strong { color: var(--text-primary); }

/* ── Layout ────────────────────────────────────────────────── */
main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 20px 48px;
  overflow: hidden;
}

.content-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Header ────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(10,15,26,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  white-space: nowrap;
}

.site-logo {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}
.site-logo:hover {
  color: var(--accent);
  text-decoration: none;
}
.logo-prefix {
  color: var(--text-muted);
  font-weight: 400;
}

/* Desktop nav */
.main-nav {
  display: none;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 10px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
  cursor: pointer;
}
.nav-link::before {
  content: "/";
  color: var(--text-muted);
  font-weight: 300;
}
.nav-link:hover {
  color: var(--text-primary);
  border-bottom-color: transparent;
  text-decoration: none;
}
.nav-link.active {
  color: #ffffff;
  font-weight: 600;
  background: rgba(100,116,139,0.5);
  border-bottom-color: transparent;
  padding: 5px 10px;
}
.nav-link.active::before {
  content: "[/";
  color: rgba(255,255,255,0.6);
}
.nav-link.active::after {
  content: "]";
  color: rgba(255,255,255,0.6);
}

/* Hamburger button */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  gap: 5px;
  padding: 10px;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
}

/* Mobile overlay nav */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  z-index: 100;
  display: none;
  flex-direction: column;
  padding: 20px;
}
.mobile-nav-overlay.open {
  display: flex;
}

.mobile-nav-close {
  align-self: flex-end;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.mobile-nav-link {
  display: block;
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 14px 16px;
  min-height: 52px;
  display: flex;
  align-items: center;
  border-left: none;
  cursor: pointer;
}
.mobile-nav-link::before {
  content: "/";
  color: var(--text-muted);
  font-weight: 300;
  margin-right: 2px;
}
.mobile-nav-link:hover {
  color: var(--text-primary);
  text-decoration: none;
}
.mobile-nav-link.active {
  color: #ffffff;
  font-weight: 600;
  background: rgba(100,116,139,0.5);
}
.mobile-nav-link.active::before {
  content: "[/";
  color: rgba(255,255,255,0.6);
}
.mobile-nav-link.active::after {
  content: "]";
  color: rgba(255,255,255,0.6);
}

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  border-top: none;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px 24px;
  text-align: left;
}

.site-footer p {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--footer-text);
  margin: 0;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
  padding: 10px 16px;
  border-radius: 0;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
  color: var(--text-primary);
  background: rgba(100,116,139,0.2);
}
.btn::before {
  content: "% ";
  color: var(--text-muted);
  font-weight: 300;
  white-space: pre;
}
.btn::after {
  content: "▊";
  color: #ffffff;
  margin-left: 6px;
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}
.btn:hover {
  background: rgba(100,116,139,0.35);
  color: #fff;
  text-decoration: none;
}

.btn-primary {
  /* inherits terminal style from .btn */
}
.btn-primary:hover {
  /* inherits from .btn:hover */
}

.btn-outline {
  background: transparent;
}
.btn-outline:hover {
  background: rgba(100,116,139,0.2);
}

/* ── Homepage Hero ─────────────────────────────────────────── */
.hero-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.hero-title::before {
  content: "% ";
  color: var(--text-muted);
  font-weight: 400;
}

.hero-tagline {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--accent);
  margin-bottom: 24px;
  letter-spacing: 0.02em;
}
.hero-tagline::before {
  content: "// ";
  color: var(--text-muted);
}

.hero-photo {
  width: 200px;
  height: auto;
  border-radius: 0;
  border: none;
}

/* Mobile: photo left-aligned */
.hero-photo-wrap {
  text-align: left;
  margin-bottom: 24px;
}

.hero-signature {
  display: block;
  width: 180px;
  margin: 24px 0;
}

.hero-brands {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--brands-text);
  margin-top: 24px;
  line-height: 1.8;
}

/* Homepage link sections */
.home-links-external {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0;
}

.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: 0;
  padding: 6px 0;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
}
.pill-link::before {
  content: "[";
  color: var(--text-muted);
}
.pill-link::after {
  content: "]";
  color: var(--text-muted);
}
.pill-link:hover {
  color: var(--text-primary);
  background: none;
  text-decoration: none;
}
.pill-link svg {
  display: none;
}

.home-links-internal {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 16px 0;
}
.home-links-internal a {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}
.home-links-internal a:hover {
  text-decoration: underline;
}

/* ── Blog listing ──────────────────────────────────────────── */
.blog-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.blog-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s;
}
.blog-item:hover {
  text-decoration: none;
}
.blog-item:hover .blog-title {
  color: var(--accent);
}

.blog-date {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.blog-date::before {
  content: "» ";
  color: var(--accent);
}

.blog-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  transition: color 0.2s;
}

/* ── Blog Post ─────────────────────────────────────────────── */
.post-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 24px;
  cursor: pointer;
}
.post-back:hover { text-decoration: underline; }

/* Terminal prompt on the first paragraph of each blog post */
.post-body p:first-child::before {
  content: "";
  color: var(--accent);
  font-weight: 500;
}

.post-meta {
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.post-body {
  margin-top: 24px;
}
.post-body p {
  margin-bottom: 16px;
  color: var(--text-secondary);
  line-height: 1.8;
}
.post-body h2 {
  margin-top: 32px;
  margin-bottom: 12px;
}
.post-body h3 {
  margin-top: 24px;
  margin-bottom: 8px;
}
.post-body ul, .post-body ol {
  margin: 0 0 16px 24px;
  color: var(--text-secondary);
}
.post-body li {
  margin-bottom: 6px;
}
.post-body pre {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 16px;
}
.post-body code {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-primary);
}
.post-body p code {
  background: var(--accent-dim);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 14px;
}
.post-body em {
  color: var(--text-primary);
  font-style: italic;
}
.post-body strong {
  color: var(--text-primary);
}
.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--text-secondary);
  font-style: italic;
}

.video-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  padding-bottom: 56.25%;
  margin-bottom: 24px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.video-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-fallback {
  font-family: var(--font-mono);
  font-size: 13px;
  margin-top: -16px;
  margin-bottom: 24px;
}

/* ── Books ─────────────────────────────────────────────────── */
.book-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 24px;
}

.book-cover {
  width: 100%;
  max-width: 200px;
  height: auto;
  border-radius: 0;
  border: none;
  align-self: flex-start;
}

.book-info h2 {
  margin-bottom: 8px;
}
.book-info p {
  color: var(--text-secondary);
}
.book-info .btn {
  margin-top: 12px;
}

/* ── Contact ───────────────────────────────────────────────── */
.contact-section {
  text-align: left;
  padding: 0;
}

.contact-section h1 {
  margin-bottom: 12px;
}

.contact-section p {
  color: var(--text-secondary);
}

/* ── Placeholder pages ─────────────────────────────────────── */
.placeholder-section {
  text-align: left;
  padding: 0;
}

.placeholder-section h1 {
  margin-bottom: 12px;
}

.placeholder-section p {
  color: var(--text-secondary);
}

/* ════════════════════════════════════════════════════════════
   TIER 2: Tablet / Small Desktop  (600px – 960px)
   ════════════════════════════════════════════════════════════ */
@media (min-width: 600px) {
  /* Show full nav, hide hamburger */
  .main-nav { display: flex; }
  .hamburger { display: none; }

  .nav-link { font-size: 11px; padding: 6px 8px; }
  .site-logo { font-size: 14px; }

  /* Hero photo: float right */
  .hero-photo-wrap {
    float: right;
    margin: 0 0 16px 24px;
    text-align: right;
  }
  .hero-photo {
    width: 180px;
  }

  /* Blog listing: inline date + title */
  .blog-item {
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
  }
  .blog-date {
    padding-top: 2px; /* align with first line of title */
  }

  /* Books: horizontal layout */
  .book-card {
    flex-direction: row;
    align-items: flex-start;
  }
  .book-cover {
    align-self: flex-start;
    flex-shrink: 0;
    width: 160px;
  }
}

/* ════════════════════════════════════════════════════════════
   TIER 3: Desktop  (961px+)
   ════════════════════════════════════════════════════════════ */
@media (min-width: 961px) {
  .nav-link { font-size: 13px; padding: 6px 10px; }
  .site-logo { font-size: 15px; }

  h1 { font-size: 32px; }
  h2 { font-size: 24px; }

  .hero-photo {
    width: 220px;
  }

  .book-cover {
    width: 200px;
  }
}

/* ── Utilities ─────────────────────────────────────────────── */
.clearfix::after {
  content: '';
  display: table;
  clear: both;
}

/* Images lazy-load */
img[loading="lazy"] {
  opacity: 1;
}

/* Print: remove background */
@media print {
  body {
    background: #fff;
    color: #000;
  }
  .site-header, .site-footer { display: none; }
}
