/* ==========================================
   TERMINAL PORTFOLIO — Ethan Koester-Schmidt
   Shared Styles
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=VT323&family=IBM+Plex+Mono:wght@400;600&display=swap');

:root {
  --bg: #0d0d0d;
  --bg-terminal: #111111;
  --text: #e0e0e0;
  --accent: #ffffff;
  --accent-glow: rgba(255, 255, 255, 0.4);
  --scanline-opacity: 0.04;
  --cursor-color: var(--accent);
  --border-color: #2a2a2a;
  --dim: #555;
  --font-mono: 'VT323', monospace;
  --font-body: 'IBM Plex Mono', monospace;
}

/* Per-page accent overrides */
body.page-index    { --accent: #ffffff; --accent-glow: rgba(255,255,255,0.35); }
body.page-about    { --accent: #6ee7b7; --accent-glow: rgba(110,231,183,0.35); }
body.page-projects { --accent: #c4b5fd; --accent-glow: rgba(196,181,253,0.35); }
body.page-github   { --accent: #7dd3fc; --accent-glow: rgba(125,211,252,0.35); }
body.page-work     { --accent: #fcd34d; --accent-glow: rgba(252,211,77,0.35); }
body.page-education{ --accent: #fda4af; --accent-glow: rgba(253,164,175,0.35); }

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ==========================================
   CRT EFFECTS
   ========================================== */

/* Scanlines overlay */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0, var(--scanline-opacity)) 2px,
    rgba(0,0,0, var(--scanline-opacity)) 4px
  );
  pointer-events: none;
  z-index: 9998;
  animation: scanline-drift 8s linear infinite;
}

/* CRT curvature */
body::after {
  content: '';
  position: fixed;
  top: -2%; left: -2%;
  width: 104%; height: 104%;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.45) 100%);
  pointer-events: none;
  z-index: 9997;
}

/* Noise texture */
.noise-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0.03;
  pointer-events: none;
  z-index: 9996;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

@keyframes scanline-drift {
  0% { background-position: 0 0; }
  100% { background-position: 0 100vh; }
}

/* Screen flicker on load */
@keyframes flicker-on {
  0%   { opacity: 0; filter: brightness(0); }
  5%   { opacity: 1; filter: brightness(3); }
  10%  { opacity: 0.8; filter: brightness(0.5); }
  15%  { opacity: 1; filter: brightness(2); }
  25%  { opacity: 1; filter: brightness(1.2); }
  100% { opacity: 1; filter: brightness(1); }
}

.screen-flicker {
  animation: flicker-on 1.2s ease-out forwards;
}

/* ==========================================
   TERMINAL WINDOW CHROME
   ========================================== */

.terminal-wrapper {
  max-width: 900px;
  margin: 40px auto;
  padding: 0 20px;
}

.terminal-window {
  background: var(--bg-terminal);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    0 0 40px rgba(0,0,0,0.6),
    0 0 80px var(--accent-glow),
    inset 0 0 60px rgba(0,0,0,0.3);
}

.terminal-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #1a1a1a;
  border-bottom: 1px solid var(--border-color);
}

.terminal-btn {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: none;
}
.terminal-btn.close { background: #ff5f57; }
.terminal-btn.min   { background: #ffbd2e; }
.terminal-btn.max   { background: #28c840; }

.terminal-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--dim);
  letter-spacing: 0.5px;
}

.terminal-body {
  padding: 30px 30px 40px;
  min-height: 500px;
  position: relative;
}

/* ==========================================
   PHOSPHOR TEXT GLOW
   ========================================== */

.glow {
  color: var(--accent);
  text-shadow: 0 0 6px var(--accent-glow), 0 0 20px var(--accent-glow);
}

.glow-subtle {
  text-shadow: 0 0 4px var(--accent-glow);
}

/* ==========================================
   TYPOGRAPHY
   ========================================== */

.ascii-art {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.15;
  color: var(--accent);
  text-shadow: 0 0 8px var(--accent-glow), 0 0 24px var(--accent-glow);
  white-space: pre;
  text-align: center;
  margin-bottom: 24px;
  opacity: 0;
  animation: art-fade-in 1.5s ease-out 1.5s forwards;
}

@keyframes art-fade-in {
  0%   { opacity: 0; filter: blur(2px); }
  100% { opacity: 1; filter: blur(0); }
}

.prompt-prefix {
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 600;
}

h1, h2, h3 {
  font-family: var(--font-mono);
  color: var(--accent);
  text-shadow: 0 0 8px var(--accent-glow);
}

h1 { font-size: 2rem; margin-bottom: 16px; }
h2 { font-size: 1.4rem; margin: 28px 0 12px; }
h3 { font-size: 1.1rem; margin: 16px 0 8px; }

p, li, span.body-text {
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
}

/* ==========================================
   BLINKING CURSOR
   ========================================== */

.cursor {
  display: inline-block;
  width: 10px;
  height: 1.1em;
  background: var(--cursor-color);
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.cursor.processing {
  animation: blink 0.2s step-end infinite;
}

/* ==========================================
   NAV
   ========================================== */

.nav-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 20px 0;
  font-family: var(--font-mono);
  font-size: 1rem;
}

.nav-bar a {
  color: var(--dim);
  text-decoration: none;
  padding: 4px 8px;
  position: relative;
  transition: color 0.2s, text-shadow 0.2s;
}

.nav-bar a::before {
  content: '> ';
  color: var(--dim);
  transition: color 0.2s;
}

.nav-bar a:hover,
.nav-bar a.active {
  color: var(--accent);
  text-shadow: 0 0 8px var(--accent-glow);
}

.nav-bar a:hover::before,
.nav-bar a.active::before {
  color: var(--accent);
}

/* Glitch on hover */
.nav-bar a:hover {
  animation: glitch-text 0.3s ease;
}

@keyframes glitch-text {
  0%   { transform: translate(0); }
  20%  { transform: translate(-2px, 1px); }
  40%  { transform: translate(2px, -1px); }
  60%  { transform: translate(-1px, -1px); }
  80%  { transform: translate(1px, 1px); }
  100% { transform: translate(0); }
}

/* ==========================================
   CONTENT SECTIONS
   ========================================== */

.section {
  margin: 24px 0;
  padding: 16px 0;
  border-top: 1px solid var(--border-color);
}

.section:first-of-type {
  border-top: none;
}

/* Line-drawing borders */
.box {
  border: 1px solid var(--border-color);
  padding: 16px 20px;
  margin: 12px 0;
  position: relative;
  background: rgba(255,255,255,0.01);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.box:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.box-header {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 6px;
  text-shadow: 0 0 4px var(--accent-glow);
}

.box-sub {
  font-family: var(--font-body);
  color: var(--dim);
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.box ul {
  list-style: none;
  padding: 0;
}

.box ul li {
  padding: 3px 0;
  font-size: 0.85rem;
}

.box ul li::before {
  content: '|-- ';
  color: var(--dim);
  font-family: var(--font-mono);
}

.box ul li:last-child::before {
  content: '`-- ';
}

/* ==========================================
   SKILL ICONS (pixel art grid)
   ========================================== */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.skill-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.01);
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}

.skill-item:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  transform: translateY(-2px);
}

