@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Newsreader:opsz,wght@6..72,400;6..72,600&display=swap");

:root {
  --ui-scale: 1.3;
  --cp-alpha: #e1dbd1;
  --cp-legend: #eaecf0;
  --cp-ink: #712f3e;
  --cp-accent: #88d4cc;
  --shadow-soft: rgba(113, 47, 62, 0.12);
  --shadow-strong: rgba(113, 47, 62, 0.22);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --header-height: 112px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  font-size: calc(16px * var(--ui-scale));
  scrollbar-gutter: stable;
}

body {
  font-family: "Manrope", sans-serif;
  color: var(--cp-ink);
  min-height: 100vh;
}

body.maintenance-mode {
  display: grid;
  place-items: center;
}

.page-shell {
  max-width: calc(1040px * var(--ui-scale));
  margin: 0 auto;
  padding: calc(var(--header-height) + 0.5rem) 1.25rem 2rem;
}

.site-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(1040px * var(--ui-scale)), 100vw);
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #ffffff98;
  border-bottom: 1px solid rgba(113, 47, 62, 0.16);
  backdrop-filter: blur(6px);
}

#site-name {
  margin: 0;
  font-family: "Newsreader", serif;
  font-size: clamp(1.55rem, 1.9vw, 2rem);
  line-height: 1.1;
}

#site-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  opacity: 0.8;
}

.tab-nav {
  display: flex;
  gap: 0.95rem;
  align-items: center;
  flex-wrap: wrap;
  padding-bottom: 0.2rem;
}

.tab-button {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--cp-ink);
  padding: 0.36rem 0.1rem 0.45rem;
  font: inherit;
  font-size: 0.93rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  position: relative;
  transition:
    transform 0.2s ease,
    color 0.2s ease,
    background-color 0.2s ease;
}

.tab-button::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--cp-accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.2s ease;
}

.tab-button:hover {
  transform: translateY(-1px);
  color: var(--cp-ink);
  background: rgba(136, 212, 204, 0.24);
  background: color-mix(in srgb, var(--cp-accent) 24%, transparent);
}

.tab-button:hover::after {
  transform: scaleX(1);
}

.tab-button.active {
  background: rgba(136, 212, 204, 0.36);
  background: color-mix(in srgb, var(--cp-accent) 36%, transparent);
  color: var(--cp-ink);
  font-weight: 800;
}

.tab-button.active::after {
  transform: scaleX(1);
}

.tab-content {
  margin-top: 1rem;
}

.tab-panel {
  display: none;
  animation: panelFade 0.35s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes panelFade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.about-grid {
  display: grid;
  grid-template-columns: calc(300px * var(--ui-scale)) minmax(0, 1fr);
  gap: 1.9rem;
  align-items: start;
}

.profile-card {
  width: calc(300px * var(--ui-scale));
  position: fixed;
}

.profile-photo {
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: cover;
  object-position: center;
  border-radius: 14px;
  border: 2px solid rgba(113, 47, 62, 0.2);
}

.profile-photo-game {
  width: 100%;
  margin: 0 auto 0.65rem;
}

.profile-photo-hitbox {
  width: 100%;
  border: 0;
  margin: 0;
  padding: 0;
  border-radius: 14px;
  background: transparent;
  cursor: crosshair;
}

.profile-photo-hitbox:active .profile-photo {
  transform: scale(0.99);
}

.profile-hud {
  margin-top: 0.45rem;
}

.profile-hp-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(113, 47, 62, 0.18);
}

.profile-hp-fill {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #88d4cc 0%, #59cbbf 100%);
  transition: width 0.18s ease;
}

.profile-hp-text {
  margin: 0.28rem 0 0;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-align: center;
}

.profile-photo-game.pre-combat .profile-hp-track,
.profile-photo-game.pre-combat .profile-hp-text {
  display: none;
}

.profile-photo-game.is-hit .profile-photo {
  animation: profileHitFlash 0.22s ease;
}

