/* ==========================================================================
   Shared components, loaded last on every page:
   1. "What I can help with" nav dropdown
   2. Footer social links
   3. Frosted-glass boxes (Brand: gunmetal glass, silver edges)
   Selectors that restyle existing boxes start with :root so they win over
   the page themes (theme-dark, palette, home, skills) without !important.
   ========================================================================== */

:root {
  --glass-fill: rgba(43, 43, 47, 0.42);
  --glass-fill-hover: rgba(52, 52, 57, 0.5);
  --glass-solid: rgba(36, 36, 40, 0.96);
  --glass-blur: blur(16px) saturate(1.4);
  --glass-edge-hi: rgba(236, 236, 240, 0.5);   /* top + left */
  --glass-edge-lo: rgba(192, 192, 196, 0.14);  /* right + bottom */
  --glass-inner: inset 0 0.0625rem 0 rgba(255, 255, 255, 0.16), inset 0.0625rem 0 0 rgba(255, 255, 255, 0.06);
  --glass-shadow: 0 1.25rem 2.5rem -0.75rem rgba(0, 0, 0, 0.7), 0 0.25rem 0.75rem rgba(0, 0, 0, 0.35);
  --glass-glow: 0 0 1.5rem rgb(var(--accent-rgb) / 0.45);
}

@media (max-width: 47.99rem), (pointer: coarse) {
  :root {
    --glass-blur: blur(14px) saturate(1.3); /* a little lighter on phones */
  }
}

/* ---------- 1. Nav dropdown ---------- */

.nav-dropdown {
  position: relative;
}

.nav-dropdown__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  width: 100%;
  min-height: 2.75rem;
  margin: 0;
  padding: 0.7rem var(--space-md);
  border: 0;
  border-bottom: 0.0625rem solid var(--color-border);
  border-radius: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.nav-dropdown__chevron {
  flex: none;
  transition: transform 0.2s ease;
}

.nav-dropdown.is-open .nav-dropdown__chevron {
  transform: rotate(180deg);
}

.site-nav .nav-dropdown__menu {
  margin: 0;
  padding: 0.25rem 0 0.5rem;
  list-style: none;
}

.site-nav .nav-dropdown__menu a {
  display: block;
  min-height: 2.75rem;
  padding: 0.7rem var(--space-md) 0.7rem calc(var(--space-md) + 1rem);
  border-bottom: 0;
  box-shadow: none;
  font-size: 0.95rem;
  line-height: 1.35;
}

.nav-dropdown.is-enhanced:not(.is-open) .nav-dropdown__menu {
  display: none;
}

.nav-dropdown.is-current > .nav-dropdown__toggle {
  font-weight: 650;
  box-shadow: inset 0.25rem 0 0 var(--color-accent);
}

@media (min-width: 48rem) {
  .nav-dropdown__toggle {
    display: inline-flex;
    width: auto;
    min-height: var(--header-height);
    padding: 0 0.8rem;
    border-bottom: 0;
    white-space: nowrap;
  }

  .nav-dropdown.is-current > .nav-dropdown__toggle {
    box-shadow: inset 0 -0.1875rem 0 var(--color-accent);
  }

  .site-nav .nav-dropdown__menu {
    display: block;
    position: absolute;
    z-index: 200;
    top: calc(100% - 0.25rem);
    left: 0;
    width: max-content;
    min-width: 16rem;
    max-width: min(22rem, calc(100vw - 2rem));
    padding: 0.4rem;
    border: 0.0625rem solid var(--color-border);
    border-radius: 0.9rem;
    background: var(--color-bg-elevated);
  }

  .site-nav .nav-dropdown__menu a {
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.55rem 0.85rem;
    border-radius: 0.6rem;
    white-space: normal;
  }

  /* Without JS, open on hover or keyboard focus. */
  .nav-dropdown:not(.is-enhanced) .nav-dropdown__menu {
    display: none;
  }

  .nav-dropdown:not(.is-enhanced):hover .nav-dropdown__menu,
  .nav-dropdown:not(.is-enhanced):focus-within .nav-dropdown__menu {
    display: block;
  }
}

/* Dark Brand pages */
.theme-dark .nav-dropdown__toggle {
  color: var(--dk-muted);
  border-bottom-color: var(--dk-line);
}

.theme-dark .nav-dropdown__toggle:hover,
.theme-dark .nav-dropdown.is-open > .nav-dropdown__toggle,
.theme-dark .nav-dropdown.is-current > .nav-dropdown__toggle {
  color: var(--dk-text);
}

.theme-dark .nav-dropdown__toggle:hover {
  background: rgba(43, 43, 47, 0.7);
}

.theme-dark .nav-dropdown.is-current > .nav-dropdown__toggle {
  box-shadow: inset 0.25rem 0 0 var(--accent);
}

.theme-dark .site-nav .nav-dropdown__menu a {
  color: #e6e6ea;
}

.theme-dark .site-nav .nav-dropdown__menu a:hover,
.theme-dark .site-nav .nav-dropdown__menu a:focus-visible {
  color: #ffffff;
  background: rgb(var(--accent-rgb) / 0.35);
}

.theme-dark .site-nav .nav-dropdown__menu a[aria-current="page"] {
  color: #ffffff;
  font-weight: 600;
  box-shadow: inset 0.1875rem 0 0 var(--accent);
}

@media (min-width: 48rem) {
  .theme-dark .nav-dropdown__toggle {
    font-size: 0.95rem;
  }

  .theme-dark .nav-dropdown.is-current > .nav-dropdown__toggle {
    box-shadow: inset 0 -0.125rem 0 var(--accent);
  }
}

