/* ============================================================
   KWY_ — smart contract auditor portfolio
   Aesthetic: audit terminal. Near-black, radioactive lime,
   severity-coded data, mono labels, Unbounded display type.
   ============================================================ */

:root {
  --bg: #060906;
  --bg-panel: #0b100b;
  --bg-panel-2: #0e140e;
  --border: #1c241c;
  --border-bright: #2c382c;
  --text: #e6ede4;
  --text-dim: #8b988a;
  --text-faint: #5a675a;
  --accent: #b3ff2e;
  --accent-dim: #7ab814;
  --accent-glow: rgba(179, 255, 46, 0.14);

  --sev-critical: #ff4d4d;
  --sev-high: #ff9040;
  --sev-medium: #ffd23f;
  --sev-low: #4da6ff;
  --sev-info: #8b98a8;

  --font-display: "Unbounded", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --font-body: "IBM Plex Sans", sans-serif;

  --maxw: 1180px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

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

::selection { background: var(--accent); color: #0a0e06; }

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

/* ---------- background atmosphere ---------- */

.bg-grid, .bg-glow, .bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.bg-grid {
  z-index: -3;
  background-image:
    linear-gradient(rgba(179, 255, 46, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(179, 255, 46, 0.03) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 30%, transparent 80%);
}

.bg-glow {
  z-index: -2;
  background:
    radial-gradient(ellipse 50% 35% at 75% -5%, rgba(179, 255, 46, 0.08), transparent),
    radial-gradient(ellipse 40% 30% at 10% 10%, rgba(77, 166, 255, 0.04), transparent);
}

.bg-noise {
  z-index: 50;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- nav ---------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem 1rem;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(6, 9, 6, 0.78);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  text-decoration: none !important;
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: var(--text);
}

.brand-cursor {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 600;
  font-size: 1.15rem;
  animation: blink 1.1s steps(1) infinite;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

@media (max-width: 640px) { .brand-sub { display: none; } }

.site-nav nav { display: flex; gap: 0.25rem; }

.site-nav nav a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 0.45rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 2px;
  text-decoration: none !important;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}

.site-nav nav a:hover { color: var(--text); border-color: var(--border-bright); }

.site-nav nav a.active {
  color: var(--accent);
  border-color: var(--border-bright);
  background: var(--accent-glow);
}

.nav-idx { color: var(--text-faint); font-size: 0.68rem; margin-right: 0.2rem; }
.site-nav nav a.active .nav-idx { color: var(--accent-dim); }
.nav-admin { color: var(--sev-high) !important; }

/* ---------- language switcher ---------- */

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  border: 1px solid var(--border-bright);
  border-radius: 2px;
  overflow: hidden;
  background: var(--border);
  position: relative;
}

.lang-switch[aria-busy='true'] { opacity: 0.6; }

.lang-switch[data-error]::after {
  content: attr(data-error);
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--sev-critical);
  background: var(--bg-panel);
  border: 1px solid rgba(255, 77, 77, 0.35);
  padding: 0.25rem 0.5rem;
  border-radius: 2px;
}

.lang-btn {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-dim);
  background: var(--bg-panel);
  border: none;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  transition: color 0.16s, background 0.16s;
}

.lang-btn:hover { color: var(--text); }
.lang-btn:disabled { cursor: progress; }

.lang-btn.active {
  color: #0a0e06;
  background: var(--accent);
  font-weight: 600;
}

@media (max-width: 640px) { .lang-btn { padding: 0.4rem 0.45rem; font-size: 0.7rem; } }

/* ---------- layout primitives ---------- */

.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
}

.section { margin-top: 5.5rem; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.hero-kicker, .section-kicker {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.4rem;
}

.kicker-line { flex: 1; max-width: 220px; height: 1px; background: linear-gradient(90deg, var(--border-bright), transparent); }

.section-more {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  white-space: nowrap;
}
.section-more:hover { color: var(--accent); }

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 3rem;
  align-items: center;
  padding: 5rem 0 1rem;
  min-height: 72vh;
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 3.5rem; }
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.1rem, 5.2vw, 4rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin-bottom: 1.6rem;
}

.hero-title span { display: block; }

