/* =============================================================================
   0xatsupon — Portfolio v2
   Redesigned: Apple/Stripe/Vercel inspired
   Key: Large typography, extreme whitespace, restraint over decoration
   ============================================================================= */

:root {
  --bg: #050505;
  --bg-raised: #0c0c0d;
  --bg-card: #0f0f11;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.1);

  --text-1: #f0f0f2;
  --text-2: #888;
  --text-3: #555;

  --accent: #6366f1;
  --accent-2: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.15);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', monospace;

  --nav-h: 56px;
  --max-w: 1080px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-1);
  background: var(--bg);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
::selection { background: rgba(99, 102, 241, 0.3); }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Noise --- */
.noise {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px;
}

/* --- Nav --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(5, 5, 5, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.nav__logo:hover { opacity: 0.7; }

.nav__logo-mark {
  color: var(--accent);
}

.nav__links { display: flex; gap: 32px; }

.nav__link {
  font-size: 0.8rem;
  color: var(--text-2);
  transition: color 150ms;
}

.nav__link:hover { color: var(--text-1); }

.nav__link--external::after {
  content: '↗';
  margin-left: 3px;
  font-size: 0.7rem;
  opacity: 0.5;
}

.nav__menu {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 24px;
  padding: 4px 0;
}

.nav__menu span {
  display: block;
  height: 1.5px;
  background: var(--text-2);
  border-radius: 1px;
  transition: all 400ms var(--ease);
  transform-origin: center;
}

.nav__menu[aria-expanded="true"] span:first-child { transform: translateY(3.25px) rotate(45deg); }
.nav__menu[aria-expanded="true"] span:last-child { transform: translateY(-3.25px) rotate(-45deg); }

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  background: rgba(5, 5, 5, 0.97);
  backdrop-filter: blur(24px);
  opacity: 0;
  visibility: hidden;
  transition: all 400ms var(--ease);
}

.mobile-menu[aria-hidden="false"] { opacity: 1; visibility: visible; }
.mobile-menu__link { font-size: 1.3rem; font-weight: 500; color: var(--text-2); }
.mobile-menu__link:hover { color: var(--text-1); }

/* --- Hero (Apple-style: huge text, minimal) --- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px 80px;
  position: relative;
}

.hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  opacity: 0.5;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(5, 5, 5, 0.4) 0%, rgba(5, 5, 5, 0.2) 25%, var(--bg) 70%);
  z-index: 1;
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(to top, var(--bg), transparent);
  z-index: 1;
  pointer-events: none;
}

.hero__container {
  position: relative;
  z-index: 2;
}

.hero__title {
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin-bottom: 32px;
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.8);
}

.hero__title-line {
  display: block;
}

.hero__title--accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-2), #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero__subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 48px;
  font-weight: 400;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.9);
}

.hero__cta {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.hide-mobile { display: inline; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 10px;
  transition: all 200ms var(--ease);
}

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

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.btn--ghost {
  border: 1px solid var(--border-hover);
  color: var(--text-2);
}

.btn--ghost:hover {
  background: var(--bg-raised);
  color: var(--text-1);
}

/* --- Section Headers --- */
.section-header {
  margin-bottom: 64px;
}

.section__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.section__sub {
  font-size: 1.1rem;
  color: var(--text-2);
}

/* --- Bento Grid (Domains) --- */
.domains {
  padding: 0 0 160px;
  position: relative;
}

.bento {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 16px;
  min-height: 420px;
}

.bento__main {
  grid-row: 1 / -1;
  padding: 48px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
  transition: border-color 400ms, box-shadow 400ms;
}

/* Bento card visuals */
.bento__visual {
  position: absolute;
  top: 0;
  right: 0;
  width: 70%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
  mask-image: linear-gradient(to left, rgba(0,0,0,0.7), transparent 85%);
  -webkit-mask-image: linear-gradient(to left, rgba(0,0,0,0.7), transparent 85%);
  pointer-events: none;
  transition: opacity 600ms var(--ease);
}

