:root {
  --bg: #07111f;
  --bg-elevated: rgba(10, 21, 38, 0.78);
  --surface: rgba(255, 255, 255, 0.08);
  --surface-strong: rgba(255, 255, 255, 0.14);
  --text: #f5f7fb;
  --muted: #9fb0c7;
  --accent: #6ee7ff;
  --accent-strong: #24284b;
  --border: rgba(255, 255, 255, 0.16);
  --radius-lg: 24px;
  --radius-md: 18px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.26);
  --max-width: 1160px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(132, 106, 38, 0.596), transparent 28%),
    linear-gradient(135deg, #06101d 0%, #091424 100%);
  line-height: 1.6;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), transparent);
  pointer-events: none;
  z-index: -1;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(var(--max-width), calc(100% - 2rem));
  margin: 0 auto;
}

.section {
  padding: 6.5rem 0;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #02111d;
  padding: 0.75rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(24px);
  background: rgba(6, 16, 29, 0.72);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.95rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.nav-links a {
  color: var(--muted);
  transition: color 180ms ease, transform 180ms ease;
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  transform: translateY(-1px);
}

.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.28rem;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 0.3rem;
  border: 0;
  background: transparent;
  padding: 0.25rem;
}

.nav-toggle span {
  width: 1.5rem;
  height: 2px;
  background: var(--text);
}

.hero {
  position: relative;
  overflow: hidden;
  padding-top: 5.6rem;
}

.hero-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 75% 10%, rgba(138, 125, 255, 0.26), transparent 24%);
  animation: float 10s ease-in-out infinite alternate;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: center;
}

.error-page {
  min-height: calc(100vh - 7rem);
  display: flex;
  align-items: center;
}

.error-content {
  max-width: 720px;
}

.error-content h1 {
  font-size: clamp(3rem, 8vw, 6rem);
  margin: 0 0 1rem;
}

.error-content code {
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.95em;
}

.eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
}

h1,
h2,
h3 {
  line-height: 1.12;
}

.hero h1 {
  font-size: clamp(2.5rem, 4vw, 4.3rem);
  max-width: 1000ch;
}

.hero h1 span {
  color: var(--accent);
}

.hero-text,
.section-heading p,
.info-card p,
.project-content p,
.contact-shell p {
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.6rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.9rem 1.2rem;
  font-weight: 600;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #04131f;
  box-shadow: 0 10px 25px rgba(115, 216, 255, 0.22);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}

.hero-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 0;
  margin: 1.4rem 0 0;
  list-style: none;
}

.hero-highlights li {
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border: 1px solid var(--border);
}

.info-card,
.skill-card,
.project-card,
.contact-card,
.post-card,
.blog-sidebar {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.card-surface {
  border-radius: calc(var(--radius-lg) - 6px);
  padding: 1.6rem;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.image-card-surface {
  padding: 1rem;
}

.portrait-frame {
  aspect-ratio: 1 / 1;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(135deg, rgba(110, 231, 255, 0.15), rgba(124, 108, 255, 0.18));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.portrait-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.section-heading {
  max-width: 720px;
  margin-bottom: 2rem;
}

.section-heading.left {
  margin-bottom: 0;
}

.section-heading h2 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin: 0 0 0.75rem;
}

.about-grid,
.skills-grid,
.projects-grid {
  display: grid;
  gap: 1.35rem;
}

.about-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.info-card,
.skill-card {
  border-radius: var(--radius-md);
  padding: 1.4rem;
}

.skill-card ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.skill-card li {
  padding: 0.6rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.projects-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 220ms ease, border-color 220ms ease;
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(115, 216, 255, 0.4);
}

.project-content {
  padding: 1.25rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.8rem 0 1rem;
}

.tag-list span,
.blog-tags span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.4rem 0.65rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.85rem;
}

.project-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.project-actions a {
  color: var(--accent);
  font-weight: 600;
}

.contact-shell {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 1.5rem;
  align-items: start;
}

.contact-card {
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.contact-spacer {
  height: clamp(220px, 26vh, 420px);
}

.contact-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.6rem;
  color: var(--muted);
}

.contact-list a {
  color: var(--accent);
}

.contact-form {
  display: grid;
  gap: 0.65rem;
}

.contact-note {
  color: var(--muted);
  margin: 0;
}

.site-footer {
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
  color: var(--muted);
}

#terminal-root.is-interactive ~ .site-footer {
  margin-top: 0;
}

.footer-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.blog-hero {
  padding-top: 2.5rem;
  padding-bottom: 3rem;
}

