/* ==========================================================================
   V-Pulse — Neon Pulse theme for Starlight CMS
   Cyber-Minimalism: true-black surfaces, electric violet accents,
   glassmorphism panels, monospaced metadata.
   Based on the Stitch "Neon Pulse" design system.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Self-hosted fonts (latin subset, variable weight)
   Japanese glyphs fall back to system fonts.
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/plus-jakarta-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/hanken-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

/* --------------------------------------------------------------------------
   Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* Surfaces */
  --background: #131314;
  --surface-deep: #080809;
  --surface-container-lowest: #0e0e0f;
  --surface-container: #201f20;
  --surface-container-high: #2a2a2b;
  --surface-glass: rgba(255, 255, 255, 0.04);

  /* Text */
  --on-surface: #e5e2e3;
  --on-surface-variant: #cdc3d0;
  --neon-text: #f9f6ff;

  /* Accents */
  --primary: #e3bcff;
  --on-primary: #42205d;
  --secondary: #a9c7ff;
  --tertiary: #42e76d;

  /* Lines */
  --border-muted: #333333;
  --outline-variant: #4b444e;

  /* Type */
  --font-head: "Plus Jakarta Sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  --font-body: "Hanken Grotesk", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Layout */
  --container-max: 1280px;
  --gutter: 24px;
  --section-gap: 80px;

  /* Shape */
  --radius-sm: 4px;
  --radius-lg: 8px;

  /* Effects */
  --glow-primary: 0 0 12px rgba(227, 188, 255, 0.2);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--background);
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(227, 188, 255, 0.3);
  color: var(--neon-text);
}

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

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

img {
  max-width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   Live dot (ping animation)
   -------------------------------------------------------------------------- */
.live-dot {
  width: 8px;
  height: 8px;
  background-color: var(--tertiary);
  border-radius: 50%;
  display: inline-block;
  position: relative;
  margin-right: 10px;
  vertical-align: middle;
}

.live-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background-color: var(--tertiary);
  opacity: 0.4;
  animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
  75%, 100% { transform: scale(2.5); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot::after { animation: none; }
  html { scroll-behavior: auto; }
}

/* --------------------------------------------------------------------------
   Site header (fixed glass bar)
   -------------------------------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 50;
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-muted);
}

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

.site-title {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--primary);
  text-shadow: 0 0 16px rgba(227, 188, 255, 0.35);
}

.site-title:hover {
  color: var(--neon-text);
}

.site-header-status {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tertiary);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Main container
   -------------------------------------------------------------------------- */
.main {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 128px var(--gutter) var(--section-gap);
  min-height: 60vh;
}

/* --------------------------------------------------------------------------
   Home: hero
   -------------------------------------------------------------------------- */
.home-header {
  margin-bottom: 64px;
}

.home-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tertiary);
  margin: 0 0 16px;
}

.home-title {
  font-family: var(--font-head);
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  color: var(--neon-text);
  background: linear-gradient(100deg, var(--neon-text) 30%, var(--primary) 75%, var(--secondary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.home-description {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  color: var(--on-surface-variant);
  max-width: 640px;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Home: article card grid
   -------------------------------------------------------------------------- */
.post-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gutter);
}

@media (max-width: 1024px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .post-grid { grid-template-columns: 1fr; }
}

.post-card {
  display: flex;
}

.post-card-link {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 32px 24px;
  background: var(--surface-glass);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.post-card-link:hover {
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
  transform: translateY(-2px);
}

.post-card-date {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tertiary);
  margin-bottom: 16px;
}

.post-card-title {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--on-surface);
  margin-bottom: 16px;
  transition: color 0.3s ease;
}

.post-card-link:hover .post-card-title {
  color: var(--primary);
}

.post-card-description {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--on-surface-variant);
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-more {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   Post: header
   -------------------------------------------------------------------------- */
.post {
  max-width: 760px;
  margin: 0 auto;
}

.breadcrumb {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--on-surface-variant);
  margin-bottom: 32px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb a {
  color: var(--primary);
}

.breadcrumb a:hover {
  color: var(--neon-text);
}

.breadcrumb-sep {
  margin: 0 8px;
  color: var(--outline-variant);
}

.post-title {
  font-family: var(--font-head);
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--neon-text);
  margin: 0 0 24px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-muted);
  margin: 0 0 48px;
}

