/* ==========================================================================
   Design tokens
   ========================================================================== */

:root {
  color-scheme: light;

  --background: oklch(94.27% 0.0268 242.57);
  --secondary-background: oklch(100% 0 0);
  --foreground: oklch(0% 0 0);
  --main-foreground: oklch(0% 0 0);
  --main: oklch(66.9% 0.18368 248.807);
  --border: oklch(0% 0 0);
  --ring: oklch(0% 0 0);
  --overlay: oklch(0% 0 0 / 0.8);
  --shadow: 4px 4px 0px 0px var(--border);

  --radius-base: 5px;
  --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";

  --gray-100: oklch(0.967 0.003 264.542);
  --gray-200: oklch(0.928 0.006 264.531);
  --gray-600: oklch(0.446 0.03 256.802);
  --gray-700: oklch(0.373 0.034 259.733);
  --gray-800: oklch(0.278 0.033 256.848);

  --skill-card-bg: var(--gray-100);
  --skill-icon-bg: var(--gray-200);
  --skill-icon-border: currentColor;
  --skill-label: var(--gray-800);
  --skill-icon-filter: none;
}

.dark {
  color-scheme: dark;

  --background: oklch(27.08% 0.0336 240.69);
  --secondary-background: oklch(23.93% 0 0);
  --foreground: oklch(92.49% 0 0);
  --main-foreground: oklch(0% 0 0);
  --main: oklch(61.9% 0.16907 248.598);
  --border: oklch(0% 0 0);
  --ring: oklch(100% 0 0);
  --shadow: 4px 4px 0px 0px var(--border);

  --skill-card-bg: var(--gray-800);
  --skill-icon-bg: var(--gray-700);
  --skill-icon-border: var(--gray-600);
  --skill-label: var(--gray-200);
  --skill-icon-filter: invert(1);
}

/* ==========================================================================
   Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  border: 0 solid;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  margin: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

img,
svg {
  display: block;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Tiling grid backdrop */
