/* ========================================
   TypingSwift Theme — Main Stylesheet
   https://typingswift.com
   ======================================== */

/* --- CSS Variables --- */
:root {
  --bg-primary:       #0e0e14;
  --bg-secondary:     #16161f;
  --bg-card:          #1e1e2a;
  --bg-card-hover:    #252534;
  --border:           #2e2e3e;
  --text-primary:     #e8e8f0;
  --text-secondary:   #9090a8;
  --text-muted:       #5c5c74;
  --accent:           #6c63ff;
  --accent-hover:     #7d75ff;
  --accent-light:     rgba(108,99,255,0.15);
  --success:          #22c55e;
  --warning:          #f59e0b;
  --error:            #ef4444;
  --correct-char:     #e8e8f0;
  --incorrect-char:   #ef4444;
  --current-char:     #6c63ff;
  --upcoming-char:    #4a4a60;
  --font-mono:        'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-sans:        'Inter', 'Segoe UI', system-ui, sans-serif;
  --radius-sm:        6px;
  --radius-md:        10px;
  --radius-lg:        16px;
  --radius-xl:        24px;
  --shadow-sm:        0 2px 8px rgba(0,0,0,.4);
  --shadow-md:        0 4px 20px rgba(0,0,0,.5);
  --shadow-lg:        0 8px 40px rgba(0,0,0,.6);
  --transition:       all 0.2s ease;
}

[data-theme="light"] {
  --bg-primary:       #f5f5fa;
  --bg-secondary:     #ffffff;
  --bg-card:          #ffffff;
  --bg-card-hover:    #f0f0f8;
  --border:           #e0e0ee;
  --text-primary:     #1a1a2e;
  --text-secondary:   #5a5a78;
  --text-muted:       #9090a8;
  --accent:           #6c63ff;
  --accent-hover:     #5a52e0;
  --accent-light:     rgba(108,99,255,0.1);
  --correct-char:     #1a1a2e;
  --incorrect-char:   #dc2626;
  --current-char:     #6c63ff;
  --upcoming-char:    #b0b0c8;
  --shadow-sm:        0 2px 8px rgba(0,0,0,.08);
  --shadow-md:        0 4px 20px rgba(0,0,0,.12);
  --shadow-lg:        0 8px 40px rgba(0,0,0,.18);
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s ease, color 0.3s ease;
}

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

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

ul { list-style: none; }

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* --- Layout --- */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-content { flex: 1; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.container--narrow { max-width: 760px; }
.container--wide   { max-width: 1300px; }

/* ======================================
   HEADER / NAV
   ====================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(14,14,20,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease;
}

[data-theme="light"] .site-header {
  background: rgba(245,245,250,0.92);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 24px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.site-logo svg { width: 32px; height: 32px; }
.logo-accent { color: var(--accent); }

.site-nav { display: flex; align-items: center; gap: 8px; }

.site-nav a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--text-primary);
  background: var(--bg-card);
}

.header-actions { display: flex; align-items: center; gap: 10px; }

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--accent);
}

/* Mobile hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 8px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}

/* ======================================
   HERO / TYPING TEST PAGE
   ====================================== */
.test-page { padding: 40px 0 60px; }

.test-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
}

.control-btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.control-btn:hover { color: var(--text-primary); background: var(--bg-card-hover); }

.control-btn.active {
  background: var(--accent);
  color: #fff;
}

/* WPM live display */
.live-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.live-stat-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  display: block;
  line-height: 1;
  margin-bottom: 2px;
}

.live-stat-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; }

/* Timer bar */
.timer-bar-wrap {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  margin-bottom: 20px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  width: 100%;
  transform-origin: left;
  transition: width 1s linear;
}

/* Typing area */
.typing-area-wrap {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  cursor: text;
  transition: border-color 0.2s;
  min-height: 180px;
}

.typing-area-wrap:focus-within,
.typing-area-wrap.focused {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.typing-area-wrap.paused { opacity: 0.5; }

/* Click-to-start overlay */
.click-to-start {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-lg);
  background: rgba(14,14,20,0.6);
  backdrop-filter: blur(2px);
  color: var(--text-secondary);
  font-size: 1rem;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 5;
}
.click-to-start.hidden { opacity: 0; pointer-events: none; }

[data-theme="light"] .click-to-start { background: rgba(245,245,250,0.7); }

.click-to-start svg { width: 36px; height: 36px; opacity: 0.6; }

/* Caps lock badge */
.caps-badge {
  position: absolute;
  top: 10px;
  right: 14px;
  background: var(--warning);
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.caps-badge.visible { opacity: 1; }

/* Pause overlay */
.pause-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: rgba(14,14,20,0.75);
  backdrop-filter: blur(4px);
  color: var(--text-secondary);
  font-size: 0.9rem;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 6;
}
.pause-overlay.visible { opacity: 1; pointer-events: auto; }
[data-theme="light"] .pause-overlay { background: rgba(245,245,250,0.8); }

