/*
 * Site look on top of Chirpy 7.6.0, modelled on icd.cs.tut.ac.jp:
 * boxed centered page, halo logo + uppercase top navigation in one row,
 * hero + three-column photo cards, light three-column footer with a dark bar.
 * Frame colours (navy grid backdrop, cyan edges) follow the KEITalk Millennium style.
 * Loaded from _includes/metadata-hook.html (after Chirpy's own stylesheet).
 */

:root {
  --site-font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui,
    'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  --site-outer-bg: #0f1822;  /* Millennium: navy with a faint cyan blueprint grid */
  --site-cyan: #29c5f6;
  --site-ink: #333;
  --site-muted: #8a8a8a;
  --site-rule: #c8c8c8;
  --site-rule-strong: #8f8f8f;
  --site-accent: #c9437a;     /* active menu, hover (Kei halo pink, darkened for text) */
  --site-accent-soft: #f0a3c1;
  --site-label: #b04a74;      /* small category labels */
  --site-logo: #5ba3c0;
  --site-box-max: 1120px;
}

:root[data-bs-theme=light] {
  --main-bg: #ebebeb;
  --card-bg: #f3f3f3;
  --topbar-bg: rgb(235 235 235 / 80%);
  --main-border-color: #d9d9d9;
  --search-border-color: #d4d4d4;
}

body,
h1, h2, h3, h4, h5, h6 {
  font-family: var(--site-font);
}

/* ---------- page frame ---------- */

body {
  background-color: var(--site-outer-bg);
  background-image:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(41, 197, 246, 0.16), transparent 70%),
    linear-gradient(rgba(41, 197, 246, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(41, 197, 246, 0.07) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
  background-attachment: fixed;
}

.site-box {
  width: 100%;
  max-width: var(--site-box-max);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--main-bg, #fff);
  border-top: 3px solid var(--site-cyan);
  box-shadow: 0 0 0 1px rgba(41, 197, 246, 0.22), 0 24px 70px rgba(0, 0, 0, 0.45);
}

#main-wrapper {
  margin-left: 0 !important;
  background: transparent;
}

#main-wrapper > .container {
  max-width: 100%;
  min-height: 0; /* Chirpy uses 100vh, which pushed the footer a full screen down */
}

/* the Chirpy sidebar is only the mobile drawer */
@media (min-width: 992px) {
  #sidebar {
    display: none !important;
  }
}

/* ---------- header: halo mark + title left, navigation right ---------- */

.site-header {
  padding: 1.75rem 3rem 0;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #d3d3d3;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none !important;
  border-bottom: 0 !important;
  flex-shrink: 0;
}

.site-logo-mark {
  width: 46px;
  height: 32px;
  flex-shrink: 0;
}

.site-logo-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.site-logo-title {
  color: var(--site-ink);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.15;
}

.site-logo-tagline {
  color: #9a9a9a;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.site-nav > ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav li {
  position: relative;
}

.site-nav > ul > li > a {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  color: #555;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-decoration: none;
  border-bottom: 0 !important;
}

.site-nav > ul > li > a i {
  font-size: 0.7rem;
  color: #aaa;
}

.site-nav > ul > li.active > a {
  color: var(--site-accent);
  box-shadow: inset 0 -2px 0 var(--site-accent-soft);
}

.site-nav > ul > li > a:hover {
  color: var(--site-accent);
}

.site-subnav {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 20;
  min-width: 180px;
  margin: 0;
  padding: 0.4rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.site-nav li.has-sub:hover > .site-subnav,
.site-nav li.has-sub:focus-within > .site-subnav {
  display: block;
}

.site-subnav a {
  display: block;
  padding: 0.55rem 1.2rem;
  color: #555;
  font-size: 0.85rem;
  text-decoration: none;
  border-bottom: 0 !important;
}

.site-subnav a:hover {
  color: var(--site-accent);
  background: #fbf3f6;
}

@media (max-width: 991.98px) {
  .site-header {
    padding: 1.25rem 1rem 0;
  }

  .site-header-inner {
    padding-bottom: 0.75rem;
  }

  .site-logo-mark {
    width: 38px;
    height: 26px;
  }

  .site-logo-title {
    font-size: 1.2rem;
  }

  .site-nav {
    display: none; /* the drawer (hamburger in the bar below) takes over */
  }
}

/* ---------- topbar: breadcrumb + search ---------- */

#topbar-wrapper {
  background: transparent;
  height: 3.25rem;
}

#topbar {
  padding-left: 0.25rem !important;
  padding-right: 0.25rem !important;
}

#topbar #breadcrumb {
  font-size: 0.82rem;
  padding-left: 0;
}

#topbar-title {
  visibility: hidden; /* the site title is already in the header */
}

