/* ==========================================================================
   components.css — UI blocks (Content-Out / Flexbox micro-layouts)
   BEM: Block__element--modifier
   ========================================================================== */

/* --------------------------------------------------------------------------
   Header / Navigation
   -------------------------------------------------------------------------- */

.header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--header-height);
  border-block-end: 1px solid var(--border-default);
  background: var(--surface-nav);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition-color);
}

.header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  max-width: var(--content-max);
  height: 100%;
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
  text-decoration: none;
  transition: var(--transition-interactive);
}

.header__brand:hover {
  color: var(--color-brand-600);
}

[data-theme="dark"] .header__brand:hover {
  color: var(--color-brand-300);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .header__brand:hover {
    color: var(--color-brand-300);
  }
}

.header__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  background: var(--gradient-hero);
  color: var(--text-on-brand);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-bold);
  box-shadow: var(--shadow-sm);
}

.nav {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.nav__toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.75rem;
  height: 2.75rem;
  padding: var(--space-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  cursor: pointer;
  transition: var(--transition-interactive);
}

.nav__toggle:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.nav__toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: var(--radius-full);
  background: var(--text-primary);
  transition: var(--transition-interactive);
}

.nav__list {
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-1);
  width: 100%;
  margin: 0;
  padding: var(--space-4);
  list-style: none;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--surface-elevated);
  box-shadow: var(--shadow-md);
}

.nav--open .nav__list {
  display: flex;
  position: absolute;
  top: calc(var(--header-height) + var(--space-2));
  right: var(--container-padding);
  left: var(--container-padding);
  z-index: var(--z-dropdown);
}

.nav__link {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-interactive);
}

.nav__link:hover,
.nav__link--active {
  color: var(--text-primary);
  background: var(--surface-muted);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

@media (min-width: 64rem) {
  .nav__toggle {
    display: none;
  }

  .nav {
    flex: 1;
    justify-content: center;
  }

  .nav__list {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: auto;
    padding: var(--space-1);
    border: none;
    border-radius: var(--radius-full);
    background: var(--surface-muted);
    box-shadow: none;
  }

  .nav--open .nav__list {
    position: static;
    inset: auto;
  }

  .nav__link {
    padding: var(--space-2) var(--space-4);
  }
}

/* --------------------------------------------------------------------------
   Theme toggle
   -------------------------------------------------------------------------- */

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-interactive);
}

.theme-toggle:hover {
  border-color: var(--color-brand-500);
  box-shadow: var(--shadow-xs);
}

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

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

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

  :root:not([data-theme="light"]) .theme-toggle__icon--dark {
    display: block;
  }
}

[data-theme="dark"] .theme-toggle__icon--dark {
  display: block;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  padding: var(--space-3) var(--space-6);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition-interactive);
}

.btn:focus-visible {
  outline: 2px solid var(--surface-focus-ring);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--gradient-hero);
  color: var(--text-on-brand);
  box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.btn--secondary {
  border-color: var(--border-strong);
  background: var(--surface-elevated);
  color: var(--text-primary);
}

.btn--secondary:hover {
  border-color: var(--color-brand-500);
  background: var(--surface-card-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--text-link);
}

.btn--ghost:hover {
  background: var(--surface-muted);
  color: var(--text-link-hover);
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */

.badge-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--tracking-wide);
  color: var(--text-secondary);
  background: var(--surface-elevated);
  transition: var(--transition-interactive);
}

.badge:hover {
  border-color: var(--color-brand-400);
  color: var(--text-primary);
}

.badge--brand {
  border-color: transparent;
  color: var(--color-brand-700);
  background: var(--color-brand-100);
}

[data-theme="dark"] .badge--brand {
  color: var(--color-brand-200);
  background: rgb(99 102 241 / 0.2);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge--brand {
    color: var(--color-brand-200);
    background: rgb(99 102 241 / 0.2);
  }
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero__greeting {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-brand-600);
}

[data-theme="dark"] .hero__greeting {
  color: var(--color-brand-300);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero__greeting {
    color: var(--color-brand-300);
  }
}

.hero__title {
  font-size: var(--text-5xl);
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__subtitle {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
}

.hero__description {
  max-width: 38ch;
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
}

.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  padding: 0;
  margin: 0;
  list-style: none;
}

.hero__stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.hero__stat-value {
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.hero__stat-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Bento cards
   -------------------------------------------------------------------------- */

.bento-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-4);
  height: 100%;
  padding: var(--space-6);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  background: var(--surface-card);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  position: relative;
  transition: var(--transition-interactive);
}

.bento-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gradient-card-shine);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-standard);
}

.bento-card:hover {
  border-color: var(--color-brand-400);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.bento-card:hover::before {
  opacity: 1;
}

.bento-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-lg);
  background: var(--color-brand-100);
  color: var(--color-brand-700);
  font-size: var(--text-xl);
}

[data-theme="dark"] .bento-card__icon {
  background: rgb(99 102 241 / 0.25);
  color: var(--color-brand-300);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bento-card__icon {
    background: rgb(99 102 241 / 0.25);
    color: var(--color-brand-300);
  }
}

.bento-card__title {
  font-size: var(--text-lg);
}

.bento-card__text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Project cards
   -------------------------------------------------------------------------- */

