/* ============================================
   HollowLight — Global Design System
   ZZZ InterKnot Forum Style
   ============================================ */

/* ---- CSS Custom Properties ---- */
:root {
  /* Colors */
  --hl-black: #000;
  --hl-card: #1c1c1c;
  --hl-card-hover: #222;
  --hl-card-gradient-start: #212121;
  --hl-card-gradient-end: #141414;
  --hl-accent: #fbfe00;
  --hl-accent-alt: #dcfe00;
  --hl-blue: #0050fe;
  --hl-text: #fff;
  --hl-text-muted: #7e7e7e;
  --hl-text-secondary: #b3b3b1;
  --hl-link: #ffde00;
  --hl-progress-start: #4a6cf6;
  --hl-progress-mid: #2bbafe;
  --hl-progress-end: #A5FECB;
  --hl-inset-light: #313431;
  --hl-inset-dark: #181818;
  --hl-tab-bg: #060606;
  --hl-tab-shadow: #313131;
  --hl-close-red: rgb(196, 34, 9);

  /* Radii */
  --hl-radius: 20px;
  --hl-radius-pill: 30px;
  --hl-radius-tab: 50px;

  /* Layout */
  --hl-header-height: 90px;

  /* Typography */
  --hl-font: '猫啃什锦黑', 'MaoKenAssortedSans', system-ui, -apple-system,
    'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;

  /* Z-index layers */
  --hl-z-bg: 0;
  --hl-z-content: 1;
  --hl-z-header: 9999;
  --hl-z-0kd: 99999;
  --hl-z-window: 999999;
  --hl-z-loading: 9999999;
}


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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--hl-black);
  color: var(--hl-text);
  font-family: var(--hl-font);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: bold;
  line-height: 1.3;
}

::selection {
  background: var(--hl-accent);
  color: var(--hl-black);
}

:focus-visible {
  outline: 2px solid var(--hl-accent);
  outline-offset: 2px;
}


/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--hl-card);
}

::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #666;
}


/* ---- Loading Overlay ---- */
.loading {
  position: fixed;
  z-index: var(--hl-z-loading);
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background-color: var(--hl-black);
  transition: opacity 0.4s ease;
}

.loading.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 52px;
  height: 52px;
  border: 4px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--hl-blue);
  border-right-color: var(--hl-blue);
  border-radius: 50%;
  animation: loading-spin 0.75s linear infinite;
}

.loading-text {
  font-size: 14px;
  letter-spacing: 4px;
  color: var(--hl-text-muted);
  text-transform: uppercase;
  animation: loading-pulse 1.5s ease-in-out infinite;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loading-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}


/* ---- _0kd Page Transition ---- */
._0kd {
  position: fixed;
  background: var(--hl-black);
  z-index: var(--hl-z-0kd);
  transform: translateY(50%);
  border-radius: 100%;
  border: 30px solid var(--hl-blue);
  animation: _0kd-expand 1s ease-out;
  display: none;
  animation-play-state: paused;
}

@keyframes _0kd-expand {
  0% {
    bottom: -50%;
    left: 0;
    width: 100vw;
    height: 100vw;
  }
  100% {
    bottom: 0%;
    left: -40vw;
    width: 200vw;
    height: 100vw;
  }
}


/* ---- Background Layer ---- */
.bg {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--hl-z-bg);
  width: 100%;
  height: 100vh;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center top;
  pointer-events: none;
}


/* ---- Header ---- */
header {
  height: var(--hl-header-height);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--hl-z-header);
  width: 100%;
  padding: 0 5%;
  user-select: none;
  transition: opacity 0.4s ease, transform 0.35s ease;
}


/* ---- Header: Personal Card ---- */
header .personal {
  background: rgb(20, 20, 20);
  background: linear-gradient(var(--hl-card-gradient-start), var(--hl-card-gradient-end));
  height: 46px;
  min-width: 0;
  flex: 1;
  margin: 0;
  border-radius: var(--hl-radius-pill);
  box-shadow:
    inset 0 2px 2px 1px var(--hl-inset-light),
    inset 0 -2px 2px 3px var(--hl-inset-dark);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  gap: 0;
  padding-right: 10px;
  text-decoration: none;
  cursor: pointer;
}

header .personal .avatar-link {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  text-decoration: none;
}

header .personal img.avatar {
  border-radius: 100%;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  max-width: 28px;
  max-height: 28px;
  border: 1.5px solid rgba(255,255,255,0.25);
  object-fit: cover;
  display: block;
  transition: border-color 0.2s;
  animation: avatar-spin 3s linear infinite;
  animation-play-state: paused;
}

header .personal:hover img.avatar {
  border-color: rgba(255,255,255,0.55);
  animation-play-state: running;
}

@keyframes avatar-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Info bar: bio + url toggle */
header .personal .info-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: var(--hl-radius-pill);
  padding: 4px 12px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

