/* Pulse — styled to match portoweeb dark hacker aesthetic */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #090a0c;
  --panel: #101217;
  --panel-fill: #14161c;
  --ink: #f2f4f7;
  --ink-strong: rgba(255, 255, 255, 0.96);
  --muted: rgba(242, 244, 247, 0.45);
  --muted-strong: rgba(255, 255, 255, 0.65);
  --line: rgba(255, 255, 255, 0.07);
  --accent: #6ee7b7;
  --accent-dim: rgba(110, 231, 183, 0.15);
  --yellow: #e3d525;
  --glow: rgba(110, 231, 183, 0.08);
  --radius: 14px;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-heading: 'Space Grotesk', sans-serif;
  --max-width: 720px;
}

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

html {
  font-size: 16px;
  color-scheme: dark;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-mono);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scanline overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  opacity: 0.4;
}

/* Vignette overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(0, 0, 0, 0.5) 100%
  );
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink-strong);
  margin: 1.5em 0 0.5em;
}

h1 { font-size: 2rem; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1.2em; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}
a:hover { opacity: 0.7; }

img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

figure {
  margin: 1.5em 0;
}

figure img {
  display: block;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

figcaption {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.5em;
}

blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5em 1em;
  margin: 1.5em 0;
  color: var(--muted-strong);
  background: var(--glow);
  border-radius: 0 var(--radius) var(--radius) 0;
}

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2em 0;
}

code {
  font-family: var(--font-mono);
  background: var(--panel);
  padding: 0.15em 0.4em;
  border-radius: 6px;
  font-size: 0.85em;
  border: 1px solid var(--line);
}

pre {
  background: var(--panel);
  padding: 1em;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow-x: auto;
  margin: 1.5em 0;
}

pre code {
  background: none;
  padding: 0;
  border: none;
}

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

/* Header */
.site-header {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
  position: relative;
}

.site-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.06), transparent);
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--ink-strong);
  letter-spacing: -0.5px;
}

.site-nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.site-nav a {
  font-size: 0.75rem;
  color: var(--muted);
  transition: color 0.2s;
}

.site-nav a:hover {
  color: var(--ink);
  opacity: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.6em 1.2em;
  border-radius: 10px;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.btn-primary {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(110, 231, 183, 0.2);
}

.btn-primary:hover {
  background: rgba(110, 231, 183, 0.25);
  color: var(--accent);
  opacity: 1;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted-strong);
  border-color: var(--line);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  opacity: 1;
}

/* Article header */
.article-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.article-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.06), transparent);
}

.article-meta {
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.article-meta a {
  color: var(--muted);
}

.article-meta a:hover {
  color: var(--accent);
  opacity: 1;
}

.article-title {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--ink-strong);
}

.article-content {
  font-size: 0.9rem;
  line-height: 1.8;
}

.article-content h2 {
  margin-top: 2.5em;
  font-size: 1.4rem;
  padding-bottom: 0.5em;
  border-bottom: 1px solid var(--line);
}

.article-content h3 {
  margin-top: 2em;
  font-size: 1.15rem;
}

.article-content img {
  margin: 1.5em 0;
  border: 1px solid var(--line);
}

.article-content ul, .article-content ol {
  margin: 1em 0;
  padding-left: 1.5em;
}

.article-content li {
  margin-bottom: 0.5em;
}

/* Footer */
.site-footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  position: relative;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.06), transparent);
}

.site-footer a {
  color: var(--muted-strong);
}

.site-footer a:hover {
  color: var(--accent);
  opacity: 1;
}

/* Home page */
.hero {
  text-align: center;
  padding: 3rem 0;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 0.5em;
  color: var(--ink-strong);
}

.hero p {
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 500px;
  margin: 0 auto 1.5em;
}

/* Article list */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 2rem 0;
}

.article-card {
  display: flex;
  gap: 1.5rem;
  padding: 1.25rem;
  background: var(--panel-fill);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: all 0.2s;
  text-decoration: none;
  color: var(--ink);
  position: relative;
  overflow: hidden;
}

.article-card::before {
  content: '';
  position: absolute;
  inset-x: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.06), transparent);
}

.article-card:hover {
  border-color: rgba(110, 231, 183, 0.3);
  background: rgba(110, 231, 183, 0.03);
  transform: translateY(-2px);
  color: var(--ink);
  opacity: 1;
}

.article-card-image {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  border: 1px solid var(--line);
}

.article-card-content {
  flex: 1;
  min-width: 0;
}

.article-card-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.3em;
  line-height: 1.3;
  color: var(--ink-strong);
}

.article-card-excerpt {
  font-size: 0.8rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-meta {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.5em;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Editor */
.editor-container {
  max-width: 800px;
  margin: 0 auto;
}

.editor-header {
  margin-bottom: 2rem;
}

.editor-title-input {
  width: 100%;
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  border: none;
  outline: none;
  padding: 0.5em 0;
  background: transparent;
  color: var(--ink-strong);
  letter-spacing: -0.5px;
}

.editor-title-input::placeholder {
  color: rgba(255, 255, 255, 0.15);
}

.editor-toolbar {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted-strong);
  font-size: 0.85rem;
  transition: all 0.15s;
}

.toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
}

.toolbar-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.toolbar-separator {
  width: 1px;
  background: var(--line);
  margin: 0 0.25rem;
}

.editor-content {
  min-height: 400px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  font-size: 0.9rem;
  line-height: 1.8;
  background: var(--panel-fill);
  color: var(--ink);
}

.editor-content:focus {
  border-color: rgba(110, 231, 183, 0.3);
  box-shadow: 0 0 0 3px rgba(110, 231, 183, 0.08);
}

.editor-content:empty::before {
  content: "Start writing your story...";
  color: rgba(255, 255, 255, 0.15);
  pointer-events: none;
}

.editor-content figure {
  margin: 1em 0;
  text-align: center;
}

.editor-content figure img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.editor-meta {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.meta-field {
  flex: 1;
}

.meta-field label {
  display: block;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.4em;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.meta-field input {
  width: 100%;
  padding: 0.6em 0.8em;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.2s;
  background: var(--panel);
  color: var(--ink);
}

.meta-field input:focus {
  border-color: rgba(110, 231, 183, 0.3);
}

.editor-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  justify-content: flex-end;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--panel);
  color: var(--accent);
  padding: 0.8em 1.2em;
  border-radius: var(--radius);
  font-size: 0.8rem;
  border: 1px solid rgba(110, 231, 183, 0.3);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  letter-spacing: 0.03em;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Loading overlay */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(9, 10, 12, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.loading.show {
  opacity: 1;
  pointer-events: all;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
  html { font-size: 15px; }

  .container { padding: 0 1rem; }

  .article-card {
    flex-direction: column;
    gap: 1rem;
  }

  .article-card-image {
    width: 100%;
    height: 160px;
  }

  .hero h1 { font-size: 2rem; }
  .article-title { font-size: 1.8rem; }

  .editor-meta {
    flex-direction: column;
    gap: 0.75rem;
  }

  .editor-actions {
    flex-direction: column;
  }

  .editor-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Print styles */
@media print {
  .site-header, .site-footer, .site-nav { display: none; }
  body { font-size: 12pt; background: white; color: black; }
  body::before, body::after { display: none; }
  .article-content img { max-width: 100%; }
}