.svg-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.3;
  pointer-events: none;
  background-image: url("../img/grid.svg");
  background-repeat: repeat;
  background-size: auto;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.main {
  flex: 1 1 0%;
  width: 750px;
  max-width: 100%;
  margin-inline: auto;
  padding: 112px 20px 40px;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.animate-fade-in {
  animation: fade-in 0.5s ease-out;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.nav-wrap {
  position: fixed;
  top: 20px;
  left: 0;
  z-index: 50;
  width: 100%;
}

.nav {
  display: flex;
  align-items: center;
  gap: 20px;
  width: max-content;
  margin-inline: auto;
  padding: 10px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-base);
  background-color: var(--main);
  font-size: 14px;
  font-weight: 500;
}

.nav--mobile {
  display: none;
}

.nav-link {
  border: 2px solid transparent;
  border-radius: var(--radius-base);
  padding: 6px 8px;
  transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover,
.nav-link.active {
  border-color: var(--border);
}

/* Theme toggle button */
.theme {
  position: relative;
  display: flex;
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-radius: var(--radius-base);
  background-color: var(--main);
  color: var(--main-foreground);
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px #000;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  width: 1.2rem;
  height: 1.2rem;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle .icon-moon {
  position: absolute;
  transform: rotate(90deg) scale(0);
}

.dark .theme-toggle .icon-sun {
  transform: rotate(-90deg) scale(0);
}

.dark .theme-toggle .icon-moon {
  transform: rotate(0) scale(1);
}

/* Theme dropdown */
.theme-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  min-width: 8rem;
  overflow: hidden;
  padding: 4px;
  border: 2px solid var(--border);
  border-radius: var(--radius-base);
  background-color: var(--main);
  color: #000;
  font-weight: 500;
  animation: menu-in 0.15s ease-out;
}

.theme-menu[hidden] {
  display: none;
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.theme-menu button {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 6px 8px;
  border: 2px solid transparent;
  border-radius: var(--radius-base);
  background-color: var(--main);
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-menu button:hover,
.theme-menu button:focus-visible {
  outline: none;
  border-color: var(--border);
}

/* Mobile drawer */
.menu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px solid transparent;
  border-radius: var(--radius-base);
  padding: 6px 8px;
  font-weight: 500;
}

.menu-trigger:hover {
  border-color: var(--border);
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background-color: var(--overlay);
  animation: fade-in 0.2s ease-out;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 61;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-bottom: 2px solid var(--border);
  border-radius: 0 0 var(--radius-base) var(--radius-base);
  background-color: var(--background);
  color: var(--foreground);
  box-shadow: var(--shadow);
  animation: drawer-in 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes drawer-in {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
}

.drawer-header h2 {
  font-size: 18px;
  line-height: 28px;
  font-weight: 700;
}

.drawer[hidden],
.drawer-overlay[hidden] {
  display: none;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 0;
  border: 2px solid var(--border);
  border-radius: var(--radius-base);
  background-color: var(--background);
  color: var(--foreground);
  box-shadow: var(--shadow);
  font-weight: 500;
}

.card-header {
  display: grid;
  grid-auto-rows: min-content;
  align-items: start;
  gap: 6px;
  padding-inline: 24px;
}

.card-title {
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
}

.card-title--lg {
  font-size: 36px;
  line-height: 40px;
}

.card-description {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
}

.card-content {
  padding-inline: 24px;
}

.card-content a {
  text-decoration: underline;
}

/* Tilt behaviour shared by hero card and skill cards */
.tilt {
  will-change: transform;
  transition: all 400ms cubic-bezier(0.03, 0.98, 0.52, 0.99) 0s;
}

/* ==========================================================================
   Hero card
   ========================================================================== */

.hero {
  width: 100%;
  margin: 16px 0;
  padding: 16px 12px;
  gap: 24px;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.3s ease-in-out;
}

.hero-avatar {
  position: relative;
  display: flex;
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  overflow: hidden;
  border-radius: 9999px;
  outline: 2px solid var(--border);
  transition: all 0.3s ease-in-out;
}

.hero-avatar img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: opacity 0.3s ease-in-out;
}

.hero-text {
  display: flex;
  flex-direction: column;
  text-align: center;
  transition: all 0.3s ease-in-out;
}

.hero-name {
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
  transition: all 0.3s ease-in-out;
}

.hero-role {
  margin-top: 4px;
  font-size: 16px;
  line-height: 24px;
  transition: all 0.3s ease-in-out;
}

.hero-meta {
  margin-top: 4px;
  font-size: 14px;
  line-height: 20px;
  transition: all 0.3s ease-in-out;
}

/* ==========================================================================
   Skills
   ========================================================================== */

.skills-card {
  width: 100%;
  overflow: hidden;
  padding: 16px 0;
}

.skills-marquee {
  display: flex;
  gap: 16px;
  overflow-x: hidden;
  scroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.skills-marquee::-webkit-scrollbar {
  display: none;
}

.skills-marquee > * {
  flex-shrink: 0;
}

.skills-page-title {
  font-size: 36px;
  line-height: 40px;
  font-weight: 700;
}

.skills-grid {
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  gap: 16px;
  margin: 16px auto 0;
}

.skill-card {
  position: relative;
  width: 120px;
  height: 150px;
  overflow: hidden;
  border: 2px solid currentColor;
  border-radius: 8px;
  background-color: var(--skill-card-bg);
  will-change: transform;
  transition: all 400ms cubic-bezier(0.03, 0.98, 0.52, 0.99) 0s;
}

.skill-card__icon {
  height: 66.6667%;
  margin: 8px;
  padding: 8px;
  overflow: hidden;
  border: 1px solid var(--skill-icon-border);
  border-radius: 6px;
  background-color: var(--skill-icon-bg);
}

.skill-card__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.skill-card__icon img[data-invert-on-dark] {
  filter: var(--skill-icon-filter);
}

.skill-card__label {
  text-align: center;
  font-weight: 500;
  font-size: clamp(0.65rem, 2.5vw, 0.875rem);
  line-height: 1.5;
  color: var(--skill-label);
}

/* Holographic shine */
.skill-card__shine {
  position: absolute;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  pointer-events: none;
}

.skill-card__shine .s {
  position: absolute;
  left: -50%;
  top: -50%;
  width: 200%;
  height: 200%;
  filter: blur(18px);
  mix-blend-mode: screen;
  opacity: 0.06;
  transform: translateZ(0);
}

.skill-card__shine .r {
  background: linear-gradient(
    90deg,
    transparent 30%,
    rgba(255, 80, 80, 0.9) 50%,
    transparent 70%
  );
  animation: shimmer-rc 6s linear infinite;
}

.skill-card__shine .g {
  background: linear-gradient(
    90deg,
    transparent 30%,
    rgba(80, 255, 160, 0.85) 50%,
    transparent 70%
  );
  animation: shimmer-gc 7.2s linear infinite;
}

.skill-card__shine .b {
  background: linear-gradient(
    90deg,
    transparent 30%,
    rgba(120, 160, 255, 0.9) 50%,
    transparent 70%
  );
  animation: shimmer-bc 5.2s linear infinite;
}

@keyframes shimmer-rc {
  from {
    transform: translateX(-60%) translateY(-10%);
  }
  to {
    transform: translateX(60%) translateY(10%);
  }
}

@keyframes shimmer-gc {
  from {
    transform: translateX(-40%) translateY(10%);
  }
  to {
    transform: translateX(40%) translateY(-10%);
  }
}

@keyframes shimmer-bc {
  from {
    transform: translateX(-50%) translateY(0%);
  }
  to {
    transform: translateX(50%) translateY(0%);
  }
}

.skill-card__spot {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  width: var(--spot-size, 220px);
  height: var(--spot-size, 220px);
  left: var(--mxp, 50%);
  top: var(--myp, 50%);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.6) 20%,
    rgba(255, 255, 255, 0.15) 45%,
    transparent 70%
  );
  mix-blend-mode: screen;
  opacity: 0;
  filter: blur(8px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.skill-card.is-hovering .skill-card__spot {
  opacity: 0.95;
}

.skill-card.is-hovering .skill-card__shine .s {
  opacity: 0.12;
  filter: blur(12px);
}

.skill-card.is-idle .skill-card__shine .s {
  opacity: 0.06;
}

/* ==========================================================================
   Contact
   ========================================================================== */

.contact-email {
  margin-top: 20px;
  text-align: center;
}

.contact-email a {
  font-size: 24px;
  line-height: 32px;
  text-decoration: underline;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  width: 100%;
}

.footer-socials {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 12px;
  margin-inline: auto;
}

.footer-socials svg {
  width: 32px;
  height: 32px;
}

.footer-copy {
  padding: 8px 0;
  text-align: center;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (min-width: 640px) {
  .nav {
    font-size: 16px;
  }

  .hero {
    padding: 20px 16px;
  }

  .hero-inner {
    gap: 16px;
  }

  .hero-avatar {
    width: 140px;
    height: 140px;
  }

  .hero-name {
    font-size: 30px;
    line-height: 36px;
  }

  .hero-role {
    margin-top: 8px;
    font-size: 18px;
    line-height: 28px;
  }

  .hero-meta {
    margin-top: 8px;
  }
}

@media (min-width: 768px) {
  .hero {
    padding: 24px;
  }

  .hero-inner {
    flex-direction: row;
    gap: 24px;
  }

  .hero-avatar {
    width: 180px;
    height: 180px;
  }

  .hero-text {
    text-align: left;
  }

  .hero-name {
    font-size: 48px;
    line-height: 48px;
  }

  .hero-role {
    font-size: 24px;
    line-height: 32px;
  }

  .hero-meta {
    font-size: 16px;
    line-height: 24px;
  }
}

@media (min-width: 1024px) {
  .hero-inner {
    gap: 48px;
  }
}

/* Desktop nav above md, drawer nav below */
@media (max-width: 767.98px) {
  .nav--desktop {
    display: none;
  }

  .nav--mobile {
    display: flex;
  }
}

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

  html {
    scroll-behavior: auto;
  }
}