.post-meta-sep {
  color: var(--tertiary);
}

/* --------------------------------------------------------------------------
   Post: body (rendered Markdown)
   -------------------------------------------------------------------------- */
.post-body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.9;
  color: var(--on-surface-variant);
}

.post-body > p:first-child {
  font-size: 19px;
  color: var(--on-surface);
}

.post-body h2,
.post-body h3,
.post-body h4 {
  font-family: var(--font-head);
  color: var(--neon-text);
  line-height: 1.4;
  margin: 3em 0 1em;
}

.post-body h2 {
  font-size: 26px;
  font-weight: 700;
  padding-left: 16px;
  border-left: 3px solid var(--primary);
}

.post-body h3 {
  font-size: 21px;
  font-weight: 600;
}

.post-body h4 {
  font-size: 18px;
  font-weight: 600;
}

.post-body a {
  color: var(--secondary);
  border-bottom: 1px solid rgba(169, 199, 255, 0.35);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.post-body a:hover {
  color: var(--neon-text);
  border-bottom-color: var(--secondary);
}

.post-body strong {
  color: var(--on-surface);
}

.post-body blockquote {
  margin: 3em 0;
  padding: 16px 0 16px 32px;
  border-left: 4px solid var(--primary);
}

.post-body blockquote p {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 600;
  font-style: italic;
  line-height: 1.5;
  color: var(--primary);
  margin: 0;
}

.post-body ul,
.post-body ol {
  padding-left: 1.5em;
  margin: 1.5em 0;
}

.post-body li {
  margin: 0.5em 0;
}

.post-body li::marker {
  color: var(--primary);
}

.post-body img {
  display: block;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
  margin: 3em auto;
}

.post-body figure {
  margin: 3em 0;
}

.post-body figure img {
  margin: 0;
}

.post-body figcaption {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  font-style: italic;
  text-align: center;
  color: var(--on-surface-variant);
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface-container);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  color: var(--tertiary);
}

.post-body pre {
  background: var(--surface-container-lowest);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
  padding: 24px;
  overflow-x: auto;
  margin: 2em 0;
}

.post-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--on-surface);
  font-size: 14px;
  line-height: 1.7;
}

.post-body hr {
  border: none;
  height: 1px;
  background: var(--border-muted);
  margin: 4em 0;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 2em 0;
  font-size: 15px;
  display: block;
  overflow-x: auto;
}

.post-body th,
.post-body td {
  border: 1px solid var(--border-muted);
  padding: 10px 16px;
  text-align: left;
}

.post-body th {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--surface-container-lowest);
}

/* --------------------------------------------------------------------------
   Post: footer / back link
   -------------------------------------------------------------------------- */
.post-footer {
  margin-top: var(--section-gap);
  padding-top: 32px;
  border-top: 1px solid var(--border-muted);
}

.back-link {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--on-surface);
  background: var(--surface-glass);
  border: 1px solid var(--border-muted);
  border-radius: 9999px;
  padding: 14px 32px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}

.back-link:hover {
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   Site footer
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--surface-deep);
  border-top: 1px solid var(--border-muted);
}

.site-footer-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 64px var(--gutter) 32px;
}

.site-footer-name {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 16px;
}

.site-footer-description {
  font-family: var(--font-body);
  color: var(--on-surface-variant);
  max-width: 400px;
  margin: 0;
}

.site-footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.site-footer-copy,
.site-footer-signal {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  margin: 0;
}

.site-footer-signal span {
  color: var(--tertiary);
}

/* --------------------------------------------------------------------------
   Mobile adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  :root {
    --gutter: 16px;
    --section-gap: 48px;
  }

  .main {
    padding-top: 104px;
  }

  .home-header {
    margin-bottom: 48px;
  }

  .post-card-link {
    padding: 24px 20px;
  }

  .post-body {
    font-size: 16px;
  }
}
