/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-bg: #fffaf5;
  --color-bg-alt: #fff0e8;
  --color-surface: #ffffff;
  --color-border: #f0d0c0;
  --color-text: #2d1a0e;
  --color-text-muted: #8a6a5a;
  --color-accent: #e60012;
  --color-accent-hover: #ff2030;
  --color-accent-light: #fff0ee;
  --color-tag-bg: #ffe8e5;
  --color-tag-text: #c4000f;
  --color-sub-accent: #1e6fe5;  /* Secondary blue accent */
  --color-highlight: #ffcb05;   /* Yellow highlight */
  --shadow-pop: 4px 4px 0 var(--color-text);
  --shadow-pop-sm: 2px 2px 0 var(--color-text);
  --shadow-pop-hover: 6px 6px 0 var(--color-text);
  --font-sans: 'M PLUS Rounded 1c', 'Zen Maru Gothic', 'Nunito', sans-serif;
  --font-heading: 'Nunito', 'M PLUS Rounded 1c', sans-serif;
  --max-width: 960px;
  --radius: 16px;
}

/* Scroll progress bar */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: var(--scroll, 0%);
  background: linear-gradient(90deg, var(--color-accent), var(--color-highlight));
  z-index: 200;
  transition: width 0.05s linear;
}

/* Decorative dot pattern helper */
.dot-pattern {
  background-image: radial-gradient(circle, var(--color-border) 1.5px, transparent 1.5px);
  background-size: 16px 16px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--color-accent-hover);
}

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

/* ===== Navigation ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 250, 245, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--color-accent);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-logo {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--color-accent);
}

.nav-logo:hover {
  color: var(--color-accent-hover);
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 24px;
}

.nav-links a {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  font-weight: 700;
  transition: color 0.15s;
  position: relative;
  padding: 4px 2px;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-accent);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 3px;
  background: var(--color-accent);
  border-radius: 2px;
}

/* ===== Hiring Banner ===== */
.hiring-banner {
  background: var(--color-accent);
  color: #fff;
  padding: 28px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hiring-banner::before,
.hiring-banner::after {
  content: '';
  position: absolute;
  top: 0;
  height: 100%;
  width: 60px;
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.15),
    rgba(255, 255, 255, 0.15) 10px,
    transparent 10px,
    transparent 20px
  );
}

.hiring-banner::before { left: 0; }
.hiring-banner::after { right: 0; }

.hiring-content h2 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.hiring-content p {
  font-size: 0.95rem;
  line-height: 1.7;
  max-width: 640px;
  margin: 0 auto;
  opacity: 0.95;
}

.hiring-content a {
  color: #fff;
  text-decoration: underline;
  font-weight: 700;
}

.hiring-content a:hover {
  opacity: 0.8;
}

/* ===== Hero ===== */
.hero {
  padding: 160px 0 100px;
  text-align: center;
  background: linear-gradient(180deg, var(--color-accent-light) 0%, var(--color-bg) 100%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(230, 0, 18, 0.12) 2px, transparent 2px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at center, transparent 35%, black 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, transparent 35%, black 80%);
  pointer-events: none;
}

.hero > .container {
  position: relative;
  z-index: 1;
}

@keyframes float-avatar {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.hero-avatar {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 5px solid var(--color-accent);
  margin-bottom: 24px;
  image-rendering: pixelated;
  box-shadow: 0 8px 30px rgba(230, 0, 18, 0.2), var(--shadow-pop);
  animation: float-avatar 4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .hero-avatar { animation: none; }
}

.hero-name {
  font-family: var(--font-heading);
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--color-accent);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.hero-tagline {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--color-text);
  font-weight: 700;
  margin-bottom: 20px;
}

.hero-description {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto 32px;
}

.hero-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  margin-right: 4px;
}

.btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  transition: transform 0.15s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s;
  border: 2px solid var(--color-text);
  box-shadow: var(--shadow-pop-sm);
}

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

.btn-primary:hover {
  background: var(--color-accent-hover);
  color: #fff;
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-pop);
}

.btn-primary:active {
  transform: translate(0, 0);
  box-shadow: 1px 1px 0 var(--color-text);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
}

.btn-secondary:hover {
  color: var(--color-accent);
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-pop);
}

/* ===== Sections ===== */
.section {
  padding: 80px 0;
}

.section-alt {
  background: var(--color-bg-alt);
}

.section-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 40px;
  letter-spacing: -0.01em;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  background: var(--color-accent);
  border-radius: 4px;
  transform: rotate(45deg);
  box-shadow: 2px 2px 0 var(--color-highlight);
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 48px;
  height: 4px;
  background: var(--color-accent);
  border-radius: 2px;
}

/* ===== About ===== */
.about-content p {
  color: var(--color-text-muted);
  font-size: 1.02rem;
  margin-bottom: 24px;
  max-width: 680px;
}

.about-interests {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-block;
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.825rem;
  font-weight: 700;
}

/* ===== Career ===== */
.career-list {
  margin-bottom: 32px;
}

.career-item {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
  align-items: baseline;
}

.career-period {
  font-size: 0.825rem;
  color: var(--color-text-muted);
  font-weight: 700;
  white-space: nowrap;
}

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

.career-org {
  font-size: 0.95rem;
  font-weight: 700;
}

.career-link {
  color: var(--color-accent);
}

.career-link:hover {
  color: var(--color-accent-hover);
}

