:root {
  --bg: #07090d;
  --panel: #0f141c;
  --panel-2: #121a25;
  --text: #e8edf2;
  --muted: #9aa8b5;
  --border: rgba(162, 239, 255, 0.18);
  --accent: #8de8ff;
  --accent-2: #b8ffca;
  --danger: #ff7a90;
  --max: 1120px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); }
body { margin: 0; font-family: var(--sans); line-height: 1.6; background: radial-gradient(circle at 20% -10%, rgba(141,232,255,.16), transparent 32rem), var(--bg); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.site-shell { width: min(var(--max), calc(100% - 32px)); margin: 0 auto; }
.site-header { display:flex; align-items:center; justify-content:space-between; gap:24px; padding:28px 0; font-family:var(--mono); }
.site-logo { font-weight:800; letter-spacing:.02em; }
.prompt, .site-logo .prompt { color: var(--accent-2); }
.site-nav ul { display:flex; gap:18px; list-style:none; padding:0; margin:0; flex-wrap:wrap; }
.site-nav a { color: var(--muted); font-size:14px; }
.site-nav a:hover { color: var(--accent); }
.terminal-hero { padding:56px 0 32px; }
.terminal-window { border:1px solid var(--border); border-radius:20px; overflow:hidden; background:linear-gradient(180deg, rgba(18,26,37,.9), rgba(7,9,13,.95)); box-shadow:0 20px 80px rgba(0,0,0,.45); }
.terminal-bar { display:flex; align-items:center; gap:8px; padding:12px 16px; background:rgba(255,255,255,.04); border-bottom:1px solid var(--border); font-family:var(--mono); color:var(--muted); }
.terminal-bar span { width:10px; height:10px; border-radius:50%; background:var(--danger); }
.terminal-bar span:nth-child(2){ background:#ffd166; }.terminal-bar span:nth-child(3){ background:#78f0a4; }
.terminal-bar p { margin:0 0 0 8px; font-size:13px; }
.terminal-body { padding:40px; font-family:var(--mono); }
.terminal-body h1 { font-family:var(--sans); font-size:clamp(44px,8vw,92px); line-height:.95; margin:8px 0 18px; letter-spacing:-.06em; }
.typing-line { color:var(--accent); min-height:1.6em; }
.typing-line::after { content:"_"; animation:blink 1s steps(1) infinite; color:var(--accent-2); }
@keyframes blink { 50% { opacity:0; } }
.focus-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-top:18px; }
.focus-grid a { border:1px solid var(--border); padding:14px; border-radius:12px; color:var(--accent-2); background:rgba(255,255,255,.03); }
.focus-grid a:hover { border-color:var(--accent); color:var(--accent); transform:translateY(-1px); }
.eyebrow { font-family:var(--mono); color:var(--accent-2); text-transform:uppercase; letter-spacing:.12em; font-size:12px; }
.featured-research, .content-feed, .archive-header { padding:40px 0; }
.featured-card { display:grid; grid-template-columns:1fr 1.2fr; gap:28px; border:1px solid var(--border); border-radius:22px; padding:18px; background:rgba(255,255,255,.035); }
.featured-card img { border-radius:16px; aspect-ratio:16/10; object-fit:cover; }
.featured-card h2, .section-heading h2, .archive-header h1 { font-size:clamp(30px,4vw,54px); line-height:1; letter-spacing:-.04em; margin:8px 0 12px; }
.featured-card p, .archive-header p { color:var(--muted); }
.featured-card span { font-family:var(--mono); color:var(--accent); }
.post-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px; }
.post-card { border:1px solid var(--border); border-radius:18px; background:rgba(255,255,255,.03); overflow:hidden; transition:transform .2s ease, border-color .2s ease; }
.post-card:hover { transform:translateY(-3px); border-color:rgba(141,232,255,.5); }
.post-card-image { aspect-ratio:16/9; object-fit:cover; width:100%; }
.post-card-content { padding:18px; }
.tag-chip { display:inline-block; font-family:var(--mono); color:var(--accent-2); border:1px solid var(--border); border-radius:999px; padding:3px 9px; font-size:12px; margin-bottom:10px; }
.post-card h3 { font-size:22px; line-height:1.12; margin:0 0 10px; letter-spacing:-.02em; }
.post-card p, .article-excerpt { color:var(--muted); }
.post-card footer, .article-meta { display:flex; gap:14px; flex-wrap:wrap; color:var(--muted); font-family:var(--mono); font-size:12px; }
.article-shell { max-width:860px; margin:0 auto; padding:56px 0; }
.article-header h1 { font-size:clamp(42px,7vw,76px); line-height:.95; letter-spacing:-.055em; margin:12px 0 18px; }
.article-image img { border-radius:22px; border:1px solid var(--border); margin:36px 0; }
.gh-content { font-size:19px; }
.gh-content p, .gh-content li { color:#d6dee7; }
.gh-content h2 { margin-top:2.2em; font-size:34px; line-height:1.1; letter-spacing:-.03em; }
.gh-content h3 { margin-top:1.8em; font-size:25px; }
.gh-content a { color:var(--accent); border-bottom:1px solid rgba(141,232,255,.45); }
.gh-content pre { overflow:auto; padding:18px; border-radius:14px; background:#020408; border:1px solid var(--border); font-size:15px; }
.gh-content code { font-family:var(--mono); color:var(--accent-2); }
.gh-content blockquote { border-left:3px solid var(--accent); margin:28px 0; padding:8px 0 8px 20px; color:var(--muted); background:rgba(255,255,255,.025); }
.site-footer { display:flex; justify-content:space-between; gap:18px; border-top:1px solid var(--border); padding:28px 0 40px; color:var(--muted); font-family:var(--mono); font-size:13px; }
.author-avatar { width:96px; height:96px; border-radius:50%; border:1px solid var(--border); margin-bottom:18px; }
.pagination { display:flex; justify-content:center; gap:18px; margin:34px 0; font-family:var(--mono); color:var(--accent); }
@media (max-width: 860px) {
  .site-header, .site-footer { flex-direction:column; align-items:flex-start; }
  .terminal-body { padding:26px; }
  .focus-grid, .post-grid, .featured-card { grid-template-columns:1fr; }
}

/* Ghost editor width support: required for wide/full cards */
.kg-width-wide {
  width: min(85vw, 1200px);
  max-width: 1200px;
  margin-left: calc(50% - min(42.5vw, 600px));
  margin-right: calc(50% - min(42.5vw, 600px));
}
.kg-width-full {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}
.kg-width-full img { width: 100%; }
.kg-card { margin-top: 2.2em; margin-bottom: 2.2em; }
.kg-card figcaption {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  text-align: center;
  margin-top: 10px;
}

/* Terminal animation helpers */
.boot-line { opacity: 0; transform: translateY(4px); animation: bootIn .55s ease forwards; }
.boot-line:nth-of-type(1) { animation-delay: .05s; }
.boot-line:nth-of-type(2) { animation-delay: .25s; }
.boot-line:nth-of-type(3) { animation-delay: .45s; }
.boot-line:nth-of-type(4) { animation-delay: .65s; }
@keyframes bootIn { to { opacity: 1; transform: translateY(0); } }
.terminal-window { position: relative; }
.terminal-window::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(rgba(255,255,255,.035) 50%, rgba(0,0,0,0) 50%);
  background-size: 100% 4px;
  opacity: .08;
}
.terminal-window::after {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  border-radius: 20px;
  box-shadow: 0 0 36px rgba(141,232,255,.08), inset 0 0 24px rgba(141,232,255,.04);
}
@media (prefers-reduced-motion: reduce) {
  .typing-line::after, .boot-line, .terminal-window::before { animation: none; opacity: 1; transform: none; }
}

/* Corgi Corp terminal landing page */
.corgi-terminal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
  gap: 28px;
  align-items: stretch;
}
.ascii-panel {
  display:flex;
  align-items:center;
  justify-content:center;
  min-height: 420px;
}
.ascii-corgi {
  margin:0;
  color:#f7f9fb;
  font-family:var(--mono);
  font-size: clamp(9px, 1.3vw, 17px);
  line-height: 1.05;
  letter-spacing: .02em;
  text-shadow: 0 0 16px rgba(255,255,255,.16);
}
.ascii-corgi .cursor-tail { color: var(--accent-2); }
.terminal-copy p { margin: 0 0 12px; color: #d6dee7; }
.command-list { list-style:none; padding:0; margin:22px 0 0; font-family:var(--mono); }
.command-list li { border-top:1px solid var(--border); padding:12px 0; color:var(--muted); }
.command-list a { color:var(--accent-2); }
.command-list a:hover { color:var(--accent); }
.identity-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-top:24px; }
.identity-card { border:1px solid var(--border); border-radius:14px; padding:16px; background:rgba(255,255,255,.03); }
.identity-card strong { display:block; font-family:var(--mono); color:var(--accent-2); margin-bottom:8px; }
.identity-card span { color:var(--muted); font-size:14px; }
.route-header { padding: 42px 0 20px; }
.route-header h1 { font-size:clamp(40px,6vw,72px); line-height:.95; letter-spacing:-.055em; margin:10px 0 14px; }
.route-header p { color:var(--muted); max-width:760px; }
@media (max-width: 920px) {
  .corgi-terminal-layout, .identity-grid { grid-template-columns:1fr; }
  .ascii-panel { min-height: 260px; }
}

