@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,700&family=DM+Sans:wght@300;400;500&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg:           #f0ede8;
  --card-bg:      #fafaf8;
  --surface:      #f2f0ec;
  --surface-2:    #e8e5e0;
  --border:       #c8c4bc;
  --border-dash:  #bbb8b0;
  --text:         #1a1814;
  --text-muted:   #6b6860;
  --text-faint:   #a8a5a0;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
img  { display: block; max-width: 100%; }
a    { color: inherit; text-decoration: none; }

.scanlines {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0px, transparent 2px, rgba(0,0,0,0.018) 2px, rgba(0,0,0,0.018) 4px);
}

.cursor-dot {
  width: 8px; height: 8px; background: var(--text); border-radius: 50%;
  position: fixed; pointer-events: none; z-index: 10000;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s, background 0.2s;
}
body:has(a:hover) .cursor-dot,
body:has(button:hover) .cursor-dot {
  width: 20px; height: 20px; background: transparent; border: 1.5px solid var(--text);
}

body {
  min-height: 100dvh;
  background: var(--bg);
  background-image: radial-gradient(circle, #bbb8b0 1px, transparent 1px);
  background-size: 24px 24px;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 16px;
  font-family: var(--font-body);
  color: var(--text);
}

.card-wrapper { width: 100%; max-width: 800px; }

.card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.08), 4px 4px 0 var(--surface-2);
  transition: transform 0.5s cubic-bezier(0.16,1,0.3,1);
}

/* ── Topbar ── */
.card-topbar {
  background: var(--surface); border-bottom: 1.5px solid var(--border);
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-title { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); }
.topbar-dots  { display: flex; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid rgba(0,0,0,0.12); }
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }

/* ── Topbar nav ── */
.topbar-nav {
  display: flex; align-items: center; gap: 8px;
}
.topbar-link {
  font-family: var(--font-mono); font-size: 0.72rem;
  color: var(--text-faint); text-decoration: none;
  letter-spacing: 0.04em; transition: color 0.2s;
}
.topbar-link:hover, .topbar-link-active { color: var(--text) !important; }
.topbar-sep { color: var(--border-dash); font-size: 0.72rem; }
.topbar-back { text-decoration: none !important; transition: color 0.2s; }
.topbar-back:hover { color: var(--text-muted) !important; }

/* ── Card body ── */
.card-body {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 24px; padding: 24px;
}

.name { font-family: var(--font-display); font-style: italic; font-size: clamp(2.5rem,6vw,3.5rem); line-height: 1; letter-spacing: -0.02em; }

.meta-pills {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 12px; font-size: 0.82rem; font-weight: 500;
  color: var(--text-muted); font-family: var(--font-mono);
}
.diamond { color: var(--border-dash); font-size: 0.7rem; }

.dashed-divider {
  margin: 16px 0; border: none;
  border-top: 1.5px dashed var(--border-dash); opacity: 0.7;
}

.info-box {
  border: 1.5px solid var(--border); border-radius: 4px;
  margin-bottom: 16px; overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}
.info-box:hover { box-shadow: 3px 3px 0 var(--surface-2); transform: translate(-1px,-1px); }

.info-box-label {
  background: var(--surface); border-bottom: 1.5px solid var(--border);
  padding: 8px 12px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em;
}
.info-box-content { padding: 12px; font-size: 0.88rem; line-height: 1.6; color: var(--text-muted); }

.likes-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  background: var(--surface); border: 1px solid var(--border); border-radius: 4px;
  padding: 2px 8px; font-size: 0.78rem; font-family: var(--font-mono); cursor: default;
  transition: background 0.15s, transform 0.15s, color 0.15s;
}
.tag:hover { background: var(--text); color: var(--card-bg); transform: translateY(-1px); }

.currently-list { display: flex; flex-direction: column; gap: 8px; }
.currently-item { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-muted); }

.manga-strip {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 3px; border: 1.5px solid var(--border); border-radius: 4px;
  overflow: hidden; position: relative; height: 90px;
}
.manga-panel {
  background: var(--surface-2); background-size: cover; background-position: center;
  filter: grayscale(1) contrast(1.1);
}
.manga-overlay {
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(circle, rgba(0,0,0,0.08) 1px, transparent 1px);
  background-size: 4px 4px;
}

.profile-img-frame {
  position: relative; border: 1.5px solid var(--border); border-radius: 4px;
  overflow: hidden; aspect-ratio: 3/4; margin-bottom: 16px;
}
.profile-img {
  width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(0.4) contrast(1.05);
  transition: filter 0.3s;
}
.profile-img:hover { filter: grayscale(0) contrast(1); }