.career-role {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* ===== Projects ===== */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.project-card {
  display: block;
  background: var(--color-surface);
  border: 2px solid var(--color-text);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform 0.2s cubic-bezier(.34,1.56,.64,1), box-shadow 0.2s;
  color: var(--color-text);
  box-shadow: var(--shadow-pop-sm);
}

.project-card:hover {
  transform: translate(-3px, -3px);
  box-shadow: var(--shadow-pop-hover);
  color: var(--color-text);
}

.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.project-name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--color-accent);
}

.project-stars {
  color: #e6a700;
  font-size: 0.85rem;
  font-weight: 700;
}

.project-desc {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  margin-bottom: 14px;
  line-height: 1.6;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-sm {
  display: inline-block;
  background: var(--color-tag-bg);
  color: var(--color-accent);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ===== Apps ===== */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.app-card {
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--color-surface);
  border: 2px solid var(--color-text);
  border-radius: var(--radius);
  padding: 16px;
  transition: transform 0.2s cubic-bezier(.34,1.56,.64,1), box-shadow 0.2s;
  color: var(--color-text);
  box-shadow: var(--shadow-pop-sm);
}

.app-card:hover {
  transform: translate(-3px, -3px);
  box-shadow: var(--shadow-pop-hover);
  color: var(--color-text);
}

.app-icon {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.app-info {
  min-width: 0;
}

.app-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-accent);
  margin-bottom: 4px;
}

.app-desc {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ===== Talks ===== */
.talk-year {
  border: none;
}

.talk-year summary {
  cursor: pointer;
  list-style: none;
}

.talk-year summary::-webkit-details-marker {
  display: none;
}

.talk-year summary h3 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 20px;
  padding: 8px 16px;
  border: 2px solid var(--color-text);
  border-radius: 999px;
  background: var(--color-surface);
  box-shadow: var(--shadow-pop-sm);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.talk-year summary:hover h3 {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-pop);
}

.talk-year summary h3::after {
  content: '+';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 1rem;
  color: #fff;
  background: var(--color-accent);
  border-radius: 50%;
  transition: transform 0.3s;
}

.talk-year[open] summary h3::after {
  content: '\2212';
  transform: rotate(180deg);
}

.talk-year + .talk-year {
  margin-top: 40px;
}

.talk-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.talk-item {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0 16px;
  align-items: baseline;
}

.talk-event {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 700;
}

.talk-title {
  font-size: 0.95rem;
  font-weight: 600;
}

a.talk-title {
  color: var(--color-text);
  transition: color 0.15s;
}

a.talk-title:hover {
  color: var(--color-accent);
}

.talk-item a.talk-title ~ a {
  grid-column: 2;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-accent);
}

/* ===== Writing ===== */
.subsection-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--color-text-muted);
}

.subsubsection-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 12px;
  padding-left: 4px;
}

.posts-list + h4.subsubsection-title {
  margin-top: 28px;
}

.posts-list + h3.subsection-title {
  margin-top: 48px;
}

.books {
  margin-bottom: 48px;
}

.book-item {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.book-year {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 700;
  min-width: 60px;
}

.book-title {
  font-size: 0.95rem;
}

.book-link {
  color: var(--color-text);
  transition: color 0.15s;
}

.book-link:hover {
  color: var(--color-accent);
}

.posts-list {
  display: flex;
  flex-direction: column;
}

.post-item {
  display: flex;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  transition: color 0.15s;
}

.post-item:hover {
  color: var(--color-accent);
}

.post-date {
  font-size: 0.825rem;
  color: var(--color-text-muted);
  font-weight: 700;
  min-width: 72px;
  flex-shrink: 0;
}

.post-title {
  font-size: 0.92rem;
}

.media-item.post-item {
  display: grid !important;
  grid-template-columns: 72px 1fr;
  grid-template-rows: auto auto;
  gap: 0 16px;
}

.media-item .post-date {
  grid-column: 1;
  grid-row: 1 / 3;
  align-self: start;
  padding-top: 2px;
}

.media-item .post-title {
  grid-column: 2;
  grid-row: 1;
}

.media-source {
  grid-column: 2;
  grid-row: 2;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-top: 2px;
}

.post-item.media-item:has(+ .media-video) {
  border-bottom: none;
  padding-bottom: 4px;
}

.media-video {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-accent);
  padding: 0 0 14px 88px;
  border-bottom: 1px solid var(--color-border);
}

.read-more {
  margin-top: 20px;
  text-align: center;
}

.posts-loading {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  padding: 16px 0;
}

/* ===== Footer ===== */
.footer {
  padding: 48px 0;
  text-align: center;
  border-top: 2px solid var(--color-accent);
  background: var(--color-bg-alt);
}

.footer-icon {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  margin-bottom: 16px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.footer-icon:hover {
  opacity: 1;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  font-weight: 700;
}

.footer-links a:hover {
  color: var(--color-accent);
}

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

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .hero-name {
    font-size: 2.4rem;
  }

  .hero {
    padding: 120px 0 60px;
  }

  .section {
    padding: 56px 0;
  }

  .talk-item,
  .career-item {
    grid-template-columns: 1fr;
  }

  .talk-item a.talk-title ~ a {
    grid-column: 1;
  }

  .talk-event {
    margin-bottom: 2px;
  }

  .nav-links {
    gap: 16px;
  }

  .nav-links a {
    font-size: 0.8rem;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }
}