.hero-title .hl {
  font-style: normal;
  color: var(--accent);
  text-shadow: 0 0 32px rgba(179, 255, 46, 0.35);
}

.hero-lede {
  max-width: 46ch;
  color: var(--text-dim);
  font-size: 1.08rem;
  margin-bottom: 2.2rem;
}

.hero-lede strong { color: var(--text); font-weight: 600; }

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

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.75rem 1.4rem;
  border-radius: 2px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none !important;
  transition: transform 0.16s, box-shadow 0.16s, background 0.16s, color 0.16s, border-color 0.16s;
}

.btn-primary {
  background: var(--accent);
  color: #0a0e06;
  box-shadow: 0 0 0 rgba(179, 255, 46, 0);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(179, 255, 46, 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border-bright);
}

.btn-ghost:hover { color: var(--accent); border-color: var(--accent-dim); }

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

.btn-mini { padding: 0.35rem 0.8rem; font-size: 0.72rem; background: transparent; color: var(--text-dim); border-color: var(--border-bright); }
.btn-mini:hover { color: var(--accent); border-color: var(--accent-dim); }
.btn-danger:hover { color: var(--sev-critical); border-color: var(--sev-critical); }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { text-decoration: underline; }

.inline-form { display: inline; }

/* ---------- terminal panel ---------- */

/* about-page animated terminal */
.term {
  position: relative;
  margin: 0.4rem 0 1.8rem;
  width: 100%;
  max-width: 460px;
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5), 0 0 26px var(--accent-glow);
}

.term-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg-panel-2);
  border-bottom: 1px solid var(--border);
}
.term-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-bright); }
.term-dot:nth-child(1) { background: #ff5f57; }
.term-dot:nth-child(2) { background: #febc2e; }
.term-dot:nth-child(3) { background: #28c840; }
.term-title {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  color: var(--text-faint);
}

.term-body {
  padding: 1.05rem 1.15rem;
  min-height: 20rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.85;
  color: var(--text);
}
.tl-out { color: var(--text); }

.term-body .tl { white-space: pre; }
.tl-cmd  { color: var(--accent); }
.tl-dim  { color: var(--text-faint); }
.tl-high { color: var(--sev-high); }
.tl-ok   { color: var(--accent-dim); }
.tl-done { color: var(--accent); font-weight: 600; }
.tl-cur  {
  display: inline-block;
  width: 0.62em;
  margin-left: 1px;
  background: var(--accent);
  color: transparent;
  animation: blink 1.1s steps(1) infinite;
}

.hero-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(179, 255, 46, 0.03);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1rem;
  background: var(--bg-panel-2);
  border-bottom: 1px solid var(--border);
}

.panel-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border-bright); }
.panel-dot:first-child { background: var(--sev-critical); opacity: 0.7; }
.panel-dot:nth-child(2) { background: var(--sev-medium); opacity: 0.7; }
.panel-dot:nth-child(3) { background: var(--accent); opacity: 0.7; }

.panel-title {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-faint);
}

.panel-rows { padding: 1.1rem 1.2rem; }

.panel-row {
  display: flex;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px dashed var(--border);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.panel-row:last-child { border-bottom: none; }
.panel-row dt { width: 72px; flex-shrink: 0; color: var(--text-faint); }
.panel-row dd { color: var(--text); display: flex; align-items: center; gap: 0.5rem; }

.status-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(179, 255, 46, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(179, 255, 46, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(179, 255, 46, 0); }
  100% { box-shadow: 0 0 0 0 rgba(179, 255, 46, 0); }
}

.panel-foot {
  padding: 0.8rem 1.2rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-dim);
  background: var(--bg-panel-2);
}

.blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- about / profile ---------- */

.alias { color: var(--text-faint); font-family: var(--font-mono); font-size: 0.9em; }

.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 820px) { .about-grid { grid-template-columns: 1fr; gap: 2rem; } }

.about-bio p { color: var(--text-dim); font-size: 1.02rem; margin-bottom: 1.1rem; max-width: 58ch; }
.about-bio strong { color: var(--text); font-weight: 600; }

.fact-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

.fact { background: var(--bg-panel); padding: 1.1rem 1.2rem; }

.fact dt {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-dim);
  margin-bottom: 0.4rem;
}

