/**
 * components.css
 * -----------------------------------------------------------------------------
 * Reusable UI components: buttons, cards, forms, glass surfaces, badges,
 * chips, nav, etc. Each component is composable and themeable.
 * ----------------------------------------------------------------------------- */

/* ============================================================
 *  BUTTONS
 * ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  white-space: nowrap;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  user-select: none;
}
.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  box-shadow: var(--shadow-sm), var(--shadow-glow);
}
.btn-primary:hover {
  background: var(--color-accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: var(--glass-bg);
  color: var(--color-text);
  border-color: var(--color-border-strong);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.btn-ghost:hover {
  background: var(--color-bg-elevated);
  border-color: var(--color-accent);
  color: var(--color-accent-hover);
}

.btn-outline {
  background: transparent;
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.btn-outline:hover {
  border-color: var(--color-accent);
  color: var(--color-accent-hover);
}

.btn-icon {
  padding: var(--space-3);
  border-radius: var(--radius-full);
  width: 44px;
  height: 44px;
}

.btn-sm { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-4) var(--space-6); font-size: var(--text-md); }

/* Magnetic wrapper (used by magnetic buttons in JS) */
.magnetic { display: inline-block; }

/* ============================================================
 *  CARDS
 * ============================================================ */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.card:hover {
  border-color: var(--color-border-strong);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.card-feature {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
  transition: all var(--duration-slow) var(--ease-out);
}
.card-feature::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gradient-glow);
  opacity: 0;
  transition: opacity var(--duration-slow);
  pointer-events: none;
}
.card-feature:hover::before { opacity: 1; }
.card-feature > * { position: relative; z-index: 1; }

/* ============================================================
 *  FORMS
 * ============================================================ */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: var(--text-base);
  transition: all var(--duration-base) var(--ease-out);
  font-family: inherit;
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-muted);
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--color-faint); }

.form-textarea {
  min-height: 140px;
  resize: vertical;
  font-family: inherit;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-muted);
  margin-top: var(--space-2);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-danger);
  margin-top: var(--space-2);
}

/* ============================================================
 *  BADGES & CHIPS
 * ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 10px;
  background: var(--color-accent-muted);
  color: var(--color-accent-hover);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.badge-neutral {
  background: var(--color-bg-elevated);
  color: var(--color-muted);
}

.badge-success {
  background: rgba(16, 185, 129, 0.16);
  color: var(--color-success);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}
.chip:hover {
  border-color: var(--color-accent);
  color: var(--color-text);
}
.chip.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

/* ============================================================
 *  AVATAR
 * ============================================================ */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--gradient-aurora);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: var(--weight-semibold);
  overflow: hidden;
  flex-shrink: 0;
}
.avatar-lg { width: 96px; height: 96px; font-size: var(--text-2xl); }
.avatar-sm { width: 32px; height: 32px; font-size: var(--text-xs); }

/* ============================================================
 *  DIVIDER
 * ============================================================ */
.divider {
  height: 1px;
  background: var(--color-border);
  border: none;
  margin-block: var(--space-6);
}
.divider-gradient {
  background: linear-gradient(to right, transparent, var(--color-border-strong), transparent);
}

/* ============================================================
 *  STAT BLOCK
 * ============================================================ */
.stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.stat-value {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  line-height: 1;
}
.stat-label {
  font-size: var(--text-sm);
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

/* ============================================================
 *  LINK WITH ARROW
 * ============================================================ */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-accent);
  transition: gap var(--duration-fast) var(--ease-out);
}
.link-arrow:hover { gap: var(--space-3); color: var(--color-accent-hover); }
.link-arrow svg { width: 16px; height: 16px; }

/* ============================================================
 *  TOAST
 * ============================================================ */
.toast-container {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}
.toast {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  min-width: 280px;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  pointer-events: auto;
  animation: toast-in var(--duration-base) var(--ease-spring);
}
.toast.success { border-left: 3px solid var(--color-success); }
.toast.error   { border-left: 3px solid var(--color-danger); }
.toast.info    { border-left: 3px solid var(--color-info); }

/* ============================================================
 *  MODAL
 * ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-base);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95);
  transition: transform var(--duration-base) var(--ease-spring);
}
.modal-overlay.open .modal { transform: scale(1); }

/* ============================================================
 *  PROJECT CARD
 * ============================================================ */
.project-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
}
.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--color-accent);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}
.project-card__image {
  aspect-ratio: 16 / 10;
  background: var(--gradient-cosmic);
  position: relative;
  overflow: hidden;
}
.project-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}
.project-card:hover .project-card__image img { transform: scale(1.05); }
.project-card__body {
  padding: var(--space-5);
}
.project-card__title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-2);
}
.project-card__tagline {
  color: var(--color-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-3);
}
.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ============================================================
 *  TIMELINE
 * ============================================================ */
.timeline {
  position: relative;
  padding-left: var(--space-7);
}
.timeline::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--color-accent), transparent);
}
.timeline-item {
  position: relative;
  padding-bottom: var(--space-7);
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -29px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  box-shadow: 0 0 0 4px var(--color-bg-primary), 0 0 16px var(--color-accent-glow);
}