/* on the home page the breadcrumb is just "홈" — hide it */
#breadcrumb:has(> span:only-child) {
  visibility: hidden;
}

#search {
  border-radius: 999px;
}

#search-input {
  font-size: 0.85rem;
}

/* ---------- home ---------- */

.home-hero {
  text-align: center;
  padding-top: 2.5rem;
}

.home-catchphrase {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--site-ink);
  margin: 0 0 1rem;
}

.home-subtitle {
  font-size: 1.05rem;
  color: #444;
  margin: 0 0 1.25rem;
}

.home-intro {
  max-width: 40rem;
  margin: 0 auto 2.25rem;
  font-size: 0.92rem;
  line-height: 1.8;
  color: #666;
  word-break: keep-all;
}

.home-hero-img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

.home-posts {
  padding: 3rem 0 1rem;
}

/* ---------- home: public chat room (KEITalk, Millennium style) (assets/js/kei-chat.js) ---------- */

.home-chat {
  padding-top: 2.25rem;
}

.kchat {
  /* Millennium look: navy panels, cyan accents, blueprint grid, cut corners */
  --kchat-cyan: #29c5f6;
  --kchat-cyan-deep: #1489bd;
  --kchat-navy: #111a26;
  --kchat-other: #1f2b3b;
  --kchat-me: #1489bd;
  --kchat-kei: #e8578f;
  --kchat-mono: ui-monospace, 'Cascadia Mono', Consolas, 'Liberation Mono', monospace;
  max-width: none; /* same width as the project grid below */
  margin: 0 auto;
  overflow: hidden;
  background: #f2f2f2;
  border: 1px solid #cfcfcf;
  border-radius: 3px;
  box-shadow: 0 10px 30px rgba(17, 26, 38, 0.08);
}

.kchat-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 1.1rem;
  background: var(--kchat-navy);
  border-bottom: 3px solid var(--kchat-cyan);
  color: #fff;
  font-family: var(--kchat-mono);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.kchat-head > i {
  color: var(--kchat-cyan);
}

/* diagonal tech stripes on the right edge of the header */
.kchat-head::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 70px;
  background: repeating-linear-gradient(-45deg, rgba(41, 197, 246, 0.28) 0 4px, transparent 4px 10px);
  pointer-events: none;
}

.kchat-room {
  position: relative;
  z-index: 1;
  margin-left: auto;
  margin-right: 60px;
  color: var(--kchat-cyan);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.kchat-room::before {
  content: '// ';
  opacity: 0.7;
}

.kchat-log {
  height: 420px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.25rem 1.1rem 1.1rem;
  background-color: #f2f2f2;
  background-image:
    linear-gradient(rgba(20, 137, 189, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 137, 189, 0.07) 1px, transparent 1px);
  background-size: 24px 24px;
}

.kchat-day {
  margin: 1rem auto 0.25rem;
  width: fit-content;
  padding: 0.15rem 0.8rem;
  border: 1px solid #bcd6e6;
  border-radius: 2px;
  background: #fff;
  color: #4b7690;
  font-size: 0.75rem;
}

.kchat-row {
  display: flex;
  gap: 0.7rem;
  margin-top: 0.9rem;
}

.kchat-row.is-me {
  justify-content: flex-end;
}

.kchat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--kchat-cyan);
}

.kchat-row.is-kei .kchat-avatar {
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--kchat-kei);
}

.kchat-avatar.is-initial {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}

.kchat-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  min-width: 0;
  max-width: 78%;
}

.kchat-row.is-me .kchat-col {
  align-items: flex-end;
}

.kchat-name {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--kchat-navy);
}

.kchat-row.is-kei .kchat-name {
  color: var(--kchat-kei);
}

.kchat-line {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  max-width: 100%;
  animation: kchat-in 0.18s ease-out;
}

.kchat-row.is-me .kchat-line {
  flex-direction: row-reverse;
}

.kchat-bubble {
  position: relative;
  min-width: 0;
  padding: 0.45rem 0.9rem 0.45rem 0.8rem;
  border-left: 3px solid var(--kchat-cyan);
  border-radius: 0;
  background: var(--kchat-other);
  color: #f2f7fb;
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: anywhere;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%);
}

.kchat-row.is-kei .kchat-bubble {
  border-left-color: var(--kchat-kei);
}

.kchat-row.is-me .kchat-bubble {
  padding: 0.45rem 0.8rem 0.45rem 0.9rem;
  border-left: 0;
  border-right: 3px solid var(--kchat-cyan);
  background: var(--kchat-me);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 9px 100%, 0 calc(100% - 9px));
}

.kchat-time {
  flex-shrink: 0;
  font-family: var(--kchat-mono);
  font-size: 0.66rem;
  color: #8199ad;
  white-space: nowrap;
}

