/* =====================================================================
   btm Original Theme — Light Liuli Bento Grid  v4.0
   Pixel-perfect match to HOME-Design.png / PINNED-and-POSTS-Design.png
   ===================================================================== */

/* ---------- Design Tokens ---------- */
:root {
  --bg-page:        #F5F5F7;
  --bg-card:        #FFFFFF;
  --bg-emoji:       #D9ECFF;
  --bg-teleport:    #FFF0F5;
  --bg-colormode:   #E8F5E9;

  --text-primary:   #1D1D1F;
  --text-secondary: #6E6E73;
  --text-tertiary:  #A1A1A6;
  --text-inverse:   #FFFFFF;

  --accent-blue:    #0071E3;
  --accent-pink:    #FF2D55;

  --nav-bg:         rgba(255, 255, 255, 0.45);
  --nav-border:     rgba(255, 255, 255, 0.50);
  --nav-shadow:     0 2px 12px rgba(0, 0, 0, 0.06);

  --radius-card:    28px;
  --radius-pill:    9999px;

  --ease-bouncy:    cubic-bezier(0.16, 1, 0.3, 1);
  --dur:            0.35s;

  --max-width:      1100px;
  --gutter:         16px;
  --border-subtle:  rgba(0,0,0,0.05);
  --hover-bg:       rgba(0,0,0,0.04);
}

/* ---------- Dark Mode ---------- */
[data-theme="dark"] {
  --bg-page:        #1C1C1E;
  --bg-card:        #2C2C2E;
  --bg-emoji:       #1A3A5C;
  --bg-teleport:    #3A1A2E;
  --bg-colormode:   #1A3326;

  --text-primary:   #F5F5F7;
  --text-secondary: #A1A1A6;
  --text-tertiary:  #6E6E73;
  --text-inverse:   #1D1D1F;

  --accent-blue:    #0A84FF;
  --accent-pink:    #FF375F;

  --nav-bg:         rgba(44, 44, 46, 0.45);
  --nav-border:     rgba(255, 255, 255, 0.12);
  --nav-shadow:     0 2px 12px rgba(0, 0, 0, 0.3);

  --border-subtle:  rgba(255,255,255,0.08);
  --hover-bg:       rgba(255,255,255,0.06);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Helvetica Neue", "Inter", "Segoe UI", system-ui, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }

.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  line-height: 1;
  user-select: none;
}
.fab { line-height: 1; }

/* =====================================================================
   Navigation — Avatar outside left, capsule panel
   Matches HOME-Design.png exactly
   ===================================================================== */
.nav-zone {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 48px);
  max-width: 680px;
}

.nav-avatar { flex-shrink: 0; }

.nav-avatar img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid var(--bg-card);
  box-shadow: none;
  transition: transform var(--dur) var(--ease-bouncy);
}
.nav-avatar img:hover { transform: scale(1.08); }

.nav { flex: 1; }

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px 8px 18px;
  background: var(--nav-bg);
  backdrop-filter: saturate(120%) blur(10px);
  -webkit-backdrop-filter: saturate(120%) blur(10px);
  border: 1px solid var(--nav-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--nav-shadow);
}

.nav__brand {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 0;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  transition: all var(--dur) var(--ease-bouncy);
  letter-spacing: 0.02em;
}

.nav__link:hover { background: var(--hover-bg); color: var(--text-primary); }

.nav__link.is-active {
  background: rgba(29, 29, 31, 0.09);
  color: var(--text-primary);
  font-weight: 600;
}

/* =====================================================================
   Page Container
   ===================================================================== */
.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 90px var(--gutter) 64px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

/* =====================================================================
   Bento Grid — 4-column × 3-row
   Four square cards (Emoji/Music/Teleport/Tags) forced to 1:1 via aspect-ratio
   Row heights auto-driven by the square cards' aspect-ratio

     ┌───────────────────┬─────────┬─────────┐
     │   Profile (2col)  │ Emoji   │  Music  │   Row 1 (height = 1 col width)
     │                   │ (1:1)   │ (1:1)   │
     ├───────────────────┼─────────┴─────────┤
     │  Latest Post      │   Pinned          │   Row 2 (auto height)
     │  (2col, wide)     │   (2col × 2row)   │
     ├──────────┬────────┤                   │
     │Teleport  │ Tags   │                   │   Row 3 (height = 1 col width)
     │ (1:1)    │ (1:1)  │                   │
     └──────────┴────────┴───────────────────┘
   ===================================================================== */
.bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: auto auto auto;
  gap: var(--gutter);
  margin-bottom: 0;
}

/* ---- Base card ---- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-card);
  box-shadow: none;
  padding: 24px;
  overflow: hidden;
  transition: transform var(--dur) var(--ease-bouncy),
              box-shadow var(--dur) var(--ease-bouncy);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: none;
}

/* ---- Grid placement — 4×3, square cards forced to 1:1 ---- */
.card--profile  { grid-column: 1 / 3; grid-row: 1; }
.card--emoji    { grid-column: 3 / 4; grid-row: 1; aspect-ratio: 1; }
.card--music    { grid-column: 4 / 5; grid-row: 1; aspect-ratio: 1; }
.card--latest   { grid-column: 1 / 3; grid-row: 2; }
.card--pinned   { grid-column: 3 / 5; grid-row: 2 / 4; }
.card--teleport-stack {
  grid-column: 1 / 2; grid-row: 3; aspect-ratio: 1;
  display: flex; flex-direction: column; gap: var(--gutter);
}
.card--tags     { grid-column: 2 / 3; grid-row: 3; aspect-ratio: 1; }

/* =====================================================================
   Profile Card — 2col × 1row
   Layout: avatar+name top-aligned | flexible space | links bottom-aligned
   ===================================================================== */
.profile {
  align-items: flex-start;
  justify-content: space-between;
  text-align: left;
}

.profile__top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 4px;
}

.profile__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid var(--border-subtle);
}

.profile__name-block { display: flex; flex-direction: column; gap: 3px; padding-top: 2px; }

.profile__name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.profile__subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.3;
}

.profile__links {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  margin-bottom: 4px;
}

.profile__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--dur) var(--ease-bouncy);
}
.profile__link:hover { background: var(--hover-bg); transform: translateX(3px); }
.profile__link .material-symbols-rounded,
.profile__link .fab { font-size: 16px; opacity: 0.45; width: 17px; text-align: center; }

/* =====================================================================
   Random 3D Emoji Card
   ===================================================================== */
.emoji { cursor: pointer; background: var(--bg-emoji); padding: 12px; align-items: center; justify-content: space-between; }

.emoji__image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
}

.emoji__image {
  width: 88px;
  height: 88px;
  object-fit: contain;
  transition: transform 0.5s var(--ease-bouncy);
  filter: drop-shadow(0 6px 14px rgba(0, 113, 227, 0.15));
}
.emoji.is-spinning .emoji__image { transform: scale(0.3) rotate(180deg); opacity: 0.25; }

.emoji__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: calc(100% - 16px);
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow: none;
  transition: all var(--dur) var(--ease-bouncy);
}
.emoji__btn:hover { transform: scale(1.04); box-shadow: none; }

/* =====================================================================
   Music Card — title top, play button bottom (absolute)
   ===================================================================== */
.music {
  position: relative;
  background: linear-gradient(135deg, #FFE4EC, #E8D5FF);
  padding: 0;
  overflow: hidden;
}

.music__cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease-bouncy);
}
.music:hover .music__cover { transform: scale(1.04); }

.music__title {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 1;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music__play {
  position: absolute;
  bottom: 10px;
  left: 12px;
  z-index: 1;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: #fff;
  flex-shrink: 0;
  transition: all var(--dur) var(--ease-bouncy);
}
.music__play:hover { transform: scale(1.07); }
.music__play .material-symbols-rounded { font-size: 22px; font-variation-settings: 'FILL' 1; }

/* =====================================================================
   Latest Post Card — 2col × 1row, text-only layout (no cover)
   ===================================================================== */
.latest { flex-direction: column; align-items: stretch; }

.latest__header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.latest__title { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; color: var(--text-tertiary); text-transform: uppercase; }
.latest__date-badge { display: none; }

.latest__info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  min-width: 0;
}

