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

:root {
  --white:  #ffffff;
  --off:    #f8f7f5;
  --dark:   #1a1814;
  --mid:    #8a8278;
  --light:  #c8c4be;
  --accent: #7a6a52;
  --line:   rgba(26,24,20,0.1);
  --serif:  'Cormorant Garamond', 'Noto Serif KR', Georgia, serif;
}

/* ── Dark mode variables ─────────────────────────────────────────────── */
[data-theme="dark"] {
  --white:  #1c1916;
  --off:    #231f1b;
  --dark:   #ede8e2;
  --mid:    rgb(219 216 212);
  --light:  #4a4540;
  --accent: #9e8e74;
  --line:   rgba(237,232,226,0.1);
}

html { scroll-behavior: auto; }

body {
  background: var(--white);
  color: var(--dark);
  font-family: 'Noto Serif KR', Georgia, serif;
  font-weight: 200;
  overflow-x: hidden;
}

img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ── NAV ─────────────────────────────────────────────────────────────── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--nav-py, 24px) 52px;
}

.nav-logo {
  font-family: var(--serif);
  font-size: 16px; font-weight: 200; letter-spacing: 0.22em;
  color: var(--dark); text-decoration: none;
  transition: opacity 0.3s;
}

.nav-right {
  display: flex; align-items: center; gap: 28px;
}

/* WordPress nav menu reset */
#primary-menu {
  display: flex; align-items: center; gap: 28px;
  list-style: none; margin: 0; padding: 0;
}

#primary-menu li a {
  font-size: 11px; letter-spacing: 0.2em;
  color: var(--mid); text-decoration: none;
  transition: color 0.2s;
}

#primary-menu li a:hover { color: var(--dark); }

/* 하위 메뉴가 있는 상위 항목은 데스크탑에서 클릭 비활성화 */
@media (hover: hover) {
  #primary-menu li:has(.sub-menu) > a { pointer-events: none; cursor: default; }
}

/* Sub-menu dropdown */
#primary-menu li { position: relative; }

#primary-menu .sub-menu {
  display: none;
  position: absolute; top: 150%; left: 0;
  min-width: 140px;
  margin-top: 0;
  padding: 6px 0 6px;
  list-style: none;
  background: var(--white);
  border: 1px solid var(--line);
  flex-direction: column; gap: 0;
}

#primary-menu li:hover > .sub-menu { display: flex; }

#primary-menu .sub-menu li a {
  display: block;
  padding: 8px 16px;
  white-space: nowrap;
}

#primary-menu .sub-menu li a:hover { background: var(--off); }

/* ── HERO ────────────────────────────────────────────────────────────── */
#hero-wrapper { position: relative; height: 200vh; }
#hero-sticky  { position: sticky; top: 0; height: 100vh; overflow: hidden; }

.hero-img {
  position: absolute; inset: 0; opacity: 0;
  background: linear-gradient(135deg, #cfc0aa 0%, #b8a07a 45%, #9a8058 100%);
}
.hero-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.hero-overlay { position: absolute; inset: 0; background: var(--white); opacity: 1; }

.hero-title {
  position: absolute; left: 52px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--serif);
  font-size: clamp(36px, 4.5vw, 60px);
  font-weight: 200; letter-spacing: 0.18em; line-height: 1;
  color: var(--dark); pointer-events: none;
}

.hero-title .sub {
  display: block; font-size: clamp(10px, 1.1vw, 13px);
  font-weight: 200; letter-spacing: 0.32em;
  color: var(--mid); font-style: italic; margin-top: 16px;
}

.scroll-hint {
  position: absolute; bottom: 36px; left: 52px;
  display: flex; align-items: center; gap: 14px;
  font-size: 9px; letter-spacing: 0.25em; color: var(--light);
  pointer-events: none;
}

.scroll-hint-line {
  width: 32px; height: 0.5px; background: var(--light);
  animation: lineAnim 2s ease-in-out infinite; transform-origin: left;
}

