/* shadcn/ui components translated to vanilla CSS.
   All colors come from tokens.css — no literals here. */

/* ---- Button ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.5rem;
  padding-inline: 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 550;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease), transform 0.12s var(--ease),
    box-shadow 0.18s var(--ease);
}

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

.btn-default {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: var(--shadow-sm);
}

.btn-default:hover {
  background: hsl(var(--primary) / 0.88);
}

.btn-outline {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}

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

.btn-ghost {
  background: transparent;
  color: hsl(var(--foreground));
}

.btn-ghost:hover {
  background: hsl(var(--accent));
}

.btn-icon {
  width: 2.5rem;
  padding: 0;
}

/* Icons need an explicit size. An inline <svg> with only a viewBox falls back
   to its 300x150 intrinsic size, which max-width then squashes into nothing. */
.btn-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.btn-sm {
  height: 2rem;
  padding-inline: 0.75rem;
  font-size: 0.8125rem;
}

/* ---- Card ---- */
.card {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 0.25rem);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease),
    border-color 0.25s var(--ease);
}

.card-header {
  padding: 1.25rem 1.25rem 0;
}

.card-title {
  font-size: 1.0625rem;
  font-weight: 650;
}

.card-description {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.card-content {
  padding: 1rem 1.25rem;
}

.card-footer {
  padding: 0 1.25rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

/* ---- Badge ---- */
/* Squared, monospaced tags. Pill badges are the single loudest shadcn tell. */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1875rem 0.4375rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.35;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.badge-secondary {
  background: transparent;
  color: hsl(var(--muted-foreground));
  border-color: hsl(var(--border));
}

.badge-outline {
  background: transparent;
  color: hsl(var(--muted-foreground));
  border-color: hsl(var(--border));
}

.badge-brand {
  background: hsl(var(--brand));
  color: hsl(var(--brand-foreground));
}

/* ---- Separator / Avatar / Skeleton / Ratios ---- */
.separator {
  height: 1px;
  width: 100%;
  background: hsl(var(--border));
  border: 0;
}

.avatar {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid hsl(var(--border));
  border-top: 2px solid hsl(var(--brand));
  color: hsl(var(--muted-foreground));
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
}

@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

.skeleton {
  display: block;
  background: hsl(var(--muted));
  border-radius: var(--radius);
  animation: pulse 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.ratio-16x9 {
  aspect-ratio: 16 / 9;
}

.ratio-9x16 {
  aspect-ratio: 9 / 16;
}

/* ---- Theme toggle ---- */
.theme-toggle {
  display: grid;
  place-items: center;
}

.theme-toggle > svg {
  grid-area: 1 / 1;
  width: 1.15rem;
  height: 1.15rem;
  transition: opacity 0.25s var(--ease), transform 0.35s var(--ease);
}

[data-theme='light'] .theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

[data-theme='dark'] .theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

/* ---- Header / nav ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: hsl(var(--background) / 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(var(--border) / 0.7);
}

/* Three tracks so the nav sits centred on the page, not centred in the space
   the actions happen to leave. The first track stays empty. */
.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  height: 3.75rem;
}

/* A monogram rule, not a filled rounded-square icon tile. */
.wordmark-badge {
  display: inline-block;
  padding-bottom: 0.15rem;
  border-bottom: 2px solid hsl(var(--brand));
  color: hsl(var(--foreground));
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: none;
}

.nav-desktop {
  grid-column: 2;
  display: flex;
  justify-content: center;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  color: hsl(var(--muted-foreground));
  transition: color 0.18s var(--ease), background-color 0.18s var(--ease);
}

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

.nav-link[aria-current='page'] {
  color: hsl(var(--foreground));
  background: hsl(var(--accent));
}

.header-actions {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
}

/* The four section links stay visible at every width. They fit inside 360px
   at this size, so there is no menu to open. */
@media (max-width: 767px) {
  .header-inner {
    grid-template-columns: 0 1fr auto;
    gap: 0.5rem;
  }

  .nav-desktop {
    gap: 0.125rem;
  }

  /* Vertical padding tuned to a 44px tap target inside the 60px header. */
  .nav-link {
    padding: 0.72rem 0.45rem;
    font-size: 0.8125rem;
  }
}

/* ---- Hero / About ---- */
.hero {
  padding-block: clamp(4.5rem, 13vw, 9rem) clamp(3rem, 8vw, 5rem);
}

.hero-inner {
  display: grid;
  gap: 1.15rem;
  max-width: 46rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

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

.about-copy {
  display: grid;
  gap: 0.85rem;
  max-width: 44rem;
}

@media (max-width: 639px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Projects ---- */
.project-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.chip {
  height: 1.875rem;
  padding-inline: 0.7rem;
  display: inline-flex;
  align-items: center;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: transparent;
  color: hsl(var(--muted-foreground));
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  text-transform: lowercase;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease);
}

.chip:hover {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
}

.chip[aria-pressed='true'] {
  background: hsl(var(--brand));
  color: hsl(var(--brand-foreground));
  border-color: hsl(var(--brand));
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 1.75rem;
}

.project-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr));
  align-items: start;
}

