/* 공개 게시판 전용 토큰. 실제 에고리즘 사이트 톤(흰 바탕 + 러스트 주황 + 고딕)에 맞춘다.
   에고리즘 사이트처럼 기기 다크 모드와 상관없이 항상 흰 톤으로 고정한다.
   관리 화면은 style.css를 따로 쓴다. */
:root {
  color-scheme: light;
  --site-bg: #ffffff;
  --site-surface: #ffffff;
  --site-text: #161616;
  --site-muted: #5f5f5f;          /* 대비 6.39 */
  --site-line: #8f8f8f;           /* UI 테두리: 대비 3.23 */
  --site-divider: #ececec;        /* 장식 구분선(상호작용 요소 아님) */
  --site-frame: #e3e3e3;          /* 글 상자 테두리(네이버 카페 본문 영역처럼) */
  --radius-panel: 8px;
  --site-accent: #c2410c;         /* 에고리즘 주황: 흰 바탕 글자·버튼 대비 5.18 */
  --site-on-accent: #ffffff;
  --site-accent-soft: #fff6f0;    /* 연한 살구 바탕 */
  --site-hero-from: #fffdfc;
  --site-hero-to: #fff8f2;
  --site-hero-line: #f3e6dc;      /* 카드 장식 테두리 */
  --site-highlight: rgba(194, 65, 12, 0.22); /* 본문 형광펜(<mark>) */
  --site-underline: #dc2626;      /* 본문 빨간 밑줄(<u>) — 장식선이라 글자 대비 기준 대상 아님 */
  --underline-width: 2px;
  --site-focus: #c2410c;
  --site-on-photo: #ffffff;       /* 사진 위 어두운 그라데이션 위 아이콘 */
  --site-shade: rgba(0, 0, 0, 0.55);
  --site-backdrop: rgba(17, 17, 17, 0.6);

  --font-sans: "Pretendard", "Pretendard Variable", system-ui, -apple-system, "Malgun Gothic", sans-serif;

  --text-body: 17px;
  --text-small: 14px;
  --text-tiny: 12px;
  --text-label: 13px;
  --text-h1: clamp(26px, 6vw, 34px);
  --text-h2: 22px;
  --text-h3: 18px;
  --leading-body: 1.8;
  --leading-title: 1.35;
  --tracking-wide: 0.16em;
  --weight-bold: 700;
  --weight-heavy: 800;

  --gap-1: 4px;
  --gap-2: 8px;
  --gap-3: 12px;
  --gap-4: 16px;
  --gap-5: 24px;
  --gap-6: 40px;
  --gap-7: 64px;

  --measure: 680px;               /* 읽기 편한 본문 폭 */
  --tap-height: 52px;
  --logo-height: 28px;   /* 로고 가로 약 210px — 너무 크지 않게(사용자 요청 2026-11-26) */
  --radius-thumb: 4px;
  --thumb-ratio: 3 / 4;           /* 인스타 프로필 격자 비율: 릴스 커버 글씨가 잘리지 않는 선 */
  --veil-height: 30%;             /* 영상 격자 아래쪽을 덮는 흐림 영역 */
  --veil-blur: 2px;
  --lock-overlap: 40px;           /* 마지막 카드가 흐린 격자 아랫부분에 겹치는 정도 */
  --site-veil-clear: rgba(255, 255, 255, 0);
  --radius-btn: 10px;
  --radius-card: 16px;
  --line-width: 1px;
  --accent-bar: 2px;
  --quote-bar: 3px;
  --transition: 150ms ease;
  --z-masthead: 10;
}

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

body {
  margin: 0;
  background: var(--site-bg);
  color: var(--site-text);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  word-break: keep-all;           /* 한글이 단어 중간에서 끊기지 않게 */
  overflow-wrap: break-word;
}

a { color: inherit; }
a:focus-visible, button:focus-visible {
  outline: 3px solid var(--site-focus);
  outline-offset: 3px;
}

