/* Portfolio — plain CSS (no Tailwind / build step) */

/* Light theme (default when html has no .dark) */
:root {
  color-scheme: light;
  --background: hsl(220 20% 98%);
  --foreground: hsl(222 47% 11%);
  --border: hsl(220 13% 88%);
  --card: hsl(0 0% 100%);
  --muted-foreground: hsl(220 9% 40%);
  --primary: hsl(210 90% 45%);
  --primary-foreground: hsl(0 0% 100%);
  --accent: hsl(220 14% 95%);
  --accent-foreground: hsl(222 47% 11%);
  --radius: 0.5rem;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
  --font-serif: "New York", "Iowan Old Style", Georgia, serif;
  --header-h: 4rem;
}

/* Dark theme */
html.dark {
  color-scheme: dark;
  --background: hsl(222 47% 9%);
  --foreground: hsl(210 40% 95%);
  --border: hsl(222 30% 18%);
  --card: hsl(222 47% 13%);
  --muted-foreground: hsl(215 25% 60%);
  --primary: hsl(210 100% 65%);
  --primary-foreground: hsl(222 47% 9%);
  --accent: hsl(222 40% 16%);
  --accent-foreground: hsl(210 40% 95%);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.35s ease, color 0.35s ease;
}

h1,
h2,
h3,
h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: var(--primary-foreground);
}

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

.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.icon--sm {
  width: 1rem;
  height: 1rem;
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--header-h);
  background: color-mix(in hsl, var(--background) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.site-header__home {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.2s;
}

.site-header__home:hover {
  color: var(--foreground);
}

.site-header__name {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.theme-toggle:hover {
  color: var(--foreground);
  background: color-mix(in hsl, var(--foreground) 6%, transparent);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.theme-toggle__icon {
  width: 1.125rem;
  height: 1.125rem;
}

html.dark .theme-toggle__icon--sun {
  display: none;
}

html:not(.dark) .theme-toggle__icon--moon {
  display: none;
}

/* Layout */
.page-wrap {
  max-width: 56rem;
  margin: 0 auto;
  padding: 7rem 1.5rem 6rem;
  display: flex;
  flex-direction: column;
  gap: 6rem;
}

/* Hero */
.hero {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  min-height: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Lower % = anchor toward top of GIF so heads aren’t clipped */
  object-position: center 22%;
  opacity: 0.3;
  pointer-events: none;
  user-select: none;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  background: color-mix(in hsl, var(--background) 50%, transparent);
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 0 1rem;
}

.hero__avatar {
  width: 8rem;
  height: 8rem;
  border-radius: 999px;
  overflow: hidden;
  border: 4px solid var(--border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  position: relative;
  background: var(--card);
}

.hero__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero__avatar--fallback img {
  display: none !important;
}

.hero__initials {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--muted-foreground);
}

.hero__avatar--fallback .hero__initials {
  display: flex;
}

.hero__title {
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero__tagline {
  margin: 0;
  font-size: 1.5rem;
  font-style: italic;
  color: var(--muted-foreground);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  padding-top: 0.5rem;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
  padding: 0 0 0.25rem;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.link-btn--primary {
  color: var(--foreground);
  border-bottom-color: var(--foreground);
}

.link-btn--primary:hover {
  color: var(--muted-foreground);
  border-bottom-color: var(--muted-foreground);
}

.link-btn--muted {
  color: var(--muted-foreground);
  border-bottom-color: transparent;
}

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

/* Sections */
.section--about {
  display: grid;
  gap: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 4rem;
}

@media (min-width: 768px) {
  .section--about {
    grid-template-columns: 1fr 2fr;
    align-items: start;
  }
}

.section__label {
  margin: 0.25rem 0 0;
  font-size: 1.5rem;
}

.section__prose,
.prose {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--muted-foreground);
}

.prose p {
  margin: 0 0 1.25rem;
}

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

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

.section--projects {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.section__title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
}

.section__title--center {
  text-align: center;
}

.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

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

.project-card {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 0.75rem;
  padding: 1.5rem 2rem;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  transition: background 0.3s;
  font: inherit;
  color: inherit;
}

.project-card:hover {
  background: var(--accent);
}

.project-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.project-card__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 400;
}

.project-card__arrow {
  color: var(--muted-foreground);
  flex-shrink: 0;
  transition: transform 0.3s, color 0.3s;
}

.project-card:hover .project-card__arrow {
  color: var(--foreground);
  transform: translate(0.25rem, -0.25rem);
}

.project-card__desc {
  margin: 1rem 0 0;
  color: var(--muted-foreground);
  line-height: 1.6;
}

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.tag-pill {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  background: var(--background);
  border: 1px solid var(--border);
  color: var(--muted-foreground);
}

.tag-pill--more {
  opacity: 0.5;
  border: none;
  background: transparent;
}

/* Contact */
.section--contact {
  border-top: 1px solid var(--border);
  padding-top: 4rem;
  padding-bottom: 3rem;
}

.section--contact > .section__title {
  margin-bottom: 1.5rem;
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--foreground);
  text-decoration: none;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.contact-btn:hover {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.contact-btn--github:hover {
  background: var(--foreground);
  color: var(--background);
  border-color: var(--foreground);
}

.contact-btn--linkedin:hover {
  background: #0a66c2;
  color: #fff;
  border-color: #0a66c2;
}

/* Modal */
.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}

.modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  cursor: pointer;
}

.modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 48rem;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  margin: auto 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
}

.modal__header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 1.5rem 2rem 1rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.modal__title {
  margin: 0 0 0.5rem;
  font-family: var(--font-serif);
  font-size: 1.5rem;
}

@media (min-width: 768px) {
  .modal__title {
    font-size: 1.875rem;
  }
}

.modal__desc {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 1rem;
  line-height: 1.5;
}

.modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 0.25rem;
}

.modal__close:hover {
  color: var(--foreground);
}

.modal__body {
  padding: 1.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.modal__video {
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border);
  background: color-mix(in hsl, var(--background) 90%, transparent);
}

.modal__video iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.modal__subtitle {
  margin: 0 0 1rem;
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal__chart-wrap {
  height: 16rem;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
  background: var(--card);
}

.modal__chart-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.modal__text {
  margin: 0;
  color: var(--muted-foreground);
  line-height: 1.7;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-list .tag-pill {
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
  background: var(--accent);
  color: var(--accent-foreground);
  border: none;
}

body.modal-open {
  overflow: hidden;
}