/* The word display */
#typing-display {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  line-height: 2.2;
  word-spacing: 0.4em;
  color: var(--upcoming-char);
  user-select: none;
  overflow: hidden;
  height: calc(3 * 2.2 * 1.35rem);
  position: relative;
}

.word { display: inline-block; margin-right: 0.4em; }

.char { color: var(--upcoming-char); transition: color 0.05s; }
.char.correct { color: var(--correct-char); }
.char.incorrect { color: var(--incorrect-char); }
.char.extra { color: var(--incorrect-char); opacity: 0.7; }
.char.current {
  color: var(--current-char);
  border-bottom: 2px solid var(--accent);
  animation: blink 1s ease infinite;
}

@keyframes blink {
  0%, 100% { border-color: var(--accent); }
  50% { border-color: transparent; }
}

.word.incorrect-word .char.correct {
  color: var(--incorrect-char);
  opacity: 0.7;
}

/* Hidden input */
#typing-input {
  position: absolute;
  opacity: 0;
  top: 0; left: 0;
  width: 100%; height: 100%;
  cursor: text;
  z-index: 4;
  resize: none;
  background: transparent;
  border: none;
  color: transparent;
  caret-color: transparent;
  outline: none;
}

/* Test action buttons */
.test-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.btn svg { width: 16px; height: 16px; }

/* Custom text modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 600px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal h3 { margin-bottom: 16px; font-size: 1.2rem; }

.modal textarea {
  width: 100%;
  height: 160px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  resize: vertical;
  outline: none;
  line-height: 1.6;
}

.modal textarea:focus { border-color: var(--accent); }

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* ======================================
   RESULTS / STATS PANEL
   ====================================== */
#results-panel {
  display: none;
  animation: fadeInUp 0.4s ease;
}

#results-panel.visible { display: block; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.results-hero {
  text-align: center;
  padding: 40px 0 32px;
}

.results-hero h2 {
  font-size: 1.2rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.wpm-big {
  font-size: clamp(4rem, 12vw, 7rem);
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.wpm-label {
  font-size: 1rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  transition: var(--transition);
}

.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-sm); }

.stat-card-value {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-card-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.stat-card-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Accuracy color coding */
.stat-high { color: var(--success) !important; }
.stat-mid  { color: var(--warning) !important; }
.stat-low  { color: var(--error)   !important; }

/* Results actions */
.results-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0;
}

/* ======================================
   HEAT MAP
   ====================================== */
.heatmap-section {
  margin: 32px 0;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
}

.keyboard-heatmap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  overflow-x: auto;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-bottom: 5px;
}

.key {
  min-width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
  position: relative;
  transition: background 0.3s, color 0.3s;
  cursor: default;
}

.key[data-count]:not([data-count="0"])::after {
  content: attr(data-count);
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 0.5rem;
  opacity: 0.7;
}

.key.hm-0 { background: var(--bg-secondary); }
.key.hm-1 { background: rgba(245,158,11,0.15); border-color: rgba(245,158,11,0.3); color: #f59e0b; }
.key.hm-2 { background: rgba(245,158,11,0.3); border-color: rgba(245,158,11,0.5); color: #f59e0b; }
.key.hm-3 { background: rgba(239,68,68,0.25); border-color: rgba(239,68,68,0.4); color: #ef4444; }
.key.hm-4 { background: rgba(239,68,68,0.45); border-color: rgba(239,68,68,0.6); color: #fff; }
.key.hm-5 { background: #ef4444; border-color: #dc2626; color: #fff; }

.key.space { min-width: 200px; }
.key.tab, .key.caps { min-width: 56px; }
.key.shift-l, .key.shift-r { min-width: 72px; }
.key.enter { min-width: 68px; }
.key.backspace { min-width: 72px; }

/* Heatmap legend */
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
  justify-content: center;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* ======================================
   CERTIFICATE
   ====================================== */
.certificate-section { margin: 24px 0; }

#certificate-canvas {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  display: block;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.cert-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

/* ======================================
   ABOUT PAGE
   ====================================== */
.about-hero {
  padding: 80px 0 60px;
  text-align: center;
}

.about-hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

.about-hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.75;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin: 48px 0;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  transition: var(--transition);
}

.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
}

.feature-icon {
  width: 48px;
  height: 48px;
  background: var(--accent-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--accent);
}

.feature-icon svg { width: 24px; height: 24px; }

.feature-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; }
.feature-card p { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.65; }

/* Stats row on about page */
.about-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  padding: 48px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 32px 0;
  text-align: center;
}

.about-stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent);
  margin-bottom: 4px;
}

.about-stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Team / story section */
.story-section { padding: 48px 0; max-width: 680px; margin: 0 auto; }
.story-section h2 { font-size: 1.6rem; font-weight: 700; margin-bottom: 20px; }
.story-section p { color: var(--text-secondary); line-height: 1.8; margin-bottom: 16px; }

/* Benchmark table */
.benchmark-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.9rem;
}

.benchmark-table th,
.benchmark-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.benchmark-table th {
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  background: var(--bg-card);
}

.benchmark-table tr:hover td { background: var(--bg-card); }

/* ======================================
   CONTACT PAGE
   ====================================== */