/* Skills page header: mono uppercase like its other nav links */
.skills-page .nav-dropdown__toggle {
  color: var(--sk-muted);
  font-family: var(--sk-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom-color: var(--sk-line);
}

.skills-page .nav-dropdown__toggle:hover,
.skills-page .nav-dropdown.is-open > .nav-dropdown__toggle {
  color: var(--sk-text);
}

.skills-page .site-nav .nav-dropdown__menu a {
  color: #e6e6ea;
  letter-spacing: 0.1em;
}

.skills-page .site-nav .nav-dropdown__menu a:hover,
.skills-page .site-nav .nav-dropdown__menu a:focus-visible {
  color: #ffffff;
  background: rgb(var(--accent-rgb) / 0.35);
}

@media (min-width: 48rem) {
  .skills-page .nav-dropdown__toggle {
    padding: 0 0.9rem;
  }

  .skills-page .site-nav .nav-dropdown__menu {
    border-radius: 0;
  }

  .skills-page .site-nav .nav-dropdown__menu a {
    border-radius: 0;
  }
}

/* ---------- 2. Footer social links ---------- */

.footer-social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.footer-social__link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0 0.85rem 0 0.45rem;
  border: 0.0625rem solid rgba(192, 192, 196, 0.3);
  border-radius: 999px;
  background: rgba(43, 43, 47, 0.45);
  color: #e6e6ea;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.footer-social__link:hover {
  border-color: #c0c0c4;
  background: rgba(52, 52, 57, 0.75);
  color: #ffffff;
  box-shadow: var(--glass-glow);
}

.footer-social__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  background: rgb(var(--accent-rgb) / 0.55);
  color: #f2f2f4;
}

.footer-social__icon svg {
  width: 0.875rem;
  height: 0.875rem;
}

.skills-page .footer-social {
  margin-top: 0.5rem;
}

.skills-page .footer-social__link {
  letter-spacing: 0.08em;
}

/* ---------- 3. Frosted-glass boxes ---------- */

:root .home .glass-card,
:root .theme-dark .service-list li,
:root .theme-dark .project-card,
:root .theme-dark .callout,
:root .theme-dark .form,
:root .theme-dark .site-nav .nav-dropdown__menu,
:root .skills-page .site-nav .nav-dropdown__menu {
  background: var(--glass-fill);
  border-color: var(--glass-edge-hi) var(--glass-edge-lo) var(--glass-edge-lo) var(--glass-edge-hi);
  box-shadow: var(--glass-shadow), var(--glass-inner);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

/* The dropdown sits inside the blurred sticky header, which limits what its
   own backdrop blur can see, so it uses a denser fill to stay readable over
   page text. */
:root .theme-dark .site-nav .nav-dropdown__menu,
:root .skills-page .site-nav .nav-dropdown__menu {
  background: rgba(30, 30, 34, 0.9);
}

/* The service-page callout keeps its crimson left edge. */
:root .theme-dark .callout {
  border-left-color: var(--accent);
}

/* Tool chips: same glass fill and edges, without a backdrop blur (there are
   dozens per page, and blurring each one over the animated particles would
   make scrolling heavy on phones). */
:root .theme-dark .tool-list li,
:root .theme-dark .skills-category .tool-list li + li,
:root .skills-page .skills-category .tool-list li,
:root .skills-page .skills-category .tool-list li + li {
  background: rgba(43, 43, 47, 0.5);
  border-color: var(--glass-edge-hi) var(--glass-edge-lo) var(--glass-edge-lo) var(--glass-edge-hi);
  box-shadow: var(--glass-inner), 0 0.35rem 0.75rem -0.35rem rgba(0, 0, 0, 0.6);
}

/* Mobile menu: the dropdown is an inline sub-list, not a floating panel. */
@media (max-width: 47.99rem) {
  :root .theme-dark .site-nav .nav-dropdown__menu,
  :root .skills-page .site-nav .nav-dropdown__menu {
    background: rgba(43, 43, 47, 0.35);
    border: 0;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* Clickable boxes float up slightly with a faint crimson glow. */
:root .theme-dark .service-list li,
:root .theme-dark .project-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

:root .theme-dark .service-list li:hover,
:root .theme-dark .service-list li:focus-within,
:root .theme-dark .service-list li:active,
:root .theme-dark .project-card:hover,
:root .theme-dark .project-card:focus-within,
:root .theme-dark .project-card:active {
  transform: translateY(-2px);
  background: var(--glass-fill-hover);
  border-color: rgba(244, 244, 246, 0.7) rgba(192, 192, 196, 0.3) rgba(192, 192, 196, 0.3) rgba(244, 244, 246, 0.7);
  box-shadow: var(--glass-shadow), var(--glass-inner), var(--glass-glow);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root .home .glass-card,
  :root .theme-dark .service-list li,
  :root .theme-dark .project-card,
  :root .theme-dark .callout,
  :root .theme-dark .form,
  :root .theme-dark .site-nav .nav-dropdown__menu,
  :root .skills-page .site-nav .nav-dropdown__menu {
    background: var(--glass-solid);
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-dropdown__chevron,
  .footer-social__link,
  :root .theme-dark .service-list li,
  :root .theme-dark .project-card {
    transition: none;
  }

  :root .theme-dark .service-list li:hover,
  :root .theme-dark .service-list li:focus-within,
  :root .theme-dark .service-list li:active,
  :root .theme-dark .project-card:hover,
  :root .theme-dark .project-card:focus-within,
  :root .theme-dark .project-card:active {
    transform: none;
  }
}

@media (forced-colors: active) {
  .nav-dropdown__toggle,
  .footer-social__link {
    border: 0.0625rem solid ButtonText;
  }
}

/* ---------- Project card screenshot (real projects with an image) ---------- */
:root .project-card__media--image {
  display: block;
  min-height: 0;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #151518;
}

.project-card__media--image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