.bento__main:hover .bento__visual {
  opacity: 0.5;
}

.bento__side-visual {
  position: absolute;
  top: 0;
  right: 0;
  width: 55%;
  height: 100%;
  object-fit: cover;
  opacity: 0.3;
  mask-image: linear-gradient(to left, rgba(0,0,0,0.6), transparent 75%);
  -webkit-mask-image: linear-gradient(to left, rgba(0,0,0,0.6), transparent 75%);
  pointer-events: none;
  transition: opacity 600ms var(--ease);
}

.bento__side:hover .bento__side-visual {
  opacity: 0.45;
}

.bento__content {
  position: relative;
  z-index: 1;
}

.bento__main:hover {
  border-color: rgba(99, 102, 241, 0.15);
  box-shadow: 0 0 60px rgba(99, 102, 241, 0.04);
}

.bento__label {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 16px;
}

.bento__title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 16px;
}

.bento__text {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.7;
}

.bento__side {
  padding: 32px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
  transition: border-color 400ms, box-shadow 400ms;
}

.bento__side--top:hover {
  border-color: rgba(245, 158, 11, 0.15);
  box-shadow: 0 0 40px rgba(245, 158, 11, 0.04);
}

.bento__side--bottom:hover {
  border-color: rgba(168, 85, 247, 0.15);
  box-shadow: 0 0 40px rgba(168, 85, 247, 0.04);
}

.bento__side-title {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: 10px;
}

/* --- Projects (each card is unique) --- */
.work {
  padding: 160px 0;
}

/* Card base */
.pcard {
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color 400ms, transform 400ms var(--ease), box-shadow 400ms;
  position: relative;
}

.pcard:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

/* Full-width hero card */
.pcard--hero {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
}

.pcard--hero .pcard__img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
  transition: transform 600ms var(--ease);
}

.pcard--hero:hover .pcard__img {
  transform: scale(1.03);
}

/* Side-by-side row */
.pcard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

/* Standard card with top image */
.pcard .pcard__img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  transition: transform 600ms var(--ease);
}

.pcard:hover .pcard__img {
  transform: scale(1.03);
}

/* Wide card (text left, image right) */
.pcard--wide {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 16px;
}

.pcard__img-side {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms var(--ease);
}

.pcard--wide:hover .pcard__img-side {
  transform: scale(1.03);
}

.pcard__body {
  padding: 32px;
}

.pcard__tags {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 100px;
  letter-spacing: 0.02em;
}