.glitch-layer { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.profile-img-frame:hover .glitch-r { animation: glitch-r 0.3s steps(2) forwards; }
.profile-img-frame:hover .glitch-b { animation: glitch-b 0.3s steps(2) 0.05s forwards; }

@keyframes glitch-r {
  20% { opacity: 0.15; transform: translate(-3px,1px); background: rgba(255,0,0,0.2); }
  60% { opacity: 0.12; transform: translate(2px,-1px); background: rgba(255,0,0,0.15); }
  100%{ opacity: 0; }
}
@keyframes glitch-b {
  20% { opacity: 0.15; transform: translate(3px,-1px); background: rgba(0,0,255,0.2); }
  60% { opacity: 0.12; transform: translate(-2px,1px); background: rgba(0,0,255,0.15); }
  100%{ opacity: 0; }
}

.speed-lines {
  position: absolute; bottom: 0; right: 0; width: 60px; height: 60px; pointer-events: none;
  background: repeating-linear-gradient(135deg, transparent 0px, transparent 3px, rgba(0,0,0,0.06) 3px, rgba(0,0,0,0.06) 4px);
}

/* ── Projects section (index.html) ── */
.projects-section { padding: 16px 24px; }
.section-label {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-faint); font-family: var(--font-mono); margin-bottom: 12px;
}

.projects-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.project-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border: 1.5px solid var(--border); border-radius: 4px; background: var(--surface);
  transition: box-shadow 0.2s, transform 0.2s, background 0.2s, color 0.2s;
}
.project-card:hover {
  background: var(--text); color: var(--card-bg);
  box-shadow: 3px 3px 0 var(--border); transform: translate(-1px,-1px);
}
.project-card:hover .project-desc { color: rgba(255,255,255,0.6); }
.project-icon { font-size: 1.2rem; flex-shrink: 0; }
.project-name { font-size: 0.85rem; font-weight: 600; }
.project-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.project-arrow { margin-left: auto; font-size: 1rem; flex-shrink: 0; }
.project-wip { opacity: 0.65; cursor: default; }
.project-wip:hover { background: var(--surface); color: var(--text); transform: none; box-shadow: none; }
.project-wip-badge {
  margin-left: auto; font-size: 0.65rem; font-family: var(--font-mono);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px;
  padding: 2px 7px; color: var(--text-faint); flex-shrink: 0;
}

/* ── Social bar ── */
.social-bar {
  display: flex; justify-content: center; align-items: center;
  gap: 24px; padding: 20px 24px;
}
.social-link { color: var(--text-faint); display: flex; align-items: center; transition: color 0.2s, transform 0.2s; }
.social-link:hover { color: var(--text); transform: translateY(-3px); }

.card-footer {
  text-align: center; padding: 12px 24px 20px;
  font-size: 0.75rem; color: var(--text-faint); font-family: var(--font-mono);
}

/* ── Inner page shared layout ── */
.page-content { padding: 24px; }
.page-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1; letter-spacing: -0.02em;
}
.page-subtitle {
  font-size: 0.85rem; color: var(--text-muted);
  margin-top: 6px; font-family: var(--font-mono);
}
.exclaim { color: var(--text-faint); }

/* ── Featured project block (projects.html) ── */
.featured-project {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}
.featured-badge {
  background: var(--text); color: var(--card-bg);
  font-size: 0.68rem; font-family: var(--font-mono);
  font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 12px; display: inline-block;
}
.featured-body {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 24px; padding: 20px;
}
.featured-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 10px; }
.featured-desc {
  font-size: 0.85rem; color: var(--text-muted);
  line-height: 1.65; margin-bottom: 14px;
}
.featured-desc a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.featured-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.featured-links { display: flex; gap: 10px; flex-wrap: wrap; }

.btn-primary {
  display: inline-flex; align-items: center;
  background: var(--text); color: var(--card-bg);
  padding: 8px 16px; border-radius: 4px;
  font-size: 0.82rem; font-weight: 600;
  text-decoration: none;
  border: 1.5px solid var(--text);
  transition: opacity 0.2s, transform 0.2s;
}
.btn-primary:hover { opacity: 0.82; transform: translateY(-1px); }

.btn-ghost {
  display: inline-flex; align-items: center;
  background: transparent; color: var(--text);
  padding: 8px 16px; border-radius: 4px;
  font-size: 0.82rem; font-weight: 600;
  text-decoration: none;
  border: 1.5px solid var(--border);
  transition: border-color 0.2s, transform 0.2s;
}
.btn-ghost:hover { border-color: var(--text); transform: translateY(-1px); }

.featured-preview { display: flex; align-items: center; justify-content: center; }
.preview-placeholder {
  width: 100%; background: var(--surface-2);
  border-radius: 6px; padding: 16px; font-family: var(--font-mono);
}
.preview-label { font-size: 0.7rem; color: var(--text-faint); margin-bottom: 12px; display: block; }
.preview-lines { display: flex; flex-direction: column; gap: 8px; }
.pline { height: 8px; border-radius: 2px; background: var(--border); width: 100%; }
.pline-green { background: var(--border-dash); width: 60%; }
.pline-short { width: 40%; }
.pline-med   { width: 70%; }