.profile-photo-game.is-rage .profile-hp-fill {
  background: linear-gradient(90deg, #ff9b7e 0%, #ff5c5c 100%);
}

.profile-photo-game.is-low-hp .profile-hp-fill {
  background: linear-gradient(90deg, #ffd07a 0%, #ff8a65 100%);
}

.profile-photo-game.is-defeated .profile-photo-hitbox {
  cursor: not-allowed;
}

.profile-photo-game.is-defeated .profile-photo {
  filter: contrast(1.05) saturate(0.86);
}

.profile-photo-game.is-defeated .profile-hp-fill {
  width: 0 !important;
}

.profile-photo-game.is-defeated .profile-hp-text {
  color: #b43636;
}

@keyframes profileHitFlash {
  0% {
    transform: translateX(0) scale(1);
    filter: brightness(1);
  }
  20% {
    transform: translateX(-2px) scale(0.995);
    filter: brightness(1.08);
  }
  50% {
    transform: translateX(3px) scale(1.005);
    filter: brightness(0.96);
  }
  100% {
    transform: translateX(0) scale(1);
    filter: brightness(1);
  }
}

.profile-name {
  margin: 0.9rem 0 0.2rem;
  font-family: "Newsreader", serif;
  font-size: 1.8rem;
  text-align: center;
}

.profile-role {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}

.profile-school {
  margin: 0.3rem 0 1rem;
  text-align: center;
  opacity: 0.85;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.profile-links a {
  text-decoration: none;
  border: 1px solid rgba(113, 47, 62, 0.25);
  color: var(--cp-ink);
  padding: 0.34rem 0.58rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.84rem;
  transition: background 0.2s ease;
}

.profile-links a:hover {
  background: rgba(136, 212, 204, 0.38);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.36rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 254, 254, 0.95);
  border: 1px solid rgba(113, 47, 62, 0.18);
}

.about-main {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  grid-column: 2;
}

.section-card {
  padding: 0 0 1.1rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid rgba(113, 47, 62, 0.14);
}

.section-title {
  margin: 0 0 0.9rem;
  font-family: "Newsreader", serif;
  font-size: clamp(1.35rem, 1.8vw, 1.7rem);
}

.section-card p {
  margin: 0 0 0.78rem;
  line-height: 1.72;
}

.section-card p:last-child {
  margin-bottom: 0;
}

.section-card a {
  color: var(--cp-ink);
  font-weight: 700;
}

.experience-list,
.education-list {
  display: grid;
  gap: 0.75rem;
}

.education-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  padding: 0.8rem 0;
  border-bottom: 1px solid rgba(113, 47, 62, 0.12);
}

.education-logo-wrap {
  width: 96px;
  height: 56px;
  display: grid;
  place-items: center;
}

.education-logo {
  width: 80%;
  object-fit: contain;
  object-position: center;
}

.education-content {
  min-width: 0;
}

.timeline-item {
  padding: 0.8rem 0 0.8rem 0.8rem;
  border-left: 2px solid rgba(113, 47, 62, 0.22);
  border-radius: 0;
  background: transparent;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: baseline;
  flex-wrap: wrap;
}

.timeline-role {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
}

.timeline-date {
  font-size: 0.86rem;
  font-weight: 700;
  opacity: 0.72;
}

.timeline-org {
  margin: 0.2rem 0;
  font-size: 0.92rem;
  font-weight: 700;
  opacity: 0.88;
}

.timeline-meta {
  margin: 0.2rem 0 0.5rem;
  font-size: 0.84rem;
  opacity: 0.78;
}

.timeline-desc {
  margin: 0;
  font-size: 0.93rem;
  line-height: 1.58;
}

.publication-list {
  margin-top: 1rem;
  display: grid;
  gap: 0;
}

.publication-row {
  display: grid;
  grid-template-columns: calc(240px * var(--ui-scale)) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(113, 47, 62, 0.14);
}

.publication-teaser-wrap {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(113, 47, 62, 0.16);
  background: #ffffff;
}

.publication-teaser {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  object-position: center;
  display: block;
}

.publication-content {
  min-width: 0;
}

.publication-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.4;
}

