/*
  Minimal, clean, responsive styles for a personal site.
  Focus: readability, fast load, accessible contrast.
*/

:root {
  /* Dark, blue theme */
  --bg: #0b1220;        /* deep navy */
  --text: #e6eefc;      /* light text */
  --muted: #9db1d5;     /* muted text */
  --border: #17233f;    /* subtle borders */

  /* Blue accents */
  --brand: #60a5fa;     /* blue-400 */
  --brand-2: #3b82f6;   /* blue-500 */
  --brand-3: #1e3a8a;   /* blue-900 */
  --link: var(--brand);
  --link-visited: #93c5fd; /* blue-300 */
  --card-bg1: rgba(59, 130, 246, 0.12);
  --card-bg2: rgba(37, 99, 235, 0.06);
  --glow1: rgba(59, 130, 246, 0.26);
  --glow2: rgba(37, 99, 235, 0.18);
  --shadow: 0 1px 1px rgba(0,0,0,0.3), 0 10px 30px rgba(59, 130, 246, 0.18);
  color-scheme: dark;
}


* { box-sizing: border-box; }
html, body { height: 100%; }
/* Smooth anchor scrolling */
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Oxygen,
    Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

/* Ambient gradient glow */
body::before {
  content: "";
  position: fixed;
  inset: -20vmax;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(50vmax 50vmax at 85% -10%, var(--glow1), transparent 60%),
    radial-gradient(40vmax 40vmax at -10% 10%, var(--glow2), transparent 60%);
  filter: blur(30px) saturate(1.05);
  animation: float 36s ease-in-out infinite alternate;
  opacity: .7;
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

/* Accessibility: skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  left: 16px;
  top: 12px;
  width: auto;
  height: auto;
  padding: 8px 12px;
  background: var(--text);
  color: var(--bg);
  border-radius: 6px;
}

.site-header { margin-bottom: 20px; }
.site-title {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.02em;
}
.tagline {
  margin: 6px 0 12px;
  color: var(--muted);
}

/* Tagline typewriter */
.tagline .typed { white-space: pre; }
.tagline .cursor {
  display: inline-block;
  width: 0.55ch;
  margin-left: 2px;
  border-right: 2px solid currentColor;
  opacity: 0.8;
  animation: blink 1s steps(1, end) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* Hero with avatar */
.hero .hero-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.avatar {
  width: 112px; height: 112px;
  border-radius: 999px;
  position: relative;
  filter: drop-shadow(0 10px 18px rgba(59,130,246,0.22));
}
.avatar::before {
  content: "";
  position: absolute; inset: -3px;
  border-radius: inherit;
  background: conic-gradient(from 0deg, var(--brand), var(--brand-2), var(--brand), var(--brand-2));
  animation: spin 18s linear infinite;
}
.avatar::after {
  content: "";
  position: absolute; inset: 2px;
  border-radius: inherit;
  background: var(--bg);
}
.avatar img {
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  border-radius: 999px;
  object-fit: cover;
}

.nav { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.nav a {
  position: relative;
  color: var(--text);
  text-decoration: none;
  padding-bottom: 2px;
  transition: color .2s ease;
}
.nav a::after {
  content: "";
  position: absolute; left: 0; bottom: -2px;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transform: scaleX(0);
  transform-origin: 25% 50%;
  transition: transform .4s ease;
}
.nav a:hover { color: var(--brand); }
.nav a:hover::after { transform: scaleX(1); }

.section { padding: 28px 0 12px; }
/* Avoid rendering offscreen sections until needed */
.section { content-visibility: auto; contain-intrinsic-size: 1 600px; }
.section h2 {
  margin: 0 0 10px;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.section p { margin: 8px 0; }

/* Lists */
ul { padding: 0; margin: 12px 0; list-style: none; }
li + li { margin-top: 14px; }

.timeline li {
  border-left: 2px solid var(--border);
  padding-left: 12px; /* restore previous outer box spacing */
  border-radius: 8px;
  background: linear-gradient(180deg, var(--card-bg1), var(--card-bg2));
  transition: transform .28s ease, box-shadow .28s ease;
  display: grid;
  grid-template-columns: 66px 1fr; /* fixed logo column to fit 66px box */
  column-gap: 12px;
  align-items: stretch;
  overflow: hidden; /* allow logo to match card corners */
}
.timeline li:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.timeline li .logo {
  /* Fixed visual box: 66x66 */
  width: 66px;
  height: 66px;
  object-fit: contain;
  border-radius: 8px 0 0 8px; 
  background: var(--bg);
  align-self: center; /* center vertically within the row */
}
.timeline .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .what { margin: 2px 0; }
.timeline .desc { color: var(--muted); }

.items li {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(180deg, var(--card-bg1), var(--card-bg2));
  transition: transform .28s ease, box-shadow .28s ease, background .28s ease;
}
.items li:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.items .item-title { font-weight: 600; color: var(--link); }
.items .item-title:visited { color: var(--link-visited); }
.items .item-meta { color: var(--muted); margin-left: 8px; }
.items .item-desc { margin: 4px 0 0; color: var(--muted); }

.contact li { display: flex; gap: 8px; align-items: baseline; }

a { color: var(--link); }
a:visited { color: var(--link-visited); }
a:hover { text-decoration: underline; }
/* Keep nav links clean: no underline on hover, keep gradient bar animation */
.nav a:hover { text-decoration: none; }


.site-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

/* Reveal animations */
[data-animate] { opacity: 0; transform: translateY(12px) scale(0.985); }
[data-animate].in { opacity: 1; transform: none; transition: opacity .9s cubic-bezier(.2,.65,.2,1) var(--delay, 0ms), transform .9s cubic-bezier(.2,.65,.2,1) var(--delay, 0ms); }

/* Make printing tidy */
@media print {
  .nav, .site-footer, .skip-link { display: none !important; }
  .container { padding: 0; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* Keyframes */
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes float { from { transform: translate3d(0,0,0); } to { transform: translate3d(0,-2%,0); } }

/* Skills grid */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.skill {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--card-bg1), var(--card-bg2));
  transition: transform .28s ease, box-shadow .28s ease;
  min-height: 60px; /* ensure uniform height with 40px logo + padding */
}
.skill:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.skill .logo { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
/* Remove generic li spacing inside grid to avoid odd first-item size */
.skills-grid .skill { margin: 0; }

/* Food gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.gallery figure {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0000;
  position: relative;
}
.gallery img {
  width: 100%; height: 100%; display: block; object-fit: cover;
  aspect-ratio: 4 / 3;
  transform: scale(1.01);
  transition: transform .6s ease;
}
.gallery figure:hover img { transform: scale(1.05); }
.gallery figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 8px 10px;
  font-size: 12px; color: var(--bg);
  background: linear-gradient(180deg, #0000, rgba(0,0,0,.55));
}

/* Personality section removed */

/* Travel & Food stacks */
.stacks {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 20px;
  align-items: start;
}
@media (max-width: 680px) {
  .stacks { grid-template-columns: 1fr; }
}
.stack {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 16px;
  overflow: visible; /* allow fan to extend outside */
  border: none; /* remove border */
  background: transparent; /* remove background frame */
  box-shadow: 0 0 0 rgba(0,0,0,0);
  transform-style: preserve-3d;
  perspective: 1000px;
  transition: transform .18s ease; /* faster hover scaling */
  will-change: transform;
}
/* Enlarge border on hover so the fan fits inside */
.stack:hover { transform: none; z-index: 10; }
/* Further reduce work for offscreen stacks */
.stack { content-visibility: visible; contain-intrinsic-size: auto; }

/* Ensure the travel section doesn’t clip overflow */
#travel-food, #travel-food .stacks, #travel-food .stack { content-visibility: visible; contain-intrinsic-size: auto; }
.stack .stack-title {
  position: absolute; z-index: 999; left: 50%; top: 8px;
  transform: translateX(-50%);
  padding: 4px 10px; font-size: 12px; font-weight: 600;
  color: var(--bg);
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(0,0,0,.12);
  pointer-events: none;
}
.stack img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition: transform .5s cubic-bezier(.2,.65,.2,1), opacity .5s ease, filter .4s ease;
  transform-origin: 50% 90%;
  will-change: transform, opacity, filter;
}
/* Deck layout: show top + two peeking cards shifted right */
.stack img:nth-of-type(1) { z-index: 3; transform: translateX(-6%) scale(1); opacity: 1; pointer-events: auto; }
.stack img:nth-of-type(2) { z-index: 2; transform: translateX(0) scale(.985); opacity: .98; pointer-events: none; }
.stack img:nth-of-type(3) { z-index: 1; transform: translateX(6%) scale(.97); opacity: .94; pointer-events: none; }
.stack img:nth-of-type(n+4) { transform: translateX(8%) scale(.95); opacity: 0; pointer-events: none; }

/* Hover: fan out like a hand of cards; reveal two more cards */
.stack:hover img:nth-of-type(1) { transform: translateX(-16%) rotate(-8deg) scale(1); filter: blur(0px); box-shadow: 0 0 0 3px var(--brand), var(--shadow); }
.stack:hover img:nth-of-type(2) { transform: translateX(-4%) rotate(-3deg) scale(.985); filter: blur(1px); }
.stack:hover img:nth-of-type(3) { transform: translateX(14%) rotate(3deg) scale(.985); opacity: .98; filter: blur(2px); }
.stack:hover img:nth-of-type(4) { z-index: 0; transform: translateX(26%) rotate(8deg) scale(.97); opacity: .92; filter: blur(3px); }
.stack:hover img:nth-of-type(5) { z-index: 0; transform: translateX(38%) rotate(12deg) scale(.96); opacity: .86; filter: blur(4px); }
.stack:hover img:nth-of-type(n+6) { opacity: 0; }

/* Left column: mirror the fan to the left so stacks don't overlap */
.stacks .stack:nth-of-type(1):hover img:nth-of-type(1) { transform: translateX(16%) rotate(8deg) scale(1); filter: blur(0px); box-shadow: 0 0 0 3px var(--brand), var(--shadow); }
.stacks .stack:nth-of-type(1):hover img:nth-of-type(2) { transform: translateX(4%) rotate(3deg) scale(.985); filter: blur(1px); }
.stacks .stack:nth-of-type(1):hover img:nth-of-type(3) { transform: translateX(-14%) rotate(-3deg) scale(.985); opacity: .98; filter: blur(2px); }
.stacks .stack:nth-of-type(1):hover img:nth-of-type(4) { z-index: 0; transform: translateX(-26%) rotate(-8deg) scale(.97); opacity: .92; filter: blur(3px); }
.stacks .stack:nth-of-type(1):hover img:nth-of-type(5) { z-index: 0; transform: translateX(-38%) rotate(-12deg) scale(.96); opacity: .86; filter: blur(4px); }

/* Reduced motion: keep stacks static */
@media (prefers-reduced-motion: reduce) {
  .stack, .stack img, .stack:hover img, .stack .stack-title { transition: none !important; transform: none !important; }
}
