/* ==========================================================================
   Portfolio — minimal developer style
   Light/dark theming via CSS variables; the `dark` class on <html>
   is toggled by script.js (saved in localStorage, system preference default).
   ========================================================================== */

:root {
  /* light theme */
  --background: #ffffff;
  --foreground: #0a0a0a;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --border: #e4e4e7;
  --outline-border: #e4e4e7;
  --primary: #18181b;
  --primary-hover: #303036;
  --primary-foreground: #fafafa;
  --header-bg: rgba(255, 255, 255, 0.8);
  --accent: #059669; /* emerald-600 */
  --accent-bright: #10b981; /* emerald-500 */
  --accent-soft: rgba(5, 150, 105, 0.5);
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;
}

.dark {
  /* dark theme */
  --background: #0a0a0a;
  --foreground: #fafafa;
  --muted: #27272a;
  --muted-foreground: #a1a1aa;
  --border: rgba(255, 255, 255, 0.1);
  --outline-border: rgba(255, 255, 255, 0.15);
  --primary: #e4e4e7;
  --primary-hover: #d4d4d8;
  --primary-foreground: #18181b;
  --header-bg: rgba(10, 10, 10, 0.8);
  --accent: #34d399; /* emerald-400 */
  --accent-bright: #10b981;
  --accent-soft: rgba(52, 211, 153, 0.4);
}

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

html {
  scroll-behavior: smooth;
  /* keep anchor targets clear of the sticky header */
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
p {
  margin: 0;
}

::selection {
  background: rgba(16, 185, 129, 0.25);
}

:focus-visible {
  outline: 2px solid var(--muted-foreground);
  outline-offset: 2px;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

.container {
  width: 100%;
  max-width: 56rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

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

/* ------------------------------ header ------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
}

.logo {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--foreground);
  text-decoration: none;
}

.logo .dim {
  color: var(--muted-foreground);
  opacity: 0.6;
}

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

@media (min-width: 640px) {
  .nav {
    gap: 0.5rem;
  }
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--muted-foreground);
  text-decoration: none;
  padding: 0.375rem 0.625rem;
  border-radius: 0.375rem;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-link:hover {
  color: var(--foreground);
  background: var(--muted);
}

.nav-link .accent-dim {
  color: var(--accent);
  opacity: 0.7;
  margin-right: 0.25rem;
}

/* theme toggle button */
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--foreground);
  background: var(--muted);
}

.theme-toggle svg {
  width: 1.1rem;
  height: 1.1rem;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.icon-sun {
  transform: rotate(0deg) scale(1);
  opacity: 1;
}

.icon-moon {
  position: absolute;
  transform: rotate(90deg) scale(0);
  opacity: 0;
}

.dark .icon-sun {
  transform: rotate(-90deg) scale(0);
  opacity: 0;
}

.dark .icon-moon {
  transform: rotate(0deg) scale(1);
  opacity: 1;
}

/* ------------------------------ hero ------------------------------ */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.dot-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: var(--foreground);
  opacity: 0.06;
  background-image: radial-gradient(currentColor 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(
    ellipse 70% 70% at 50% 20%,
    #000,
    transparent
  );
  mask-image: radial-gradient(ellipse 70% 70% at 50% 20%, #000, transparent);
}

.hero-inner {
  position: relative;
  padding-top: 6rem;
  padding-bottom: 6rem;
}

@media (min-width: 768px) {
  .hero-inner {
    padding-top: 9rem;
    padding-bottom: 9rem;
  }
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  background: var(--muted);
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.pulse {
  position: relative;
  display: inline-flex;
  width: 0.5rem;
  height: 0.5rem;
}

.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: var(--accent-bright);
  opacity: 0.6;
  animation: ping 1.2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.pulse-core {
  position: relative;
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: var(--accent-bright);
}

@keyframes ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

.prompt {
  margin-top: 2rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--accent);
}

.work .prompt {
  margin-top: 0;
}

h1 {
  margin-top: 0.75rem;
  max-width: 42rem;
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

@media (min-width: 640px) {
  h1 {
    font-size: 3rem;
  }
}

@media (min-width: 768px) {
  h1 {
    font-size: 3.75rem;
    line-height: 1.05;
  }
}

.role {
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 1.125rem;
  color: var(--muted-foreground);
}

@media (min-width: 640px) {
  .role {
    font-size: 1.25rem;
  }
}

.caret {
  display: inline-block;
  width: 9px;
  height: 1.1em;
  transform: translateY(3px);
  margin-left: 0.375rem;
  background: var(--accent);
  opacity: 0.8;
  animation: blink 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 0.8;
  }
  50% {
    opacity: 0.2;
  }
}

.bio {
  margin-top: 1.5rem;
  max-width: 36rem;
  line-height: 1.625;
  color: var(--muted-foreground);
}

/* buttons */
.cta-row {
  margin-top: 2.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 2.25rem;
  padding: 0 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-sans);
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn svg {
  width: 1rem;
  height: 1rem;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border: 1px solid var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-outline {
  border: 1px solid var(--outline-border);
  background: var(--background);
  color: var(--foreground);
}

.btn-outline:hover {
  background: var(--muted);
}

.stack {
  margin-top: 3rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-foreground);
  opacity: 0.85;
}

.stack-label {
  opacity: 0.6;
}

/* ------------------------- portfolio section ------------------------- */
.work {
  padding: 5rem 0;
}

@media (min-width: 768px) {
  .work {
    padding: 7rem 0;
  }
}

.work h2 {
  margin-top: 0.5rem;
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

@media (min-width: 640px) {
  .work h2 {
    font-size: 2.25rem;
  }
}

.work-sub {
  margin-top: 0.75rem;
  max-width: 36rem;
  font-size: 0.875rem;
  line-height: 1.625;
  color: var(--muted-foreground);
}

.card-grid {
  margin-top: 2.5rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.project-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  background: var(--background);
  color: var(--foreground);
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease,
    box-shadow 0.2s ease;
}

.project-card:hover {
  border-color: var(--accent-soft);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.25);
}

.project-preview {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--muted);
}

.project-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
  transition: transform 0.35s ease;
}

.project-card:hover .project-preview img {
  transform: scale(1.04);
}

.preview-tag {
  position: absolute;
  right: 0.625rem;
  bottom: 0.625rem;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent);
  opacity: 0.9;
}

