/* ─── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --black:       #0f0f0f;
  --ink:         #1a1a1a;
  --muted:       #5a5a5a;
  --faint:       #888;
  --surface:     #d6d9de;      /* gray-blue block bg */
  --surface-dim: #c8ccd2;
  --border:      #b8bcc4;
  --bg:          #e8e6e1;      /* warm off-white base */
  --accent:      #c0392b;      /* tiny red dot accent */
  --font-display: 'Caveat', cursive;
  --font-ui:      'DM Sans', sans-serif;
  --radius:       4px;
  --gap:          24px;
}

html { scroll-behavior: smooth; height: 100%; }

body {
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

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

/* ─── LAYOUT ────────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* ─── HEADER ────────────────────────────────────────────────── */
.site-header {
  background: #8fa3b3;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid #7d92a2;
  overflow: hidden;
}

.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  opacity: 0.12;
  mix-blend-mode: multiply;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 56px;
}

@keyframes glitch-main {
  0%, 90%, 100%         { transform: translate(0); }
  91%                   { transform: translate(-2px, 1px); }
  93%                   { transform: translate(2px, -1px); }
  95%                   { transform: translate(-1px, 0px); }
  97%                   { transform: translate(1px, 1px); }
}

@keyframes glitch-before {
  0%, 88%, 100%         { clip-path: inset(100% 0 0 0); transform: translate(0); opacity: 0; }
  89%                   { clip-path: inset(20% 0 50% 0); transform: translate(-3px, 0); opacity: 0.8; color: #5ecfcf; }
  91%                   { clip-path: inset(60% 0 10% 0); transform: translate(3px, 0);  opacity: 0.8; color: #5ecfcf; }
  93%                   { clip-path: inset(35% 0 40% 0); transform: translate(-2px, 0); opacity: 0.6; color: #5ecfcf; }
  95%                   { clip-path: inset(100% 0 0 0);  opacity: 0; }
}

@keyframes glitch-after {
  0%, 91%, 100%         { clip-path: inset(100% 0 0 0); transform: translate(0); opacity: 0; }
  92%                   { clip-path: inset(40% 0 30% 0); transform: translate(3px, 0);  opacity: 0.7; color: #c0392b; }
  94%                   { clip-path: inset(10% 0 70% 0); transform: translate(-3px, 0); opacity: 0.7; color: #c0392b; }
  96%                   { clip-path: inset(65% 0 15% 0); transform: translate(2px, 0);  opacity: 0.5; color: #c0392b; }
  98%                   { clip-path: inset(100% 0 0 0);  opacity: 0; }
}

.logo {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f1c24;
  text-decoration: none;
  letter-spacing: 0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
}

.logo::before,
.logo::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  opacity: 0;
}

.logo:hover { animation: glitch-main 0.6s steps(1) infinite; }
.logo:hover::before { animation: glitch-before 0.6s steps(1) infinite; }
.logo:hover::after  { animation: glitch-after  0.6s steps(1) infinite 0.08s; }
.logo.small { font-size: 1.2rem; color: #666; }

.logo-jelly {
  width: 22px;
  height: auto;
  flex-shrink: 0;
  transform: rotate(28deg);
  transform-origin: center 40%;
  opacity: 0.9;
  margin-right: 16px;
}

.nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

/* ── LANG SWITCHER ── */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.lang-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 8px 10px;
  opacity: 0.45;
  transition: opacity 0.2s;
}
.lang-btn.active  { opacity: 1; color: var(--ink); }
.lang-btn:hover   { opacity: 0.75; }
.lang-sep         { font-size: 0.65rem; color: var(--muted); opacity: 0.35; }

/* light variant for dark-bg pages */
.lang-switch--light .lang-btn { color: rgba(255,255,255,0.5); }
.lang-switch--light .lang-btn.active { color: #fff; opacity: 1; }
.lang-switch--light .lang-sep { color: rgba(255,255,255,0.25); }

/* fixed slot for chapter pages */
#lang-switch-slot.fixed-slot {
  position: fixed;
  top: 18px;
  right: 22px;
  z-index: 100;
}

#lang-switch-slot.fixed-slot .lang-switch,
[data-light] .lang-switch {
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 20px;
  padding: 5px 14px;
  gap: 2px;
}

.nav a {
  color: #1e3040;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: color 0.18s, background 0.18s;
}
.nav a:hover { color: #0f1c24; background: rgba(0,0,0,0.1); }

.header-actions { margin-left: auto; }

.btn-ghost {
  background: transparent;
  border: 1px solid #333;
  color: #aaa;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s;
}
.btn-ghost:hover { border-color: #666; color: #f0ede8; }

/* ─── PLACEHOLDERS ──────────────────────────────────────────── */
.placeholder {
  background: var(--surface);
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--faint);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.5;
  border-radius: var(--radius);
}

.banner-placeholder {
  width: 100%;
  height: 280px;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}

.banner-custom {
  width: 100%;
  height: 260px;
  background-color: #8fa3b3;
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  padding-top: 32px;
  overflow: hidden;
  border-radius: 0 0 50% 50% / 0 0 70px 70px;
}

/* grain via SVG filter */
.banner-custom::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px 180px;
  opacity: 0.18;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.banner-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 48px;
  flex: 1;
}

.banner-socials {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 48px 0 0;
  margin-left: auto;
  align-self: center;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  opacity: 0.7;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.social-link:hover {
  opacity: 1;
  transform: translateY(-2px);
}

.social-link img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.banner-heading {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 500;
  color: #1a1a1a;
  line-height: 1;
  letter-spacing: 0.01em;
}

.banner-item {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.banner-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid #1a1a1a;
  border-radius: 3px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.banner-checkbox::after {
  content: '';
  display: block;
  width: 10px;
  height: 6px;
  border-left: 2px solid #1a1a1a;
  border-bottom: 2px solid #1a1a1a;
  transform: rotate(-45deg) translateY(-1px);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.banner-item.checked .banner-checkbox::after {
  opacity: 1;
}

.banner-item.checked .banner-item-text {
  text-decoration: line-through;
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

.banner-item-text {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
  color: #1a1a1a;
  line-height: 1;
}

.avatar-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0.6rem;
}

.avatar-img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.cover-placeholder {
  width: 100%;
  aspect-ratio: 5/7;
}

.update-thumb {
  width: 60px;
  min-width: 60px;
  height: 86px;
  font-size: 0.55rem;
}

/* ─── PROFILE HERO ──────────────────────────────────────────── */
.profile-hero { margin-bottom: 48px; }

.banner-wrap {
  position: relative;
  overflow: visible;
}


.profile-meta {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 8px;
  margin-top: -50px;
  padding-bottom: 16px;
  position: relative;
  z-index: 3;
  text-align: center;
}

.avatar-wrap {
  position: relative;
  z-index: 2;
  background: var(--bg);
  border-radius: 50%;
  padding: 3px;
  flex-shrink: 0;
}

.profile-info {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.profile-name {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255,255,255,0.15);
}

.profile-bio {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 4px;
  margin-bottom: 12px;
}

.profile-stats {
  display: flex;
  gap: 28px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.stat-num {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1;
}

.stat-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--faint);
}

/* ─── CONTENT ───────────────────────────────────────────────── */
.content-area {
  display: flex;
  flex-direction: column;
  gap: 48px;
  padding-bottom: 80px;
}

.section-title {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ─── COVER LAYERS & ANIMATIONS ────────────────────────────── */
@keyframes float-back {
  0%, 100% { transform: translateY(0px) translateX(0px); }
  40%       { transform: translateY(-8px) translateX(2px); }
  70%       { transform: translateY(-5px) translateX(-2px); }
}

@keyframes float-front {
  0%, 100% { transform: translateY(0px) translateX(0px); }
  35%       { transform: translateY(3px) translateX(-1px); }
  65%       { transform: translateY(2px) translateX(1px); }
}

@keyframes light-rays {
  0%   { opacity: 0.2;  transform: translateX(0px)   scaleX(1)    skewX(0deg); }
  20%  { opacity: 0.85; transform: translateX(6px)   scaleX(1.02) skewX(1deg); }
  45%  { opacity: 0.4;  transform: translateX(-4px)  scaleX(0.99) skewX(-0.8deg); }
  65%  { opacity: 1;    transform: translateX(8px)   scaleX(1.03) skewX(1.2deg); }
  85%  { opacity: 0.35; transform: translateX(-6px)  scaleX(1)    skewX(-0.5deg); }
  100% { opacity: 0.2;  transform: translateX(0px)   scaleX(1)    skewX(0deg); }
}

.project-cover {
  position: relative;
  width: 480px;
  min-width: 480px;
  aspect-ratio: 3/4;
  flex-shrink: 0;
  border-radius: var(--radius);
  overflow: hidden;
  outline: 6px solid #fff;
  outline-offset: 0px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.15);
  display: block;
  cursor: pointer;
}

.project-cover:hover .layer-titlehover { opacity: 1; }

.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.layer-cover      { z-index: 1; }
.layer-titlehover { z-index: 7; opacity: 0; transition: opacity 0.5s ease; }
.layer-jelly-back { z-index: 2; animation: float-back  6s ease-in-out infinite; }
.layer-hero       { z-index: 3; filter: contrast(1.18) brightness(0.96); }
.layer-hero-grain { z-index: 4; mix-blend-mode: overlay; opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 160px 160px; }
.layer-jelly-front{ z-index: 5; animation: float-front 4.5s ease-in-out infinite 0.8s; top: 30px; left: 20px; width: 100%; height: 100%; }
.layer-light      { z-index: 6; mix-blend-mode: soft-light; animation: light-rays 6s ease-in-out infinite; }

/* ─── CURRENT PROJECT ───────────────────────────────────────── */
.project-wrap {
  display: flex;
  gap: 56px;
  align-items: center;
}


.project-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 8px;
}

.project-title {
  font-family: 'Cinzel', serif;
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: 0.03em;
}

.project-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 420px;
}

.btn-read {
  display: inline-block;
  align-self: flex-start;
  margin-top: 8px;
  padding: 10px 36px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1a3040;
  text-decoration: none;
  background: rgba(143, 163, 179, 0.25);
  border: 1px solid rgba(143, 163, 179, 0.6);
  border-radius: 2px;
  backdrop-filter: blur(6px);
  position: relative;
  overflow: hidden;
  transition: background 0.25s, border-color 0.25s, color 0.25s;
}

.btn-read::after {
  content: '';
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255,255,255,0.45) 50%,
    transparent 100%
  );
  transform: skewX(-20deg);
  transition: none;
  pointer-events: none;
}

.btn-read:hover {
  background: rgba(143, 163, 179, 0.45);
  border-color: rgba(143, 163, 179, 0.9);
  color: #0f1c24;
}

.btn-read:hover::after {
  left: 130%;
  transition: left 0.5s ease;
}

.card-tag {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--faint);
  background: var(--surface);
  padding: 2px 7px;
  border-radius: 2px;
  align-self: flex-start;
}

/* ─── FOOTER ────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--black);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.footer-copy {
  font-size: 0.72rem;
  color: #444;
  letter-spacing: 0.04em;
}

/* ─── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 960px) {
  .project-wrap {
    flex-direction: column;
    gap: 28px;
    align-items: flex-start;
  }

  .project-cover {
    width: 100%;
    min-width: unset;
    max-width: 480px;
  }
}

@media (max-width: 680px) {
  .nav { display: none; }

  .banner-placeholder { height: 160px; }

  .banner-custom {
    height: 180px;
    padding-top: 22px;
  }

  .banner-content {
    padding: 0 20px;
  }

  .banner-heading     { font-size: 1.5rem; }
  .banner-item-text   { font-size: 1.2rem; }

  .header-inner { gap: 12px; }

  .logo { font-size: 1.35rem; }

  .profile-meta { margin-top: -28px; }

  .avatar-img,
  .avatar-placeholder { width: 72px; height: 72px; }

  .project-cover {
    width: 100%;
    min-width: unset;
    max-width: 100%;
  }

  .project-title { font-size: 1.8rem; }

  .project-desc { max-width: 100%; }

  .footer-inner { flex-direction: column; gap: 4px; height: auto; padding: 16px 0; }
}

@media (max-width: 400px) {
  .logo     { font-size: 1.1rem; }
  .logo-jelly { display: none; }
  .banner-custom { height: 150px; }
  .project-title { font-size: 1.5rem; }
  .btn-read { padding: 8px 24px; font-size: 1rem; }
}

