:root {
  --bg: #f6f7fb;
  --bg-alt: #ecedf6;
  --card: #ffffff;
  --text: #191b2e;
  --text-soft: #5a5f78;
  --accent: #5a4fe0;
  --accent-soft: rgba(90, 79, 224, 0.12);
  --on-accent: #ffffff;
  --red: #e2574c;
  --blue: #1499ad;
  --border: #e3e5f0;
  --terminal-bg: #191b2e;
  --terminal-text: #e9ebf7;
  --shadow: 0 12px 32px rgba(25, 27, 46, 0.12);
  --radius: 16px;
  --font-head: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

:root[data-theme="dark"] {
  --bg: #0e1020;
  --bg-alt: #15172a;
  --card: #1a1d33;
  --text: #ecedfb;
  --text-soft: #9a9fc2;
  --accent: #8b7dff;
  --accent-soft: rgba(139, 125, 255, 0.14);
  --on-accent: #14162b;
  --border: #2a2e4a;
  --terminal-bg: #090a15;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1020;
    --bg-alt: #15172a;
    --card: #1a1d33;
    --text: #ecedfb;
    --text-soft: #9a9fc2;
    --accent: #8b7dff;
    --accent-soft: rgba(139, 125, 255, 0.14);
    --on-accent: #14162b;
    --border: #2a2e4a;
    --terminal-bg: #090a15;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition: background 0.3s, color 0.3s;
}

h1, h2, h3 {
  font-family: var(--font-head);
  color: var(--text);
  line-height: 1.2;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 6vw;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

.navbar.scrolled {
  border-bottom-color: var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--text);
}

.logo-mark {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}

.logo-text {
  font-family: var(--font-head);
  font-weight: 600;
}

.nav-links {
  display: flex;
  gap: 1.8rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-soft);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--accent);
}

#theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, transform 0.15s;
}

#theme-toggle:hover {
  border-color: var(--accent);
}

#theme-toggle:active {
  transform: scale(0.92);
}

#theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--text);
  stroke-width: 1.7;
}

.icon-moon { display: none; }

:root[data-theme="dark"] .icon-moon { display: block; }
:root[data-theme="dark"] .icon-sun { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-moon { display: block; }
  :root:not([data-theme="light"]) .icon-sun { display: none; }
}

.hero {
  position: relative;
  overflow: hidden;
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 26px 26px;
}

.hero::before {
  content: "";
  position: absolute;
  top: -30%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  max-width: 700px;
  max-height: 700px;
  background: radial-gradient(circle, var(--accent-soft), transparent 65%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 5rem 6vw 6rem;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 3rem;
  align-items: center;
}

.hello {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 0.6rem;
}

.hero-text h1 {
  font-size: clamp(2.8rem, 6vw, 4.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.2rem;
}

.accent-dot {
  color: var(--accent);
}

.tagline {
  font-size: 1.15rem;
  color: var(--text-soft);
  max-width: 460px;
  margin-bottom: 2.2rem;
}

.tagline strong {
  color: var(--text);
  font-weight: 600;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 8px 22px var(--accent-soft);
}

.btn-primary:hover {
  box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 35%, transparent);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.05rem;
  font-family: var(--font-mono);
}

.terminal {
  background: var(--terminal-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.dot-red { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }

.terminal-title {
  margin-left: 0.6rem;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.75rem;
}

.terminal-body {
  padding: 1.2rem 1.3rem 1.5rem;
  color: var(--terminal-text);
  min-height: 210px;
  max-height: 260px;
  overflow-y: auto;
  line-height: 1.9;
  cursor: text;
}

.term-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
}

.term-input {
  flex: 1;
  min-width: 6ch;
  margin-left: 0.4ch;
  background: transparent;
  border: none;
  outline: none;
  color: var(--terminal-text);
  font-family: var(--font-mono);
  font-size: inherit;
  caret-color: #a99bff;
  padding: 0;
}

.terminal-body .prompt {
  color: #6dd67f;
}

.terminal-body .cmd {
  color: #a99bff;
}

.terminal-body .out {
  color: rgba(239, 230, 214, 0.85);
}

.cursor {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  background: #a99bff;
  vertical-align: text-bottom;
  animation: blink 1.05s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 5rem 6vw;
}

.section.alt {
  max-width: 100%;
  background: var(--bg-alt);
}

.section.alt > * {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

.eyebrow {
  display: block;
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.section h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  margin-bottom: 2.2rem;
  letter-spacing: -0.01em;
}

.section-note {
  color: var(--text-soft);
  margin-top: -1.6rem;
  margin-bottom: 2.2rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.8rem;
}

.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s, opacity 0.6s ease;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.project-preview {
  display: block;
  border-bottom: 1px solid var(--border);
}

.project-preview svg {
  display: block;
  width: 100%;
  height: auto;
}

.preview-next {
  color: var(--text-soft);
  background:
    radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 18px 18px;
}

.project-info {
  padding: 1.4rem 1.5rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  flex: 1;
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.project-info h3 {
  font-size: 1.2rem;
}

.project-info h3 a {
  color: var(--text);
  text-decoration: none;
}

.project-info h3 a:hover {
  color: var(--accent);
}

.project-info p {
  color: var(--text-soft);
  font-size: 0.95rem;
}

.learned {
  font-size: 0.9rem;
}

.learned strong {
  color: var(--accent);
}

.honest-note {
  font-size: 0.82rem;
  font-style: italic;
  opacity: 0.8;
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-soft);
  white-space: nowrap;
}

.chip-live,
.chip-code {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.4rem;
}

.tags li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
}

.tags-lg li {
  font-size: 0.85rem;
  padding: 0.45rem 0.9rem;
}

.project-next {
  border-style: dashed;
}

.project-next:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--accent);
}

