/* =========================================================
   Base reset & typography
   ========================================================= */


* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font: 14px "Arial", Helvetica, sans-serif;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  background: #fff;
}


:root{
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --font-myeong: "Nanum Myeongjo", "Apple SD Gothic Neo", "Batang", serif;
}

  
/* =========================================================
   High-contrast (invert) — Single source of truth
   html.is-inverted 만 사용 (이미지/비디오 자연색 복원,
   네비/헤더는 반전 해제 + 색상 수동 지정)
   ========================================================= */


:root {
  --invert-filter: invert(1) hue-rotate(180deg);
}

html.is-inverted {
  filter: var(--invert-filter);
  --nav-bg: #000000;
  --nav-fg: #FFFFFF;
  /* selection 토큰도 함께 교체 */
  --selection-bg: #68DE95;
  --selection-fg: #000000;
}


html.is-inverted img,
html.is-inverted video {
  filter: var(--invert-filter) !important;
}


html.is-inverted .navigation a.active {
  text-decoration: underline !important;
}



/* =========================================================
   Links
   ========================================================= */


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

a.active {
  text-decoration: underline;
}



  
/* =========================================================
   Page scaffold (nav + page)
   ========================================================= */


.page-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: #fff;
}

.navigation {
  background: #FFFFFF;
  color: #000000;
  width: 300px;
  padding: 2rem;
  overflow-y: auto;
  flex-shrink: 0;
}

.navigation *{
  color: inherit !important;
  filter: none !important;
}

.page {
  width: 100%;
  padding: 2rem;
  overflow-y: auto;
  order: 2;
  background: #fff;
}

.navigation ul {
  list-style: none;
}

.navigation li {
  margin-bottom: 1rem;
}

.navigation a {
  font-weight: normal;
}

.NavItemToggle.open::after {
  content: '–';
  padding-left: .5rem;
}

.NavSubItemContainer {
  list-style: none;
  margin: 0;
  padding-left: 1.2rem;
}

.NavSubItem {
  margin: .25rem 0 .25rem 1rem !important;
}



  
/* =========================================================
   Media helpers (grid & box)
   ========================================================= */


.wrap {
  margin-bottom: 2rem;
}

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

.wrap-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.wrap-grid .img-box {
  position: relative;
  width: 100%;
  padding-top: 75%;
  border: .5px solid #000;
  overflow: hidden;
}

.wrap-grid .img-box img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: .5px solid #000;
}

.img-box {
  position: relative;
  width: 100%;
  padding-top: 75%;
  overflow: hidden;
  border: .5px solid #000;
  container-type: inline-size;
}

.img-box img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter .3s ease;
}

/* Hover blur overlay + memo */


.img-box::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  backdrop-filter: blur(3px) brightness(.4);
  opacity: 0;
  transition: opacity .3s ease;
  z-index: 1;
  pointer-events: none;
}

.img-box .memo {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 0.7rem;
  text-align: center;

  pointer-events: none;
  white-space: pre-line;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
}



.img-box:hover::before,
.img-box:hover .memo {
  opacity: 1;
}

.img-box a {
  display: block;
  width: 100%;
  height: 100%;
}

/* Mobile blur helpers */


.img-box.mobile-blur::before {
  opacity: 1;
}

.img-box.mobile-blur .memo {
  opacity: 1;
}



  
/* =========================================================
   Buttons
   ========================================================= */


.contact-and-toggle {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-top: 1rem;
}