.eyebrow {
  margin: 0;
  font-size: var(--text-label);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wide);
  color: var(--site-accent);
}

/* 머리: 가운데 로고 + 슬로건 + 탭 (실제 에고리즘 사이트와 같은 배치) */
.masthead {
  position: relative;
  z-index: var(--z-masthead);
  background: var(--site-bg);
  border-bottom: var(--line-width) solid var(--site-divider);
}
/* 머리는 화면 위에 붙여 두지 않고 글과 같이 스크롤된다(PC·휴대폰 모두, 사용자 결정 2026-11-26).
   붙여 두면 아이폰 사파리에서 주소창이 작아질 때 머리 위 틈으로 본문이 비쳐 보였다(흰 덮개로도 못 막음). */
.masthead__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-1);
  padding: var(--gap-4) var(--gap-4) var(--gap-3);
  text-decoration: none;
}
.masthead__logo { height: var(--logo-height); width: auto; display: block; }
.masthead__slogan {
  font-size: var(--text-tiny);
  font-weight: var(--weight-heavy);
  letter-spacing: var(--tracking-wide);
  color: var(--site-accent);
}
.masthead__sub { font-size: var(--text-tiny); color: var(--site-muted); }

.tabs {
  display: flex;
  justify-content: center;
  gap: var(--gap-6);
  border-top: var(--line-width) solid var(--site-divider);
}
.tab {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-height);
  font-weight: var(--weight-bold);
  white-space: nowrap;
  text-decoration: none;
  border-bottom: var(--accent-bar) solid transparent;
}
.tab[aria-current="page"] { color: var(--site-accent); border-bottom-color: var(--site-accent); }
.tab:hover { color: var(--site-accent); }

@media (max-width: 479px) {
  .masthead__sub { display: none; }   /* 좁은 화면에서는 슬로건 한 줄만 */
  .tabs { gap: var(--gap-5); }
  .tab { font-size: var(--text-small); }
}

.main { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gap-4); }

/* 버튼 */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-height);
  padding: var(--gap-2) var(--gap-5);
  border-radius: var(--radius-btn);
  font-weight: var(--weight-bold);
  text-align: center;
  text-decoration: none;
  transition: transform var(--transition), filter var(--transition);
}
.btn:hover { filter: brightness(0.92); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--site-accent); color: var(--site-on-accent); }

/* 글 */
.article {
  margin-top: var(--gap-5);
  padding: var(--gap-5) var(--gap-5) var(--gap-2);
  border: var(--line-width) solid var(--site-frame);
  border-radius: var(--radius-panel);
}
@media (max-width: 479px) { .article { padding-inline: var(--gap-4); } }
.article__title {
  margin: var(--gap-2) 0;
  font-size: var(--text-h1);
  font-weight: var(--weight-heavy);
  line-height: var(--leading-title);
}
.article__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-3);
  margin: 0 0 var(--gap-5);
  padding-bottom: var(--gap-3);
  border-bottom: var(--line-width) solid var(--site-divider);
}
.article__date { color: var(--site-muted); font-size: var(--text-small); }
.copy-url {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-1);
  min-height: 36px;
  padding: 0 var(--gap-2);
  border: 0;
  border-radius: var(--radius-btn);
  background: none;
  color: var(--site-text);
  font: inherit;
  font-size: var(--text-small);
  cursor: pointer;
}
.copy-url:hover { background: var(--site-accent-soft); color: var(--site-accent); }
.copy-url svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
/* 복사 결과 알림: 화면 아래 가운데 잠깐 */
.copy-toast {
  position: fixed;
  left: 50%;
  bottom: var(--gap-6);
  transform: translateX(-50%);
  z-index: var(--z-masthead);
  max-width: calc(100% - 2 * var(--gap-4));
  margin: 0;
  padding: var(--gap-2) var(--gap-4);
  border-radius: 999px;
  background: var(--site-text);
  color: var(--site-bg);
  font-size: var(--text-small);
  word-break: break-all;
}
.copy-toast[hidden] { display: none; }