.blog-back-button {
  margin: 0 0 1.4rem;
}

.blog-hero-meta {
  margin-top: 1rem;
}

.blog-divider {
  width: 100%;
  height: 1px;
  margin-top: 1.5rem;
  background: var(--border);
}

.blog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.blog-toolbar input {
  max-width: 320px;
  padding: 0.9rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.blog-toggle {
  border: 1px solid var(--border);
}


.blog-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1.35fr 0.65fr;
}

.blog-main {
  grid-column: 1 / -1;
}

.featured-post,
.post-card {
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  overflow-wrap: anywhere;
}

.post-meta {
  color: var(--accent);
  font-size: 0.9rem;
  margin: 0 0 0.6rem;
}

.post-link {
  display: block;
  color: inherit;
  overflow-wrap: anywhere;
}

.post-link h2,
.post-link p {
  margin-left: 0;
  margin-right: 0;
}

.post-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.post-link:hover h2,
.post-link:focus-visible h2,
.read-more,
.back-link {
  color: var(--accent);
}

.read-more,
.back-link {
  display: inline-flex;
  margin-top: 0.4rem;
  font-weight: 700;
}

.full-post {
  max-width: 820px;
  padding: 0;
  overflow-wrap: anywhere;
}

.back-button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.8rem 1.05rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: transform 180ms ease, border-color 180ms ease, color 180ms ease;
}

.back-button:hover,
.back-button:focus-visible {
  border-color: rgba(115, 216, 255, 0.55);
  color: var(--accent);
  transform: translateY(-2px);
}

.full-post-body {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.blog-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
}

.page-link:hover,
.page-link:focus-visible,
.page-link.active {
  border-color: rgba(115, 216, 255, 0.55);
  color: var(--accent);
}

.posts-list {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.blog-sidebar {
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  align-self: start;
}

.blog-sidebar ul {
  padding-left: 1rem;
  color: var(--muted);
}

.blog-sidebar li + li {
  margin-top: 0.7rem;
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

body[data-theme="light"] {
  --bg: #ecf3f7;
  --bg-elevated: rgba(255, 255, 255, 0.7);
  --surface: rgba(17, 38, 57, 0.04);
  --surface-strong: rgba(17, 38, 57, 0.08);
  --text: #122334;
  --muted: #4d6479;
  --accent: #1e7a6f;
  --accent-strong: #abdbab;
  --border: rgba(13, 36, 54, 0.12);
  background:
    radial-gradient(circle at top left, rgba(18, 96, 70, 0.14), transparent 28%),
    linear-gradient(135deg, #edf4f6 0%, #dfe9ef 100%);
}

body[data-theme="light"] .nav-links a,
body[data-theme="light"] .hero-text,
body[data-theme="light"] .section-heading p,
body[data-theme="light"] .info-card p,
body[data-theme="light"] .project-content p,
body[data-theme="light"] .contact-shell p,
body[data-theme="light"] .contact-list,
body[data-theme="light"] .tag-list span,
body[data-theme="light"] .hero-highlights li,
body[data-theme="light"] .site-footer,
body[data-theme="light"] .footer-content,
body[data-theme="light"] .skill-card li {
  color: var(--muted);
}

#terminal-root {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: calc(100vw - 48px);
  z-index: 60;
  pointer-events: none;
  transition: position 500ms cubic-bezier(0.22, 1, 0.36, 1), left 500ms cubic-bezier(0.22, 1, 0.36, 1), bottom 500ms cubic-bezier(0.22, 1, 0.36, 1), transform 500ms cubic-bezier(0.22, 1, 0.36, 1), width 500ms cubic-bezier(0.22, 1, 0.36, 1), margin 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

#terminal-root.is-interactive {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  width: calc(100% - 48px);
  margin: 1.5rem auto 3.5rem;
  pointer-events: auto;
  z-index: 2;
}

body.terminal-activated #terminal-root.is-interactive::before {
  content: "";
  position: absolute;
  inset: -16rem calc(50% - 50vw) -4rem;
  z-index: -1;
  background:
    radial-gradient(circle at 18% 24%, rgba(116, 211, 171, 0.18), transparent 38%),
    linear-gradient(
      180deg,
      rgba(7, 18, 29, 0) 0%,
      rgba(8, 24, 28, 0.08) 18%,
      rgba(9, 29, 31, 0.52) 48%,
      #061912 100%
    );
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0) 12%, #000 46%);
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0) 12%, #000 46%);
}

