:root {
  --bg: #ffffff;
  --text: #333333;
  --muted: #6b7280;
  --card: #f9fafb;
  --border: #e5e7eb;
  --accent: #3b82f6;
  --accent-soft: #dbeafe;
  --page-width: 960px;
  --rainbow: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899, #f59e0b, #10b981);
  --rainbow-angle: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899, #f59e0b, #10b981);
  --rainbow-soft: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(139, 92, 246, 0.12), rgba(236, 72, 153, 0.12), rgba(245, 158, 11, 0.12), rgba(16, 185, 129, 0.12));
  --rainbow-wash: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(139, 92, 246, 0.08), rgba(236, 72, 153, 0.08), rgba(245, 158, 11, 0.08), rgba(16, 185, 129, 0.08));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

img {
  max-width: 100%;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 3px;
}

main {
  width: min(var(--page-width), calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: white;
  background: var(--accent);
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
  transition:
    transform 0.25s ease,
    background-color 0.25s ease;
}

.brand-mark:hover {
  transform: translateY(-2px);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.nav-links a {
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--text);
}

.hire-button {
  padding: 0.65rem 1rem;
  color: white !important;
  background: var(--accent);
  border-radius: 999px;
  transition:
    background-color 0.25s ease,
    transform 0.2s ease;
}

.hire-button:hover {
  transform: translateY(-1px);
}

.hero {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-bottom: 0.65rem;
  padding: 2rem 0;
  background: radial-gradient(circle at top, #ffffff 0%, #e7e8e9 100%);
}

.hero-inner {
  width: min(var(--page-width), calc(100% - 2rem));
  margin: 0 auto;
  text-align: center;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;

  margin-left: 0.25rem;

  color: var(--accent);
  font-weight: 600;
  text-decoration: none;

  transition:
    color 0.2s ease,
    opacity 0.2s ease;
}

.hero-link:hover {
  opacity: 0.75;
}

.hero-link span {
  display: inline-block;
  transition: transform 0.2s ease;
}

.hero-link:hover span {
  transform: translateY(3px);
}

h1 {
  margin: 0;
  font-size: clamp(2.1rem, 6vw, 4.4rem);
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.role-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.85rem;
  font-size: clamp(1.7rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.45rem 0.35rem 0.85rem;
  color: var(--text);
  background: white;
  border: 1px solid #ececec;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  perspective: 700px;
  animation: roleHint 7s ease-in-out 1s infinite;
  transition: border-color 0.2s ease;
}

.role-pill:hover {
  border-color: var(--accent);
}

.role-pill.first-hint {
  animation: firstRoleHint 700ms ease-in-out;
}

#role-name {
  display: inline-block;
  color: var(--accent);
  transform-origin: center;
}

#role-name.flipping {
  animation: flipRole 460ms ease;
}

.spin-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;

  width: 3rem;
  height: 3rem;
  padding: 0;

  color: white;
  background: var(--accent);
  border-radius: 999px;

  font-size: 0;
  line-height: 0;

  transition: background-color 0.25s ease;
}