.suggest-form {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  flex-wrap: wrap;
}

.suggest-form input {
  flex: 1;
  min-width: 8ch;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.suggest-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.suggest-form .btn {
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
}

.suggest-done {
  margin-top: auto;
  color: var(--accent);
  font-weight: 600;
}

.suggest-err {
  margin-top: auto;
  color: var(--red);
  font-size: 0.85rem;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.skill-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
}

.skill-card h3 {
  font-size: 1.05rem;
  margin-bottom: 1rem;
  color: var(--accent);
  font-family: var(--font-mono);
}

.skill-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.skill-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
}

.level {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

.level-1 {
  background: var(--accent-soft);
  color: var(--accent);
}

.level-2 {
  background: color-mix(in srgb, var(--blue) 14%, transparent);
  color: var(--blue);
}

:root[data-theme="dark"] .level-2 {
  color: #5cc8ff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .level-2 {
    color: #5cc8ff;
  }
}

.next-up {
  margin-top: 2.2rem;
  padding: 1.5rem 1.6rem;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
}

.next-up h3 {
  font-size: 1rem;
  margin-bottom: 0.9rem;
}

.timeline {
  list-style: none;
  position: relative;
  padding-left: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2.2rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}

.timeline li {
  position: relative;
}

.tl-marker {
  position: absolute;
  left: -2rem;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
}

.tl-now {
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
}

.tl-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tl-content h3 {
  font-size: 1.15rem;
  margin: 0.2rem 0 0.3rem;
}

.tl-content p {
  color: var(--text-soft);
  font-size: 0.95rem;
  max-width: 560px;
}

.about {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2.2rem;
  align-items: center;
}

.about-photo {
  position: relative;
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}

.portrait,
.portrait-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid var(--accent);
  box-shadow: var(--shadow);
}

.portrait {
  object-fit: cover;
  object-position: center 20%;
  display: none;
}

.portrait.loaded {
  display: block;
}

.portrait-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 2.6rem;
  letter-spacing: 0.02em;
}

.about-text p {
  color: var(--text-soft);
  margin-bottom: 0.9rem;
  max-width: 620px;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-text strong {
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 640px) {
  .about {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 1.5rem;
  }
}

.goal {
  max-width: 780px;
}

.goal-lead {
  font-size: 1.15rem;
  color: var(--text);
  margin-bottom: 1.2rem;
}

.goal-fields {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 1.6rem;
}

.goal-fields li {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding: 0.5rem 1rem;
  border-radius: 10px;
}

.goal-why {
  color: var(--text-soft);
}

.goal-lead strong,
.goal-why strong {
  color: var(--text);
  font-weight: 600;
}

.contact-box {
  text-align: center;
  padding: 1rem 0;
}

.contact-box h2 {
  margin-bottom: 1rem;
}

.contact-box p {
  color: var(--text-soft);
  margin-bottom: 2rem;
}

.contact-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

footer {
  text-align: center;
  padding: 2.5rem 6vw;
  color: var(--text-soft);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
}

footer strong {
  color: var(--accent);
  font-weight: 600;
}

.footer-copy {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 0.5rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.4rem 2rem 2rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  transform: translateY(18px) scale(0.97);
  transition: transform 0.3s ease;
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.7rem;
  width: 2rem;
  height: 2rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-soft);
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
}

.modal-close:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.modal-emoji {
  display: block;
  font-size: 2.4rem;
  margin-bottom: 0.5rem;
}

.modal h3 {
  font-size: 1.35rem;
  margin-bottom: 0.6rem;
}

.modal p {
  color: var(--text-soft);
  font-size: 0.98rem;
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  flex-wrap: wrap;
}

#contact-form {
  text-align: left;
  margin-top: 0.4rem;
}

.field {
  display: block;
  margin-bottom: 0.8rem;
}

.field > span {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 0.3rem;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.field textarea {
  resize: vertical;
  min-height: 84px;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.form-error {
  color: var(--red);
  font-size: 0.85rem;
  margin: 0 0 0.6rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
  margin-top: 0.2rem;
}

.btn-block[disabled] {
  opacity: 0.65;
  cursor: default;
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal {
    transition: opacity 0.2s ease;
  }
  .modal {
    transform: none;
  }
}

.contact-fab {
  position: fixed;
  right: 1.4rem;
  bottom: 1.4rem;
  z-index: 400;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.2rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
  transition: transform 0.18s ease, box-shadow 0.2s ease;
}

.contact-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px color-mix(in srgb, var(--accent) 45%, transparent);
}

.contact-fab:active {
  transform: scale(0.96);
}

.contact-fab svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 560px) {
  .contact-fab {
    right: 1rem;
    bottom: 1rem;
    padding: 0.7rem;
  }
  .contact-fab span {
    display: none;
  }
}

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .cursor {
    animation: none;
  }
}

@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
    padding-top: 3.5rem;
    gap: 2.5rem;
  }
  .terminal {
    max-width: 560px;
  }
}

@media (max-width: 640px) {
  .navbar {
    flex-wrap: wrap;
    justify-content: center;
  }
  .logo-text {
    display: none;
  }
  .nav-links {
    gap: 1.1rem;
    font-size: 0.88rem;
  }
  .hero-text h1 {
    font-size: 2.6rem;
  }
}

@media print {
  .navbar, .terminal, footer, #theme-toggle {
    display: none !important;
  }
  body {
    background: white;
    color: black;
  }
}