.publication-authors,
.publication-conf {
  margin: 0.28rem 0 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

.link-row {
  margin-top: 0.85rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.cta-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border-radius: 10px;
  border: 1px solid rgba(113, 47, 62, 0.16);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.44rem 0.72rem;
  transition: transform 0.2s ease;
}

.cta-button.primary {
  background: #ffffff;
  color: var(--cp-ink);
}

.cta-button.secondary {
  background: #ffffff;
  color: var(--cp-ink);
}

.cta-button:hover {
  transform: translateY(-1px);
  border-color: var(--cp-ink);
}

.cta-button.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.project-list {
  display: grid;
  gap: 0;
  margin-top: 1rem;
}

.blog-list {
  margin-top: 1rem;
  display: grid;
  gap: 0;
}

.blog-list-item {
  display: grid;
  grid-template-columns: calc(240px * var(--ui-scale)) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(113, 47, 62, 0.14);
}

.blog-cover-link {
  display: block;
  border: 1px solid rgba(113, 47, 62, 0.16);
  border-radius: 10px;
  overflow: hidden;
}

.blog-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
  display: block;
}

.blog-item-content {
  min-width: 0;
}

.blog-item-title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.35;
}

.blog-item-intro {
  margin: 0.5rem 0 0;
  line-height: 1.6;
}

.blog-open-button {
  margin-top: 0.8rem;
}

.blog-article-shell .blog-back-button {
  margin-bottom: 0.9rem;
}

.blog-article {
  margin-top: 0.9rem;
}

.blog-article-cover-wrap {
  margin: 0 0 1rem;
}

.blog-article-cover-link {
  display: block;
  margin: 0 auto;
  border: 1px solid rgba(113, 47, 62, 0.16);
  border-radius: 10px;
  overflow: hidden;
  max-width: calc(680px * var(--ui-scale));
}

.blog-article-cover {
  width: 100%;
  display: block;
  object-fit: cover;
}

.blog-article-loading {
  opacity: 0.8;
  margin-top: 0.7rem;
}