/* Homepage ASCII corgi layout */
.home-terminal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, .7fr);
  gap: 28px;
  align-items: center;
}
.ascii-panel.compact { min-height: 260px; }
.ascii-corgi-horizontal {
  font-size: clamp(16px, 2vw, 28px);
  line-height: 1.02;
}

/* Terminal-styled research articles */
.terminal-article-shell {
  max-width: 920px;
  padding-top: 48px;
}
.terminal-article {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(18,26,37,.58), rgba(7,9,13,.72));
  padding: clamp(22px, 4vw, 42px);
  box-shadow: 0 18px 60px rgba(0,0,0,.28);
}
.terminal-article-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 24px;
  margin-bottom: 28px;
}
.terminal-command-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 22px;
  font-family: var(--mono);
  font-size: clamp(14px, 1.8vw, 18px);
}
.terminal-user { color: var(--accent-2); font-weight: 800; }
.terminal-command { color: var(--text); }
.terminal-meta {
  border-top: 1px dashed rgba(162,239,255,.18);
  padding-top: 14px;
  margin-top: 18px;
}
.research-brief {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 28px 0 34px;
}
.research-brief div {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255,255,255,.03);
}
.research-brief strong {
  display: block;
  font-family: var(--mono);
  color: var(--accent-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 4px;
}
.research-brief span { color: var(--muted); font-family: var(--mono); font-size: 13px; }

/* Research content formatting */
.research-content {
  font-family: var(--sans);
  line-height: 1.75;
}
.research-content > p:first-child {
  font-size: 1.12em;
  color: #eef4f8;
}
.research-content h2 {
  position: relative;
  padding-left: 18px;
  font-family: var(--mono);
  color: var(--text);
  border-left: 3px solid var(--accent-2);
}
.research-content h2::before {
  content: "##";
  color: var(--accent-2);
  margin-right: 10px;
  font-size: .72em;
}
.research-content h3 {
  font-family: var(--mono);
  color: var(--accent);
}
.research-content h3::before { content: "> "; color: var(--accent-2); }
.research-content ul, .research-content ol { padding-left: 1.35em; }
.research-content li::marker { color: var(--accent-2); }
.research-content hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 42px 0;
}

