/*
 * XtremWeb Journal - Custom Design System
 * Bespoke layout for Distributed Systems & Web Architecture
 */

:root {
  --font-sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
  
  /* Color Palette */
  --bg-primary: #fcfbfa;      /* Off-white paper */
  --bg-secondary: #f4f3f0;    /* Warm gray blueprint card */
  --bg-dark: #12141c;         /* Sleek terminal dark */
  --text-primary: #1c1e24;    /* Charcoal black */
  --text-secondary: #585d6b;  /* Slate gray */
  --text-muted: #848a9c;      /* Muted gray */
  --accent: #1e40af;          /* Blueprint blue */
  --accent-light: #3b82f6;    /* Mathematical blue */
  --accent-hover: #1d4ed8;
  --border: rgba(28, 30, 36, 0.1); /* Crisp thin grid lines */
  --border-dark: rgba(255, 255, 255, 0.1);
  --success: #10b981;
  --warning: #f59e0b;
  
  /* Layout constraints */
  --max-width: 1120px;
  --header-height: 64px;
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
}

body, h1, h2, h3, h4, p, ul, ol, dl, figure {
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* Base Typography */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: 2.25rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.5rem; margin-top: 2rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
h3 { font-size: 1.25rem; margin-top: 1.5rem; margin-bottom: 0.75rem; }
h4 { font-size: 1rem; margin-top: 1.25rem; margin-bottom: 0.5rem; }

p {
  margin-bottom: 1.25rem;
  font-size: 1.05rem;
  color: var(--text-secondary);
}

a {
  color: var(--accent-light);
  text-decoration: none;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

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

/* Layout Framework */
.container {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* Masthead Navigation */
.masthead {
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background-color: rgba(252, 251, 250, 0.9);
}

.masthead .container {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.05em;
}

.brand::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  background-color: var(--accent-light);
  border-radius: 50%;
  animation: pulse-dot 2s infinite ease-in-out;
}

.brand:hover {
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1.75rem;
  list-style: none;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  text-decoration: none;
  border-bottom-color: var(--accent-light);
}

/* Main Section Styling */
main {
  padding-top: 3rem;
  padding-bottom: 4rem;
}

/* Hero Masthead */
.hero-masthead {
  border: 1px solid var(--border);
  padding: 3rem 2rem;
  background-color: var(--bg-secondary);
  position: relative;
  overflow: hidden;
  margin-bottom: 3rem;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: center;
}

@media (max-width: 768px) {
  .hero-masthead {
    grid-template-columns: 1fr;
    padding: 2rem 1.25rem;
  }
}

.hero-info h1 {
  font-size: 2.25rem;
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: 1rem;
}

.hero-info p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.hero-button {
  text-align: center;
  display: inline-block;
  width: auto;
  font-size: 0.8rem;
  text-decoration: none;
}

.hero-link,
.sidebar-link {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-primary);
}

.hero-link {
  display: inline-flex;
  align-items: center;
}

.hero-graphics {
  border-left: 1px solid var(--border);
  padding-left: 1.5rem;
}

.hero-graphics-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  margin-top: 0;
  color: var(--text-muted);
  margin-bottom: 1rem;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background-color: rgba(30, 64, 175, 0.1);
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(30, 64, 175, 0.2);
  margin-bottom: 1rem;
}

/* Grid Topologies Animation (SVG) */
.topo-svg {
  width: 100%;
  height: auto;
  max-height: 240px;
}

.topo-node {
  fill: var(--bg-primary);
  stroke: var(--text-primary);
  stroke-width: 2;
  transition: all 0.3s ease;
}

.topo-node:hover {
  fill: var(--accent-light);
  stroke: var(--accent);
  cursor: pointer;
}

.topo-node.coord {
  fill: var(--accent);
  stroke: var(--bg-primary);
}

.topo-line {
  stroke: var(--text-muted);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.topo-line.active {
  stroke: var(--accent-light);
  animation: stroke-pulse 2s infinite linear;
}

.topo-text {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-secondary);
  font-weight: 600;
}

/* Home Section Layouts */
.home-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
}

.home-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

@media (max-width: 768px) {
  .masthead {
    height: auto;
    padding: 0.9rem 0;
  }

  .masthead .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .nav-links {
    gap: 0.9rem;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .home-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .hero-graphics {
    border-left: 0;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 1.5rem;
  }
}

/* Article Lists */
.section-title-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--text-primary);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-primary);
}