/* ============================================================
 *  NAVBAR
 * ============================================================ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-height);
  z-index: var(--z-navbar);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
  transition: all var(--duration-base) var(--ease-out);
}
.navbar.scrolled {
  background: var(--color-bg-overlay);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.navbar__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}
.navbar__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}
.navbar__brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--gradient-aurora);
  border-radius: var(--radius-md);
  color: #fff;
  font-weight: var(--weight-bold);
  font-size: var(--text-md);
}
.navbar__menu {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.navbar__link {
  position: relative;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
}
.navbar__link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  transform: translateX(-50%);
  transition: width var(--duration-fast) var(--ease-out);
}
.navbar__link:hover,
.navbar__link.active {
  color: var(--color-text);
}
.navbar__link:hover::after,
.navbar__link.active::after { width: 16px; }
.navbar__link--cta {
  background: var(--color-accent);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
}
.navbar__link--cta:hover { background: var(--color-accent-hover); color: #fff; }
.navbar__link--cta::after { display: none; }

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

.navbar__trigger {
  display: none;
  flex-direction: column;
  gap: 4px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.navbar__trigger span {
  width: 22px;
  height: 2px;
  background: var(--color-text);
  transition: all var(--duration-base) var(--ease-out);
}
.navbar__trigger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.navbar__trigger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.navbar__trigger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Theme toggle icons */
#theme-toggle .icon-moon { display: none; }
[data-theme="light"] #theme-toggle .icon-sun  { display: none; }
[data-theme="light"] #theme-toggle .icon-moon { display: block; }

/* ============================================================
 *  HERO
 * ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding-top: var(--navbar-height);
  overflow: hidden;
}
.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.hero__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
}
.hero__content { max-width: 920px; }
.hero__title {
  margin-bottom: var(--space-5);
}
.hero__title-line {
  display: block;
  overflow: hidden;
}
.hero__title-line em { font-style: normal; }
.hero__lead {
  margin-bottom: var(--space-6);
  max-width: 640px;
}
.hero__actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-8);
}
.hero__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  max-width: 640px;
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}
.hero__scroll {
  position: absolute;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
.hero__scroll-text {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--color-muted);
  writing-mode: vertical-rl;
}
.hero__scroll-line {
  width: 1px;
  height: 64px;
  background: linear-gradient(to bottom, var(--color-accent), transparent);
  position: relative;
  overflow: hidden;
}
.hero__scroll-line::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: var(--color-accent);
  animation: scroll-line 2s var(--ease-in-out) infinite;
}
@keyframes scroll-line {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(200%); }
}

/* ============================================================
 *  FOOTER
 * ============================================================ */
.footer {
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-8) var(--space-5);
}
.footer__inner {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-8);
  margin-bottom: var(--space-6);
}
.footer__logo {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
}
.footer__nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}
.footer__heading {
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--color-muted);
  margin-bottom: var(--space-3);
}
.footer__col ul li { margin-bottom: var(--space-2); }
.footer__col a {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  transition: color var(--duration-fast);
}
.footer__col a:hover { color: var(--color-accent); }
.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

/* ============================================================
 *  LOADER
 * ============================================================ */
.loader {
  position: fixed;
  inset: 0;
  background: var(--color-bg-primary);
  z-index: var(--z-loader);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--duration-slow) var(--ease-out),
              visibility var(--duration-slow);
}
.loader.hidden { opacity: 0; visibility: hidden; }
.loader__inner {
  text-align: center;
  width: min(360px, 80vw);
}
.loader__logo {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  background: var(--gradient-aurora);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: var(--space-5);
}
.loader__progress {
  width: 100%;
  height: 2px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-3);
}
.loader__bar {
  height: 100%;
  background: var(--color-accent);
  width: 0%;
  transition: width var(--duration-base) var(--ease-out);
}
.loader__percent {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-muted);
}

/* ============================================================
 *  CUSTOM CURSOR
 * ============================================================ */
.cursor {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: var(--z-cursor);
  mix-blend-mode: difference;
}
.cursor__dot {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: transform var(--duration-fast) var(--ease-out);
}
.cursor__ring {
  position: absolute;
  width: 36px;
  height: 36px;
  border: 1.5px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width var(--duration-base) var(--ease-out),
              height var(--duration-base) var(--ease-out),
              background var(--duration-base) var(--ease-out);
}
.cursor.hover .cursor__ring {
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.1);
}
.cursor.hover .cursor__dot { transform: translate(-50%, -50%) scale(0); }

/* ============================================================
 *  CODE BLOCK (with copy button)
 * ============================================================ */
.code-block {
  position: relative;
}
.code-block__copy {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  cursor: pointer;
  transition: all var(--duration-fast);
}
.code-block__copy:hover { color: var(--color-accent); border-color: var(--color-accent); }

/* ============================================================
 *  TIMELINE (horizontal scroll variant)
 * ============================================================ */
#timeline-section {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  overflow: hidden;
}
#timeline-track {
  min-width: 100vw;
}
.milestone {
  width: 340px;
  flex-shrink: 0;
}
.milestone__year {
  font-family: var(--font-display);
  font-size: var(--text-5xl);
  font-weight: var(--weight-bold);
  background: var(--gradient-aurora);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: var(--space-4);
  line-height: 1;
}
.milestone__card { min-height: 240px; }

/* ============================================================
 *  ADMIN SIDEBAR NAV
 * ============================================================ */
.layout-admin__sidebar nav .navbar__link {
  display: flex;
  align-items: center;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}
.layout-admin__sidebar nav .navbar__link:hover,
.layout-admin__sidebar nav .navbar__link.active {
  background: var(--color-bg-elevated);
  color: var(--color-text);
}
.layout-admin__sidebar nav .navbar__link.active {
  border-left: 2px solid var(--color-accent);
}
.layout-admin__main { background: var(--color-bg-primary); }

/* ============================================================
 *  W-FULL utility (Tailwind compat for non-Tailwind contexts)
 * ============================================================ */
.w-full { width: 100%; }