.project-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  background: var(--surface-card);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: var(--transition-interactive);
}

.project-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.project-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
}

.project-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.project-card__title {
  font-size: var(--text-lg);
}

.project-card__title a {
  color: var(--text-primary);
  text-decoration: none;
}

.project-card__title a:hover {
  color: var(--text-link);
}

.project-card__description {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.project-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-block-start: auto;
  padding-block-start: var(--space-3);
  border-block-start: 1px solid var(--border-default);
}

.project-card__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
}

.project-card__link::after {
  content: "→";
  transition: transform var(--duration-base) var(--ease-standard);
}

.project-card:hover .project-card__link::after {
  transform: translateX(4px);
}

/* Placeholder shimmer for lazy images */
.project-card__media--placeholder {
  background: linear-gradient(
    90deg,
    var(--surface-muted) 0%,
    var(--surface-card-hover) 50%,
    var(--surface-muted) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* --------------------------------------------------------------------------
   Experience timeline
   -------------------------------------------------------------------------- */

.timeline__dot {
  display: block;
  width: 0.875rem;
  height: 0.875rem;
  border: 3px solid var(--color-brand-500);
  border-radius: var(--radius-full);
  background: var(--surface-page);
  box-shadow: 0 0 0 4px var(--color-brand-100);
  transition: var(--transition-interactive);
}

[data-theme="dark"] .timeline__dot {
  box-shadow: 0 0 0 4px rgb(99 102 241 / 0.25);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .timeline__dot {
    box-shadow: 0 0 0 4px rgb(99 102 241 / 0.25);
  }
}

.timeline__line {
  flex: 1;
  width: 2px;
  min-height: 2rem;
  margin-block-start: var(--space-2);
  background: var(--border-default);
}

.timeline__marker {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline__date {
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
  white-space: nowrap;
}

.timeline__role {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.timeline__company {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-brand-600);
}

[data-theme="dark"] .timeline__company {
  color: var(--color-brand-300);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .timeline__company {
    color: var(--color-brand-300);
  }
}

.timeline__summary {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
}

.timeline__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-block-start: var(--space-2);
}

/* --------------------------------------------------------------------------
   Contact form
   -------------------------------------------------------------------------- */

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-field__label {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
}

.form-field__hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.form-field__input,
.form-field__textarea,
.form-field__select {
  width: 100%;
  min-height: 2.75rem;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-input);
  color: var(--text-primary);
  transition: var(--transition-interactive);
}

.form-field__textarea {
  min-height: 8rem;
  resize: vertical;
}

.form-field__input::placeholder,
.form-field__textarea::placeholder {
  color: var(--text-muted);
}

.form-field__input:hover,
.form-field__textarea:hover,
.form-field__select:hover {
  border-color: var(--border-strong);
}

.form-field__input:focus,
.form-field__textarea:focus,
.form-field__select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgb(99 102 241 / 0.25);
}

.form-field__input:invalid:not(:placeholder-shown),
.form-field__textarea:invalid:not(:placeholder-shown) {
  border-color: var(--color-error);
}

.form-field__error {
  font-size: var(--text-xs);
  color: var(--color-error);
}

.contact-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-8);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  background: var(--surface-card);
  box-shadow: var(--shadow-sm);
}

.contact-panel__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-panel__item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.contact-panel__icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--color-brand-600);
}

[data-theme="dark"] .contact-panel__icon {
  color: var(--color-brand-300);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .contact-panel__icon {
    color: var(--color-brand-300);
  }
}

.contact-panel__label {
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
}

.contact-panel__value {
  font-size: var(--text-base);
  color: var(--text-primary);
}

.contact-panel__value a {
  color: inherit;
  text-decoration: none;
}

.contact-panel__value a:hover {
  color: var(--text-link);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  border-block-start: 1px solid var(--border-default);
  background: var(--surface-elevated);
  transition: var(--transition-color);
}

.footer__brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.footer__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  text-decoration: none;
}

.footer__tagline {
  max-width: 28ch;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.footer__social {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.footer__social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-interactive);
}

.footer__social-link:hover {
  border-color: var(--color-brand-500);
  color: var(--text-primary);
  background: var(--surface-muted);
  transform: translateY(-2px);
}

.footer__column-title {
  margin-block-end: var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-primary);
}

.footer__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer__link {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-interactive);
}

.footer__link:hover {
  color: var(--text-link);
  padding-inline-start: var(--space-1);
}

.footer__bottom {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
  max-width: var(--content-max);
  margin-inline: auto;
  padding: var(--space-6) var(--container-padding) var(--space-8);
  border-block-start: 1px solid var(--border-default);
}

.footer__copyright {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer__legal-link {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition-color);
}

.footer__legal-link:hover {
  color: var(--text-link);
}

@media (min-width: 48rem) {
  .footer__bottom {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* --------------------------------------------------------------------------
   Skip link (accessibility)
   -------------------------------------------------------------------------- */

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: calc(var(--z-modal) + 1);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--color-brand-600);
  color: var(--text-on-brand);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--duration-base) var(--ease-standard);
}

.skip-link:focus {
  transform: translateY(0);
  outline: 2px solid var(--text-on-brand);
  outline-offset: 2px;
}