.latest__name {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.latest__excerpt {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}

.latest__meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-tertiary);
  margin-left: auto;
  flex-shrink: 0;
}
.latest__meta .material-symbols-rounded { font-size: 13px; }

/* =====================================================================
   Pinned Posts Card
   ===================================================================== */
.pinned { flex-direction: column; }

.pinned__header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 10px;
}
.pinned__header .material-symbols-rounded { font-size: 16px; color: var(--accent-pink); font-variation-settings: 'FILL' 1; }
.pinned__title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }

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

.pinned__item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 6px 8px;
  border-radius: 14px;
  transition: all var(--dur) var(--ease-bouncy);
}
.pinned__item:hover { background: var(--bg-page); transform: translateX(2px); }

.pinned__cover {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 14px;
  object-fit: cover;
  background: linear-gradient(135deg, #FFD6E8, #FFE4EC);
}

.pinned__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pinned__name { font-size: 13.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.pinned__excerpt { font-size: 11.5px; color: var(--text-secondary); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.pinned__date { font-size: 10.5px; color: var(--text-tertiary); text-align: right; margin-top: auto; }

/* =====================================================================
   Teleport Card — half-height rectangle inside stack
   ===================================================================== */
.card--teleport { flex: 1; background: var(--bg-teleport); padding: 12px 14px; aspect-ratio: auto; }

.teleport__inner { display: flex; flex-direction: column; justify-content: space-between; flex: 1; }
.teleport__label { font-size: 15px; font-weight: 700; color: var(--accent-pink); }

.teleport__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 18px;
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  align-self: flex-start;
  margin-top: auto;
  box-shadow: none;
  transition: all var(--dur) var(--ease-bouncy);
}
.teleport__btn:hover { transform: scale(1.04); box-shadow: none; }

/* =====================================================================
   Color Mode Card — half-height rectangle, same layout as Teleport
   Layout: "Color Mode" label top | icon button bottom
   ===================================================================== */
.card--colormode {
  flex: 1; background: var(--bg-colormode); padding: 12px 14px; aspect-ratio: auto;
  flex-direction: column; justify-content: space-between; cursor: pointer;
}

.colormode__label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.colormode__icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: 50%;
  flex-shrink: 0;
  align-self: flex-start;
  transition: all var(--dur) var(--ease-bouncy);
}
.colormode__icon:hover { transform: scale(1.08); }
.colormode__icon .material-symbols-rounded {
  font-size: 17px;
  color: var(--text-primary);
  font-variation-settings: 'FILL' 1;
}

/* =====================================================================
   Tags Card — 2col wide, horizontal tag list
   ===================================================================== */

.tags { flex-direction: column; padding: 14px 16px; }

.tags__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tags__title { font-size: 16px; font-weight: 700; }

.tags__shuffle {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-page); color: var(--text-secondary);
  border: var(--border-subtle);
  border-radius: 50%;
  transition: all var(--dur) var(--ease-bouncy);
  flex-shrink: 0;
}
.tags__shuffle:hover { background: var(--text-primary); color: var(--bg-card); transform: rotate(90deg); }
.tags__shuffle .material-symbols-rounded { font-size: 15px; }

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

.tags__item {
  display: inline-flex; align-items: center;
  font-size: 13px; font-weight: 500;
  padding: 1px 0;
  animation: tagIn 0.4s var(--ease-bouncy) backwards;
  transition: all var(--dur) var(--ease-bouncy);
}
.tags__item:hover { color: var(--accent-blue); transform: translateX(4px); }

@keyframes tagIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }

/* =====================================================================
   Posts Gallery — Masonry for index page
   ===================================================================== */
.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 190px;
  grid-auto-flow: dense;
  gap: var(--gutter);
}

