@import url("https://fonts.googleapis.com/css2?family=Archivo+Black&family=Lexend:wght@100..900&display=swap");
:root {
  --font: "Lexend", sans-serif;
  --bg: #ebebeb;
  --card-bg: #ffffff;
  --text: #171717;
  --text-muted: #737373;
  --border: #e5e5e5;
  --guide: rgba(0, 0, 0, 0.08);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --selection-bg: #d4d4d4;
  --selection-fg: #171717;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --texture-dot: rgba(0, 0, 0, 0.025);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --card-bg: #111111;
    --text: #ededed;
    --text-muted: #888888;
    --border: #2a2a2a;
    --guide: rgba(255, 255, 255, 0.06);
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --selection-bg: #404040;
    --selection-fg: #ededed;
    --texture-dot: rgba(255, 255, 255, 0.03);
  }
}
html[data-theme=dark] {
  --bg: #0f0f0f;
  --card-bg: #111111;
  --text: #ededed;
  --text-muted: #888888;
  --border: #2a2a2a;
  --guide: rgba(255, 255, 255, 0.06);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --selection-bg: #404040;
  --selection-fg: #ededed;
  --texture-dot: rgba(255, 255, 255, 0.03);
}

html[data-theme=light] {
  --bg: #ebebeb;
  --card-bg: #ffffff;
  --text: #171717;
  --text-muted: #737373;
  --border: #e5e5e5;
  --guide: rgba(0, 0, 0, 0.08);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --selection-bg: #d4d4d4;
  --selection-fg: #171717;
  --texture-dot: rgba(0, 0, 0, 0.025);
}

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

html {
  height: 100%;
}

body {
  background: var(--bg);
  font-family: var(--font);
  font-weight: 600;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
@media (max-height: 500px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }
}

::selection {
  background: var(--selection-bg);
  color: var(--selection-fg);
}

.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: 100dvh;
  padding: 2rem;
}
@media (max-height: 500px) {
  .page {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }
}

.card-frame {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin-block: auto;
  aspect-ratio: 1.75;
  perspective: 1200px;
  overflow: visible;
}

.page-tagline {
  margin-top: auto;
  padding-top: 1.5rem;
  margin-bottom: 1rem;
  max-width: 480px;
  width: 100%;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.6;
  color: var(--text-muted);
  text-align: center;
  opacity: 0.6;
  letter-spacing: 0.02em;
}

.guide {
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.guide--v-left,
.guide--v-right {
  width: 1px;
  top: -50vh;
  bottom: -50vh;
  background: var(--guide);
}

.guide--v-left {
  left: 0;
}

.guide--v-right {
  right: 0;
}

.guide--h-top,
.guide--h-bottom {
  height: 1px;
  left: -50vw;
  right: -50vw;
  background: var(--guide);
}

.guide--h-top {
  top: 0;
}

.guide--h-bottom {
  bottom: 0;
}

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  will-change: transform;
  cursor: pointer;
}
.card.flipped {
  transform: rotateY(180deg);
}
.card.flipping {
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.3s ease;
}

.card-back {
  transform: rotateY(180deg);
  transition: background-color 0.3s var(--ease-out), border-color 0.3s var(--ease-out);
}
.card-back[data-color=blue] {
  background: #2563eb;
  border-color: #3b82f6;
}
.card-back[data-color=pink] {
  background: #db2777;
  border-color: #ec4899;
}
.card-back[data-color=purple] {
  background: #7c3aed;
  border-color: #8b5cf6;
}
.card-back::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0.5px, transparent 0.5px), radial-gradient(circle, rgba(255, 255, 255, 0.05) 0.4px, transparent 0.4px);
  background-size: 5px 5px, 9px 7px;
}
.card-back::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(circle 140px at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.12), transparent 80%);
  mix-blend-mode: overlay;
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.card.flipped:hover .card-back::after {
  opacity: 1;
}
.card-back h2 {
  color: rgba(255, 255, 255, 0.45);
}
.card-back ul li {
  color: rgba(255, 255, 255, 0.75);
}
.card-back .year {
  color: rgba(255, 255, 255, 0.3);
  opacity: 1;
}
.card-back a {
  color: rgba(255, 255, 255, 0.8);
}
.card-back a:hover {
  color: #ffffff;
}
.card-back .social-links a {
  color: rgba(255, 255, 255, 0.45);
}
.card-back .social-links a:hover {
  color: rgba(255, 255, 255, 0.85);
}
.card-back .sep {
  color: rgba(255, 255, 255, 0.18);
}

