/* 다크모드: 기기(PC·휴대폰)가 다크 설정이면 자동 적용. "스탠드만 켜 둔 밤의 서재" */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --color-bg-canvas: #1c1916;
    --color-surface: #26221e;
    --color-surface-pure: #221e1b;
    --color-text-main: #ece3d6;
    --color-text-sub: #b9ad9e;
    --color-text-muted: #887d70;
    --color-border: #3a332c;
    --color-accent: #e0a15e;
    --color-seal-red: #a8442c;
    --color-seal-link: #5f9a78;
    --shadow-soft: 0 16px 40px rgba(0, 0, 0, .35);
    --shadow-card: 0 8px 24px rgba(0, 0, 0, .3);
  }

  html body {
    background:
      radial-gradient(circle at 14% 6%, rgba(224, 161, 94, .07), transparent 30rem),
      radial-gradient(circle at 88% 84%, rgba(95, 154, 120, .05), transparent 32rem),
      var(--color-bg-canvas);
  }

  html .site-header { border-bottom-color: rgba(58, 51, 44, .8); background: rgba(28, 25, 22, .9); }
  html .site-footer { background: rgba(38, 34, 30, .6); }
  html .tag { background: rgba(38, 34, 30, .8); }

  /* 그림(SVG 장면)은 불을 낮춘 듯 어둡게 */
  html .hub-card__art svg,
  html .post-figure__art svg,
  html .about-hero__art svg,
  html .empty-art svg { filter: brightness(.6) saturate(.85) contrast(1.05); }
  html .hub-card__art::after { opacity: .12; mix-blend-mode: screen; }

  /* 공간별 머리 영역 */
  html .notes-hero {
    background-color: #24201c;
    background-image:
      linear-gradient(rgba(201, 170, 130, .08) 1px, transparent 1px),
      linear-gradient(90deg, rgba(201, 170, 130, .08) 1px, transparent 1px);
    background-size: 20px 20px, 20px 20px;
  }
  html .pencil-line { border-bottom-color: rgba(224, 190, 150, .25); }

  html .books-hero {
    border-color: #4a3d30;
    background:
      radial-gradient(ellipse at 82% 0%, rgba(224, 161, 94, .16), transparent 55%),
      repeating-linear-gradient(4deg, rgba(0, 0, 0, .15) 0 1px, transparent 1px 19px),
      linear-gradient(135deg, #3a2f25, #2b231d);
  }
  html .books-hero::after { background: linear-gradient(#5a4634, #4a3a2c); }
  html .shelf-wrap {
    border-color: #4a3d30;
    background:
      radial-gradient(ellipse at 75% 10%, rgba(224, 161, 94, .14), transparent 50%),
      repeating-linear-gradient(8deg, rgba(0, 0, 0, .14) 0 1px, transparent 1px 24px),
      linear-gradient(180deg, #3a2f25, #2e251f);
  }
  html .shelf-board { border-top-color: #6b5440; background: linear-gradient(#5e4936, #4a3a2c); }
  html .book-spine,
  html .book-cover { filter: brightness(.78) saturate(.9); }
  html .view-tab.is-active { background: #8a6b4f; }

  html .travel-hero { background: #24211c; }
  html .contour-map { color: #c9b08f; opacity: .14; }
  html .travel-scene { filter: brightness(.7) saturate(.85); }

  html .vault-page {
    background:
      radial-gradient(circle at 48% 12%, rgba(224, 161, 94, .08), transparent 30rem),
      var(--color-bg-canvas);
  }
  html .vault-hero {
    border-color: #4a3f34;
    background:
      radial-gradient(circle at 78% 28%, rgba(224, 161, 94, .12), transparent 24%),
      #25211d;
    box-shadow: inset 0 0 0 6px rgba(34, 30, 27, .6), var(--shadow-soft);
  }
  html .unlock-state { border-color: rgba(95, 154, 120, .4); color: #9fd0b2; background: rgba(95, 154, 120, .12); }
  html .vault-hero::before { border-color: rgba(201, 170, 130, .22); }
  html .vault-tab { border-color: #4a3d30; color: #c9b8a2; background: #2e271f; }
  html #tab-diary:checked ~ .vault-tabs .tab-diary,
  html #tab-folio:checked ~ .vault-tabs .tab-folio { color: #fffaf0; background: #8a6b4f; }
  html .drawer {
    border-color: #4a3d30;
    background:
      repeating-linear-gradient(3deg, rgba(0, 0, 0, .14) 0 1px, transparent 1px 19px),
      linear-gradient(145deg, #3a2f25, #2e251f);
    box-shadow: inset 0 0 22px rgba(0, 0, 0, .25), 0 12px 28px rgba(0, 0, 0, .3);
  }
  html .drawer-heading { border-bottom-color: rgba(201, 170, 130, .2); }
  html .diary-card,
  html .project-card { border-color: #3a332c; box-shadow: 0 4px 12px rgba(0, 0, 0, .3); }
  html .project-file { filter: brightness(.75) saturate(.9); }

  /* 글 상세 */
  html .post-sheet::before {
    background:
      linear-gradient(90deg, transparent 0 46px, rgba(168, 68, 44, .45) 46px 47px, transparent 47px),
      repeating-linear-gradient(180deg, transparent 0 9px, rgba(201, 170, 130, .12) 9px 10px),
      linear-gradient(180deg, #2a241f, rgba(42, 36, 31, 0));
  }
  html .post-head { border-bottom-color: #3f372f; }
  html .toc { border-left-color: #b8904f; }
  html .post-body code { background: #332c26; }
  html .code-box code { background: none; }
  html .post-body mark { background: linear-gradient(transparent 58%, rgba(224, 161, 94, .3) 58%); }
  html .post-body blockquote { border-left-color: #6b5a47; }
  html .code-box { border-color: #3f372f; background: #1f1b18; }
  html .code-box__bar { border-bottom-color: #3a332c; background: #2a241f; }
  html .code-box pre { color: #e4dacb; }
  html .c-key { color: #e0a15e; }
  html .c-str { color: #9bc191; }
  html .c-com { color: #7f7468; }
  html .comment-box {
    border-color: #4a3f34;
    background:
      repeating-linear-gradient(180deg, transparent 0 31px, rgba(201, 170, 130, .1) 31px 32px) 0 32px / 100% 32px,
      var(--color-surface-pure);
  }

  /* 소개 */
  html .about-hero {
    background:
      radial-gradient(ellipse at 82% 20%, rgba(224, 161, 94, .18), transparent 55%),
      linear-gradient(135deg, #2a241f, #221e1b);
  }
  html .about-letter .sign b { border-color: #5a4c3e; }

  /* 링크 공개 포트폴리오 */
  html .share-note { border-color: rgba(95, 154, 120, .4); background: rgba(95, 154, 120, .08); }
  html .folio { border-color: #4a3d30; }
  html .folio-cover { filter: none; background-color: #2f3d34; }
  html .folio-cover {
    background:
      linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px),
      linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
      linear-gradient(145deg, #3f5446, #2c3b31);
    background-size: 18px 18px, 18px 18px, auto;
  }
  html .folio-facts { background: rgba(28, 25, 22, .85); color: var(--color-text-main); }
  html .folio-foot { border-top-color: #3f372f; }
  html .folio-foot a { background: #4f7a60; }
  html .shot {
    background:
      repeating-linear-gradient(135deg, transparent 0 12px, rgba(201, 170, 130, .06) 12px 13px),
      var(--color-surface);
  }

  /* 404 */
  html .empty-links a:first-child { background: #8a6b4f; }
}