.gallery__item {
  position: relative;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: none;
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  transition: opacity 0.7s ease, transform 0.7s ease, box-shadow 0.4s ease;
}
.gallery__item.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.gallery__item:hover { transform: translateY(-4px) scale(1.02); box-shadow: none; z-index: 10; }

.gallery__item:nth-child(12n+1)   { grid-column: span 2; grid-row: span 2; }
.gallery__item:nth-child(12n+2)   { grid-column: span 1; grid-row: span 1; }
.gallery__item:nth-child(12n+3)   { grid-column: span 2; grid-row: span 2; }
.gallery__item:nth-child(12n+4)   { grid-column: span 2; grid-row: span 1; }
.gallery__item:nth-child(12n+5)   { grid-column: span 1; grid-row: span 1; }
.gallery__item:nth-child(12n+6)   { grid-column: span 1; grid-row: span 1; }
.gallery__item:nth-child(12n+7)   { grid-column: span 1; grid-row: span 1; }
.gallery__item:nth-child(12n+8)   { grid-column: span 1; grid-row: span 1; }
.gallery__item:nth-child(12n+9)   { grid-column: span 1; grid-row: span 1; }
.gallery__item:nth-child(12n+10)  { grid-column: span 2; grid-row: span 2; }
.gallery__item:nth-child(12n+11)  { grid-column: span 1; grid-row: span 1; }
.gallery__item:nth-child(12n+12)  { grid-column: span 1; grid-row: span 1; }

.gallery__cover {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease-bouncy);
}
.gallery__item:hover .gallery__cover { transform: scale(1.05); }

.gallery__overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.70) 0%, rgba(0,0,0,0.30) 30%, rgba(0,0,0,0.06) 55%, transparent 78%);
  pointer-events: none; z-index: 1;
}

.gallery__date {
  position: absolute; top: 14px; left: 16px; z-index: 3;
  font-size: 11px; font-weight: 500; color: rgba(255,255,255,0.65); letter-spacing: 0.02em;
}

.gallery__body {
  position: absolute; left: 16px; right: 16px; bottom: 14px; z-index: 3;
  display: flex; flex-direction: column; gap: 2px;
}

.gallery__name {
  font-size: 17px; font-weight: 700; color: #fff; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 2px 10px rgba(0,0,0,0.42);
}
.gallery__excerpt {
  font-size: 12.5px; color: rgba(255,255,255,0.76); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 1px 5px rgba(0,0,0,0.28);
}

.gallery__empty {
  grid-column: 1 / -1; padding: 64px 28px; text-align: center;
  color: var(--text-tertiary); font-size: 14px;
  background: var(--bg-card); border-radius: var(--radius-card);
}

/* =====================================================================
   Button
   ===================================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 22px; border-radius: var(--radius-pill);
  font-size: 13.5px; font-weight: 600; transition: all var(--dur) var(--ease-bouncy);
}
.btn:active { transform: scale(0.96); }
.btn--ghost { background: var(--bg-card); border: 1px solid rgba(0,0,0,0.05); }
.btn--ghost:hover { background: var(--text-primary); color: #fff; }

/* =====================================================================
   Footer
   ===================================================================== */
.footer {
  max-width: var(--max-width); margin: 0 auto; padding: 20px var(--gutter) 32px; text-align: center;
}
.footer__text { font-size: 12.5px; color: var(--text-tertiary); }

/* =====================================================================
   Article / Page Body
   ===================================================================== */
.article { max-width: 720px; margin: 0 auto; padding: 88px var(--gutter) 64px; }

.article__back {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 500; color: var(--text-secondary);
  padding: 7px 14px; background: var(--bg-card);
  border: 1px solid rgba(0,0,0,0.05); border-radius: var(--radius-pill);
  box-shadow: none; margin-bottom: 24px;
  transition: all var(--dur) var(--ease-bouncy);
}
.article__back:hover { transform: translateX(-3px); }

.article__title { font-size: 36px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.15; margin-bottom: 12px; }

.article__meta { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--text-tertiary); margin-bottom: 24px; flex-wrap: wrap; }
.article__meta-item { display: inline-flex; align-items: center; gap: 5px; }