.card-front {
  background: var(--card-bg);
  border: 2px solid var(--border);
  transition: border-color 0.3s ease;
}
.card-front::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(circle 220px at var(--mx, 50%) var(--my, 50%), rgba(120, 110, 255, 0.12), rgba(190, 90, 255, 0.08) 35%, rgba(80, 200, 255, 0.05) 60%, transparent 80%);
  mix-blend-mode: multiply;
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.card-front::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.08) 1px, transparent 1px);
  background-size: 14px 14px;
  -webkit-mask-image: radial-gradient(circle 120px at var(--mx, 50%) var(--my, 50%), black 0%, transparent 100%);
  mask-image: radial-gradient(circle 120px at var(--mx, 50%) var(--my, 50%), black 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.card:not(.flipped):hover .card-front::before {
  opacity: 1;
}
.card:not(.flipped):hover .card-front::after {
  opacity: 1;
}
.card-front h1 {
  color: var(--text);
}
.card-front .card-url {
  color: var(--text-muted);
}
.card-front .card-url a {
  color: var(--text-muted);
}
.card-front .card-url a:hover {
  color: var(--text);
}
@media (prefers-color-scheme: dark) {
  .card-front {
    border-color: var(--accent);
  }
  .card-front::after {
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.2) 1px, transparent 1px);
  }
  .card-front::before {
    background: radial-gradient(circle 220px at var(--mx, 50%) var(--my, 50%), rgba(100, 220, 255, 0.06), rgba(200, 80, 200, 0.05) 25%, rgba(80, 255, 180, 0.04) 45%, rgba(255, 160, 100, 0.03) 65%, transparent 80%);
    mix-blend-mode: screen;
  }
}
html[data-theme=dark] .card-front {
  border-color: var(--accent);
}
html[data-theme=dark] .card-front::after {
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.2) 1px, transparent 1px);
}
html[data-theme=dark] .card-front::before {
  background: radial-gradient(circle 220px at var(--mx, 50%) var(--my, 50%), rgba(100, 220, 255, 0.06), rgba(200, 80, 200, 0.05) 25%, rgba(80, 255, 180, 0.04) 45%, rgba(255, 160, 100, 0.03) 65%, transparent 80%);
  mix-blend-mode: screen;
}
html[data-theme=light] .card-front {
  border-color: var(--border);
}
html[data-theme=light] .card-front::after {
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.08) 1px, transparent 1px);
}
html[data-theme=light] .card-front::before {
  mix-blend-mode: multiply;
}

.card-front-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 1.75rem;
}

.share-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.4rem;
  transition: color 0.2s ease;
  opacity: 0.5;
}
.share-btn:hover {
  color: var(--text);
  opacity: 1;
}
@media (prefers-color-scheme: dark) {
  .share-btn {
    color: rgba(255, 255, 255, 0.3);
    opacity: 1;
  }
  .share-btn:hover {
    color: rgba(255, 255, 255, 0.8);
  }
}
html[data-theme=dark] .share-btn {
  color: rgba(255, 255, 255, 0.3);
  opacity: 1;
}
html[data-theme=dark] .share-btn:hover {
  color: rgba(255, 255, 255, 0.8);
}
html[data-theme=light] .share-btn {
  color: var(--text-muted);
  opacity: 0.5;
}
html[data-theme=light] .share-btn:hover {
  color: var(--text);
  opacity: 1;
}