.spin-icon svg {
  display: block;
  width: 62%;
  height: 62%;
  overflow: visible;

  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spin-icon.spinning {
  animation: spin 450ms ease;
}

/* Character traits without summaries or tools */
.trait-mode #role-name {
  color: transparent;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899, #f59e0b, #10b981, #3b82f6);
  background-size: 200% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.trait-mode .spin-icon,
.trait-mode .brand-mark,
.trait-mode .hire-button {
  background: var(--rainbow-angle);
}

.trait-mode .role-pill:hover {
  border-color: #a855f7;
}

/* Subtle rainbow treatment for the About section */
.trait-mode .section-resume .project-card {
  background: var(--rainbow-soft);

  border-color: rgba(139, 92, 246, 0.2);
}

/* Rainbow numbers in the About cards */
.trait-mode .section-resume .project-card h3 {
  color: transparent;

  background: var(--rainbow);

  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Subtle rainbow wash behind the Hire section */
.trait-mode .hire-card {
  background: var(--rainbow-wash);

  border-color: rgba(139, 92, 246, 0.2);
}

/* Rainbow primary Email Me button */
.trait-mode .primary-button {
  background: var(--rainbow-angle);
}

/* Rainbow eyebrow text in the Hire section */
.trait-mode .hire-card .eyebrow,
.trait-mode #work > .eyebrow {
  color: transparent;

  background: var(--rainbow);

  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.summary {
  margin: 1.25rem auto 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.tool-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  min-height: 60px;
  margin: 1rem auto 0;
}

.tool-strip img {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.fade-in {
  animation: fadeIn 280ms ease;
}

.content-section {
  padding-bottom: 2.5rem;
  scroll-margin-top: 6rem;
}

.section-heading {
  margin-bottom: 1.5rem;
}

.section-heading h2 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.9rem, 5vw, 3rem);
  letter-spacing: -0.05em;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.eyebrow {
  margin: 0.5rem 0;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.project-card {
  position: relative;
  min-height: 220px;
  padding: 1rem;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease;
}

.project-card:hover {
  border-color: var(--section-accent, var(--accent));
  transform: translateY(-4px);
}

.project-preview {
  margin-bottom: 1rem;
  overflow: hidden;
  border-radius: 12px;
}

.project-preview img {
  display: block;
  width: 100%;
  height: auto;
}

.project-card h3 {
  margin: 0 0 0.45rem;
  color: var(--section-accent, var(--accent));
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.project-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.section-product {
  --section-accent: #3b82f6;
  --section-soft: #dbeafe;
}

.section-developer {
  --section-accent: #10b981;
  --section-soft: #d1fae5;
}

.section-artist {
  --section-accent: #a855f7;
  --section-soft: #f3e8ff;
}

.section-3dmodeler {
  --section-accent: #f59e0b;
  --section-soft: #fef3c7;
}

#work > .content-section {
  position: relative;
  margin-bottom: 1rem;
  padding: 1.1rem 1.25rem 1.25rem 1.5rem;

  background: linear-gradient(135deg, color-mix(in srgb, var(--section-soft) 42%, white), white 58%);

  border: 1px solid color-mix(in srgb, var(--section-accent) 14%, white);
  border-radius: 20px;

  box-shadow:
    0 8px 24px rgba(17, 24, 39, 0.035),
    0 0 24px color-mix(in srgb, var(--section-accent) 7%, transparent);

  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    background 0.22s ease;
}

#work > .content-section::before {
  content: "";
  position: absolute;
  top: 1rem;
  bottom: 1rem;
  left: 0.55rem;

  width: 3px;
  border-radius: 999px;
  background: var(--section-accent);
  opacity: 0.7;
}

#work > .content-section:has(.work-group[open]) {
  border-color: color-mix(in srgb, var(--section-accent) 24%, white);

  box-shadow:
    0 12px 30px rgba(17, 24, 39, 0.05),
    0 0 34px color-mix(in srgb, var(--section-accent) 11%, transparent);
}

#work > .content-section:has(.work-group[open])::before {
  opacity: 1;
}

.work-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  color: var(--section-accent);
  cursor: pointer;
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  list-style: none;
}

.work-heading::-webkit-details-marker {
  display: none;
}

.work-heading::after {
  content: "+";
  font-size: 1.5rem;
}

.work-group[open] .work-heading {
  margin-bottom: 1rem;
}

.work-group[open] .work-heading::after {
  content: "–";
}

.section-resume .project-card {
  min-height: auto;
  background: var(--accent-soft);
}

.section-resume .project-card h3 {
  font-size: 3rem;
  text-transform: none;
}