.skill-icon {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  white-space: pre;
  color: var(--accent);
  text-shadow: 0 0 4px var(--accent-glow);
}

.skill-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text);
  text-align: center;
}

/* ==========================================
   LINKS
   ========================================== */

a.terminal-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
  transition: text-shadow 0.2s, border-color 0.2s;
  font-family: var(--font-mono);
}

a.terminal-link:hover {
  text-shadow: 0 0 8px var(--accent-glow);
  animation: glitch-text 0.2s ease;
}

/* ==========================================
   REPO CARDS
   ========================================== */

.repo-card {
  border: 1px solid var(--border-color);
  padding: 16px 20px;
  margin: 12px 0;
  background: rgba(255,255,255,0.01);
  transition: border-color 0.3s, box-shadow 0.3s;
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: inherit;
}

.repo-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.repo-name {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1rem;
  text-shadow: 0 0 4px var(--accent-glow);
}

.repo-desc {
  font-size: 0.85rem;
  color: var(--dim);
  margin-top: 4px;
}

.repo-meta {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--dim);
}

/* ==========================================
   BOOT SEQUENCE
   ========================================== */

.boot-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--bg);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  color: var(--accent);
  text-shadow: 0 0 6px var(--accent-glow);
  transition: opacity 0.4s ease;
}

.boot-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.boot-text {
  font-size: 0.9rem;
  white-space: pre-wrap;
  max-width: 600px;
  padding: 20px;
}

/* ==========================================
   PAGE TRANSITION OVERLAY
   ========================================== */

.page-transition {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--bg);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.page-transition.active {
  opacity: 1;
  pointer-events: all;
}

.glitch-bar {
  width: 100%;
  height: 3px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  position: absolute;
  animation: glitch-scan 0.6s linear infinite;
}

@keyframes glitch-scan {
  0%   { top: 0; }
  100% { top: 100%; }
}

/* ==========================================
   TYPED CONTENT (hidden until typed)
   ========================================== */

.typed-content {
  visibility: hidden;
}

.typed-content.revealed {
  visibility: visible;
}

/* ==========================================
   CERTIFICATION BADGE
   ========================================== */

.cert-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--accent);
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  text-shadow: 0 0 4px var(--accent-glow);
  box-shadow: 0 0 8px var(--accent-glow);
  margin: 8px 0;
}

/* ==========================================
   COMMAND LINE INPUT
   ========================================== */

.cmd-output {
  margin-top: 16px;
  max-height: 200px;
  overflow-y: auto;
  text-align: left;
}

.cmd-line {
  display: flex;
  align-items: center;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-align: left;
}

.cmd-input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  flex: 1;
  caret-color: var(--accent);
  padding: 0;
  margin: 0;
}

.cmd-input::placeholder {
  color: var(--border-color);
  font-style: italic;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 640px) {
  .terminal-wrapper { margin: 16px auto; padding: 0 10px; }
  .terminal-body { padding: 16px 14px 24px; }
  .ascii-art { font-size: 9px; }
  .skills-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  .nav-bar { font-size: 0.85rem; }
  h1 { font-size: 1.5rem; }
}