/* Code block styling */
.research-content pre,
.gh-content pre {
  position: relative;
  margin: 28px 0;
  padding: 48px 18px 18px;
  border-radius: 16px;
  background: #020407;
  border: 1px solid rgba(184,255,202,.24);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025), 0 12px 40px rgba(0,0,0,.25);
}
.research-content pre::before,
.gh-content pre::before {
  content: "code/output";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(184,255,202,.18);
  color: var(--accent-2);
  background: rgba(184,255,202,.045);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.research-content pre code,
.gh-content pre code {
  display: block;
  color: #dfe7ee;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre;
  overflow-x: auto;
}
.research-content :not(pre) > code,
.gh-content :not(pre) > code {
  padding: 2px 6px;
  border: 1px solid rgba(184,255,202,.18);
  border-radius: 6px;
  background: rgba(184,255,202,.07);
  color: var(--accent-2);
  font-size: .9em;
}

/* Research callouts using Ghost blockquotes */
.research-content blockquote,
.gh-content blockquote {
  border: 1px solid rgba(141,232,255,.22);
  border-left: 4px solid var(--accent-2);
  border-radius: 14px;
  padding: 16px 18px;
  background: rgba(141,232,255,.045);
  color: #d8e3ec;
}
.research-content blockquote p,
.gh-content blockquote p { margin: 0; color: inherit; }

/* Ghost cards */
.kg-callout-card {
  border: 1px solid rgba(184,255,202,.22);
  border-radius: 14px;
  background: rgba(184,255,202,.055);
}
.kg-toggle-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
}
.kg-bookmark-card,
.kg-bookmark-container {
  border-color: var(--border) !important;
  border-radius: 14px !important;
  background: rgba(255,255,255,.03) !important;
}

@media (max-width: 920px) {
  .home-terminal-layout,
  .research-brief { grid-template-columns: 1fr; }
  .terminal-article { padding: 20px; }
  .terminal-article-shell { padding-top: 28px; }
}