.article__cover { width: 100%; height: 320px; object-fit: cover; border-radius: 28px; margin-bottom: 32px; box-shadow: none; }

.article__content { font-size: 15.5px; line-height: 1.8; color: var(--text-primary); }
.article__content h1, .article__content h2, .article__content h3 { letter-spacing: -0.02em; margin-top: 1.8em; margin-bottom: 0.6em; font-weight: 700; }
.article__content h1 { font-size: 27px; } .article__content h2 { font-size: 23px; } .article__content h3 { font-size: 19px; }
.article__content p { margin-bottom: 1.2em; }
.article__content img { border-radius: 22px; margin: 1.5em auto; box-shadow: none; }
.article__content a { color: var(--accent-blue); text-decoration: underline; text-underline-offset: 3px; }
.article__content pre, .article__content code { font-family: "SF Mono", "JetBrains Mono", monospace; font-size: 13.5px; }
.article__content pre { background: #1d1d1f; color: #f5f5f7; padding: 18px 22px; border-radius: 22px; overflow-x: auto; margin: 1.5em 0; }
.article__content blockquote { border-left: 3px solid var(--accent-blue); padding: 4px 18px; margin: 1.5em 0; color: var(--text-secondary); font-style: italic; }

.article__navigation {
  display: flex; justify-content: space-between; gap: 14px; margin-top: 48px;
  padding-top: 24px; border-top: 1px solid var(--border-subtle); flex-wrap: wrap;
}
.article__nav-link {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 20px;
  background: var(--bg-card); border: 1px solid rgba(0,0,0,0.05); border-radius: var(--radius-card);
  box-shadow: none; max-width: 48%; transition: all var(--dur) var(--ease-bouncy);
}
.article__nav-link:hover { transform: translateY(-3px); box-shadow: none; }
.article__nav-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); }
.article__nav-title { font-size: 13.5px; font-weight: 600; }

.tags__chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 13px; background: var(--bg-card);
  border: 1px solid rgba(0,0,0,0.05); border-radius: var(--radius-pill);
  font-size: 12.5px; font-weight: 500;
  box-shadow: none;
  transition: all var(--dur) var(--ease-bouncy);
}
.tags__chip:hover { background: var(--accent-blue); color: #fff; transform: translateY(-2px); }

/* =====================================================================
   Archive / Tag / Category pages
   ===================================================================== */
.archive { max-width: var(--max-width); margin: 0 auto; padding: 88px var(--gutter) 64px; }

.page-header { text-align: center; margin-bottom: 40px; }
.page-header__title { font-size: 40px; font-weight: 800; letter-spacing: -0.04em; }
.page-header__subtitle { font-size: 14.5px; color: var(--text-tertiary); margin-top: 6px; }

.archive-group { margin-bottom: 32px; }
.archive-group__year { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-subtle); }

.archive-list { display: flex; flex-direction: column; gap: 3px; }
.archive-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 18px; border-radius: 18px; transition: all var(--dur) var(--ease-bouncy);
}
.archive-item:hover { background: var(--bg-card); box-shadow: none; transform: translateX(4px); }
.archive-item__title { font-size: 14.5px; font-weight: 500; }
.archive-item__date { font-size: 12.5px; color: var(--text-tertiary); flex-shrink: 0; }

