/* ============================================================
   홍해진 포트폴리오
   - 레퍼런스: agency-grid-layout-minimal / container-lines /
     beautiful-shadows / staggered-word-reveal (히어로 1회)
   - 차트 색은 dataviz 검증기 통과분만 사용 (모드별로 다름)
   ============================================================ */

:root {
  color-scheme: light dark;

  --bg:        #fcfcfb;   /* dataviz light surface */
  --surface:   #ffffff;
  --surface-2: #f6f5f1;
  --ink:       #1a1a19;
  --ink-2:     #55534e;
  --ink-3:     #8a8880;
  --line:      #e6e4de;
  --line-2:    #d8d5cc;

  --accent:     #0d8695;  /* 인터랙티브·텍스트 (대비 확보) */
  --accent-tint:#e8f6f7;
  --s-d102:     #4abcc7;  /* 차트 시리즈 — light 검증 통과 */
  --s-ilb:      #b8923f;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

  --sh-1: 0 1px 2px rgb(0 0 0 / .05), 0 1px 1px rgb(0 0 0 / .04);
  --sh-2: 0 2px 4px rgb(0 0 0 / .04), 0 6px 14px rgb(0 0 0 / .05);
  --img-ring: oklch(0 0 0 / .1);

  --wrap: 1080px;
  --pad: clamp(1.25rem, 4vw, 2.5rem);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

:root[data-theme="dark"] {
  --bg:        #1a1a19;   /* dataviz dark surface */
  --surface:   #232320;
  --surface-2: #2b2b27;
  --ink:       #f2f1ed;
  --ink-2:     #b3b0a8;
  --ink-3:     #85827a;
  --line:      #35342f;
  --line-2:    #43423b;

  --accent:     #58c6d0;
  --accent-tint:#123033;
  --s-d102:     #0097a2;  /* 차트 시리즈 — dark 검증 통과 */
  --s-ilb:      #a07918;

  --sh-1: 0 1px 2px rgb(0 0 0 / .4);
  --sh-2: 0 2px 6px rgb(0 0 0 / .45), 0 10px 24px rgb(0 0 0 / .3);
  --img-ring: oklch(1 0 0 / .1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1a19; --surface: #232320; --surface-2: #2b2b27;
    --ink: #f2f1ed; --ink-2: #b3b0a8; --ink-3: #85827a;
    --line: #35342f; --line-2: #43423b;
    --accent: #58c6d0; --accent-tint: #123033;
    --s-d102: #0097a2; --s-ilb: #a07918;
    --sh-1: 0 1px 2px rgb(0 0 0 / .4);
    --sh-2: 0 2px 6px rgb(0 0 0 / .45), 0 10px 24px rgb(0 0 0 / .3);
    --img-ring: oklch(1 0 0 / .1);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Pretendard, "Pretendard Variable", -apple-system, BlinkMacSystemFont,
               "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.72;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.022em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
b, strong { font-weight: 600; }
.tnum, .num, time { font-variant-numeric: tabular-nums; }

a { color: var(--accent); text-underline-offset: .22em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a, button, summary { -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.skip {
  position: absolute; left: 50%; top: -100px; transform: translateX(-50%);
  z-index: 100; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: .75rem 1.25rem; box-shadow: var(--sh-2); text-decoration: none;
  transition: top .18s var(--ease);
}
.skip:focus-visible { top: .75rem; }

.wrap {
  width: 100%; max-width: var(--wrap); margin-inline: auto;
  padding-inline: max(var(--pad), env(safe-area-inset-left), env(safe-area-inset-right));
}

/* 앵커 이동 시 스티키 상단바에 제목이 가리지 않게 */
:target, .sec, .hero, [id^="work-"] { scroll-margin-top: 76px; }

/* container-lines — 넓은 화면에서만 본문 열을 감싸는 헤어라인 + 코너 틱 */
@media (min-width: 1180px) {
  .sec > .wrap, .hero > .wrap { position: relative; }
  .sec > .wrap::before, .sec > .wrap::after,
  .hero > .wrap::before, .hero > .wrap::after {
    content: ""; position: absolute; top: -1px; bottom: -1px; width: 1px;
    background: var(--line); pointer-events: none;
  }
  .sec > .wrap::before, .hero > .wrap::before { left: 18px; }
  .sec > .wrap::after,  .hero > .wrap::after  { right: 18px; }
}

.note { color: var(--ink-3); font-size: .875rem; line-height: 1.6; }

/* ── 상단바 ─────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1rem;
  padding: .625rem max(var(--pad), env(safe-area-inset-right)) .625rem max(var(--pad), env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.5) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__name { font-weight: 600; letter-spacing: -0.02em; margin-right: auto; }
.topbar__nav { display: flex; gap: .25rem; }
.topbar__nav a {
  color: var(--ink-2); text-decoration: none; font-size: .9375rem;
  padding: .5rem .625rem; border-radius: var(--r-sm);
  min-height: 40px; display: inline-flex; align-items: center;
  transition: color .16s var(--ease), background-color .16s var(--ease);
}
.topbar__nav a:hover { color: var(--ink); background: var(--surface-2); }
@media (max-width: 600px) { .topbar__nav { display: none; } }

.themebtn {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center;
  background: transparent; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: var(--r-md);
  cursor: pointer; transition: color .16s var(--ease), border-color .16s var(--ease), transform .12s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.themebtn:hover { color: var(--ink); border-color: var(--line-2); }
.themebtn:active { transform: scale(.96); }

/* ── 히어로 ─────────────────────────────────────────────── */
.hero { padding: clamp(3.5rem, 11vw, 7.5rem) 0 clamp(2.5rem, 7vw, 4.5rem); }
.hero__who {
  color: var(--ink-3); font-size: .9375rem; letter-spacing: .01em; margin-bottom: 1.5rem;
}
.hero__h {
  font-size: clamp(2rem, 5.6vw, 3.75rem);
  font-weight: 600; letter-spacing: -0.035em; line-height: 1.16;
  max-width: 20ch;
}
.hero__h .w { display: inline-block; }
.hero__sub {
  margin-top: 1.5rem; max-width: 54ch; color: var(--ink-2); font-size: 1.0625rem;
}

.stats {
  margin: clamp(2.5rem, 6vw, 3.5rem) 0 0;
  display: grid; gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.stat { background: var(--surface); padding: 1.375rem 1.5rem; }
.stat dt { color: var(--ink-3); font-size: .875rem; }
.stat dd {
  margin: .375rem 0 0; display: flex; align-items: baseline; gap: .1em;
  font-weight: 600; letter-spacing: -0.03em;
}
.stat .num { font-size: clamp(2rem, 4.5vw, 2.75rem); line-height: 1.05; color: var(--ink); }
.stat .unit { font-size: 1.0625rem; color: var(--ink-2); margin-left: .12em; }
.stat .unit--lead { margin: 0 .2em 0 0; }
.stat__note { margin-top: .5rem; color: var(--ink-3); font-size: .8125rem; line-height: 1.5; }

.cta {
  margin-top: 2rem; display: inline-flex; align-items: center; gap: .55rem;
  min-height: 48px; padding: .75rem 1.25rem;
  background: var(--ink); color: var(--bg); text-decoration: none;
  font-weight: 500; border-radius: var(--r-md); box-shadow: var(--sh-1);
  transition: transform .12s var(--ease), box-shadow .16s var(--ease), opacity .16s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.cta:hover { box-shadow: var(--sh-2); opacity: .93; }
.cta:active { transform: scale(.97); }
.cta svg { flex: none; }
.cta--lg { font-size: 1.0625rem; min-height: 54px; padding: .875rem 1.5rem; }

/* ── 섹션 공통 (container-lines) ────────────────────────── */
.sec { padding: clamp(3.5rem, 9vw, 6rem) 0; border-top: 1px solid var(--line); }
.sec--alt { background: var(--surface-2); }
.sec__head { max-width: 62ch; margin-bottom: clamp(2rem, 5vw, 3rem); }
.sec__head h2 { font-size: clamp(1.5rem, 3.4vw, 2.25rem); font-weight: 600; }
.sec__lead { margin-top: .875rem; color: var(--ink-2); font-size: 1.0625rem; }
.sec__head .note { margin-top: .75rem; }

/* ── 차트 ───────────────────────────────────────────────── */
.fig { margin: 0 0 clamp(2.5rem, 6vw, 3.5rem); }
.fig__cap { margin-bottom: 1rem; }
.fig__cap h3 { font-size: 1.125rem; font-weight: 600; }
.fig__cap p { margin-top: .375rem; color: var(--ink-2); font-size: .9375rem; max-width: 60ch; }
.fig__foot { margin-top: .75rem; color: var(--ink-3); font-size: .8125rem; }

.legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: .875rem; }
.legend span { display: inline-flex; align-items: center; gap: .45rem; font-size: .875rem; color: var(--ink-2); }
.sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.sw--d102 { background: var(--s-d102); }
.sw--ilb  { background: var(--s-ilb); }

.chart {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.25rem;
  overflow-x: auto; overscroll-behavior-x: contain;
}
.chart svg { display: block; width: 100%; height: auto; }
.chart .ax { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .lbl { fill: var(--ink-2); font-size: 12px; }
.chart .val { fill: var(--ink); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .bar { transition: opacity .14s var(--ease); }
.chart .bar:hover { opacity: .82; }
.chart .subhead { fill: var(--ink); font-size: 12px; font-weight: 600; }

.tablewrap { margin-top: .5rem; }
.tablewrap summary {
  cursor: pointer; color: var(--accent); font-size: .9375rem;
  padding: .5rem 0; min-height: 40px; display: flex; align-items: center;
}
.tablescroll { overflow-x: auto; margin-top: .75rem; }
.tablescroll table { border-collapse: collapse; width: 100%; font-size: .875rem; }
.tablescroll caption { text-align: left; color: var(--ink-3); font-size: .8125rem; padding-bottom: .5rem; }
.tablescroll th, .tablescroll td {
  border: 1px solid var(--line); padding: .45rem .7rem; text-align: right;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tablescroll th:first-child, .tablescroll td:first-child { text-align: left; }
.tablescroll thead th { background: var(--surface-2); font-weight: 600; }

/* ── 사례 ───────────────────────────────────────────────── */
.cases { display: grid; gap: clamp(1.25rem, 3vw, 1.75rem); }
.case {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: clamp(1.375rem, 3.5vw, 2rem);
  box-shadow: var(--sh-1);
}
.sec--alt .case { border-color: var(--line-2); }
.case__head h3 { font-size: clamp(1.125rem, 2.2vw, 1.375rem); font-weight: 600; }
.case__one { margin-top: .75rem; color: var(--ink-2); font-size: 1.0625rem; max-width: 66ch; }

.kpis {
  list-style: none; margin: 1.375rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: .5rem;
}
.kpis li {
  display: flex; align-items: baseline; gap: .4rem;
  background: var(--accent-tint); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: var(--r-md); padding: .5rem .75rem;
}
.kpis b { font-size: 1.0625rem; font-weight: 700; color: var(--accent); }
.kpis span { font-size: .8125rem; color: var(--ink-2); }

.case__body {
  margin-top: 1.5rem; display: grid; gap: 1.125rem;
  border-top: 1px solid var(--line); padding-top: 1.375rem;
}
@media (min-width: 860px) { .case__body { grid-template-columns: repeat(3, 1fr); gap: 1.75rem; } }
.pa h4 {
  font-size: .8125rem; font-weight: 600; color: var(--ink-3);
  letter-spacing: .02em; margin-bottom: .4rem;
}
.pa p { font-size: .9375rem; color: var(--ink-2); }

.case__tech {
  margin-top: 1.375rem; padding-top: 1rem; border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: .8125rem; line-height: 1.7;
}
.case__link { margin-top: .625rem; font-size: .875rem; color: var(--ink-3); }
.case__link a { font-weight: 500; }

/* ── 매출 관리 방식 ─────────────────────────────────────── */
.howto { margin-top: clamp(1.5rem, 4vw, 2.25rem); }
.howto > h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: 1rem; }
.howto__grid { display: grid; gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
@media (min-width: 760px) { .howto__grid { grid-template-columns: 1fr 1fr; } }
.howto__grid > div { background: var(--surface); padding: clamp(1.125rem, 2.6vw, 1.5rem); }
.howto__grid h4 { font-size: .9375rem; font-weight: 600; }
.howto__grid p { margin-top: .5rem; color: var(--ink-2); font-size: .9375rem; }

/* ── 사이드 프로젝트 ────────────────────────────────────── */
.side { display: grid; gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
@media (min-width: 780px) { .side { grid-template-columns: repeat(3, 1fr); } }
.side article { background: var(--surface); padding: clamp(1.25rem, 3vw, 1.625rem); }
.side h3 { font-size: 1rem; font-weight: 600; }
.side p { margin-top: .5rem; color: var(--ink-2); font-size: .9375rem; }

/* ── AI 보충 블록 ───────────────────────────────────────── */
.ai-extra { margin-top: 1.75rem; display: grid; gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
@media (min-width: 760px) { .ai-extra { grid-template-columns: 1fr 1fr; } }
.ai-extra > div { background: var(--surface); padding: clamp(1.25rem, 3vw, 1.625rem); }
.ai-extra h3 { font-size: 1rem; font-weight: 600; }
.ai-extra p { margin-top: .625rem; color: var(--ink-2); font-size: .9375rem; }

/* ── 만든 도구 ──────────────────────────────────────────── */
.tools { display: grid; gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
@media (min-width: 820px) { .tools { grid-template-columns: 1fr 1fr; } }
.tool { background: var(--surface); padding: clamp(1.25rem, 3vw, 1.75rem); }
.tool h3 { font-size: 1.0625rem; font-weight: 600; }
.tool > p { margin-top: .625rem; color: var(--ink-2); font-size: .9375rem; }
.tool__kpi { list-style: none; margin: .875rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: .375rem .875rem; }
.tool__kpi li { font-size: .8125rem; color: var(--ink-2); }
.tool__kpi b { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.tool__tech { margin-top: .875rem; padding-top: .75rem; border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: .8125rem; line-height: 1.6; }
.tool__link {
  margin-top: .875rem; display: inline-flex; align-items: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1rem;
  background: var(--accent-tint); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--r-md); font-size: .9375rem; font-weight: 600; text-decoration: none;
  transition: border-color .16s var(--ease), transform .12s var(--ease);
}
.tool__link:hover { border-color: var(--accent); }
.tool__link:active { transform: scale(.97); }
.tool__link svg { flex: none; }
.tool__linknote { margin-top: .5rem; color: var(--ink-3); font-size: .8125rem; }

/* ── AI 활용 ────────────────────────────────────────────── */
.ai-grid { display: grid; gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
@media (min-width: 900px) { .ai-grid { grid-template-columns: repeat(3, 1fr); } }
.ai-col { background: var(--surface); padding: clamp(1.25rem, 3vw, 1.625rem); }
.ai-h3 { font-size: .8125rem; font-weight: 700; color: var(--accent);
  letter-spacing: .04em; padding-bottom: .875rem; border-bottom: 1px solid var(--line); }
.ai-list { margin: 0; }
.ai-list > div { padding: .875rem 0; border-bottom: 1px solid var(--line); }
.ai-list > div:last-child { border-bottom: 0; padding-bottom: 0; }
.ai-list dt { font-size: .9375rem; font-weight: 600; }
.ai-list dd { margin: .375rem 0 0; color: var(--ink-2); font-size: .875rem; line-height: 1.66; }

.proof {
  margin-top: 1.75rem; background: var(--surface);
  border: 1px solid var(--line-2); border-left: 3px solid var(--accent);
  border-radius: var(--r-md); padding: clamp(1.25rem, 3vw, 1.625rem);
}
.proof h3 { font-size: 1rem; font-weight: 600; }
.proof p { margin-top: .625rem; color: var(--ink-2); font-size: .9375rem; max-width: 72ch; }
.proof .note { margin-top: .875rem; }

/* ── 경력 타임라인 ──────────────────────────────────────── */
.tl { list-style: none; margin: 0; padding: 0; }
.tl__item { display: grid; gap: .5rem 2rem; padding: 1.5rem 0; border-top: 1px solid var(--line); }
.tl__item:first-child { border-top: 0; padding-top: 0; }
@media (min-width: 760px) { .tl__item { grid-template-columns: 190px 1fr; } }
.tl__when { color: var(--ink-3); font-size: .875rem; font-variant-numeric: tabular-nums; padding-top: .15rem; }
.tl__item--now .tl__when { color: var(--accent); font-weight: 500; }
.tl__body h3 { font-size: 1.0625rem; font-weight: 600; }
.tl__role { font-weight: 400; color: var(--ink-3); font-size: .9375rem; }
.tl__body p { margin-top: .5rem; color: var(--ink-2); font-size: .9375rem; max-width: 68ch; }

.edu { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.edu h3 { font-size: .8125rem; font-weight: 600; color: var(--ink-3); letter-spacing: .02em; }
.edu p { margin-top: .5rem; color: var(--ink-2); font-size: .9375rem; }
.edu .note { margin-top: .375rem; }

/* ── 연락처 · 푸터 ──────────────────────────────────────── */
.contact { text-align: center; }
.contact h2 { font-size: clamp(1.5rem, 3.4vw, 2.25rem); font-weight: 600; }
.contact__lead { margin: .875rem auto 0; max-width: 46ch; color: var(--ink-2); font-size: 1.0625rem; }
.contact .cta { margin-top: 2rem; }

.foot { border-top: 1px solid var(--line); padding: 2rem 0 calc(2rem + env(safe-area-inset-bottom)); }
.foot p { color: var(--ink-3); font-size: .875rem; }
.foot .note { margin-top: .25rem; font-size: .8125rem; }

/* ── 모션 (절제: 히어로 1회 + 지표 카운트업) ─────────────── */
@media (prefers-reduced-motion: no-preference) {
  [data-reveal] .w { opacity: 0; transform: translateY(.35em); }
  [data-reveal].on .w { animation: rise .5s var(--ease) forwards; }
  @keyframes rise { to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] .w { opacity: 1; transform: none; }
  .chart .bar { transition: none; }
}
