/* Profile Picture / Album Crate */
.pfp-wrap {
  margin: 20px auto;
  width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
  -webkit-user-select: none; /* Safari/older iOS still need the prefix */
  -webkit-touch-callout: none; /* stops the iOS long-press "copy/select" menu on the image itself */

}

.pfp-stage {
  position: relative;
  width: 100px;
  height: 100px;
}

.pfp {
  display: block;
  width: 100px;
  height: 100px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  object-fit: cover;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  transition: opacity 0.3s ease, border-radius 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.pfp[role="button"] {
  cursor: url('../cursors/handpointing.svg') 10 5, pointer;
  outline: none;
}

.pfp:focus {
  box-shadow: 0 0 0 4px rgba(255, 171, 7, 0.12);
}

.crate-front,
.crate-left,
.crate-right {
  position: absolute;
  box-sizing: border-box;
  top: 5px;
  left: 5px;
  width: 90px;
  height: 90px;
  border: 2px solid var(--primary);
  background-color: var(--disabled);
  background-size: cover;
  background-position: center;
  cursor: url('../cursors/handpointing.svg') 10 5, pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, left 0.35s cubic-bezier(0.22, 1, 0.36, 1), right 0.35s cubic-bezier(0.22, 1, 0.36, 1), filter 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.crate-left::after,
.crate-right::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  border-top: 2px solid var(--primary);
  border-right: 2px solid var(--primary);
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.crate-left::after {
  right: 6px;
  transform: translateY(-50%) rotate(-135deg);
}

.crate-right::after {
  left: 6px;
  transform: translateY(-50%) rotate(45deg);
}

.crate-left:hover::after,
.crate-right:hover::after {
  opacity: 1;
}

.crate-front {
  top: 0;
  left: 0;
  width: 100px;
  height: 100px;
  z-index: 4;
}

.crate-left {
  z-index: 3;
  filter: grayscale(100%);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.crate-right {
  left: auto;
  right: 5px;
  z-index: 3;
  filter: grayscale(100%);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.pfp-stage.is-dealt .pfp {
  opacity: 0;
  border-radius: 0;
  pointer-events: none;
}

.pfp-stage.is-dealt .crate-front {
  opacity: 1;
  pointer-events: auto;
}

.pfp-stage.is-dealt .crate-left {
  opacity: 0.6;
  left: -18px;
  pointer-events: auto;
}

.pfp-stage.is-dealt .crate-right {
  opacity: 0.6;
  right: -18px;
  pointer-events: auto;
}

.crate-left:hover,
.crate-left:focus-visible {
  filter: grayscale(40%);
  transform: translateX(-6px) rotate(-4deg);

}
.crate-right:hover,
.crate-right:focus-visible {
  filter: grayscale(40%);
  transform: translateX(6px) rotate(4deg);
}

.crate-front:focus-visible,
.crate-left:focus-visible,
.crate-right:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.crate-close {
  position: absolute;
  left: -30px;
  bottom: -30px;
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--background);
  border: 2px solid var(--primary);  
  color: var(--primary);
  cursor: url('../cursors/handpointing.svg') 10 5, pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
}

.pfp-stage.is-dealt .crate-close {
  opacity: 1;
  pointer-events: auto;
}

.pfp-stage.is-dealt .sidebar-ko-fi {
  right: -36px;
  bottom: -36px;
}

.crate-close:hover,
.crate-close:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}

.crate-caption {
  margin: 8px 0 0;
  font-family: "Special Gothic Condensed One", sans-serif;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--primary);
  opacity: 0;
  text-align: center;
  min-height: 14px;
  transition: opacity 0.2s ease;
}

.crate-caption.is-visible {
  opacity: 0.6;
}

/* Sidebar Content */
.name-section h1 {
  width: fit-content;
}

.name-section h2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5px;
}

#age {
  font-size: 14px;
  color: var(--primary);
  margin-left: 10px;
}

.divider {
  border: none;
  height: 2px;
  background: var(--primary);
  margin: 20px 0;
}