.tags-cloud { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 20px; }
.tags-cloud__chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 9px 18px; background: var(--bg-card);
  border: 1px solid rgba(0,0,0,0.05); border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 500;
  box-shadow: none;
  transition: all var(--dur) var(--ease-bouncy);
}
.tags-cloud__chip:hover { background: var(--accent-blue); color: #fff; transform: translateY(-3px) scale(1.03); }
.tags-cloud__count { font-size: 11px; opacity: 0.55; }

.categories-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--gutter); }
.category-card { padding: 22px; background: var(--bg-card); border: 1px solid rgba(0,0,0,0.05); border-radius: var(--radius-card); box-shadow: none; transition: all var(--dur) var(--ease-bouncy); }
.category-card:hover { transform: translateY(-4px) scale(1.01); box-shadow: none; }
.category-card__name { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.category-card__count { font-size: 12.5px; color: var(--text-tertiary); margin-top: 5px; }
.category-card__desc { font-size: 13px; color: var(--text-secondary); margin-top: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.pagination {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 40px;
}
.pagination__link {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 9px 18px; background: var(--bg-card);
  border: 1px solid rgba(0,0,0,0.05); border-radius: var(--radius-pill);
  font-size: 12.5px; font-weight: 500;
  box-shadow: none;
  transition: all var(--dur) var(--ease-bouncy);
}
.pagination__link:hover { background: var(--text-primary); color: #fff; transform: translateY(-2px); }
.pagination__link--disabled { opacity: 0.35; pointer-events: none; }
.pagination__info { font-size: 12.5px; color: var(--text-tertiary); padding: 0 6px; }

.error { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: var(--gutter); }
.error__code { font-size: 110px; font-weight: 800; letter-spacing: -0.06em; background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; line-height: 1; }
.error__title { font-size: 23px; font-weight: 700; margin-top: 14px; }
.error__desc { font-size: 14.5px; color: var(--text-secondary); margin-top: 6px; max-width: 400px; }
.error__home { margin-top: 28px; }

/* =====================================================================
   Section title (Archives / Gallery heading)
   ===================================================================== */
.section-title {
  font-size: 26px; font-weight: 700; letter-spacing: -0.02em;
  color: #1D1D1F; margin: 44px 0 20px;
}

.archives-page { max-width: 760px; margin: 0 auto; padding: 36px 0 72px; }
.archives-list { display: flex; flex-direction: column; gap: 36px; }
.archive-group__month { font-size: 19px; font-weight: 600; color: var(--text-tertiary); letter-spacing: -0.01em; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-subtle); }
.archive-group__posts { display: flex; flex-direction: column; gap: 2px; }
.archive-post {
  display: flex; align-items: baseline; gap: 14px; padding: 10px 12px;
  border-radius: 14px; text-decoration: none; color: #1D1D1F;
  transition: background 0.3s ease, color 0.3s ease;
}
.archive-post:hover { background: var(--hover-bg); color: var(--accent-blue); }
.archive-post__title { font-size: 16px; font-weight: 500; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archive-post__date { font-size: 13px; color: #86868B; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.empty-hint { text-align: center; color: #86868B; font-size: 16px; padding: 72px 0; }

/* =====================================================================
   Gallery Page — Posts / Pinned pages (3-col masonry)
   Matches PINNED-and-POSTS-Design.png exactly
   
   Design shows: image cards with date top-left, title+excerpt bottom-left,
   3 columns, large rounded corners, masonry-style varied heights
   ===================================================================== */
.gallery-page { padding-top: 88px; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 220px;
  grid-auto-flow: dense;
  gap: var(--gutter);
}

.gallery-card {
  position: relative; border-radius: var(--radius-card); overflow: hidden;
  background: var(--bg-card); box-shadow: none;
  opacity: 0; transform: translateY(22px) scale(0.97);
  transition: opacity 0.7s ease, transform 0.7s ease, box-shadow 0.4s ease, border-color 0.3s ease;
}
.gallery-card.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.gallery-card:hover { transform: translateY(-5px) scale(1.02); box-shadow: none; z-index: 10; border-color: rgba(0,113,227,0.10); }

/* Masonry pattern matching design — mixed heights */
.gallery-card:nth-child(12n+1)  { grid-column: span 1; grid-row: span 2; }
.gallery-card:nth-child(12n+2)  { grid-column: span 1; grid-row: span 1; }
.gallery-card:nth-child(12n+3)  { grid-column: span 1; grid-row: span 2; }
.gallery-card:nth-child(12n+4)  { grid-column: span 1; grid-row: span 2; }
.gallery-card:nth-child(12n+5)  { grid-column: span 1; grid-row: span 1; }
.gallery-card:nth-child(12n+6)  { grid-column: span 1; grid-row: span 1; }
.gallery-card:nth-child(12n+7)  { grid-column: span 1; grid-row: span 1; }
.gallery-card:nth-child(12n+8)  { grid-column: span 1; grid-row: span 1; }
.gallery-card:nth-child(12n+9)  { grid-column: span 1; grid-row: span 2; }
.gallery-card:nth-child(12n+10) { grid-column: span 1; grid-row: span 1; }
.gallery-card:nth-child(12n+11) { grid-column: span 1; grid-row: span 1; }
.gallery-card:nth-child(12n+12) { grid-column: span 1; grid-row: span 1; }

.gallery-card__cover-wrap { position: absolute; inset: 0; }
.gallery-card__cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s var(--ease-bouncy); }
.gallery-card:hover .gallery-card__cover { transform: scale(1.06); }

.gallery-card__cover--placeholder { background: linear-gradient(135deg, #E8F0FE, #F3E8FF, #FFE8EC); background-size: 200% 200%; animation: placeholderShift 8s ease infinite; }
@keyframes placeholderShift { 0%,100%{background-position:0% 50%} 50%{background-position:100% 50%} }

.gallery-card__overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.74) 0%, rgba(0,0,0,0.34) 28%, rgba(0,0,0,0.07) 52%, transparent 72%);
  pointer-events: none; z-index: 1;
}

/* Date badge — top-left per design */
.gallery-card__date {
  position: absolute; top: 18px; left: 18px; z-index: 3;
  font-size: 10.5px; font-weight: 500; color: rgba(255,255,255,0.70); letter-spacing: 0.02em; font-variant-numeric: tabular-nums;
}

/* Title + excerpt — bottom-left per design */
.gallery-card__body {
  position: absolute; left: 18px; right: 18px; bottom: 18px; z-index: 3;
  display: flex; flex-direction: column; gap: 5px;
}
.gallery-card__title {
  font-size: 17px; font-weight: 700; color: #fff; letter-spacing: -0.01em; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 2px 10px rgba(0,0,0,0.4);
  margin-bottom: 2px;
}
.gallery-card__excerpt {
  font-size: 12.5px; font-weight: 400; color: rgba(255,255,255,0.73); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 1px 5px rgba(0,0,0,0.25);
}
.gallery-pagination { text-align: center; margin-top: 44px; }
.btn--lg { padding: 12px 30px; font-size: 14px; }
.gallery-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 110px 28px; text-align: center; color: var(--text-tertiary); font-size: 14px;
}

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1024px) {
  :root { --max-width: 920px; }
  .bento {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 200px);
    min-height: auto;
  }
  .card--profile  { grid-column: 1 / 3; grid-row: 1 / 2; }
  .card--emoji    { grid-column: 1 / 2; grid-row: 2 / 3; }
  .card--music    { grid-column: 2 / 3; grid-row: 2 / 3; }
  .card--latest   { grid-column: 1 / 3; grid-row: 3 / 4; }
  .card--pinned   { grid-column: 1 / 3; grid-row: 4 / 5; }
  .card--teleport-stack { grid-column: 1 / 2; grid-row: auto !important; aspect-ratio: auto; min-height: 200px; }
  .card--colormode { grid-column: 1 / 2 !important; grid-row: auto !important; }
  .gallery { grid-template-columns: repeat(3, 1fr); }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 200px; }
  .gallery-card:nth-child(n) { grid-column: span 1 !important; grid-row: span 1 !important; }
  .gallery-card:nth-child(6n+1) { grid-column: span 1 !important; grid-row: span 2 !important; }
  .gallery-card:nth-child(6n+2) { grid-column: span 1 !important; grid-row: span 1 !important; }
  .gallery-card:nth-child(6n+3) { grid-column: span 1 !important; grid-row: span 2 !important; }
  .gallery-card:nth-child(6n+4) { grid-column: span 1 !important; grid-row: span 1 !important; }
  .gallery-card:nth-child(6n+5) { grid-column: span 1 !important; grid-row: span 1 !important; }
  .gallery-card:nth-child(6n+6) { grid-column: span 1 !important; grid-row: span 2 !important; }
  .gallery__item:nth-child(n) { grid-column: span 1 !important; grid-row: span 1 !important; }
  .gallery__item:nth-child(6n+1) { grid-column: span 2 !important; grid-row: span 2 !important; }
  .gallery__item:nth-child(6n+2) { grid-column: span 1 !important; grid-row: span 1 !important; }
  .gallery__item:nth-child(6n+3) { grid-column: span 1 !important; grid-row: span 2 !important; }
  .gallery__item:nth-child(6n+4) { grid-column: span 1 !important; grid-row: span 1 !important; }
  .gallery__item:nth-child(6n+5) { grid-column: span 1 !important; grid-row: span 1 !important; }
  .gallery__item:nth-child(6n+6) { grid-column: span 2 !important; grid-row: span 1 !important; }
  .latest { flex-direction: row; }
}