.video-link {
  display: block;
  margin-bottom: var(--gap-5);
  padding: var(--gap-3) var(--gap-4);
  border-radius: var(--radius-btn);
  background: var(--site-accent-soft);
  font-weight: var(--weight-bold);
  color: var(--site-accent);
  text-decoration: none;
}
.video-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.prose { margin-bottom: var(--gap-6); }
.prose h1, .prose h2 { font-size: var(--text-h2); font-weight: var(--weight-heavy); line-height: var(--leading-title); margin: var(--gap-6) 0 var(--gap-3); }
.prose h3 { font-size: var(--text-h3); margin: var(--gap-5) 0 var(--gap-2); }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 var(--gap-5); }
.prose li { margin-bottom: var(--gap-2); }
.prose li::marker { color: var(--site-accent); }
.prose mark { background: linear-gradient(transparent 55%, var(--site-highlight) 55%); color: inherit; padding: 0 1px; }
.prose u { text-decoration: underline var(--site-underline) var(--underline-width); text-underline-offset: 4px; }
.prose a { color: var(--site-accent); text-underline-offset: 4px; }
.prose img { display: block; max-width: 100%; height: auto; margin: var(--gap-5) auto; border-radius: var(--radius-card); }
.prose blockquote {
  margin: var(--gap-5) 0;
  padding: var(--gap-3) var(--gap-4);
  border-left: var(--quote-bar) solid var(--site-accent);
  border-radius: 0 var(--radius-btn) var(--radius-btn) 0;
  background: var(--site-accent-soft);
}
.prose blockquote p { margin: 0; }

.empty { padding: var(--gap-7) 0; text-align: center; color: var(--site-muted); }

/* 에고리즘으로 보내는 카드(실제 사이트 첫 화면 카드와 같은 결) */
.go-site {
  margin: var(--gap-5) 0;
  padding: var(--gap-6) var(--gap-5);
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, var(--site-hero-from), var(--site-hero-to));
  border: var(--line-width) solid var(--site-hero-line);
  text-align: center;
}
.go-site__title { margin: var(--gap-2) 0 0; font-size: var(--text-h2); font-weight: var(--weight-heavy); line-height: var(--leading-title); }
.go-site__text { margin: var(--gap-2) 0 var(--gap-5); color: var(--site-muted); }
/* 영상 격자 끝(흐린 자리)에 겹쳐 올리는 형태 */
.go-site--over {
  position: relative;
  z-index: 3;
  margin-top: calc(-1 * var(--lock-overlap));
}
.go-site__lock {
  display: inline-grid;
  place-items: center;
  width: var(--tap-height);
  height: var(--tap-height);
  margin-bottom: var(--gap-3);
  border-radius: 50%;
  background: var(--site-bg);
  border: var(--line-width) solid var(--site-hero-line);
  color: var(--site-accent);
}

/* 추가 영상 더 보기 */
.videos { margin: var(--gap-6) 0; display: flex; flex-direction: column; gap: var(--gap-3); }
.videos__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap-1);              /* 인스타 프로필 격자처럼 촘촘하게 */
}
.videos__item {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: var(--radius-thumb);
  background: var(--site-divider);
  cursor: pointer;
  aspect-ratio: var(--thumb-ratio);
  overflow: hidden;
}
.videos__item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform var(--transition); }
.videos__item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 55%, var(--site-shade));
}
.videos__item:hover img { transform: scale(1.04); }
.videos__meta {
  position: absolute;
  left: var(--gap-2);
  right: var(--gap-2);
  bottom: var(--gap-1);
  z-index: 1;
  display: flex;
  align-items: center;
  color: var(--site-on-photo);
  font-size: var(--text-tiny);
  font-weight: var(--weight-bold);
}