@keyframes lineAnim {
  0%,100% { transform: scaleX(1); opacity: 1; }
  50%      { transform: scaleX(0.35); opacity: 0.35; }
}

/* ── SERVICE CARDS ───────────────────────────────────────────────────── */
.services-float {
  position: absolute;
  bottom: 52px; left: 52px; right: 52px;
  display: grid;
  grid-template-columns: repeat(var(--svc-count, 3), 1fr);
  grid-template-rows: auto 1fr;
  column-gap: var(--svc-gap, 16px);
  row-gap: 6px;
  opacity: 0;
  transform: translateY(28px);
  pointer-events: none;
}

/* 레이블: 1열 1행 */
.svc-section-label {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  font-family: var(--serif);
  font-size: clamp(16px, 1.7vw, 21px);
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--light);
  margin: 0;
  padding: 0 2px;
}

/* 카드 3개 모두 2행에 배치 → 동일 높이 */
.svc-card {
  grid-row: 2;
}

.svc-card {
  position: relative;
  background-color: var(--svc-card-bg, rgba(255,255,255,0.52));
  border: 0.5px solid rgba(255,255,255,0.8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: var(--svc-card-padding, 36px 30px 30px);
  cursor: pointer;
  transition: transform 0.35s;
  overflow: hidden;
}

/* 배경 이미지 레이어 — 우측 정렬 + 좌측 그라데이션 마스크 */
.svc-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--svc-card-img, none);
  background-size: cover;
  background-position: right center;
  opacity: var(--svc-card-img-alpha, 0.6);
  transition: opacity 0.35s;
  pointer-events: none;
  z-index: 0;
  /* 이미지 자체에 마스크: 좌 1/3 투명 → 중간 페이드 → 우 1/3 불투명 */
  -webkit-mask-image: linear-gradient(to right, transparent 0%, transparent 33%, black 66%);
  mask-image: linear-gradient(to right, transparent 0%, transparent 33%, black 66%);
}

/* ::after 불필요 — mask-image로 처리 */
.svc-card::after { display: none; }

/* 카드 내용이 이미지 위에 오도록 */
.svc-card > * { position: relative; z-index: 2; }

.svc-card:hover {
  transform: translateY(-5px);
}

.svc-num {
  font-family: var(--serif); font-style: italic;
  font-size: 10px; letter-spacing: 0.25em;
  color: rgba(122,106,82,0.65); margin-bottom: 20px;
}

.svc-title {
  font-family: var(--serif);
  font-size: clamp(14px, 1.4vw, 18px); font-weight: 400;
  line-height: 1.3; color: var(--dark);
  letter-spacing: 0.02em; margin-bottom: 14px;
}

.svc-title em {
  display: block; font-style: italic;
  font-size: 0.75em; color: var(--accent); margin-top: 6px;
}

.svc-desc {
  font-size: 11px; line-height: 2.1;
  color: rgba(26,24,20,0.58); font-weight: 200; margin-bottom: 22px;
}

.svc-link {
  font-size: 9px; letter-spacing: 0.18em; color: var(--accent);
  display: flex; align-items: center; gap: 9px;
  transition: gap 0.3s;
}

.svc-card:hover .svc-link { gap: 16px; }

.svc-link::before {
  content: ''; display: block;
  width: 18px; height: 0.5px; background: currentColor;
}

/* ── GALLERY ─────────────────────────────────────────────────────────── */
#gallery { padding: 120px 0 140px; overflow: hidden; }

.gallery-header {
  padding: 0 52px;
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 56px;
}

.gallery-title {
  font-family: var(--serif);
  font-size: clamp(28px, 3.5vw, 44px); font-weight: 200; letter-spacing: 0.06em;
}

.carousel-wrap { position: relative; }

.c-side-btn {
  position: absolute; top: 0; bottom: 0; width: 60px; z-index: 2;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: var(--dark);
  transition: opacity 0.2s;
}