.project-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.125rem 1.25rem 1.25rem;
}

.project-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.project-title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.external-icon {
  flex: none;
  width: 0.9rem;
  height: 0.9rem;
  color: var(--muted-foreground);
  opacity: 0.6;
  transition: color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.project-card:hover .external-icon {
  color: var(--accent);
  opacity: 1;
  transform: translate(1px, -1px);
}

.project-desc {
  margin-top: 0.5rem;
  flex: 1;
  font-size: 0.875rem;
  line-height: 1.625;
  color: var(--muted-foreground);
}

.project-meta {
  margin-top: 0.875rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-foreground);
  opacity: 0.55;
}

.project-meta .sep {
  margin: 0 0.25rem;
}

/* ------------------------------ footer ------------------------------ */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.footer-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

@media (min-width: 640px) {
  .footer-main {
    flex-direction: row;
    align-items: center;
  }
}

.footer-prompt {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--foreground);
}

.footer-mail {
  display: inline-block;
  margin-top: 0.375rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-mail:hover {
  color: var(--accent);
  text-decoration: underline;
}

.socials {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  color: var(--foreground);
  transition: background-color 0.15s ease;
}

.icon-btn:hover {
  background: var(--muted);
}

.icon-btn svg {
  width: 1rem;
  height: 1rem;
}

.footer-copy {
  border-top: 1px solid var(--border);
}

.footer-copy p {
  padding-top: 1rem;
  padding-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-foreground);
  opacity: 0.75;
  text-align: center;
}

@media (min-width: 640px) {
  .footer-copy p {
    text-align: left;
  }
}

/* -------------------------- entrance animations -------------------------- */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-up {
  animation: fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.d1 {
  animation-delay: 0.08s;
}

.d2 {
  animation-delay: 0.16s;
}

.d3 {
  animation-delay: 0.24s;
}

.d4 {
  animation-delay: 0.34s;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .fade-up,
  .d1,
  .d2,
  .d3,
  .d4 {
    animation: none;
  }
  .pulse::after,
  .caret {
    animation: none;
  }
}
