/* Base color variables for dark mode */
:root {
  --bg: #050509;
  --bg-elevated: #11111a;
  --bg-elevated-soft: #151521;
  --border-subtle: #25253a;
  --accent: #4f46e5;
  --accent-soft: rgba(79, 70, 229, 0.18);
  --text: #f9fafb;
  --muted: #9ca3af;
  --radius-lg: 18px;
  --transition: 0.25s ease;
  --shadow-soft: 0 20px 45px rgba(0, 0, 0, 0.35);
}

/* CSS variables override in day mode */
body.day-mode {
  --bg: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-elevated-soft: #eef2f6;
  --border-subtle: #cbd5e1;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.18);
  --text: #0f172a;
  --muted: #475569;
}

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

/* Body defaults */
html,
body {
  margin: 0;
  padding: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Page wrapper */
.page {
  max-width: 1050px;
  margin: 0 auto;
  padding: 24px 18px 60px;
}

/* Top greeting bar */
.top-greeting-bar {
  text-align: left;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--accent);
  padding: 6px 0 4px;
  height: 30px;
  display: flex;
  align-items: center;
}

/* Sticky header with nav and theme toggle */
.site-header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 16px;
  backdrop-filter: blur(14px);
  background: rgba(0, 0, 0, 0.28);
  z-index: 50;
}

body.day-mode .site-header {
  background: rgba(248, 250, 252, 0.8);
}

/* Navigation links */
.nav {
  display: flex;
  gap: 18px;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  transition: var(--transition);
  font-size: 0.92rem;
}

.nav a:hover {
  background: var(--accent-soft);
  color: var(--text);
}

/* Theme toggle switch */
.switch {
  position: relative;
  width: 46px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: var(--border-subtle);
  border-radius: 34px;
  cursor: pointer;
  transition: var(--transition);
}

.slider:before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text);
  border-radius: 50%;
  transition: var(--transition);
}

input:checked + .slider {
  background: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* Hero layout */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.3fr);
  gap: 32px;
  align-items: center;
  padding: 36px 0;
}

/* Rotating greeting line */
.greeting-wrapper {
  min-height: 1.6em;
}

.eyebrow {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}

/* Hero title with typed text */
.hero-title {
  font-size: clamp(2.2rem, 4vw, 3rem);
  font-weight: 800;
  margin: 8px 0 10px;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  white-space: nowrap;
}

/* Constant "I'm" part */
.hero-im {
  flex: 0 0 auto;
}

/* Role text + cursor wrapper */
.role-typing {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  min-width: 12ch; /* keeps line height stable across roles */
}

/* Typed text span */
#typed-text {
  display: inline-block;
}

/* Blinking cursor */
.cursor {
  display: inline-block;
  margin-left: 2px;
  animation: blink 0.7s infinite;
  font-weight: 400;
}

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

/* Subtitle under hero title */
.subtitle {
  color: var(--muted);
  max-width: 36rem;
  margin-bottom: 20px;
  font-size: 0.98rem;
}

/* Hero call-to-action buttons */
.hero-actions {
  display: flex;
  gap: 14px;
}

/* Generic button style */
.btn {
  padding: 10px 22px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.96rem;
  transition: var(--transition);
}

/* Primary button */
.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.4);
  border: none;
}

/* Primary button hover */
.btn.primary:hover {
  transform: translateY(-2px);
}

/* Ghost button */
.btn.ghost {
  border: 1px solid var(--border-subtle);
  color: var(--muted);
  background: transparent;
}

/* Ghost button hover */
.btn.ghost:hover {
  background: var(--accent-soft);
  color: var(--text);
}

/* Right side hero terminal container */
.hero-terminal {
  display: flex;
  justify-content: flex-end;
}

/* Terminal window card */
.terminal-window {
  width: 100%;
  max-width: 360px;
  border-radius: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
}

/* Terminal header bar */
.terminal-header {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  gap: 6px;
  background: linear-gradient(
    to right,
    rgba(15, 23, 42, 0.95),
    rgba(15, 23, 42, 0.8)
  );
}

/* Header dots */
.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Dot colors */
.dot-red {
  background: #ff5f57;
}
.dot-amber {
  background: #febc2e;
}
.dot-green {
  background: #28c840;
}