.blog-scroll-top {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 20;
  border: 1px solid rgba(113, 47, 62, 0.2);
  border-radius: 999px;
  background: #fff;
  color: var(--cp-ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.45rem 0.78rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.blog-scroll-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.markdown-body {
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 1.3rem 0 0.7rem;
  line-height: 1.35;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body pre,
.markdown-body blockquote {
  margin: 0.75rem 0;
}

.markdown-body code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85em;
}

.markdown-body pre {
  overflow-x: auto;
  padding: 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(113, 47, 62, 0.16);
  background: rgba(255, 255, 255, 0.7);
}

.markdown-body pre code {
  font-size: 0.9rem;
}

.markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(113, 47, 62, 0.16);
}

.project-item {
  padding: 1rem 0;
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: flex-start;
  border-bottom: 1px solid rgba(113, 47, 62, 0.14);
}

.project-main {
  min-width: 0;
  flex: 1;
}

.project-actions {
  min-width: calc(220px * var(--ui-scale));
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: center;
  justify-content: center;
  align-self: center;
}

.project-title {
  margin: 0;
  font-size: 1.25rem;
  font-family: "Newsreader", serif;
}

.project-time {
  margin: 0.2rem 0 0.45rem;
  font-size: 0.9rem;
  font-weight: 700;
  opacity: 0.76;
}

.project-desc {
  margin: 0;
  line-height: 1.62;
}

.project-tags {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.run-button {
  display: inline-grid;
  place-items: center;
  width: min(100%, 230px);
  min-height: 60px;
  margin-inline: auto;
  padding: 0.45rem 1rem;
  border-radius: 14px;
  border: 1px solid #b9d8d5;
  background: #ffffff;
  color: var(--cp-ink);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 22px #e7f7f5;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}

.run-button::before {
  content: "";
  position: absolute;
  top: -140%;
  left: -35%;
  width: 28%;
  height: 380%;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(255, 255, 255, 0.68) 45%,
    transparent 100%
  );
  transform: rotate(18deg) translateX(-260%);
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  z-index: 0;
}

.run-button:hover {
  transform: translateY(-2px);
  border: 1px solid #88D4CC;
  background: rgba(136, 212, 204, 0.2);
  box-shadow: 0 12px 30px #88D4CC;
}

.run-button:hover::before {
  transform: rotate(18deg) translateX(420%);
}

.misc-summary {
  padding: 0 0 1rem;
  margin-bottom: 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(113, 47, 62, 0.14);
}

.misc-block {
  margin-top: 2rem;
  padding: 0 0 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(113, 47, 62, 0.14);
}

.misc-block h2 {
  margin: 0;
  font-family: "Newsreader", serif;
  font-size: 1.5rem;
}

.misc-caption {
  margin: 0.35rem 0 0.8rem;
  font-size: 0.94rem;
  opacity: 0.88;
}

.bird-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem;
}

.bird-shot {
  display: block;
  border: 0;
  margin: 0;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  cursor: zoom-in;
  background: transparent;
  border: 1px solid rgba(113, 47, 62, 0.18);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.bird-shot:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px var(--shadow-soft);
}

.bird-shot img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.travel-map {
  width: 100%;
  height: 430px;
  border-radius: 10px;
  border: 1px solid rgba(113, 47, 62, 0.18);
  background: #ffffff;
  overflow: hidden;
}

.map-status {
  margin: 0;
  padding: 1rem;
  font-size: 0.92rem;
  opacity: 0.8;
}

.travel-chip-list {
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.embed-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  border-radius: 12px;
  overflow: hidden;
}

.embed-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.cv-embed-wrap {
  width: 100%;
  border: 1px solid rgba(113, 47, 62, 0.18);
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}

.cv-embed-frame {
  width: 100%;
  height: min(78vh, 980px);
  border: 0;
  display: block;
}

.site-footer {
  margin-top: 1rem;
  text-align: center;
  opacity: 0.74;
  font-size: 0.83rem;
}

.maintenance-shell {
  min-height: 72vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
}

.maintenance-gif {
  width: 110px;
  height: 110px;
  object-fit: contain;
}

.maintenance-title {
  margin: 0.1rem 0 0;
  font-family: "Newsreader", serif;
  font-size: 2rem;
}

.maintenance-text {
  margin: 0.2rem 0 0;
  font-size: 1rem;
  opacity: 0.9;
}

@media (max-width: 980px) {
  .about-grid {
    grid-template-columns: 1fr;
  }

  .profile-card {
    width: 100%;
    max-width: calc(320px * var(--ui-scale));
    margin: 0 auto 0.9rem;
    position: static;
    left: auto;
  }

  .profile-photo {
    max-width: 100%;
  }

  .about-main {
    grid-column: auto;
  }

  .project-item {
    flex-direction: column;
    gap: 0.9rem;
  }

  .project-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    min-width: 0;
    align-self: stretch;
  }

  .run-button {
    width: 100%;
    min-height: 52px;
    max-width: 100%;
  }

  .publication-row {
    grid-template-columns: calc(200px * var(--ui-scale)) minmax(0, 1fr);
  }

  .blog-list-item {
    grid-template-columns: calc(200px * var(--ui-scale)) minmax(0, 1fr);
  }
}

@media (max-width: 864px) {
  :root {
    --header-height: 148px;
  }

  .page-shell {
    padding: calc(var(--header-height) + 0.5rem) 0.5rem 1.4rem;
  }

  .site-header {
    left: 0;
    transform: none;
    width: 100vw;
    padding: 0.65rem 0.5rem;
  }

  .tab-nav {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.15rem;
    scrollbar-width: thin;
  }

  .tab-button {
    white-space: nowrap;
  }

  .section-card {
    padding: 0.7rem;
  }

  .bird-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .travel-map {
    height: 340px;
  }

  .timeline-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-card {
    max-width: calc(250px * var(--ui-scale));
    margin: 0 auto 0.8rem;
    display: block;
  }

  .profile-photo {
    margin-bottom: 0.55rem;
  }

  .profile-name {
    margin-top: 0;
    text-align: center;
    font-size: 1.35rem;
  }

  .profile-role,
  .profile-school {
    text-align: center;
  }

  .profile-links {
    justify-content: center;
  }

  .publication-row {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  .blog-list-item {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  .publication-teaser-wrap {
    max-width: calc(420px * var(--ui-scale));
  }

  .blog-cover-link {
    max-width: calc(420px * var(--ui-scale));
    margin: 0 auto;
  }

  .education-item {
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 0.65rem;
  }

  .education-logo-wrap {
    width: 80px;
    height: 46px;
  }
}