.c-side-btn--prev {
  left: 0;
  background: linear-gradient(to right, var(--off) 30%, transparent);
}

.c-side-btn--next {
  right: 0;
  background: linear-gradient(to left, var(--off) 30%, transparent);
}

.c-side-btn:hover { opacity: 0.6; }

.carousel-track-wrap { overflow: hidden; padding: 0 52px; }

.carousel-track {
  display: flex; gap: 20px;
  transition: transform 0.7s cubic-bezier(0.16,1,0.3,1);
}

.carousel-item { flex: 0 0 calc(33.333% - 14px); min-width: 240px; }

.carousel-thumb {
  aspect-ratio: 3/4; position: relative; overflow: hidden;
}

.carousel-thumb::after {
  content: attr(data-label);
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 60px 20px 20px;
  background: linear-gradient(transparent, rgba(26,24,20,0.45));
  font-size: 10px; letter-spacing: 0.15em; color: rgba(255,255,255,0.7);
}

.carousel-thumb img { transition: transform 0.7s cubic-bezier(0.16,1,0.3,1); }
.carousel-item:hover .carousel-thumb img { transform: scale(1.04); }

.carousel-thumb.no-thumb {
  background: linear-gradient(135deg,#cfc0aa,#b8a080);
}

.carousel-info { display: none; }

/* ── BLOG ────────────────────────────────────────────────────────────── */
#blog { padding: 140px 52px 160px; background: var(--white); }

.blog-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 64px; border-bottom: 0.5px solid var(--line); padding-bottom: 24px;
}

.blog-title {
  font-family: var(--serif); font-size: clamp(28px,3.5vw,44px);
  font-weight: 200; letter-spacing: 0.06em;
}

.blog-all {
  font-size: 9px; letter-spacing: 0.2em; color: var(--light);
  text-decoration: none; transition: color 0.2s;
}

.blog-all:hover { color: var(--dark); }

.blog-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }

.blog-item {
  opacity: 0; transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.16,1,0.3,1), transform 0.8s cubic-bezier(0.16,1,0.3,1);
}

.blog-item.visible { opacity: 1; transform: translateY(0); }
.blog-item:nth-child(2) { transition-delay: 0.12s; }
.blog-item:nth-child(3) { transition-delay: 0.24s; }