.project-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

.project-card[hidden] {
  display: none;
}

@media (min-width: 60rem) {
  .project-card[data-featured] {
    grid-column: span 2;
  }
}

.card-media {
  background: hsl(var(--muted));
  border-bottom: 1px solid hsl(var(--border));
}

.media-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  margin-bottom: 0.5rem;
}

.project-card .card-content {
  padding-block: 0.75rem 1rem;
  margin-top: auto;
}

.accordion > summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.875rem;
  font-weight: 550;
  color: hsl(var(--muted-foreground));
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0;
  border-radius: var(--radius);
}

.accordion > summary::-webkit-details-marker {
  display: none;
}

.accordion > summary::after {
  content: '';
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.2s var(--ease);
}

.accordion[open] > summary::after {
  transform: rotate(-135deg) translateY(-1px);
}

.accordion > summary:hover {
  color: hsl(var(--foreground));
}

.accordion ul {
  margin: 0.6rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.4rem;
}

.accordion li {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

/* ---- Video facade ---- */
.video-facade {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: hsl(var(--muted));
  cursor: pointer;
  overflow: hidden;
}

.video-facade img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.4s var(--ease), filter 0.3s var(--ease);
}

.facade-skeleton {
  position: absolute;
  inset: 0;
  border-radius: 0;
}

.video-facade:hover img {
  transform: scale(1.04);
  filter: brightness(0.85);
}

.facade-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: hsl(var(--background) / 0.85);
  color: hsl(var(--foreground));
  box-shadow: var(--shadow-md);
  transition: transform 0.25s var(--ease), background-color 0.25s var(--ease);
}

.facade-play svg {
  width: 1.5rem;
  height: 1.5rem;
  margin-left: 2px;
}

.video-facade:hover .facade-play {
  transform: scale(1.12);
  background: hsl(var(--brand));
  color: hsl(var(--brand-foreground));
}

/* ---- Dialog ---- */
dialog.dialog {
  width: min(56rem, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 0.25rem);
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: var(--shadow-lg);
}

dialog.dialog::backdrop {
  background: hsl(var(--backdrop) / 0.7);
  backdrop-filter: blur(3px);
}

.js dialog.dialog[open] {
  animation: dialog-in 0.22s var(--ease);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(0.5rem) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.85rem 0.85rem 1.15rem;
  border-bottom: 1px solid hsl(var(--border));
}

.dialog-title {
  font-size: 0.975rem;
  font-weight: 600;
}

.dialog-frame {
  background: hsl(var(--video-bg));
}

.dialog-frame iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  display: block;
}

.dialog-frame.is-vertical iframe {
  aspect-ratio: 9 / 16;
  width: auto;
  height: min(70dvh, 34rem);
  margin-inline: auto;
}

/* ---- Resume ---- */
.resume-dl {
  margin-left: auto;
}

.resume-block {
  margin-bottom: 2.5rem;
}

.resume-block h3 {
  margin-bottom: 0.6rem;
}

.resume-block .separator {
  margin-bottom: 1rem;
}

.entry {
  margin-bottom: 1.4rem;
}

.entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.entry-org {
  font-size: 0.875rem;
}

.entry ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
}

.entry li {
  font-size: 0.9375rem;
  color: hsl(var(--muted-foreground));
}

.resume-note {
  font-size: 0.875rem;
}

.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  background: hsl(var(--muted));
  padding: 0.25rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.tablist [role='tab'] {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0.4rem 0.75rem;
  border-radius: calc(var(--radius) - 0.125rem);
  font-size: 0.8125rem;
  font-weight: 550;
  color: hsl(var(--muted-foreground));
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}

.tablist [role='tab']:hover {
  color: hsl(var(--foreground));
}

.tablist [role='tab'][aria-selected='true'] {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: var(--shadow-sm);
}

.tabpanel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 2.5rem;
}

/* display:flex would otherwise beat the UA's [hidden]{display:none}, leaving
   every panel on screen at once. */
.tabpanel[hidden] {
  display: none;
}

.js .tabpanel:not([hidden]) {
  animation: fade-up 0.3s var(--ease) both;
}

/* ---- Contact / footer / toast ---- */
/* Not a card. Cards are for projects; a rule is enough here. */
.contact-card {
  border-top: 1px solid hsl(var(--border));
  padding-top: 2rem;
}

.contact-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
  justify-content: space-between;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-footer {
  border-top: 1px solid hsl(var(--border));
  padding-block: 1.75rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  font-size: 0.875rem;
}

.toast-region {
  position: fixed;
  z-index: 100;
  bottom: 1rem;
  right: 1rem;
  display: grid;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.7rem 0.95rem;
  font-size: 0.875rem;
}

.js .toast {
  animation: toast-in 0.25s var(--ease);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  .js dialog.dialog[open],
  .js .toast {
    animation: none;
  }

  .js .tabpanel:not([hidden]) {
    animation: none;
  }

  .toast.is-leaving {
    transition: none;
  }

  .project-card:hover {
    transform: none;
  }
}