.kchat-sticker {
  width: 120px;
  height: 120px;
}

@keyframes kchat-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.kchat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  background: var(--kchat-navy);
  border-top: 1px solid #22344a;
}

.kchat-form input {
  min-width: 0;
  padding: 0.5rem 0.8rem;
  background: #0a111a;
  border: 1px solid #2b3d52;
  border-radius: 2px;
  color: #e8f2f9;
  font-size: 0.92rem;
  outline: none;
}

.kchat-form input::placeholder {
  color: #6b8197;
}

.kchat-form input:focus {
  border-color: var(--kchat-cyan);
  box-shadow: 0 0 0 2px rgba(41, 197, 246, 0.2);
}

.kchat-form input:disabled {
  background: #141d29;
}

.kchat-nick {
  width: 8.5rem;
  flex-shrink: 0;
}

.kchat-input {
  flex: 1;
}

.kchat-send {
  flex-shrink: 0;
  width: 2.6rem;
  border: 0;
  border-radius: 0;
  background: var(--kchat-cyan);
  color: var(--kchat-navy);
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}

.kchat-send:disabled {
  background: #33485e;
  color: #7c90a4;
  cursor: default;
}

.kchat-note {
  margin: 0;
  padding: 0 1rem;
  background: var(--kchat-navy);
  color: #8ea3b6;
  font-size: 0.78rem;
}

.kchat-note:not(:empty) {
  padding-bottom: 0.6rem;
}

.kchat-note.is-error {
  color: #ff86b0;
}

.kchat-del {
  flex-shrink: 0;
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  border: 1px solid #e3c3cf;
  border-radius: 2px;
  background: #fff;
  color: var(--site-accent);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}

.kchat-admin {
  margin-bottom: 0.2rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid #2b3d52;
  border-radius: 2px;
  background: #0a111a;
  color: #e8f2f9;
  font-size: 0.8rem;
  cursor: pointer;
}

@media (max-width: 575.98px) {
  .home-chat {
    padding-top: 1rem;
  }

  .kchat-log {
    height: 380px;
  }

  .kchat-nick {
    width: 6rem;
  }
}

/* post panel: table of contents + compact chat stick together (only shown at >= 1200px) */
.panel-sticky {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  max-height: 100vh;
  padding: 2rem 0 1.25rem;
}

.panel-sticky #toc-wrapper.position-sticky {
  position: static !important;
  flex: 0 1 auto;
  min-height: 0;
  max-height: none;
  margin-top: 0;
  padding-bottom: 1rem !important;
  overflow-y: auto;
}

/* Chirpy fades the TOC out with a fixed strip at the bottom of the screen; the TOC no longer
   reaches the bottom (the chat sits under it), and the strip covered the footer and comments */
.panel-sticky #toc-wrapper::after {
  display: none;
}

.panel-sticky #toc-wrapper.invisible {
  display: none; /* no headings: give the room to the chat */
}

.kchat.is-compact {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  height: 46vh; /* fixed share of the screen; the table of contents above scrolls if long */
  min-height: 300px;
  margin-right: 0.5rem;
  border-radius: 3px;
  box-shadow: none;
}

.kchat.is-compact .kchat-head {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.kchat.is-compact .kchat-room {
  margin-right: 28px;
  font-size: 0.72rem;
  white-space: nowrap;
}

.kchat.is-compact .kchat-room::before {
  content: none;
}

.kchat.is-compact .kchat-head::after {
  width: 34px;
}

.kchat.is-compact .kchat-log {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  padding: 0 0.7rem 0.8rem;
}

.kchat.is-compact .kchat-row {
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.kchat.is-compact .kchat-avatar {
  width: 28px;
  height: 28px;
  font-size: 0.75rem;
}

.kchat.is-compact .kchat-col {
  max-width: 85%;
  gap: 0.25rem;
}

.kchat.is-compact .kchat-name {
  font-size: 0.75rem;
}

.kchat.is-compact .kchat-bubble {
  padding: 0.3rem 0.6rem;
  border-radius: 0;
  font-size: 0.8rem;
  line-height: 1.5;
}

.kchat.is-compact .kchat-name + .kchat-line .kchat-bubble::before,
.kchat.is-compact .kchat-row.is-me .kchat-line:first-child .kchat-bubble::before {
  top: 7px;
}

.kchat.is-compact .kchat-sticker {
  width: 84px;
  height: 84px;
}

.kchat.is-compact .kchat-time {
  font-size: 0.62rem;
}

.kchat.is-compact .kchat-day {
  font-size: 0.68rem;
}

.kchat.is-compact .kchat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem;
  padding: 0.5rem 0.6rem;
}

.kchat.is-compact .kchat-nick {
  grid-column: 1 / -1;
  width: auto;
}

.kchat.is-compact .kchat-form input {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
}

.kchat.is-compact .kchat-send {
  width: 2.1rem;
}

.kchat.is-compact .kchat-note {
  padding: 0 0.6rem;
  font-size: 0.7rem;
}

.kchat.is-compact .kchat-admin {
  font-size: 0.72rem;
}

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

.home-section-title,
.category-title {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--site-ink);
  margin: 0 0 2rem;
}