header .personal .info-bio {
  color: rgba(255,255,255,0.55);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

header .personal .info-url {
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
  align-items: center;
  gap: 5px;
}

header .personal .info-url-lock {
  color: rgba(255,255,255,0.45);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

header .personal:hover .info-bio {
  display: none;
}

header .personal:hover .info-url {
  display: flex;
}

header .personal:hover .info-url-lock {
  color: rgba(255,255,255,0.65);
}

/* ---- Header: Navigation Tabs ---- */
header .tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
  margin-right: 0;
  background-color: var(--hl-tab-bg);
  padding: 4px;
  box-shadow: inset 0 0 2px 4px var(--hl-tab-shadow);
  border-radius: var(--hl-radius-tab);
  background-image:
    linear-gradient(var(--hl-black) 8px, transparent 0),
    linear-gradient(90deg, #0f0f0f 2px, transparent 0);
  background-size: 10px 10px;
}

header .tabs .tab {
  padding: 6px 20px;
  font-size: 15px;
  font-weight: bold;
  font-style: italic;
  position: relative;
}

header .tabs .tab a {
  color: var(--hl-text);
  text-decoration: none;
  z-index: 1;
  position: relative;
  white-space: nowrap;
  transition: color 0.2s ease;
}

header .tabs .tab:hover a {
  color: var(--hl-accent);
}

/* Active tab: text turns black (over yellow bg) */
header .tabs .tab.choiced a {
  color: var(--hl-black);
}

/* Active tab: yellow highlight with skew + scale animation */
header .tabs .tab.choiced::after {
  content: "";
  display: block;
  width: 70%;
  height: 100%;
  position: absolute;
  transform: skew(-27deg);
  top: -2px;
  right: 10%;
  z-index: 0;
  border-radius: 10px 15px;
  animation:
    tab-color 1s linear infinite alternate,
    tab-size 0.6s cubic-bezier(0.35, 0.7, 0, 0.8) infinite alternate;
}

/* Edge corrections for first/last active tab */
header .tabs .tab.choiced:first-child::after {
  right: 0;
}

header .tabs .tab.choiced:last-child::after {
  left: 0;
  right: unset;
}

header .tabs .tab.choiced:first-child::before {
  content: "";
  display: block;
  width: 60%;
  border-radius: 100px;
  height: 100%;
  position: absolute;
  top: -2px;
  left: 0;
  animation:
    tab-color 1s linear infinite alternate,
    tab-size 0.6s cubic-bezier(0.35, 0.7, 0, 0.8) infinite alternate;
}

header .tabs .tab.choiced:last-child::before {
  content: "";
  display: block;
  width: 60%;
  border-radius: 100px;
  height: 100%;
  position: absolute;
  top: -2px;
  right: 0;
  animation:
    tab-color 1s linear infinite alternate,
    tab-size 0.6s cubic-bezier(0.35, 0.7, 0, 0.8) infinite alternate;
}

@keyframes tab-size {
  0% {
    scale: 1.3;
  }
  to {
    scale: 1.5;
  }
}

@keyframes tab-color {
  0% {
    background: var(--hl-accent);
  }
  to {
    background: var(--hl-accent-alt);
  }
}


/* ---- Main Content ---- */
body > main {
  margin-top: var(--hl-header-height);
  position: relative;
  z-index: var(--hl-z-content);
  min-height: calc(100vh - var(--hl-header-height));
}

/* ---- Home page with curtain: no top margin (curtain fills from top) ---- */
body > main.has-curtain {
  margin-top: 0;
}

/* ---- Post page with hero cover: extend cover image under transparent header ---- */
body > main.has-hero {
  margin-top: 0;
}


/* ---- Card System ---- */
.card {
  border-radius: var(--hl-radius);
  border-bottom-right-radius: 0;
  background: var(--hl-card-hover);
  border: 5px solid var(--hl-black);
  overflow: hidden;
  transition: border-color 0.3s ease;
}

.card:hover {
  border-color: var(--hl-accent);
  animation: card-border-glow 1s linear 0.3s infinite alternate;
}

@keyframes card-border-glow {
  0% {
    border-color: var(--hl-accent);
  }
  to {
    border-color: var(--hl-accent-alt);
  }
}


/* ---- Window / Popup Overlay ---- */
.window {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: var(--hl-z-window);
  display: none;
  align-items: center;
  justify-content: center;
  /* Checkerboard texture */
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.2) 0,
    rgba(255, 255, 255, 0.2) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.2) 75%,
    transparent 75%,
    transparent
  );
  background-size: 8px 8px;
}

.window.active {
  display: flex;
}

.window-content {
  box-shadow: 0 0 0 5px rgba(101, 101, 101, 0.64);
  border: 5px solid var(--hl-black);
  height: calc(100% - 150px);
  width: calc(100% - 100px);
  max-width: 1200px;
  border-radius: var(--hl-radius);
  border-top-right-radius: 0;
  overflow: hidden;
  position: relative;
  background-color: #121212;
}


.window-frame {
  width: 100%;
  height: 100%;
  outline: 0;
  border: 0;
  background-color: #121212;
  display: block;
}


/* ---- Responsive: Large Desktop (>=1200px) ---- */
@media (min-width: 1200px) {
  :root {
    --hl-header-height: 100px;
  }


  header .tabs .tab {
    padding: 8px 28px;
    font-size: 17px;
  }
}


/* ---- Responsive: Mobile (<=768px) ---- */
@media (max-width: 768px) {
  :root {
    --hl-header-height: 140px;
  }

  header {
    flex-direction: column;
    height: auto;
    padding-bottom: 5px;
  }

  header .personal {
    min-width: unset;
    width: calc(100% - 20px);
    margin: 8px 10px 4px;
  }


  header .tabs {
    position: relative;
    right: unset;
    top: unset;
    margin: 4px 10px 8px;
    flex-wrap: wrap;
    gap: 2px;
  }

  header .tabs .tab {
    padding: 8px 20px;
    font-size: 16px;
  }

  body > main {
    /* Header becomes taller on mobile due to column layout */
    margin-top: 140px;
  }

  .window-content {
    width: calc(100% - 30px);
    height: calc(100% - 100px);
  }

}