.pill-btn {
  display: inline-block;
  padding: .4em 1em;
  font-size: .9rem;
  line-height: 1;
  color: #000000;
  background: #FFFFFF;
  border: 1px solid #000000;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}



  
/* =========================================================
   Screensaver overlay
   ========================================================= */


.screensaver {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  height: 100svh;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
  background: var(--saver-bg, #FFFFFF);
  color: var(--saver-fg, #000000);
  padding: env(safe-area-inset-top, 0)
           env(safe-area-inset-right, 0)
           env(safe-area-inset-bottom, 0)
           env(safe-area-inset-left, 0);
}

.screensaver.on {
  opacity: 1;
  pointer-events: auto;
}

.screensaver .content {
  text-align: center;
  max-width: 80%;
  line-height: 1.6;
}

/* Screensaver/selection color tokens */


:root {
  --saver-bg: #FFFFFF;
  --saver-fg: #000000;
  --selection-bg: #ff3b30;
  --selection-fg: #FFFFFF;
}



/* =========================================================
   Selection color (essay scope)
   ========================================================= */


.page--essay ::selection {
  background: var(--selection-bg);
  color: var(--selection-fg);
}

.page--essay ::-moz-selection {
  background: var(--selection-bg);
  color: var(--selection-fg);
}



  
/* =========================================================
   Essay: 3-column layout & tokens
   ========================================================= */


.page--essay {
  --page-pad: 32px;
  padding-inline: var(--page-pad);
}

.page--essay .posts-text-3grid {
  width: clamp(960px, 70vw, 1400px);
  margin-inline: auto;
  --gutter: clamp(20px, 4vw, 40px);
  --right-w: clamp(140px, 12vw, 200px);
  --sticky-top: 96px;
  display: grid;
  gap: var(--gutter);
  grid-template-columns:
    minmax(220px, 1fr)
    minmax(480px, 2fr)
    minmax(var(--right-w), 1fr);
}

/* sticky left/right columns */


.page--essay .posts-text-3grid_left,
.page--essay .posts-text-3grid_notes {
  align-self: start;
  position: sticky;
  top: var(--sticky-top);
}

/* Left meta (title/author/media) */


.page--essay .posts-text-3grid_title {
  font-weight: 700;
  font-size: 20px;
  line-height: 1.35;
  font-family: "Nanum Myeongjo", serif;
  margin: 0 0 .5rem;
}

.page--essay .posts-text-3grid_author {
  font-weight: 400;
  font-size: 14px;
  line-height: 1.6;
  font-family: "Nanum Myeongjo", serif;
  color: #666;
  margin-bottom: 1rem;
}

.page--essay .posts-text-3grid_media {
  margin: 1.25rem 0 0;
}

.page--essay .posts-text-3grid_media img {
  width: 100%;
  height: auto;
  display: block;
}

.page--essay .posts-text-3grid_media figcaption {
  font-size: 12px;
  color: #888;
  margin-top: .35rem;
}

/* Center column (body) */


.page--essay .posts-text-3grid_body {
  font-weight: 400;
  font-size: 16px;
  line-height: 1.85;
  font-family: "Nanum Myeongjo", serif;
  color: #000;
}


/* Paragraph block + roman numbers */


.page--essay {
  --para-num-gutter: 2rem;
}

.page--essay .posts-text-3grid_body .para {
  position: relative;
  padding: 18px 0 22px;
  margin: 18px 0 24px;
  counter-increment: sec;
  scroll-margin-top: calc(var(--sticky-top) + 16px);
}

.page--essay .posts-text-3grid_body .para::before {
  content: counter(sec, upper-roman);
  position: absolute;
  left: calc(0px - var(--para-num-gutter));
  top: 0;
  color: #000;
  font-weight: 700;
  font-size: 10px;
  line-height: 1;
  font-family: "Nanum Myeongjo", serif;
  letter-spacing: .08em;
}

.para {
  transition: opacity .3s ease;
}

  /* Superscript (footnote numbers) */
.page--essay sup {
  font-size: 0.7em; /* 현재보다 작게 */
  line-height: 1;
  vertical-align: super;
}
  

/* Blockquote (indent + italic) */


blockquote {
  padding-left: 1em;
  margin-left: 0;
  border-left: none;
}

.page--essay .posts-text-3grid_body blockquote {
  font-style: italic;
  color: #6c7176;
  margin: 0 0 .5rem;
}

.page--essay .posts-text-3grid_body .kicker.em {
  font-style: italic;
  color: #333;
}

.page--essay .posts-text-3grid_body .cite {
  color: #6c7176;
  margin: .25rem 0 0;
}

/* Sidenotes: container absolute, items flow */


.page--essay .posts-text-3grid_body .sidenotes {
  position: absolute;
  top: 0;
  left: calc(100% + var(--gutter));
  width: var(--right-w);
}

.page--essay .posts-text-3grid_body .sidenote {
  position: static;
  font: 11px/1.6 "Nanum Myeongjo",serif;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 0 0 .6rem 0;
  transition: opacity .2s ease, filter .2s ease;
}

/* Note numbers (from JS data-note) */


.page--essay .posts-text-3grid_body .sidenote::before {
  content: attr(data-note) " ";
  font-weight: 700;
}

/* Global right-column notes (optional) */


.page--essay .posts-text-3grid_notes {
  font: 11px/1.6 "Nanum Myeongjo",serif;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.page--essay .posts-text-3grid_notes .notes {
  list-style: decimal;
  padding-left: 1.2rem;
  margin: 0;
}

.page--essay .posts-text-3grid_notes .notes li {
  margin-bottom: .9rem;
}

/* In-text note refs */


.page--essay .posts-text-3grid_body .note-ref {
  font-weight: 700;
  cursor: pointer;
  user-select: text;
  -webkit-user-select: text;
}

.page--essay .note-ref::selection,
.page--essay .note-ref sup::selection {
  background: var(--selection-bg);
  color: #fff;
}

.page--essay .note-ref::-moz-selection,
.page--essay .note-ref sup::-moz-selection {
  background: var(--selection-bg);
  color: #fff;
}

.page--essay .note-ref {
  -webkit-tap-highlight-color: transparent;
}

/* Sidenotes dim mode */


.page--essay.sidenotes-dim .sidenote {
  opacity: .2;
  filter: saturate(.6);
}

.page--essay.sidenotes-dim .sidenote--active {
  opacity: 1 !important;
  filter: none !important;
}



  
/* =========================================================
   Lightweight ToC (optional)
   ========================================================= */


.toc {
  margin-top: 1.25rem;
}

.toc__title {
  display: block;
  margin-bottom: .5rem;
  font-weight: 700;
}

.toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: .35rem;
}

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

.toc__list a:hover {
  text-decoration: underline;
}



  
/* =========================================================
   Responsive ≤ 800px
   - 3칼럼 → 1칼럼
   - 번호는 본문 왼쪽 바깥으로 살짝
   - 사이드노트는 본문 아래로
   ========================================================= */


@media (max-width: 800px) {

  html,
  body {
    height: auto;
    overflow: auto;
  }

  .page-container {
    flex-direction: column;
    height: auto !important;
    overflow: visible !important;
  }

  .navigation {
    width: 100%;
    order: 1;
    padding: 2rem;
    position: relative;
    overflow: visible !important;
  }

  .page {
    order: 2;
    height: auto !important;
    overflow: visible !important;
  }

  .wrap-grid {
    grid-template-columns: 1fr;
  }

  .page--essay {
    --page-pad: 32px;
    --num-outside-gap: .4em;
    padding-inline: var(--page-pad);
  }

  .page--essay .posts-text-3grid {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .page--essay .posts-text-3grid_left,
  .page--essay .posts-text-3grid_notes {
    position: static;
  }

  .page--essay .posts-text-3grid_left {
    order: -1;
  }

  .page--essay .posts-text-3grid_notes {
    margin-top: 1.5rem;
    font-size: 12px;
  }

  .page--essay .posts-text-3grid_body .para {
    display: block;
    padding-left: 0;
    position: relative;
  }

  .page--essay .posts-text-3grid_body .para::before {
    position: absolute !important;
    left: 0;
    transform: translateX(calc(0% - var(--num-outside-gap)));
    top: .05em;
    font-size: .8rem;
    line-height: 1;
  }

  .page--essay .posts-text-3grid_body .sidenotes {
    position: static;
    width: auto;
    margin-top: .5rem;
  }

  .page--essay .posts-text-3grid_body .sidenote {
    text-transform: none;
    letter-spacing: 0;
    font-size: 12px;
    color: #666;
  }
  
    .img-box {
    -webkit-text-size-adjust: 100%;
            text-size-adjust: 100%;
  }

  /* 링크가 감싸는 경우 상속 꼬임 방지 */
  .img-box a {
    font-size: inherit !important;
  }

  /* 메모 텍스트 ‘크기 고정’ + 강제 우선순위 */
  .img-box .memo {
    font-size: 12px !important;  /* px로 고정: 접근성 확대 설정의 영향 최소화 */
    line-height: 1.4 !important;
    max-width: 86%;              /* 줄바꿈 유도 → 자동확대 트리거 완화 */
    -webkit-text-size-adjust: 100%;
            text-size-adjust: 100%;
  }
  
}