.contact-page { padding: 60px 0 80px; }

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 48px;
  align-items: start;
}

.contact-info h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  line-height: 1.2;
}

.contact-info p {
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 32px;
}

.contact-method {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.contact-method-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.contact-method-icon svg { width: 20px; height: 20px; }
.contact-method h3 { font-size: 0.9rem; font-weight: 600; margin-bottom: 2px; }
.contact-method p  { font-size: 0.8rem; color: var(--text-secondary); margin: 0; }
.contact-method a  { color: var(--accent); font-size: 0.85rem; }

/* Contact form */
.contact-form-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
}

.contact-form-wrap h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { height: 130px; resize: vertical; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-submit {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.form-submit:hover { background: var(--accent-hover); transform: translateY(-1px); }
.form-submit svg { width: 18px; height: 18px; }

/* Form messages */
.form-message {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-top: 12px;
  display: none;
}
.form-message.success { background: rgba(34,197,94,0.1); color: var(--success); border: 1px solid rgba(34,197,94,0.3); display: block; }
.form-message.error   { background: rgba(239,68,68,0.1); color: var(--error); border: 1px solid rgba(239,68,68,0.3); display: block; }

/* ======================================
   BLOG / ARCHIVE
   ====================================== */
.blog-page { padding: 60px 0; }

.page-header {
  text-align: center;
  margin-bottom: 48px;
}
.page-header h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em; }
.page-header p { color: var(--text-secondary); margin-top: 8px; }

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
}

.post-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-md); }

.post-card-img { aspect-ratio: 16/9; overflow: hidden; }
.post-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.post-card:hover .post-card-img img { transform: scale(1.05); }

.post-card-body { padding: 24px; }

.post-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.post-meta .tag {
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.7rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.post-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.35;
}
.post-card-title a { color: var(--text-primary); }
.post-card-title a:hover { color: var(--accent); }

.post-card-excerpt { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.65; }

.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.read-more {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.read-more svg { width: 14px; height: 14px; }

/* Single post */
.single-post { padding: 60px 0 80px; }
.post-content { max-width: 720px; margin: 0 auto; }
.post-title { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; margin-bottom: 20px; }
.post-body { color: var(--text-secondary); line-height: 1.85; }
.post-body h2 { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); margin: 40px 0 16px; }
.post-body h3 { font-size: 1.2rem; font-weight: 600; color: var(--text-primary); margin: 32px 0 12px; }
.post-body p { margin-bottom: 18px; }
.post-body ul, .post-body ol { padding-left: 24px; margin-bottom: 18px; }
.post-body li { margin-bottom: 8px; }
.post-body code { font-family: var(--font-mono); background: var(--bg-card); padding: 2px 6px; border-radius: 4px; font-size: 0.875em; color: var(--accent); }
.post-body blockquote { border-left: 3px solid var(--accent); padding: 12px 20px; background: var(--bg-card); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 24px 0; font-style: italic; }

/* ======================================
   FOOTER
   ====================================== */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 60px 0 32px;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 48px;
}

.footer-brand .site-logo { margin-bottom: 14px; font-size: 1.2rem; }
.footer-brand p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.7; max-width: 260px; }

.footer-col h4 { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 16px; }

.footer-col ul { display: flex; flex-direction: column; gap: 10px; }
.footer-col ul a { font-size: 0.875rem; color: var(--text-secondary); }
.footer-col ul a:hover { color: var(--text-primary); }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 12px;
}

.footer-social { display: flex; gap: 10px; }
.social-link {
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
}
.social-link:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-light); }
.social-link svg { width: 16px; height: 16px; }

/* ======================================
   PAGE — 404
   ====================================== */
.error-404 {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
}

.error-404 .error-number {
  font-size: clamp(5rem, 15vw, 10rem);
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--accent);
  line-height: 1;
  opacity: 0.3;
  margin-bottom: 16px;
}

.error-404 h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 12px; }
.error-404 p  { color: var(--text-secondary); margin-bottom: 24px; }

/* ======================================
   RESPONSIVE
   ====================================== */
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .header-inner { height: 56px; }
  .site-nav { display: none; position: fixed; top: 56px; left: 0; right: 0; background: var(--bg-secondary); border-bottom: 1px solid var(--border); flex-direction: column; padding: 16px; z-index: 99; }
  .site-nav.open { display: flex; }
  .hamburger { display: flex; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  #typing-display { font-size: 1.1rem; }
  .typing-area-wrap { padding: 24px 20px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .keyboard-heatmap { padding: 16px 8px; }
  .key { min-width: 28px; height: 28px; font-size: 0.6rem; }
  .key.space { min-width: 130px; }
  .key.tab, .key.caps { min-width: 42px; }
  .key.shift-l, .key.shift-r { min-width: 55px; }
  .key.enter, .key.backspace { min-width: 55px; }
}

/* ======================================
   UTILITY
   ====================================== */
.text-center { text-align: center; }
.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mb-48 { margin-bottom: 48px; }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Selection */
::selection { background: var(--accent-light); color: var(--accent); }

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