.fact dd { font-size: 0.9rem; color: var(--text); line-height: 1.5; }
.fact-sub { color: var(--text-dim); font-size: 0.84rem; }

/* ---------- skills ---------- */

.skill-list { border: 1px solid var(--border); border-radius: 3px; overflow: hidden; }

.skill-row {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  padding: 1.1rem 1.4rem;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  transition: background 0.18s;
}

.skill-row:last-child { border-bottom: none; }
.skill-row:hover { background: var(--bg-panel-2); }
.skill-row:hover .skill-name { color: var(--accent); }

@media (max-width: 700px) { .skill-row { grid-template-columns: 1fr; gap: 0.4rem; } }

.skill-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-dim);
  transition: color 0.18s;
}

.skill-name::before { content: "> "; color: var(--text-faint); }

.skill-desc { color: var(--text-dim); font-size: 0.92rem; }

/* ---------- method grid ---------- */

.method-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

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

.method {
  background: var(--bg-panel);
  padding: 1.8rem;
  position: relative;
  transition: background 0.2s;
}

.method:hover { background: var(--bg-panel-2); }

.method-idx {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-dim);
  letter-spacing: 0.2em;
}

.method h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.05rem;
  margin: 0.7rem 0 0.6rem;
}

.method p { color: var(--text-dim); font-size: 0.92rem; }

/* ---------- cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.2rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1.5rem;
  color: var(--text);
  text-decoration: none !important;
  transition: transform 0.18s ease, border-color 0.18s, box-shadow 0.18s;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-dim);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.5), 0 0 24px var(--accent-glow);
}

.card-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--border-bright);
  border-style: solid;
  border-width: 0;
  transition: border-color 0.18s;
}

.card-corner.tl { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.card-corner.br { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }
.card:hover .card-corner { border-color: var(--accent); }

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-protocol { color: var(--accent-dim); }
.card-date { color: var(--text-faint); }
.card-top-right { display: inline-flex; align-items: center; gap: 0.5rem; }
.card-pdf {
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 2px;
  padding: 0.05rem 0.32rem;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
}

.card-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.12rem;
  line-height: 1.3;
}

.card-summary {
  color: var(--text-dim);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: auto; }

.card-cta {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--accent-dim);
  transition: color 0.18s;
}
.card:hover .card-cta { color: var(--accent); }

.tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  border: 1px solid var(--border-bright);
  border-radius: 2px;
  padding: 0.18rem 0.5rem;
}

/* ---------- severity visualization ---------- */

.sev-bar {
  display: flex;
  height: 5px;
  border-radius: 2px;
  overflow: hidden;
  gap: 2px;
}

.sev-bar.large { height: 8px; max-width: 460px; }

.sev-seg { display: block; min-width: 6px; }

.sev-critical { background: var(--sev-critical); color: var(--sev-critical); }
.sev-high { background: var(--sev-high); color: var(--sev-high); }
.sev-medium { background: var(--sev-medium); color: var(--sev-medium); }
.sev-low { background: var(--sev-low); color: var(--sev-low); }
.sev-info { background: var(--sev-info); color: var(--sev-info); }

.sev-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.sev-count { display: inline-flex; align-items: center; gap: 0.38rem; }

.sev-dot {
  width: 7px;
  height: 7px;
  border-radius: 1px;
  display: inline-block;
}

/* ---------- page hero (list pages) ---------- */

.page-hero { padding: 4rem 0 0; }

.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  margin-bottom: 1rem;
}

.page-lede { color: var(--text-dim); max-width: 60ch; font-size: 1.02rem; }

/* ---------- search ---------- */

.search {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 2rem;
  max-width: 560px;
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  padding: 0.3rem 0.3rem 0.3rem 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search:focus-within {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-prompt { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent-dim); white-space: nowrap; }

.search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  padding: 0.55rem 0;
  min-width: 0;
}

.search input::placeholder { color: var(--text-faint); }

.search button {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--accent);
  color: #0a0e06;
  border: none;
  border-radius: 2px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  transition: box-shadow 0.16s;
}

.search button:hover { box-shadow: 0 0 18px rgba(179, 255, 46, 0.4); }

.result-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 1.4rem;
}