.blog-thumb {
  aspect-ratio: 4/3; overflow: hidden; margin-bottom: 20px;
  background: linear-gradient(135deg,#d8d0c4,#c0b8a8);
}

.blog-thumb img { transition: transform 0.7s cubic-bezier(0.16,1,0.3,1); }
.blog-item:hover .blog-thumb img { transform: scale(1.04); }

.blog-date { font-size: 9px; letter-spacing: 0.2em; color: var(--light); margin-bottom: 8px; }

.blog-post-title {
  font-family: var(--serif); font-size: 17px; font-weight: 200;
  line-height: 1.5; color: var(--dark); margin-bottom: 10px;
}

.blog-excerpt { font-size: 12px; line-height: 2; color: var(--mid); font-weight: 200; }

.blog-read {
  margin-top: 16px; font-size: 9px; letter-spacing: 0.2em; color: var(--light);
  display: flex; align-items: center; gap: 8px; transition: gap 0.3s, color 0.3s;
  text-decoration: none;
}

.blog-item:hover .blog-read { gap: 14px; color: var(--accent); }
.blog-read::before { content: ''; display: block; width: 20px; height: 0.5px; background: currentColor; }

/* ── POST LIST (index.php) ───────────────────────────────────────────── */
.post-list-item {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: start;
}

/* ── FOOTER ──────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--white);
  color: var(--dark);
  padding: 32px 52px 20px;
  border-top: 0.5px solid var(--line, rgba(0,0,0,0.12));
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 26px;
  border-bottom: 0.5px solid var(--line, rgba(0,0,0,0.1));
}

.footer-brand {}

.footer-logo {
  font-family: var(--serif);
  font-size: 18px; letter-spacing: 0.18em;
  color: var(--dark); font-weight: 200;
  margin-bottom: 16px; display: block;
}

.footer-tagline {
  font-size: 11px; line-height: 2; letter-spacing: 0.08em;
  color: var(--light);
}

.footer-col-title {
  font-size: 9px; letter-spacing: 0.25em;
  color: var(--light);
  margin-bottom: 20px; text-transform: uppercase;
}

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

.footer-col ul li { margin-bottom: 12px; }

.footer-col ul li a {
  font-size: 12px; letter-spacing: 0.06em;
  color: var(--dark); opacity: 0.6;
  text-decoration: none; transition: opacity 0.2s;
}

.footer-col ul li a:hover { opacity: 1; }

.footer-bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 10px;
}

.footer-copy {
  font-size: 10px; letter-spacing: 0.1em;
  color: var(--light);
}

/* ── Theme toggle button ─────────────────────────────────────────────── */
.theme-toggle {
  background: none; border: none; cursor: pointer;
  padding: 4px; display: flex; align-items: center; flex-shrink: 0;
}

.theme-toggle-icon {
  width: 13px; height: 13px; border-radius: 50%;
  background: transparent;
  box-shadow: inset -4px -1px 0 2px var(--mid);
  transition: background 0.4s, box-shadow 0.4s;
}

[data-theme="dark"] .theme-toggle-icon {
  background: var(--mid);
  box-shadow: none;
}

/* ── Dark mode overrides (hardcoded colors) ──────────────────────────── */
[data-theme="dark"] .svc-card {
  background: rgba(28,25,22,0.72);
  border-color: rgba(255,255,255,0.08);
}

[data-theme="dark"] .svc-card:hover {
  background: rgba(38,33,28,0.9);
}

/* dark mode ::after 오버라이드 불필요 (mask-image 방식으로 전환됨) */

[data-theme="dark"] .svc-desc {
  color: rgba(237,232,226,0.45);
}

[data-theme="dark"] .carousel-thumb.no-thumb {
  background: linear-gradient(135deg,#2e2822,#1e1a16);
}

[data-theme="dark"] .blog-thumb {
  background: linear-gradient(135deg,#2a2520,#1e1b17);
}


/* ── LIGHTBOX ────────────────────────────────────────────────────────── */
.lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(12,10,8,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  touch-action: none;
}

.lb-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.lb-container {
  display: flex;
  flex-direction: row;
  max-width: 87vw;
  max-height: 87vh;
  background: var(--white, #faf8f5);
  overflow: hidden;
  position: relative;
}

.lb-img-wrap {
  flex: 1 1 auto;
  background: #1a1714;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.lb-img {
  display: block;
  max-width: 100%;
  max-height: 87vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lb-info {
  width: 280px;
  flex-shrink: 0;
  padding: 40px 32px;
  overflow-y: auto;
  border-left: 0.5px solid var(--line, #e8e2da);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.lb-info.lb-info-empty { display: none; }

.lb-info-title {
  font-family: 'Noto Serif KR', serif;
  font-weight: 300;
  font-size: 1.05rem;
  color: var(--ink, #2c2118);
  line-height: 1.5;
  margin-bottom: 8px;
}

.lb-info-material {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--warm-mid, #a0917f);
  text-transform: uppercase;
  margin-bottom: 20px;
}

.lb-sep {
  width: 24px;
  height: 0.5px;
  background: var(--line, #e8e2da);
  margin-bottom: 20px;
}

.lb-info-excerpt {
  font-size: 0.82rem;
  line-height: 1.75;
  color: var(--ink-soft, #7a6e63);
  margin: 0 0 24px;
  flex: 1;
}

.lb-info-link {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--ink, #2c2118);
  text-decoration: none;
  border-bottom: 0.5px solid currentColor;
  padding-bottom: 2px;
  align-self: flex-start;
  transition: opacity 0.2s;
}

.lb-info-link:hover { opacity: 0.55; }

.lb-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--white, #faf8f5);
  opacity: 0.7;
  padding: 4px 6px;
  line-height: 1;
  z-index: 10;
  transition: opacity 0.2s;
}

.lb-close:hover { opacity: 1; }

.lb-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(12,10,8,0.45);
  border: 0.5px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.85);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1010;
  transition: background 0.2s, opacity 0.2s;
}

.lb-nav:hover { background: rgba(12,10,8,0.72); }
.lb-prev { left: 24px; }
.lb-next { right: 24px; }

/* dark mode */
[data-theme="dark"] .lb-container {
  background: #1e1b17;
}

[data-theme="dark"] .lb-info {
  border-left-color: rgba(255,255,255,0.08);
}

[data-theme="dark"] .lb-info-title {
  color: #ede8e2;
}

[data-theme="dark"] .lb-sep {
  background: rgba(255,255,255,0.1);
}

[data-theme="dark"] .lb-info-excerpt {
  color: rgba(237,232,226,0.55);
}

[data-theme="dark"] .lb-info-link {
  color: #ede8e2;
}

[data-theme="dark"] .lb-close {
  color: rgba(237,232,226,0.7);
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  nav { padding: var(--nav-py, 20px) 24px; }
  .hero-title { left: 24px; }
  .scroll-hint { left: 24px; }
  .services-float { left: 24px; right: 24px; bottom: 32px; column-gap: 10px; row-gap: 4px; }
  .svc-desc { display: none; }
  .gallery-header, .carousel-track-wrap { padding: 0 24px; }
  .carousel-item { flex: 0 0 78%; }
  #blog { padding: 100px 24px 120px; }
  .blog-grid { grid-template-columns: 1fr; }
  .post-list-item { grid-template-columns: 1fr; }
  .post-list-main { padding: 100px 24px 120px !important; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 36px; }
  .site-footer { padding: 56px 24px 32px; }
  .footer-bottom { flex-direction: column; gap: 16px; text-align: center; }
}

@media (max-width: 600px) {
  .services-float { grid-template-columns: 1fr; grid-template-rows: auto; }
  .svc-section-label { grid-row: auto; }
  .svc-card { grid-row: auto; }
  nav { flex-wrap: wrap; gap: 6px; }
  .nav-right { width: 100%; justify-content: flex-end; gap: 16px; }
  #primary-menu { gap: 16px; }
  #primary-menu li a { font-size: 8px; }
  .footer-inner { grid-template-columns: 1fr; }

  /* lightbox mobile: 이미지 위, 텍스트 아래 — 합계 95vh */
  .lb-container {
    flex-direction: column;
    width: 95vw;
    max-width: 95vw;
    max-height: 95vh;
    background: #1a1714;
  }
  .lb-img-wrap {
    flex: 1 1 auto;
    min-height: 0;        /* flex shrink 허용 */
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .lb-img {
    max-width: 100%;
    max-height: 100%;     /* wrap 남은 높이에 맞춤 */
    width: auto;
    height: auto;
    object-fit: contain;
  }
  .lb-info {
    position: static;
    flex: 0 0 auto;       /* 콘텐츠 크기만큼만 차지 */
    width: auto;
    border: none;
    border-top: 0.5px solid rgba(255,255,255,0.12);
    background: transparent;
    padding: 8px 12px;
    color: rgba(255, 255, 255, 0.9);
  }
  .lb-info .lb-info-title    { color: rgba(255, 255, 255, 0.92); margin: 0; font-size: 15px; }
  .lb-info .lb-info-material { color: rgba(255, 255, 255, 0.65); margin: 0; }
  .lb-info .lb-info-excerpt  { color: rgba(255, 255, 255, 0.6);  margin: 0; flex: none; }
  .lb-info .lb-info-link     { color: rgba(255, 255, 255, 0.8); }
  .lb-info .lb-sep           { display: none; }
  .lb-info .lb-info-material:empty,
  .lb-info .lb-info-excerpt:empty { display: none; }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
}