@media (max-width: 680px) {
  :root { --gutter: 14px; }
  .nav-zone { top: 10px; width: calc(100% - 24px); gap: 6px; }
  .nav-avatar img { width: 32px; height: 32px; }
  .nav__inner { padding: 6px 10px; }
  .nav__brand { font-size: 11.5px; }
  .nav__link { padding: 4px 8px; font-size: 11.5px; }
  .bento { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-rows: auto; }
  .card--profile, .card--emoji, .card--music, .card--tags,
  .card--latest, .card--pinned {
    grid-column: 1 / 2 !important; grid-row: auto !important; min-height: 160px;
  }
  .card--teleport-stack { grid-column: 1 / 2 !important; grid-row: auto !important; min-height: 280px; aspect-ratio: auto; }
  .gallery { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 140px; }
  .gallery-grid { grid-template-columns: 1fr; grid-auto-rows: 190px; }
  .gallery-card { grid-row: auto !important; }
  .gallery__item { grid-row: auto !important; }
  .article__title { font-size: 27px; }
  .page-header__title { font-size: 30px; }
  .article__navigation { flex-direction: column; }
  .article__nav-link { max-width: 100%; }
  .error__code { font-size: 75px; }
  .profile__avatar { width: 48px; height: 48px; }
  .profile__name { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* =====================================================================
   Halo Comment Widget — Dark Mode Adaptation
   The <halo:comment> web component renders shadow DOM we can't pierce,
   but it inherits CSS custom properties from :root. We override the
   known Halo comment design tokens under [data-theme="dark"].
   ===================================================================== */
[data-theme="dark"] halo-comment,
[data-theme="dark"] .halo-comment-widget,
[data-theme="dark"] .comment-section {
  --halo-comment-bg: #2C2C2E;
  --halo-comment-text: #F5F5F7;
  --halo-comment-text-secondary: #A1A1A6;
  --halo-comment-border: rgba(255, 255, 255, 0.08);
  --halo-comment-input-bg: #1C1C1E;
  --halo-comment-input-border: rgba(255, 255, 255, 0.12);
  color: #F5F5F7;
}

/* Pierce shadow DOM where possible via inheritable props */
[data-theme="dark"] {
  --halo-comment-color: #F5F5F7;
  --halo-comment-color-secondary: #A1A1A6;
  --halo-comment-bg-color: #2C2C2E;
  --halo-comment-border-color: rgba(255, 255, 255, 0.08);
  --halo-comment-hover-bg: rgba(255, 255, 255, 0.06);
}

/* Fallback: style the comment wrapper container */
.comment-wrapper {
  margin-top: 64px;
}
[data-theme="dark"] .comment-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 24px;
}

/* Force dark backgrounds on common Halo comment elements via deep selector */
[data-theme="dark"] halo-comment::part(comment-item),
[data-theme="dark"] halo-comment::part(comment-input),
[data-theme="dark"] halo-comment::part(comment-form) {
  background: #2C2C2E !important;
  color: #F5F5F7 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* =====================================================================
   View Transition — circular reveal for dark/light mode switch
   ===================================================================== */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-old(root) {
  z-index: 1;
}
::view-transition-new(root) {
  z-index: 9999;
}