/* ── GitHub card ── */
.github-section { margin-top: 4px; }
.github-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 6px; background: var(--surface);
  text-decoration: none; color: var(--text);
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}
.github-card:hover {
  background: var(--text); color: var(--card-bg);
  box-shadow: 3px 3px 0 var(--border); transform: translate(-1px,-1px);
}
.github-card:hover .github-card-sub { color: rgba(255,255,255,0.45); }
.github-card-title { font-size: 0.88rem; font-weight: 600; }
.github-card-sub   { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* ── Art grid (artworks.html) ── */
.art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px; margin-bottom: 20px;
}
.art-grid-digital { grid-template-columns: minmax(0, 320px); }

.art-card {
  position: relative; overflow: hidden;
  border: 1.5px solid var(--border); border-radius: 4px;
  aspect-ratio: 3/4; cursor: pointer;
  background: var(--surface-2);
  transition: transform 0.2s, box-shadow 0.2s;
}
.art-card:hover {
  transform: translate(-2px,-2px);
  box-shadow: 3px 3px 0 var(--border);
}
.art-img {
  width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(0.15);
  transition: filter 0.3s, transform 0.3s;
}
.art-card:hover .art-img { filter: grayscale(0); transform: scale(1.04); }
.art-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(26,24,20,0.85) 0%, transparent 100%);
  padding: 28px 10px 10px;
  opacity: 0; transition: opacity 0.25s;
}
.art-card:hover .art-overlay { opacity: 1; }
.art-title { font-size: 0.78rem; font-weight: 600; color: #fff; }
.art-sub   { font-size: 0.68rem; color: rgba(255,255,255,0.55); margin-top: 2px; font-family: var(--font-mono); }

/* ── Lightbox ── */
.lightbox {
  display: none; position: fixed; inset: 0;
  background: rgba(26,24,20,0.92); backdrop-filter: blur(8px);
  z-index: 9999; align-items: center; justify-content: center;
  flex-direction: column; gap: 14px;
}
.lightbox.open { display: flex; }
.lightbox-img {
  max-width: 90vw; max-height: 80vh;
  object-fit: contain; border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox-caption {
  font-size: 0.82rem; color: rgba(255,255,255,0.5);
  font-family: var(--font-mono);
}
.lightbox-close {
  position: absolute; top: 20px; right: 24px;
  background: none; border: none;
  color: rgba(255,255,255,0.45); font-size: 1.3rem;
  cursor: pointer; transition: color 0.2s; line-height: 1;
}
.lightbox-close:hover { color: #fff; }

/* ── Responsive ── */
@media (max-width: 600px) {
  body { align-items: flex-start; }
  .card-body { grid-template-columns: 1fr; gap: 16px; }
  .col-right { order: -1; }
  .profile-img-frame { aspect-ratio: 4/3; }
  .projects-grid { grid-template-columns: 1fr; }
  .social-bar { gap: 16px; flex-wrap: wrap; }
  .featured-body { grid-template-columns: 1fr; }
  .featured-preview { display: none; }
  .art-grid { grid-template-columns: repeat(2, 1fr); }
  .art-grid-digital { grid-template-columns: 1fr; }
}

/* ── Back link (above card on sub-pages) ── */
.back-link {
  display: block;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  transition: color 0.2s;
}
.back-link:hover { color: var(--text); }

/* ── Gallery page ── */
.gallery-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

/* Photos are landscape — override the portrait aspect ratio from art-grid */
.gallery-card {
  aspect-ratio: 4/3;
}

.gallery-img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.gallery-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-bottom: 14px;
}

/* Filter bar */
.gallery-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.gallery-filter-btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 4px 12px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.gallery-filter-btn:hover {
  border-color: var(--text);
  color: var(--text);
}
.gallery-filter-btn.active {
  background: var(--text);
  color: var(--card-bg);
  border-color: var(--text);
}

/* Skeleton shimmer while loading */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
.skeleton-card {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border: 1.5px solid var(--border);
  aspect-ratio: 4/3;
}

/* ── Dino Game ── */
.dino-box {
  margin-top: 14px;
  border: 2px solid var(--text);
  box-shadow: 4px 4px 0 var(--text);
  border-radius: 4px;
  overflow: hidden;
  background: var(--card-bg);
  width: 100%;
}

#dinoCanvas {
  display: block;
  width: 100%;
  height: 120px;
  image-rendering: pixelated;
}

.commitments-full {
  margin: 0 20px 14px 20px;
  box-sizing: border-box;
}

.commitments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.commitment-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.commitment-icon {
  font-size: 1.2rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.commitment-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.commitment-role {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
}

.commitment-org {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.commitment-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.study-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
}

.study-list li {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
}

.study-list li::before {
  content: "▸ ";
  font-size: 0.7rem;
  opacity: 0.5;
}

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