.category-title .category-count {
  color: var(--site-muted);
  font-size: 0.9rem;
  margin-left: 0.4rem;
}

/* ---------- post cards ---------- */

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5rem 1.75rem;
}

@media (max-width: 991.98px) {
  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.post-card > a {
  display: block;
  color: inherit;
  text-decoration: none;
  border-bottom: 0 !important;
}

.post-card-thumb {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f2f2f2;
}

.post-card-thumb.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eef3f7 0%, #f6f1ee 100%);
}

.post-card-thumb.is-empty span {
  color: #9aa4ad;
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  margin-right: -0.3em;
}

.post-card-thumb img,
.post-card-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.post-card > a:hover .post-card-thumb img,
.post-card > a:hover .post-card-thumb video {
  transform: scale(1.03);
  opacity: 0.92;
}

.post-card-title {
  margin: 0.9rem 0 0.4rem;
  text-align: center;
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--site-ink);
  word-break: keep-all;
}

.post-card-meta {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.post-card-label {
  color: var(--site-label);
}

.post-card-date {
  color: var(--site-muted);
}

/* ---------- reading typography (posts and pages) ---------- */

article .content {
  font-size: 1.125rem;
  line-height: 1.9;
  letter-spacing: -0.005em;
  word-break: keep-all;
}

@media (min-width: 1200px) {
  article .content {
    font-size: 1.0625rem;
  }
}

article .content p {
  margin-bottom: 1.5em;
}

article .content h2 {
  margin-top: 3rem;
  margin-bottom: 1rem;
  font-size: 1.45rem;
  font-weight: 700;
}

article .content h3 {
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
  font-size: 1.2rem;
  font-weight: 700;
}

article .content ol li,
article .content ul li {
  margin: 0.4rem 0;
}

article .content table {
  line-height: 1.6;
}

article .content pre,
article .content code {
  word-break: normal;
}

article > header h1 {
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.4;
  word-break: keep-all;
}

/* ---------- footer ---------- */

footer.site-footer {
  height: auto;
  margin-top: 5rem;
  padding: 0;
  border-top: 0;
  background: transparent;
  font-size: 0.85rem;
}

footer.site-footer p {
  text-align: left;
  margin-bottom: 0.6rem;
}

.site-footer-box {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem 3rem;
  margin: 0 3rem;
  padding: 2.5rem 2rem;
  background: #f4f4f4;
  color: #555;
}

.site-footer-box h2 {
  font-size: 1rem;
  font-weight: 500;
  color: #444;
  margin: 0 0 1rem;
}

.site-footer-box ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer-box li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.site-footer-box a,
.site-footer-bar a {
  color: var(--site-label);
  text-decoration: none;
  border-bottom: 0 !important;
}

.site-footer-box a:hover,
.site-footer-bar a:hover {
  color: var(--site-accent);
}

.site-footer-sub {
  display: block;
  font-size: 0.8rem;
}

.site-footer-bar {
  margin: 0 3rem;
  padding: 1rem 2rem;
  background: #111a26;
  border-top: 2px solid var(--site-cyan);
  color: #9fb3c5;
  font-size: 0.78rem;
}

.site-footer-bar a {
  color: #e6e6e6;
}

.site-footer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

footer.site-footer p.site-footer-motto {
  flex-basis: 100%;
  margin: 0 0 0.4rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid #22344a;
  color: #c9d6e2;
  letter-spacing: 0.02em;
  word-break: keep-all;
}

.site-footer-motto i {
  margin: 0 0.15rem;
  color: var(--site-cyan);
  font-style: normal;
}

.site-footer-motto span {
  margin-left: 0.3rem;
  color: #7f94a8;
}

.site-visits {
  display: flex;
  gap: 0.5rem;
}

.site-visits[hidden] {
  display: none;
}

.site-visits-item {
  padding: 0.15rem 0.7rem;
  border: 1px solid #2b3d52;
  border-radius: 2px;
  color: #8ea3b6;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.site-visits-item b {
  margin-left: 0.3rem;
  color: var(--site-accent-soft);
  font-weight: 600;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 767.98px) {
  .site-footer-box {
    grid-template-columns: 1fr;
    margin: 0;
    padding: 2rem 1.5rem;
  }

  .site-footer-bar {
    margin: 0;
    padding: 1rem 1.5rem;
  }
}