.socials a {
  display: block;
  color: var(--primary);
  text-decoration: none;
  padding: 10px;
  border: 2px solid var(--primary);
  text-align: center;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

div.social-row,
a.large {
  margin: 0 0 10px 0;
}

.socials a:hover {
  background: transparent;
  color: var(--primary);
  border-color: var(--accent);
  transform: translateY(-2px) scale(1.015);
  box-shadow: 4px 4px 0 rgba(255, 171, 7, 0.18);
}

.socials a.copied {
  background: transparent;
  color: var(--primary);
  border-color: var(--accent);
}

.copy-email {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  color: var(--primary);
  background: transparent;
  padding: 10px;
  border: 2px solid var(--primary);
  text-align: center;
  font: inherit;
  cursor: url('../cursors/handpointing.svg') 10 5, pointer;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.copy-email:hover,
.copy-email.copied {
  background: transparent;
  color: var(--primary);
  border-color: var(--accent);
  transform: translateY(-2px) scale(1.015);
  box-shadow: 4px 4px 0 rgba(255, 171, 7, 0.18);
}

.social-row {
  display: flex;
  gap: 10px;
}

.social-row a {
  flex: 1;
}

.contact-panel {
  margin-top: 42px;
  padding: 26px 0 18px;
  border-top: 2px solid var(--primary);
  scroll-margin-top: 20px;
}

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.8fr);
  gap: 30px;
  border: 2px solid var(--primary);
  padding: 22px;
  transition: border-color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

.contact-grid:hover,
.contact-grid:focus-within {
  border-color: var(--accent);
  box-shadow: 8px 8px 0 rgba(255, 171, 7, 0.12);
  transform: translateY(-2px);
}

.contact-kicker {
  color: var(--accent);
  font-family: monospace;
  font-size: 12px;
  letter-spacing: 1px;
  margin-top: 0;
}

.contact-status {
  color: #0bbb98;
  font-size: 14px;
}

.contact-status span {
  margin-right: 6px;
}

.contact-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
}