body.terminal-activated #terminal-root.is-interactive ~ .site-footer {
  background: #061912;
  border-top-color: rgba(154, 255, 198, 0.14);
  color: rgba(216, 249, 232, 0.82);
  padding-top: 3rem;
  z-index: 3;
}

body.terminal-activated #terminal-root.is-interactive ~ .site-footer .footer-content,
body.terminal-activated #terminal-root.is-interactive ~ .site-footer .footer-links a {
  color: rgba(216, 249, 232, 0.82);
}

.terminal-dock {
  position: relative;
  pointer-events: auto;
  background: rgba(6, 15, 12, 0.72);
  border: 1px solid rgba(154, 255, 198, 0.2);
  border-radius: 20px 20px 16px 16px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
  color: #d8f9e8;
  overflow: hidden;
  transition: width 600ms cubic-bezier(0.22, 1, 0.36, 1), height 600ms cubic-bezier(0.22, 1, 0.36, 1), border-radius 600ms cubic-bezier(0.22, 1, 0.36, 1), transform 600ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 600ms cubic-bezier(0.22, 1, 0.36, 1), min-height 600ms cubic-bezier(0.22, 1, 0.36, 1);
  min-height: 160px;
}

.terminal-dock::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(125, 255, 204, 0.08), transparent 28%, rgba(129, 255, 184, 0.03));
  pointer-events: none;
}

.terminal-dock.is-interactive {
  width: 100%;
  min-height: 340px;
  border-radius: 26px;
  box-shadow: 0 24px 60px rgba(5, 16, 15, 0.42);
  transform: translateY(-2px);
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.72rem 1rem;
  border-bottom: 1px solid rgba(154, 255, 198, 0.14);
  background: rgba(10, 29, 23, 0.8);
}

.terminal-window-controls {
  display: inline-flex;
  gap: 0.45rem;
}

.terminal-window-controls span {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(214, 245, 227, 0.7);
}

.terminal-window-controls span:nth-child(1) { background: rgba(123, 247, 175, 0.82); }
.terminal-window-controls span:nth-child(2) { background: rgba(255, 205, 86, 0.7); }
.terminal-window-controls span:nth-child(3) { background: rgba(255, 117, 117, 0.7); }

.terminal-title {
  color: rgba(216, 249, 232, 0.8);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.terminal-log {
  min-height: 88px;
  max-height: 160px;
  overflow: auto;
  padding: 0.9rem 1rem 0.55rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.74rem;
  line-height: 1.7;
  color: rgba(214, 249, 227, 0.9);
  scrollbar-width: thin;
  scrollbar-color: rgba(154, 255, 198, 0.3) transparent;
}

.terminal-line {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.terminal-input-row {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem 1rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color: #d7f9e7;
}

.terminal-dock.is-interactive .terminal-input-row {
  display: flex;
}

.terminal-prompt {
  white-space: nowrap;
  color: #9ce9bb;
  font-weight: 700;
}

.terminal-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  color: #effff7;
  font: inherit;
  min-width: 0;
  caret-color: #dfffe9;
}

.terminal-input::placeholder {
  color: rgba(223, 255, 233, 0.4);
}

.terminal-line.command {
  color: #b5f6d1;
}

.terminal-line.output {
  color: rgba(214, 249, 227, 0.9);
}

.terminal-line.error {
  color: #ffb8b8;
}

.terminal-line.system {
  color: #a7e7d0;
}

.terminal-line.ok {
  color: #8be4b0;
}

.terminal-line.warning {
  color: #f4df8d;
}

.terminal-dock.is-interactive .terminal-log {
  max-height: 220px;
  min-height: 120px;
}

.terminal-dock.is-interactive .terminal-input-row {
  border-top: 1px solid rgba(154, 255, 198, 0.14);
}


.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes terminal-cursor {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

@keyframes float {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(0, 8px, 0);
  }
}

@media (max-width: 900px) {
  .hero-grid,
  .contact-shell,
  .blog-grid,
  .projects-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 700px) {
  #terminal-root,
  #terminal-root.is-interactive {
    width: calc(100vw - 24px);
  }

  .nav {
    position: relative;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 0.6rem);
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.9rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(7, 17, 31, 0.96);
    box-shadow: var(--shadow);
    min-width: 180px;
  }

  .nav-links a {
    width: 100%;
    padding: 0.55rem 0;
  }

  .section {
    padding: 4.6rem 0;
  }

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

  .hero {
    padding-top: 4rem;
  }

  .hero h1 {
    max-width: 100%;
  }

  .footer-content {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