/* Per-project color tags */
.tag--green { background: rgba(34, 197, 94, 0.1); color: #4ade80; }
.tag--amber { background: rgba(245, 158, 11, 0.1); color: #fbbf24; }
.tag--blue { background: rgba(59, 130, 246, 0.1); color: #60a5fa; }
.tag--purple { background: rgba(168, 85, 247, 0.1); color: #c084fc; }
.tag--cyan { background: rgba(56, 189, 248, 0.1); color: #38bdf8; }
.tag--lime { background: rgba(132, 204, 22, 0.1); color: #a3e635; }

/* Per-project card accent border + glow on hover */
.pcard--green:hover { border-color: rgba(34, 197, 94, 0.25); box-shadow: 0 8px 32px rgba(34, 197, 94, 0.08); }
.pcard--amber:hover { border-color: rgba(245, 158, 11, 0.25); box-shadow: 0 8px 32px rgba(245, 158, 11, 0.08); }
.pcard--blue:hover { border-color: rgba(59, 130, 246, 0.25); box-shadow: 0 8px 32px rgba(59, 130, 246, 0.08); }
.pcard--purple:hover { border-color: rgba(168, 85, 247, 0.25); box-shadow: 0 8px 32px rgba(168, 85, 247, 0.08); }
.pcard--cyan:hover { border-color: rgba(56, 189, 248, 0.25); box-shadow: 0 8px 32px rgba(56, 189, 248, 0.08); }
.pcard--lime:hover { border-color: rgba(132, 204, 22, 0.25); box-shadow: 0 8px 32px rgba(132, 204, 22, 0.08); }

.pcard__title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.pcard__desc {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 16px;
}

.pcard__link {
  font-size: 0.8rem;
  font-weight: 500;
  transition: color 150ms;
}

.pcard__link--green { color: #4ade80; }
.pcard__link--amber { color: #fbbf24; }
.pcard__link--blue { color: #60a5fa; }
.pcard__link--green:hover, .pcard__link--amber:hover, .pcard__link--blue:hover { color: var(--text-1); }

.pcard__status {
  font-size: 0.75rem;
  color: var(--text-3);
  font-style: italic;
}

/* --- Experience --- */
.experience {
  padding: 0 0 160px;
}

.exp-card {
  padding: 48px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.exp-card__header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 16px;
}

.exp-card__role {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.exp-card__period {
  font-size: 0.85rem;
  color: var(--text-3);
}

.exp-card__desc {
  font-size: 0.95rem;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 40px;
  max-width: 640px;
}

.exp-items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.exp-item__title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.exp-item__text {
  font-size: 0.83rem;
  color: var(--text-2);
  line-height: 1.65;
}

/* --- Research --- */
.research {
  padding: 0 0 160px;
}

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

.paper {
  padding: 32px 40px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid transparent;
  transition: all 300ms var(--ease);
}

.paper:hover {
  border-color: var(--border);
  background: var(--bg-raised);
}

.paper__field {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 8px;
  display: block;
}

.paper__title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.paper__abstract {
  font-size: 0.83rem;
  color: var(--text-2);
  line-height: 1.65;
}

/* --- About --- */
.about {
  padding: 0 0 120px;
}

.about__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}

.about__lead {
  font-size: 1.1rem;
  color: var(--text-2);
  line-height: 1.8;
  margin-top: 16px;
}

.about__stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--border);
}

.stack-row {
  display: flex;
  align-items: baseline;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.stack-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-3);
  min-width: 100px;
  letter-spacing: 0.02em;
}

.stack-value {
  font-size: 0.85rem;
  color: var(--text-2);
}

/* --- Footer --- */
.footer {
  padding: 32px 0;
  border-top: 1px solid var(--border);
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer__name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-3);
}

.footer__link {
  font-size: 0.8rem;
  color: var(--text-3);
  transition: color 150ms;
}

.footer__link:hover { color: var(--text-1); }

/* --- Reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.bento .reveal:nth-child(2) { transition-delay: 100ms; }
.bento .reveal:nth-child(3) { transition-delay: 200ms; }
.pcard-row .reveal:nth-child(2) { transition-delay: 100ms; }
.papers .reveal:nth-child(2) { transition-delay: 80ms; }
.papers .reveal:nth-child(3) { transition-delay: 160ms; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav__links { display: none; }
  .nav__menu { display: flex; }

  .hero {
    min-height: auto;
    padding: 140px 24px 80px;
  }

  .hide-mobile { display: none; }

  .bento {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .bento__main { grid-row: auto; padding: 32px; }
  .bento__side { padding: 28px; }

  .pcard-row { grid-template-columns: 1fr; }
  .pcard--wide { grid-template-columns: 1fr; }
  .pcard__img-side { height: 180px; }

  .exp-items { grid-template-columns: 1fr; gap: 24px; }
  .exp-card { padding: 32px; }

  .about__grid { grid-template-columns: 1fr; gap: 40px; }

  .paper { padding: 24px; }

  .work, .experience, .research, .domains { padding-bottom: 100px; }
}

@media (max-width: 480px) {
  .hero__title { font-size: 2.2rem; }
  .hero__cta { flex-direction: column; }
  .btn { justify-content: center; width: 100%; }
  .exp-card__header { flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