.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.2s var(--ease-out);
}
.theme-toggle:hover {
  color: var(--text);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--text-muted);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle {
    transition: none;
  }
}
.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.card-identity {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

h1 {
  font-family: "Archivo Black", sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}


.card-front-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.card-url {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.card-back-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 1.75rem;
}

.gallery-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.85rem;
  padding: 0.4rem;
  transition: color 0.2s ease;
  z-index: 2;
}
.gallery-btn:hover {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}

.color-picker {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 2;
}

.color-dot {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  cursor: pointer;
  padding: 0;
  box-shadow: none;
  transition: transform 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}
.color-dot[data-color=blue] {
  background: #2563eb;
}
.color-dot[data-color=pink] {
  background: #db2777;
}
.color-dot[data-color=purple] {
  background: #7c3aed;
}
.color-dot:hover {
  transform: scale(1.25);
}
.color-dot.active {
  border-color: rgba(255, 255, 255, 0.9);
}
.color-dot:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .color-dot {
    transition: none;
  }
  .card-back {
    transition: none;
  }
}
h2 {
  font-family: "Archivo Black", sans-serif;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

ul li {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.project-thumb {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 3px;
  object-fit: cover;
  flex-shrink: 0;
}

.year {
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.5;
  margin-left: 0.15rem;
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}
a:hover {
  color: var(--accent);
}

.card-back-footer {
  display: flex;
  align-items: center;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.social-links a {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}
.social-links a:hover {
  color: var(--text);
}

.sep {
  font-size: 0.7rem;
  color: var(--border);
  user-select: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  cursor: pointer;
  touch-action: manipulation;
}
.lightbox.open {
  opacity: 1;
  pointer-events: all;
}
.lightbox .lightbox-spinner {
  position: absolute;
  width: 2rem;
  height: 2rem;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.lightbox .lightbox-spinner.visible {
  opacity: 1;
}
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 0.5rem;
  object-fit: contain;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.6);
  transition: opacity 0.15s ease;
}
.lightbox .lightbox-close,
.lightbox .lightbox-prev,
.lightbox .lightbox-next {
  position: absolute;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: color 0.2s;
  font-family: var(--font);
}
.lightbox .lightbox-close:hover,
.lightbox .lightbox-prev:hover,
.lightbox .lightbox-next:hover {
  color: rgba(255, 255, 255, 0.9);
}
.lightbox .lightbox-close {
  top: 1rem;
  right: 1rem;
  font-size: 2rem;
}
.lightbox .lightbox-prev,
.lightbox .lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  padding: 1rem;
}
@media (max-width: 800px) {
  .lightbox .lightbox-prev,
  .lightbox .lightbox-next {
    top: auto;
    bottom: 2rem;
    transform: none;
    font-size: 2rem;
  }
}
.lightbox .lightbox-prev {
  left: 1rem;
}
.lightbox .lightbox-next {
  right: 1rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (max-width: 540px) {
  .page {
    padding: 1rem;
    padding-top: 12dvh;
  }
  .card-frame {
    max-width: 100%;
    aspect-ratio: 1.5;
    perspective: 800px;
  }
  .card-front-content,
  .card-back-content {
    padding: 1.25rem;
  }
  .card-face {
    border-radius: 0.5rem;
  }
  .guide--h-top,
  .guide--h-bottom {
    display: none;
  }
  h1 {
    font-size: 1rem;
  }
  .avatar {
    width: 2.25rem;
    height: 2.25rem;
  }
}

/* ─── 404 page ─────────────────────────────────────────────────────────────── */
body.notfound {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  overflow: hidden;
  padding: 2rem;
}

.notfound main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

.notfound h1 {
  font-family: "Archivo Black", sans-serif;
  font-size: clamp(4rem, 16vw, 8rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text);
}

.notfound p {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.notfound a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s var(--ease-out);
}

.notfound a:hover {
  color: var(--text);
  text-decoration-color: var(--text-muted);
}

.notfound a:focus-visible {
  outline: 2px solid var(--text-muted);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .notfound a {
    transition: none;
  }
}