.hire-card {
  padding: 3rem;
  text-align: center;
  background: linear-gradient(180deg, #fafafa, #f3f4f6);
  border: 1px solid var(--border);
  border-radius: 24px;
}

.hire-card h2 {
  margin: 0.4rem 0 1rem;
  font-size: clamp(2rem, 6vw, 3.6rem);
  letter-spacing: -0.05em;
}

.hire-text {
  max-width: 700px;
  margin: auto;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.75;
}

.hire-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

.primary-button {
  padding: 1rem 1.6rem;
  border-radius: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.primary-button {
  color: white;
  background: var(--accent);
}

.primary-button:hover {
  transform: translateY(-2px);
}

.site-footer {
  padding: 2.5rem 1rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  text-align: center;
  background-color: #f1f1f1;
}

.gallery-card {
  cursor: pointer;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--section-accent, var(--accent));
  font-weight: 700;
  font-size: 0.9rem;
}

.card-link span {
  transition: transform 0.2s ease;
}

.gallery-card:hover .card-link span {
  transform: translateX(3px);
}

/* Full-screen gallery */

.gallery-dialog {
  width: min(1100px, calc(100% - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  padding: 0;
  overflow: hidden;

  background: white;
  border: 1px solid var(--border);
  border-radius: 28px;

  box-shadow:
    0 30px 80px rgba(17, 24, 39, 0.22),
    0 8px 24px rgba(17, 24, 39, 0.08);
}

.gallery-dialog::backdrop {
  background: rgba(17, 24, 39, 0.48);
  backdrop-filter: blur(12px);
}

.gallery-shell {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 2rem);
}

.gallery-header {
  position: sticky;
  top: 0;
  z-index: 2;

  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;

  padding: 1.5rem;

  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.art-gallery-eyebrow,
.threed-gallery-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.art-gallery-eyebrow { color: #a855f7; }
.threed-gallery-eyebrow { color: #f59e0b; }

.gallery-header h2 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3rem);
  letter-spacing: -0.05em;
}

.gallery-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;

  width: 42px;
  height: 42px;

  color: var(--text);
  background: #f3f4f6;
  border: 0;
  border-radius: 999px;

  cursor: pointer;
  font-size: 1.7rem;
  line-height: 1;

  transition:
    background-color 0.2s ease,
    transform 0.2s ease;
}

.gallery-close:hover {
  background: #e5e7eb;
  transform: scale(1.05);
}

.gallery-content {
  overflow-y: auto;
  padding: 1.5rem;
}

.gallery-group + .gallery-group {
  margin-top: 3rem;
}

.gallery-group h3 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.gallery-grid img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 220px;
  object-fit: contain;

  padding: 1rem;

  background: white;
  border: 1px solid var(--border);
  border-radius: 18px;
}

.gallery-item {
  display: flex;
  flex-direction: column;
}

.gallery-item p {
  margin: 0;
  text-align: center;

  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
}

@keyframes firstRoleHint {
  0%,
  100% {
    transform: translateY(0) rotate(0);
  }

  30% {
    transform: translateY(-3px) rotate(-1deg);
  }

  55% {
    transform: translateY(0) rotate(1deg);
  }

  75% {
    transform: translateY(-1px) rotate(0);
  }
}

@keyframes roleHint {
  0%,
  88%,
  100% {
    transform: translateY(0);
  }

  91% {
    transform: translateY(-3px) rotate(-1deg);
  }

  94% {
    transform: translateY(0) rotate(1deg);
  }

  97% {
    transform: translateY(-1px) rotate(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes flipRole {
  0% {
    opacity: 1;
    transform: rotateX(0deg);
  }

  45% {
    opacity: 0;
    transform: rotateX(90deg);
  }

  55% {
    opacity: 0;
    transform: rotateX(-90deg);
  }

  100% {
    opacity: 1;
    transform: rotateX(0deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .site-header {
    padding: 0.8rem 1rem;
  }

  .nav-links {
    gap: 0.8rem;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

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

  .spin-icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  .tool-strip {
    gap: 0.5rem;
    padding: 0.65rem;
  }

  .tool-strip img {
    width: 42px;
    height: 42px;
  }

  .hire-card {
    padding: 2rem 1.25rem;
  }

  .gallery-dialog {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;

    border: 0;
    border-radius: 0;
  }

  .gallery-shell {
    height: 100dvh;
    max-height: 100dvh;
  }

  .gallery-header {
    padding: max(1rem, env(safe-area-inset-top)) 1rem 1rem;
  }

  .gallery-content {
    padding: 1rem 1rem max(2rem, env(safe-area-inset-bottom));
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
  }

  .gallery-grid img {
    max-height: 160px;
    padding: 0.75rem;
  }

  .gallery-group + .gallery-group {
    margin-top: 2.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .role-pill,
  .role-pill.first-hint,
  #role-name.flipping,
  .spin-icon.spinning,
  .fade-in {
    animation: none;
  }

  .brand-mark,
  .project-card,
  .primary-button {
    transition: none;
  }
}