.article-row {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0;
  display: flex;
  flex-direction: column;
}

.article-row:last-child {
  border-bottom: none;
}

.article-row .meta-row {
  display: flex;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.article-row h3 {
  font-size: 1.2rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.article-row h3 a {
  color: var(--text-primary);
}

.article-row h3 a:hover {
  color: var(--accent-light);
  text-decoration: none;
}

.article-row p {
  font-size: 0.95rem;
  margin-bottom: 0;
  line-height: 1.5;
}

/* Research Highlight Box */
.research-highlight-box {
  border: 1px solid var(--border);
  padding: 1.5rem;
  background-color: var(--bg-primary);
  margin-bottom: 1.5rem;
}

.research-highlight-box h3 {
  margin-top: 0;
  font-size: 1.15rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.research-highlight-box p {
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.lab-status-list {
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.lab-status-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--border);
}

.lab-status-list li:last-child {
  border-bottom: none;
}

.status-value {
  color: var(--accent-light);
  font-weight: 700;
}

/* Technical Details Header inside Single Article Page */
.doc-header-card {
  border: 1px solid var(--border);
  background-color: var(--bg-secondary);
  padding: 1.5rem;
  margin-bottom: 2rem;
  font-family: var(--font-mono);
}

.doc-header-title {
  font-size: 1.85rem;
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.doc-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.doc-meta-item {
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
}

.doc-meta-label {
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.doc-meta-value {
  color: var(--text-primary);
  font-weight: 700;
}

/* Forms & Inputs */
.contact-form {
  border: 1px solid var(--border);
  padding: 2rem;
  background-color: var(--bg-secondary);
  margin-top: 2rem;
}

.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-primary);
}

.form-group input,
.form-group textarea {
  font-family: var(--font-sans);
  padding: 0.75rem;
  border: 1px solid var(--border);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.submit-btn {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  background-color: var(--accent);
  color: #ffffff;
  border: none;
  padding: 0.85rem 1.5rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
  width: 100%;
}

.submit-btn:hover {
  background-color: var(--accent-hover);
  color: #ffffff;
  text-decoration: none;
}

.submit-btn:focus-visible,
.nav-links a:focus-visible,
.hero-link:focus-visible,
.sidebar-link:focus-visible,
.brand:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.35);
  outline-offset: 3px;
}

/* Content Markup Styling */
.markup-content {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.7;
}

.markup-content h2,
.markup-content h3,
.markup-content h4 {
  color: var(--text-primary);
  margin-top: 2rem;
}

.markup-content p {
  margin-bottom: 1.5rem;
}

.markup-content ul,
.markup-content ol {
  margin-bottom: 1.5rem;
  padding-left: 2rem;
}

.markup-content li {
  margin-bottom: 0.5rem;
}

.markup-content blockquote {
  border-left: 4px solid var(--accent-light);
  background-color: var(--bg-secondary);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
}

.markup-content blockquote p {
  margin-bottom: 0;
  color: var(--text-primary);
}

.markup-content pre {
  background-color: var(--bg-dark);
  color: #f8f8f2;
  padding: 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  border-radius: 0;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.markup-content code {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  background-color: var(--bg-secondary);
  color: var(--accent);
  padding: 0.15rem 0.35rem;
}

.markup-content pre code {
  background-color: transparent;
  color: inherit;
  padding: 0;
}

.markup-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.75rem;
  font-size: 0.95rem;
}

.markup-content th,
.markup-content td {
  border: 1px solid var(--border);
  padding: 0.75rem;
  text-align: left;
}

.markup-content th {
  background-color: var(--bg-secondary);
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}

/* Footer Section */
footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0;
  background-color: var(--bg-secondary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

footer .container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

footer h4 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 1rem;
  margin-top: 0;
}

footer ul {
  list-style: none;
}

footer ul li {
  margin-bottom: 0.5rem;
}

footer ul a {
  color: var(--text-muted);
}

footer ul a:hover {
  color: var(--text-primary);
}

.footer-bottom {
  grid-column: 1 / -1;
  border-top: 1px dashed var(--border);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Animations */
@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 10px rgba(59, 130, 246, 0.5); }
  100% { transform: scale(0.9); opacity: 0.6; }
}

@keyframes stroke-pulse {
  0% { stroke-dashoffset: 24; }
  100% { stroke-dashoffset: 0; }
}