.contact-action {
  border: 2px solid var(--primary);
  background: transparent;
  color: var(--primary);
  padding: 12px 10px;
  text-align: center;
  text-decoration: none;
  font: inherit;
  cursor: url('../cursors/handpointing.svg') 10 5, pointer;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.contact-action:hover,
.contact-action:focus-visible,
.contact-action.is-copied {
  background: transparent;
  color: var(--primary);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 4px 4px 0 rgba(255, 171, 7, 0.2);
}

@media (prefers-reduced-motion: reduce) {
  .socials a,
  .copy-email,
  .contact-grid {
    transition: none;
  }

  .socials a:hover,
  .copy-email:hover,
  .copy-email.copied,
  .contact-grid:hover,
  .contact-grid:focus-within {
    transform: none;
  }

  .project,
  .project-stack span,
  .skills-group,
  .contact-action {
    transition: none;
  }

  .project:hover .project-stack span,
  .project:focus-visible .project-stack span,
  .skills-group:hover,
  .skills-group:focus-within,
  .contact-action:hover,
  .contact-action:focus-visible,
  .contact-action.is-copied {
    transform: none;
  }
}

.skills-panel {
  margin-top: 42px;
  padding: 26px 0 18px;
  border-top: 2px solid var(--primary);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}

.skills-group {
  border: 2px solid var(--primary);
  padding: 16px;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.skills-group:hover,
.skills-group:focus-within {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 6px 6px 0 rgba(255, 171, 7, 0.12);
}

.skills-group h3 {
  margin: 0 0 10px;
  font-family: "Special Gothic Expanded One", sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 1px;
}

.skills-group p {
  margin: 0;
  font-size: 0.9rem;
}

.tools-placeholder {
  flex: 1;
  display: block;
  font: inherit;
  color: var(--primary);
  background: transparent;
  padding: 10px;
  border: 2px dashed var(--primary);
  text-align: center;
  opacity: 0.5;
  cursor: not-allowed;
}

.webring-section {
  margin-top: 0px;
}

.webring-toggle {
  display: block;
  color: var(--primary);
  text-decoration: none;
  margin-bottom: 10px;
  padding: 10px;
  border: 2px solid var(--primary);
  text-align: center;
  background: none;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  font-size: inherit;
}

.webring-toggle:hover {
  background: var(--primary);
  color: var(--background);
}

.webring-content {
  display: none;
}

.sidebar-ko-fi {
  position: absolute;
  right: -6px;
  bottom: -4px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  text-decoration: none;
  transform-origin: center;
  transition: opacity 220ms cubic-bezier(0.16, 1, 0.3, 1), transform 220ms cubic-bezier(0.16, 1, 0.3, 1), border-color 220ms ease, right 0.3s cubic-bezier(0.22, 1, 0.36, 1), bottom 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 10;
}

.sidebar-ko-fi:hover,
.sidebar-ko-fi:focus-visible {
  opacity: 1;
  transform: translateY(-1px) scale(1.04);
  border-color: var(--primary);
}

.sidebar-ko-fi:active {
  transform: translateY(-1px) scale(1.04);
}

.sidebar-ko-fi-icon {
  width: 100%;
  height: 100%;
  display: block;
  transform-origin: center;
}

.sidebar-ko-fi-icon .kofi-layer-shell,
.sidebar-ko-fi-icon .kofi-layer-core,
.sidebar-ko-fi-icon .kofi-layer-heart {
  transition: fill 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-ko-fi-icon .kofi-layer-shell {
  fill: #DED8CB;
}

.sidebar-ko-fi-icon .kofi-layer-core,
.sidebar-ko-fi-icon .kofi-layer-heart {
  fill: #070707;
}

.sidebar-ko-fi:hover .sidebar-ko-fi-icon .kofi-layer-shell,
.sidebar-ko-fi:focus-visible .sidebar-ko-fi-icon .kofi-layer-shell {
  fill: #FFFFFF;
}

.sidebar-ko-fi:hover .sidebar-ko-fi-icon .kofi-layer-heart,
.sidebar-ko-fi:focus-visible .sidebar-ko-fi-icon .kofi-layer-heart {
  fill: #FF5A16;
}

.kofi-widget-panel {
  position: fixed;
  right: 32px;
  bottom: 20px;
  width: min(420px, calc(100vw - 40px));
  max-height: 80vh;
  border: 2px solid var(--primary);
  background: var(--background);
  z-index: 20000;
  overflow: auto;
}

.kofi-widget-panel.is-loading {
  overflow: hidden;
  background: var(--background);
}

.kofi-widget-panel.is-loading::before {
  content: '';
  position: absolute;
  inset: 0;
  display: block;
  background: url('../kofi_symbol_original.svg') center / 86px 86px no-repeat;
  opacity: 0.88;
  animation: kofi-loader-pulse 1.15s ease-in-out infinite;
  pointer-events: none;
}

.kofi-widget-frame {
  border: none;
  width: 100%;
  padding: 4px 4px 1px 4px;
  box-sizing: border-box;
  height: 590px;
}

@keyframes kofi-loader-pulse {
  0%,
  100% {
    transform: scale(0.94);
    opacity: 0.55;
  }

  50% {
    transform: scale(1.04);
    opacity: 0.9;
  }
}

/* Mobile socials adjustments */
@media (max-width: 768px) {
  .sidebar-ko-fi {
    right: -4px;
    bottom: -2px;
    width: 32px;
    height: 32px;
  }

  .pfp-stage.is-dealt .sidebar-ko-fi {
    right: -38px;
    bottom: -34px;
  }

  .crate-close {
    width: 24px;
    height: 24px;
    left: -28px;
    bottom: -28px;
  }

  .kofi-widget-panel {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-height: 85vh;
  }

  .kofi-widget-frame {
    height: min(590px, 82vh);
  }

  .socials .show-more-btn {
    display: block !important;
  }
}

@media (min-width: 769px) {
  .socials .show-more-btn {
    display: none;
  }
}

/* Projects */
.title-container {
  text-align: center;
  margin-bottom: 20px;
}

.title-container .line {
  display: inline-block;
  vertical-align: middle;
  width: 100px;
  height: 2px;
  border: none;
  margin: 0;
  background: var(--primary);
}

.title-container h2 {
  display: inline-block;
  vertical-align: middle;
  margin: 0 10px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.project-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.project-controls-label,
.project-count {
  font-family: monospace;
  font-size: 12px;
  letter-spacing: 1px;
  opacity: 0.7;
}

.project-filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 2px;
}

.project-filter {
  flex: 0 0 auto;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  cursor: url('../cursors/handpointing.svg') 10 5, pointer;
}

.project-filter:hover,
.project-filter.is-active {
  background: var(--primary);
  color: var(--background);
}

.project-count {
  margin-left: auto;
}

.project {
  background: var(--background);
  border: 2px solid var(--primary);
  overflow: hidden;
  cursor: url('../cursors/handpointing.svg') 10 5, pointer;
  position: relative;
  padding: 20px;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), border-color 0.2s ease, box-shadow 0.2s ease;
  will-change: transform;
}

.project:hover,
.project.is-hovered {
  z-index: 5;
  border-color: var(--accent);
  box-shadow: 8px 8px 0 rgba(255, 171, 7, 0.16);
}

.project img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  filter: grayscale(100%);
  transition: filter 0.3s ease;
  margin-bottom: 15px;
  display: block;
}

.project:hover img,
.project.is-hovered img {
  filter: none;
}

.project-logo {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  max-width: 40px;
  max-height: 40px;
  object-fit: contain;
  z-index: 1;
  pointer-events: none;
}

.in-progress-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--primary);
  color: var(--background);
  font-size: 11px;
  font-weight: bold;
  padding: 4px 8px;
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 2;
}