/* Terminal title text */
.terminal-title {
  margin-left: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

/* Terminal body content */
.terminal-body {
  padding: 10px 12px 12px;
  background: radial-gradient(circle at top left, #1f2937, #020617 62%);
}

/* Terminal line with prompt and command */
.terminal-line {
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin-top: 4px;
}

/* Prompt symbol */
.prompt {
  color: #22c55e;
}

/* Command text */
.command {
  color: var(--text);
}

/* Terminal output lines */
.terminal-output {
  margin-left: 18px;
  margin-top: 2px;
  color: #e5e7eb;
}

/* Cursor line at bottom */
.terminal-cursor-line {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}

/* Block cursor */
.cursor-block {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: #e5e7eb;
  animation: blink 0.8s infinite;
}

/* Section wrapper */
.section {
  padding: 44px 0;
}

/* About section */
.about-section {
  padding: 36px 0;
}

/* Section titles */
.section h2,
.about-section h2 {
  font-size: 1.55rem;
  margin-bottom: 8px;
}

/* About text styling */
.about-text {
  max-width: 720px;
  font-size: 1.02rem;
  color: var(--muted);
  line-height: 1.75;
}

/* Section intro text */
.section-intro {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.98rem;
}

/* Subtle helper text */
.subtle {
  font-size: 0.86rem;
  color: var(--muted);
}

/* Card grid for highlights */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

/* Generic card style */
.card {
  padding: 20px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  transition: var(--transition);
}

/* Card hover effect */
.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

/* Subheading under card title */
.card-sub {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Tag list layout */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* Individual tag pill */
.tag {
  padding: 6px 12px;
  background: var(--bg-elevated-soft);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--text);
}

/* Reading log list grid */
.article-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

/* Reading log card */
.article-card {
  padding: 18px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  transition: var(--transition);
}

/* Reading log card hover */
.article-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

/* Article title with link */
.article-title a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

/* Article title hover */
.article-title a:hover {
  text-decoration: underline;
}

/* Article note text */
.article-note {
  color: var(--muted);
  margin-top: 4px;
  font-size: 0.9rem;
}

/* Muted text utility */
.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

/* Quote card */
.quote-card {
  padding: 24px;
  max-width: 750px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

/* Quote text */
#quote-text {
  font-size: 1.3rem;
  font-weight: 500;
  margin-bottom: 10px;
}

/* Quote author line */
.quote-author {
  text-align: right;
  color: var(--muted);
  margin-top: 4px;
  font-size: 0.9rem;
}

/* Contact form layout */
.contact-form {
  max-width: 720px;
  margin-top: 24px;
}

/* Contact form grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

/* Form row label + control */
.form-row {
  display: flex;
  flex-direction: column;
}

/* Label styling */
.form-row label {
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Input and textarea styling */
.form-row input,
.form-row textarea {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated-soft);
  color: var(--text);
  font-size: 0.95rem;
}

/* Focus outline for inputs */
.form-row input:focus,
.form-row textarea:focus {
  border-color: var(--accent);
  outline: none;
}

/* Contact submit button spacing */
.contact-submit-btn {
  margin-top: 18px;
  padding: 12px 24px;
  font-size: 0.98rem;
}

/* Footer area */
.footer {
  margin-top: 40px;
  text-align: left;
  color: var(--muted);
  font-size: 0.88rem;
}

/* Mobile responsive tweaks */
@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .hero-terminal {
    justify-content: flex-start;
  }

  .site-header {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .nav {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .hero-title {
    white-space: normal;
    flex-wrap: wrap;
  }
}

/* Day mode terminal visibility tweaks */
.day-mode .terminal-window {
  background: #f2f4f8;
  border: 1px solid #d0d5dd;
}

.day-mode .terminal-header {
  background: #e2e8f0;
  color: #1e293b;
}

.day-mode .terminal-title {
  color: #1e293b;
}

.day-mode .terminal-body {
  background: #f8fafc;
}

.day-mode .prompt {
  color: #10b981;
}

.day-mode .command {
  color: #334155;
}

.day-mode .terminal-output {
  color: #1e293b;
}

.day-mode .cursor-block {
  background: #1e293b;
}
/* Fact typing cursor */
#fact-cursor {
  display: inline-block;
  margin-left: 2px;
  width: 8px;
  animation: blink 0.8s infinite;
}

/* Cursor blink animation */
@keyframes blink {
  0% { opacity: 1; }
  50% { opacity: 0; }
  100% { opacity: 1; }
}

/* Ensure fact stays on one line and never bumps UI */
#fact-text {
  white-space: nowrap;
}
#reading-pagination button {
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--muted);
  transition: var(--transition);
}

#reading-pagination button:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--text);
}

#reading-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}