/* 잠금: 둘째 줄부터 흰색으로 흐려지며 '여기부터는 에고리즘에서' */
.videos__stage { position: relative; }
.videos__veil {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--veil-height);
  background: linear-gradient(180deg, var(--site-veil-clear) 0%, var(--site-bg) 96%);
  backdrop-filter: blur(var(--veil-blur));
  -webkit-backdrop-filter: blur(var(--veil-blur));
  /* 마스크의 #000은 색이 아니라 '불투명'을 뜻한다: 위쪽은 흐림 없이, 아래로 갈수록 흐리게 */
  mask-image: linear-gradient(180deg, transparent 0%, #000 40%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 40%);
  pointer-events: none;           /* 흐린 영역 아래 썸네일도 눌리면 같은 안내 창이 뜬다 */
  z-index: 2;                     /* 썸네일 위 조회수 글자(z-index 1)까지 덮는다 */
}

/* 이전 글 하나 */
.previous { margin: var(--gap-6) 0; display: flex; flex-direction: column; gap: var(--gap-3); }
.previous__card {
  display: flex;
  flex-direction: column;
  gap: var(--gap-1);
  width: 100%;
  padding: var(--gap-4) var(--gap-5);
  background: var(--site-surface);
  border: var(--line-width) solid var(--site-line);
  border-radius: var(--radius-card);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: border-color var(--transition), transform var(--transition);
}
.previous__card:hover { border-color: var(--site-accent); transform: translateY(-1px); }
.previous__title { font-size: var(--text-h3); font-weight: var(--weight-bold); line-height: var(--leading-title); }
.previous__date { font-size: var(--text-small); color: var(--site-muted); }
.previous__lock {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-1);
  margin-top: var(--gap-1);
  font-size: var(--text-small);
  font-weight: var(--weight-bold);
  color: var(--site-accent);
}
.previous__more { align-self: center; font-size: var(--text-small); font-weight: var(--weight-bold); color: var(--site-accent); text-underline-offset: 4px; }

/* 에고리즘에서 글 확인하기 창 */
.come {
  width: min(calc(100% - 2 * var(--gap-4)), 380px);
  padding: 0 var(--gap-5) var(--gap-5);
  border: var(--line-width) solid var(--site-line);
  border-radius: var(--radius-card);
  background: var(--site-surface);
  color: var(--site-text);
  text-align: center;
  overflow: hidden;
}
.come::backdrop { background: var(--site-backdrop); }
.come__mast {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-1);
  margin: 0 calc(-1 * var(--gap-5)) var(--gap-5);
  padding: var(--gap-5) 0 var(--gap-4);
  background: linear-gradient(180deg, var(--site-hero-from), var(--site-hero-to));
  border-bottom: var(--line-width) solid var(--site-hero-line);
}
.come__mast img { height: var(--logo-height); width: auto; display: block; }
.come__slogan { font-size: var(--text-tiny); font-weight: var(--weight-heavy); letter-spacing: var(--tracking-wide); color: var(--site-accent); }
.come__title { margin: 0 0 var(--gap-2); font-size: var(--text-h2); font-weight: var(--weight-heavy); }
.come__text { margin: 0 0 var(--gap-5); color: var(--site-muted); }
.come__close {
  margin-top: var(--gap-3);
  min-height: var(--tap-height);
  padding: 0 var(--gap-5);
  border: 0;
  background: transparent;
  color: var(--site-muted);
  font: inherit;
  font-size: var(--text-small);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

/* 하단 */
.footer {
  margin-top: var(--gap-7);
  padding: var(--gap-6) var(--gap-4);
  border-top: var(--line-width) solid var(--site-divider);
  text-align: center;
  font-size: var(--text-small);
  color: var(--site-muted);
}
.footer__logo { height: var(--logo-height); width: auto; margin-bottom: var(--gap-3); }
.footer__links { margin: 0; }
.footer__links a { text-underline-offset: 4px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* 이전 글·추가 영상 제목 줄: 네이버 카페 메뉴처럼 아래 구분선으로 구역을 나눈다 */
.previous > .eyebrow, .videos > .eyebrow {
  padding-bottom: var(--gap-2);
  border-bottom: var(--line-width) solid var(--site-frame);
}