.project h3 {
  font-family: "Special Gothic Expanded One", sans-serif;
  color: var(--primary);
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.project p {
  font-family: "Special Gothic Condensed One", sans-serif;
  font-size: 0.95rem;
  opacity: 0.8;
  margin-bottom: 12px;
  word-spacing: 1px;
}

.project-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
  font-family: monospace;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  opacity: 0.7;
}

.project-card-meta span {
  border-left: 2px solid var(--accent);
  padding-left: 6px;
}

.project-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 12px;
  font-family: monospace;
  font-size: 11px;
}

.project-stack span {
  border: 1px solid var(--primary);
  padding: 3px 6px;
  opacity: 0.75;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.project:hover .project-stack span,
.project:focus-visible .project-stack span {
  background: var(--primary);
  color: var(--background);
  transform: translateY(-2px);
}

.project:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

body.scan-mode .project {
  animation: project-scan 0.9s steps(2, end) both;
}

body.scan-mode .project:nth-child(2n) {
  animation-delay: 120ms;
}

body.scan-mode .project:nth-child(3n) {
  animation-delay: 240ms;
}

@keyframes project-scan {
  0%,
  100% {
    filter: none;
    transform: translateY(0);
  }
  50% {
    filter: brightness(1.35);
    transform: translateY(-3px);
  }
}

.tags span, .tags a {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--primary);
  margin-right: 5px;
  margin-bottom: 5px;
  font-size: 12px;
  text-decoration: none;
  color: var(--primary);
}

/* Mobile project grid */
@media (max-width: 768px) {
  .title-container {
    margin-bottom: 14px;
  }

  .title-container .line {
    width: 36px;
  }

  .project-grid {
    gap: 14px;
  }

  .project {
    padding: 16px;
  }

  .project-controls {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .project-filters {
    width: 100%;
  }

  .project-count {
    margin-left: 0;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 16px;
  }

  .skills-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .skills-group {
    padding: 13px;
  }

  .contact-actions {
    grid-template-columns: 1fr;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .project img {
    height: 160px;
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      scroll-behavior: auto !important;
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}

/* Tech Scroller Parent Box */
.tech-scroller {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background-color: var(--primary);
  color: var(--background);
  overflow: hidden;
  display: flex;
  align-items: center;
  font-family: "Special Gothic Condensed One", sans-serif;
  font-size: 16px;
  font-weight: 400;
  
  /* CRITICAL BOOST: Tells the browser this container will never affect 
     the layout or painting of the rest of the portfolio page */
  contain: layout paint; 
}

/* The Animated Text Inner Wrap */
.scroller-content {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  perspective: 1000px;

  /* ✦ THE ULTIMATE PERFORMANCE FIXES ✦ */
  -webkit-font-smoothing: antialiased;  /* Disables CPU subpixel font rendering */
  -moz-osx-font-smoothing: grayscale;   /* Forces clean grayscale smoothing for Firefox */
  text-rendering: optimizeSpeed;        /* Tells the layout engine to favor frame rates over micro-kerning */
}

/* Hard-Accelerated Infinite Keyframes */
@keyframes scroll-left {
  0% { 
    transform: translate3d(0, 0, 0); 
  }
  100% { 
    /* Shifting via 3D coordinates offloads 100% of the movement to the GPU */
    transform: translate3d(-50%, 0, 0); 
  }
}

.star {
  display: inline-block;
  width: 12px;
  height: 12px;
  background-image: var(--star-image);
  background-size: contain;
  background-repeat: no-repeat;
  margin: 0 8px;
}

/* Mobile adjustments for tech scroller */
@media (max-width: 800px) {
  .tech-scroller {
    position: static;
    left: auto;
    right: auto;
    height: 32px;
  }
}

/* Markdown text processing styles */
.project-content strong {
  font-weight: bold;
}

.project-content em {
  font-style: italic;
  color: var(--primary);
}

.project-content u {
  text-decoration: underline;
}

.project-content del {
  text-decoration: line-through;
  color: #888;
}

.project-content code {
  background-color: rgba(255, 255, 255, 0.1);
  padding: 2px 4px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--accent);
}

.project-content a {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  color: var(--primary);
}

.project-content a:hover {
  color: var(--accent);
}

/* Error message box */
.error-box {
  border: 2px solid var(--primary);
  background: var(--background);
  color: var(--primary);
  padding: 40px;
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.error-box h2 {
  margin: 0 0 20px 0;
  color: #ff4444;
  font-family: "Special Gothic Condensed One", sans-serif;
  font-size: 2rem;
  letter-spacing: 2px;
}

.error-box p {
  margin: 0 0 15px 0;
  color: var(--primary);
}

.error-box small {
  color: #cc6666;
}