.is-hidden { display: none !important; }

/* ---------- embedded PDF (report/post as a PDF file) ---------- */

.pdf-block { margin-top: 1.5rem; }

.pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1rem;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
}

.pdf-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-dim);
}

.pdf-frame {
  width: 100%;
  height: 85vh;
  border: 1px solid var(--border);
  border-radius: 0 0 4px 4px;
  background: var(--bg-panel);
  display: block;
}

@media (max-width: 640px) { .pdf-frame { height: 70vh; } }

/* ---------- empty / 404 ---------- */

.empty {
  text-align: center;
  padding: 4.5rem 1rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.empty-code {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(3rem, 9vw, 5.5rem);
  color: var(--border-bright);
  line-height: 1;
  margin-bottom: 1rem;
}

.notfound { padding-top: 7rem; }
.notfound h1 { font-family: var(--font-mono); font-size: 1.3rem; color: var(--sev-critical); margin-bottom: 0.6rem; }
.notfound p { margin-bottom: 2rem; }

.glitch { position: relative; color: var(--accent); text-shadow: 0 0 40px rgba(179, 255, 46, 0.3); }

/* ---------- article (report / post detail) ---------- */

.article { max-width: 800px; margin: 0 auto; padding-top: 3.5rem; }

.back-link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 2rem;
}
.back-link:hover { color: var(--accent); }

.article-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  line-height: 1.18;
  margin-bottom: 1.6rem;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 2rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-bottom: 1.6rem;
}

.meta-item { display: flex; flex-direction: column; gap: 0.15rem; color: var(--text); }
.meta-label { font-size: 0.65rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-faint); }
.meta-link { color: var(--accent); }

.article-sev { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 1.4rem; }

.article-head { padding-bottom: 2.2rem; border-bottom: 1px solid var(--border); margin-bottom: 2.4rem; }

/* ---------- prose (rendered markdown) ---------- */

.prose { font-size: 1.02rem; color: #cdd6cb; }

.prose h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.4rem;
  margin: 2.6rem 0 1rem;
  padding-top: 1.2rem;
  color: var(--text);
}

.prose h2::before { content: "// "; color: var(--accent-dim); font-family: var(--font-mono); font-size: 1rem; }

.prose h3 {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.02rem;
  margin: 2rem 0 0.8rem;
  color: var(--accent);
}

.prose p { margin-bottom: 1.1rem; }
.prose ul, .prose ol { margin: 0 0 1.2rem 1.4rem; }
.prose li { margin-bottom: 0.45rem; }
.prose strong { color: var(--text); }

.prose blockquote {
  border-left: 2px solid var(--accent-dim);
  background: var(--accent-glow);
  padding: 0.8rem 1.2rem;
  margin-bottom: 1.4rem;
  font-size: 0.92rem;
  color: var(--text-dim);
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.12em 0.4em;
  color: var(--accent);
}

.prose pre {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent-dim);
  border-radius: 3px;
  padding: 1.1rem 1.3rem;
  overflow-x: auto;
  margin-bottom: 1.4rem;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: #d8e6cf;
  font-size: 0.84rem;
  line-height: 1.6;
}

.prose hr { border: none; border-top: 1px dashed var(--border-bright); margin: 2.4rem 0; }

.prose a { text-decoration: underline; text-underline-offset: 3px; }

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.6rem auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-panel);
}

/* image caption: italic text immediately under an image */
.prose img + em {
  display: block;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-faint);
  margin: -0.8rem 0 1.6rem;
}

.prose table { width: 100%; border-collapse: collapse; margin-bottom: 1.4rem; font-size: 0.9rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.55rem 0.8rem; text-align: left; }
.prose th { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); background: var(--bg-panel-2); }

/* ---------- CTA ---------- */

.cta {
  margin-top: 6rem;
  text-align: center;
  padding: 4rem 2rem;
  border: 1px solid var(--border);
  background:
    radial-gradient(ellipse 60% 120% at 50% 130%, rgba(179, 255, 46, 0.1), transparent),
    var(--bg-panel);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.cta h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin-bottom: 0.8rem;
}

.cta p { color: var(--text-dim); margin-bottom: 2rem; max-width: 48ch; margin-inline: auto; }

/* ---------- login ---------- */

.login-wrap {
  display: flex;
  justify-content: center;
  padding: 7rem 0 3rem;
}

.login-panel { width: 100%; max-width: 420px; }

.login-form { padding: 1.6rem 1.4rem; display: flex; flex-direction: column; gap: 1.1rem; }

.login-note { font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-faint); }

.form-error {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--sev-critical);
  border: 1px solid rgba(255, 77, 77, 0.35);
  background: rgba(255, 77, 77, 0.07);
  padding: 0.6rem 0.9rem;
  border-radius: 2px;
}

.form-notice {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  background: var(--accent-glow);
  padding: 0.6rem 0.9rem;
  border-radius: 2px;
  display: inline-block;
}

.editor + .editor { margin-top: 3rem; padding-top: 2.5rem; border-top: 1px dashed var(--border-bright); }
.editor .section-kicker { margin-bottom: 1.6rem; }

/* ---------- forms / editor ---------- */

label > span, legend {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.45rem;
}

input[type="text"], input[type="password"], input[type="url"],
input[type="date"], input[type="number"], input[type="search"], textarea {
  width: 100%;
  background: var(--bg-panel-2);
  border: 1px solid var(--border-bright);
  border-radius: 2px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.7rem 0.9rem;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

input:focus, textarea:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea { resize: vertical; line-height: 1.6; }
.mono-editor { font-size: 0.85rem; }

input[type="date"] { color-scheme: dark; }

.editor { margin-top: 2.5rem; }

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.3rem;
}

@media (max-width: 700px) { .editor-grid { grid-template-columns: 1fr; } .span-2 { grid-column: auto !important; } }

.span-2 { grid-column: span 2; }

.sev-fieldset {
  border: 1px dashed var(--border-bright);
  border-radius: 3px;
  padding: 1.1rem 1.2rem;
}

.sev-inputs { display: flex; flex-wrap: wrap; gap: 1rem; }

.sev-input { flex: 1; min-width: 100px; }
.sev-input > span { display: flex; align-items: center; gap: 0.4rem; }

.editor-actions { display: flex; gap: 0.8rem; margin-top: 2rem; }

/* ---------- admin table ---------- */

.admin-table { border: 1px solid var(--border); border-radius: 3px; overflow: hidden; }

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.2rem;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.admin-row:last-child { border-bottom: none; }
.admin-row:hover { background: var(--bg-panel-2); }

.admin-row-main { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }

.admin-row-title {
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-row-title:hover { color: var(--accent); }

.admin-row-meta { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-faint); }

.admin-row-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

.admin-empty { padding: 1.4rem; font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-faint); background: var(--bg-panel); }

/* ---------- footer ---------- */

.site-footer { margin-top: 4rem; }

.footer-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-dim), transparent);
  opacity: 0.45;
}

/* running ticker lines */

.ticker {
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
}

.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker-scroll 32s linear infinite;
}

.ticker-reverse .ticker-track { animation-direction: reverse; animation-duration: 40s; }

.ticker:hover .ticker-track { animation-play-state: paused; }

.ticker-group {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  padding-right: 1.6rem;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.ticker-label {
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--border-bright);
  border-radius: 2px;
  padding: 0.2rem 0.55rem;
  background: var(--accent-glow);
}

.ticker-item { font-size: 0.92rem; color: var(--text-dim); letter-spacing: 0.04em; }
.ticker-sep { color: var(--border-bright); font-size: 0.8rem; }

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
}

.footer-bottom {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.4rem 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
}

.footer-admin { color: var(--text-faint); opacity: 0.55; }
.footer-admin:hover { opacity: 1; color: var(--accent); }

/* ---------- reveal animations ---------- */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.d1 { animation-delay: 0.08s; }
.d2 { animation-delay: 0.16s; }
.d3 { animation-delay: 0.24s; }
.d4 { animation-delay: 0.32s; }
.d5 { animation-delay: 0.42s; }

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

/* stagger grid cards via JS-applied inline delay; fallback all visible */
.card-grid .reveal { animation-delay: var(--card-delay, 0.1s); }

@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; opacity: 1; transform: none; }
  .brand-cursor, .blink, .status-pulse { animation: none; }
}
