/* ===================================================
 * T2Editor v2 — Material 2.5D Flat Design
 * 디자인 토큰은 lib/theme.php가 :root 변수로 주입.
 * =================================================== */

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

.t2-body {
  font-family: var(--md-font);
  color: var(--md-text);
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--md-primary-soft), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, color-mix(in oklab, var(--md-accent) 14%, transparent), transparent 60%),
    var(--md-bg);
  min-height: 100vh;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ============ NAV ============ */
.t2-nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in oklab, var(--md-surface) 80%, transparent);
  border-bottom: 1px solid color-mix(in oklab, var(--md-border) 80%, transparent);
}
.t2-nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; gap: 16px;
}
.t2-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; }
.t2-brand-mark {
  font-family: 'Pacifico', cursive; color: var(--md-accent); font-size: 24px;
}
.t2-brand-divider { color: var(--md-text-muted); }
.t2-nav-links {
  display: flex; gap: 22px; margin-left: auto;
  font-size: 14.5px; color: var(--md-text-muted);
}
.t2-nav-links a { transition: color .2s; }
.t2-nav-links a:hover { color: var(--md-primary); }
.t2-nav-actions { display: flex; align-items: center; gap: 8px; }
.t2-icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: transparent; border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--md-text-muted);
  transition: background .2s, color .2s;
}
.t2-icon-btn:hover { background: var(--md-primary-soft); color: var(--md-primary); }
.t2-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--md-primary); color: #fff; font-weight: 600; font-size: 13.5px;
  box-shadow: var(--md-shadow);
}
.t2-mobile-only { display: none; }

@media (max-width: 820px) {
  /* 모바일 네비 패딩을 .t2-main(16px)와 동일하게 맞춰서, 펼친 메뉴 항목의 좌우 끝이
     아래 본문(카드) 좌우 끝과 정확히 일치하도록 한다.
     이 값이 어긋나면 "메뉴는 화면 끝까지, 카드는 더 안쪽" 같은 비대칭이 보인다. */
  .t2-nav-inner { padding: 14px 16px; }
  .t2-nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 8px 16px 18px;
    background: var(--md-surface);
    border-bottom: 1px solid var(--md-border);
    transform: translateY(-110%); transition: transform .25s ease;
  }
  .t2-nav-links.is-open { transform: translateY(0); }
  .t2-nav-links a { padding: 12px 4px; border-bottom: 1px solid color-mix(in oklab, var(--md-border) 60%, transparent); }
  .t2-mobile-only { display: inline-flex; }
}

/* ============ MAIN / SECTIONS ============ */
.t2-main { max-width: 1200px; margin: 0 auto; padding: 16px 24px 64px; overflow-x: hidden; }
@media (max-width: 820px) {
  /* 모바일에서 본문 좌우 패딩도 네비와 동일하게 16px로 통일 */
  .t2-main { padding: 12px 16px 48px; }
}
/* 그리드/플렉스 자식 요소가 min-content 크기 때문에 항상 원래 너비보다 커지는 고전적 버그 방지 */
.t2-main, .t2-main > section, .t2-card, .t2-block { min-width: 0; }
.t2-section { padding: 56px 0; }
.t2-h2 {
  font-size: 30px; font-weight: 800; margin: 0 0 28px;
  display: inline-flex; align-items: center; gap: 10px;
}
.t2-h2 i { color: var(--md-primary); font-size: 30px; }
.t2-muted { color: var(--md-text-muted); }

/* ============ HERO ============ */
.t2-hero {
  position: relative;
  padding: 64px 0 80px;
}
.t2-hero-inner { max-width: 720px; }
.t2-hero-eyebrow { color: var(--md-primary); font-weight: 700; letter-spacing: .04em; margin-bottom: 8px; }
.t2-hero-title { font-size: 56px; font-weight: 800; line-height: 1.12; margin: 0 0 18px; }
.t2-mark {
  display: inline-block; position: relative; color: var(--md-accent);
}
.t2-mark::after {
  content: ''; position: absolute; left: 0; bottom: 4px;
  width: 100%; height: .35em;
  background: color-mix(in oklab, var(--md-primary) 24%, transparent);
  z-index: -1;
}
.t2-hero-subtitle { color: var(--md-text); font-size: 34px; font-weight: 700; }
.t2-hero-desc { font-size: 17px; color: var(--md-text-muted); margin: 0 0 28px; max-width: 540px; }
.t2-hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

@media (max-width: 820px) {
  .t2-hero { padding: 32px 0 40px; }
  .t2-hero-title { font-size: 38px; }
  .t2-hero-subtitle { font-size: 22px; }
}

/* ============ CARD / BUTTON ============ */
.t2-card {
  background: var(--md-surface);
  border: 1px solid var(--md-border);
  border-radius: var(--md-radius-lg);
  box-shadow: var(--md-shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.t2-card:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(15,23,42,.10); }

.t2-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border-radius: var(--md-radius);
  font-weight: 600; font-size: 14.5px;
  border: 1px solid transparent;
  transition: transform .15s ease, background .2s ease, color .2s ease;
}
.t2-btn-primary { background: var(--md-primary); color: #fff; box-shadow: var(--md-shadow); }
.t2-btn-primary:hover { transform: translateY(-1px); background: var(--md-primary-strong); }
.t2-btn-outline { background: var(--md-surface); color: var(--md-text); border-color: var(--md-border); }
.t2-btn-outline:hover { border-color: var(--md-primary); color: var(--md-primary); }
.t2-btn:active { transform: translateY(0); }

.t2-chip {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--md-bg); color: var(--md-text-muted);
  margin-left: 6px;
}
.t2-chip-primary { background: var(--md-primary-soft); color: var(--md-primary-strong); }

/* ============ NOTICES ============ */
.t2-card-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.t2-notice { display: grid; grid-template-columns: 6px 1fr; padding: 0; overflow: hidden; }
.t2-notice-bar { background: linear-gradient(180deg, var(--md-primary), var(--md-accent)); }
.t2-notice-body { padding: 18px 22px; }
.t2-notice-title { font-weight: 700; font-size: 17px; margin-bottom: 6px; }
.t2-notice-content {
  color: var(--md-text-muted);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.t2-notice-title {
  word-break: break-word;
  overflow-wrap: anywhere;
}
.t2-notice-date { font-size: 12.5px; color: var(--md-text-muted); margin-top: 8px; }

/* ============ FEATURES ============ */
.t2-grid { display: grid; gap: 18px; }
.t2-grid-features { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.t2-feature { padding: 24px; text-align: left; }
.t2-feature-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 24px;
  background: linear-gradient(135deg, var(--md-primary-soft), color-mix(in oklab, var(--md-accent) 18%, var(--md-surface)));
  color: var(--md-primary); margin-bottom: 12px;
}
.t2-feature-title { font-size: 17px; font-weight: 700; margin: 0 0 6px; }
.t2-feature-desc { color: var(--md-text-muted); margin: 0; font-size: 14.5px; }

/* ============ INTRO ============ */
.t2-intro { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: start; }
.t2-intro-body { font-size: 17px; color: var(--md-text-muted); }
.t2-intro-highlights { list-style: none; padding: 18px; margin: 0; background: var(--md-surface);
  border: 1px solid var(--md-border); border-radius: var(--md-radius-lg); }
.t2-intro-highlights li { display: flex; gap: 8px; padding: 6px 0; }
.t2-intro-highlights i { color: var(--md-primary); }
@media (max-width: 820px) { .t2-intro { grid-template-columns: 1fr; } }

/* ============ DEMO ============ */
.t2-demo { border-radius: var(--md-radius-lg); overflow: hidden; box-shadow: var(--md-shadow); border: 1px solid var(--md-border); }
.t2-demo iframe { width: 100%; height: 650px; border: 0; display: block; background: var(--md-surface); }

/* ============ TIMELINE / VERSIONS ============ */
/* ============ TIMELINE (버전 리스토리 등) ============ */
/* timeline-card 안의 긴 텍스트/URL이 카드 경계를 뚫는 것을 차단 */
.t2-timeline-card { min-width: 0; max-width: 100%; }
.t2-timeline-card .t2-timeline-desc,
.t2-timeline-card a {
  word-break: break-word;
  overflow-wrap: anywhere;
}
.t2-timeline-head { flex-wrap: wrap; row-gap: 4px; }
.t2-timeline-ver { word-break: break-all; }
.t2-timeline { list-style: none; padding: 0 0 0 24px; margin: 0; position: relative; }
.t2-timeline::before {
  content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: linear-gradient(180deg, var(--md-primary), transparent);
}
.t2-timeline-item { position: relative; padding-left: 26px; padding-bottom: 18px; }
/* 모바일에서는 타임라인 들여쓰기를 줄여, 카드의 좌측 끝이 메뉴 항목(좌측 16px 패딩)과
   같은 라인에 오도록 한다. 점/줄은 그대로 보이도록 카드만 좌측을 끝까지 끌어준다. */
@media (max-width: 820px) {
  .t2-timeline { padding-left: 14px; }
  .t2-timeline-item { padding-left: 18px; }
  .t2-timeline-dot { left: -2px; }
}
.t2-timeline-dot {
  position: absolute; left: 0; top: 16px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--md-surface); border: 3px solid var(--md-primary);
}
.t2-timeline-dot[data-latest="1"] { background: var(--md-primary); box-shadow: 0 0 0 6px var(--md-primary-soft); }
.t2-timeline-card { padding: 18px 20px; }
.t2-timeline-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.t2-timeline-ver { font-weight: 800; font-size: 17px; }
.t2-timeline-date { color: var(--md-text-muted); font-size: 13px; }
.t2-timeline-desc { margin: 6px 0 12px; color: var(--md-text-muted); }

/* ============ STEPS ============ */
.t2-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.t2-step { display: grid; grid-template-columns: 56px 1fr; gap: 16px; padding: 18px 20px; }
.t2-step-num {
  width: 44px; height: 44px; border-radius: 50%; font-weight: 800; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--md-primary), var(--md-accent));
  box-shadow: var(--md-shadow);
}
.t2-step-body h3 { margin: 6px 0 4px; }
.t2-code { background: #0f172a; color: #e7ecff; padding: 12px 14px; border-radius: var(--md-radius);
  overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* ============ LICENSE ============ */
.t2-license { padding: 22px; }
.t2-license-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.t2-license-summary { color: var(--md-text-muted); margin-top: 4px; }
.t2-license-body { white-space: pre-wrap; background: var(--md-bg); padding: 16px;
  border-radius: var(--md-radius); margin-top: 14px; max-height: 360px; overflow: auto; font-size: 13.5px; }

.t2-btn-text { background: transparent; border: 0; box-shadow: none; padding: 6px 0; color: var(--md-primary);
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font: inherit; }
.t2-btn-text:hover { text-decoration: underline; }
.t2-chip-sm { font-size: 11px; padding: 2px 8px; }
.t2-license-history { margin-top: 16px; border-top: 1px dashed var(--md-border); padding-top: 12px; }
.t2-license-history-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
/* 과거 라이선스도 한 "카드" 형태로 펼쳐볼 수 있게 — header(요약 한 줄) + body(전문) 구조 */
.t2-license-history-item {
  display: flex; flex-direction: column; gap: 8px;
  font-size: 13.5px; padding: 10px 12px; border-radius: var(--md-radius);
  background: var(--md-bg); border: 1px solid color-mix(in oklab, var(--md-border) 70%, transparent);
}
.t2-license-history-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  width: 100%;
}
.t2-license-history-toggle {
  margin-left: auto; background: transparent; border: 0; padding: 4px 8px; cursor: pointer;
  color: var(--md-primary); font: inherit; font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px;
  border-radius: 6px;
}
.t2-license-history-toggle:hover { background: var(--md-primary-soft); }
.t2-license-history-date { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.t2-license-history-note { color: var(--md-text-muted); flex: 1 1 auto; min-width: 0; }
.t2-license-history-body {
  white-space: pre-wrap; background: var(--md-surface); padding: 12px 14px;
  border-radius: var(--md-radius); margin: 0; max-height: 320px; overflow: auto;
  font-size: 13px; border: 1px solid var(--md-border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.t2-license-history-empty-body { color: var(--md-text-muted); font-style: italic; padding: 6px 2px; }
@media (max-width: 600px) {
  .t2-license-history-toggle { margin-left: 0; }
}

/* ============ COMMENTS ============ */
.t2-comment-form { padding: 18px; margin-bottom: 14px; }
.t2-comment-form textarea {
  width: 100%; min-height: 90px; padding: 12px; border-radius: var(--md-radius);
  border: 1px solid var(--md-border); resize: vertical; font: inherit; background: var(--md-bg); color: var(--md-text);
}
.t2-form-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px; flex-wrap: wrap; }
.t2-comments { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.t2-comment { padding: 14px 18px; }
.t2-comment-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 4px; flex-wrap: wrap; }
.t2-comment-body {
  /* 사용자 입력 댓글은 종종 URL/긴 한 단어를 포함한다. 카드를 뚫고 나오지 않도록 강제로 줄바꿈 */
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.55;
}
.t2-comment-login { padding: 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.t2-comment-login i { color: var(--md-primary); font-size: 22px; }
.t2-comment-login a { margin-left: auto; }
.t2-comment-pending-badge { font-size: 11px; padding: 2px 8px; border-radius: 99px;
  background: #fff3cd; color: #8a6500; font-weight: 600; }

/* 댓글 작성 안내/에러 메시지 */
.t2-comment-msg {
  margin-top: 10px; padding: 10px 12px; border-radius: var(--md-radius);
  font-size: 13.5px; line-height: 1.5;
  word-break: break-word; overflow-wrap: anywhere;
}
.t2-comment-msg-ok { background: #e3f6e8; color: #1f7a3d; border: 1px solid #b6e3c6; }
.t2-comment-msg-err { background: #fdecec; color: #b91c1c; border: 1px solid #f6caca; }

/* 등록 중 스피너 */
.t2-spin { animation: t2spin .9s linear infinite; }
@keyframes t2spin { to { transform: rotate(360deg); } }
[x-cloak] { display: none !important; }

/* ============ STATS ============ */
.t2-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 16px; }
.t2-stat { padding: 20px 22px; text-align: center; }
.t2-stat-label { color: var(--md-text-muted); font-size: 13.5px; }
.t2-stat-value { font-size: 30px; font-weight: 800; margin-top: 4px;
  background: linear-gradient(135deg, var(--md-primary), var(--md-accent));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.t2-bar-chart { padding: 20px; }
.t2-bar-row { display: grid; grid-template-columns: 80px 1fr 60px; gap: 10px; padding: 4px 0; align-items: center; }
.t2-bar-label, .t2-bar-value { font-size: 13px; color: var(--md-text-muted); }
.t2-bar-value { text-align: right; }
.t2-bar-track { height: 10px; background: var(--md-bg); border-radius: 999px; overflow: hidden; }
.t2-bar-fill { height: 100%; background: linear-gradient(90deg, var(--md-primary), var(--md-accent)); border-radius: 999px; }

@media (max-width: 600px) { .t2-stats-grid { grid-template-columns: 1fr 1fr; } }

/* ============ CONTACT ============ */
.t2-contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.t2-contact-card { display: flex; align-items: center; gap: 14px; padding: 18px; }
.t2-contact-card i { font-size: 28px; color: var(--md-primary); }

/* ============ FOOTER ============ */
.t2-foot { padding: 24px; border-top: 1px solid var(--md-border); }
.t2-foot-inner {
  max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; gap: 12px; color: var(--md-text-muted); font-size: 13.5px;
}
.t2-foot-tools { display: flex; gap: 14px; }
.t2-foot-tools a:hover { color: var(--md-primary); }

/* ============ AUTH ============ */
.t2-auth { max-width: 460px; margin: 80px auto; padding: 0 16px; }
.t2-auth-card { padding: 32px; }
.t2-auth-card h1 { margin-top: 0; font-size: 24px; font-weight: 800; }
.t2-form label { display: block; margin: 14px 0 4px; font-weight: 600; font-size: 13.5px; color: var(--md-text-muted); }
.t2-form input { width: 100%; padding: 12px 14px; border-radius: var(--md-radius); border: 1px solid var(--md-border);
  background: var(--md-bg); color: var(--md-text); font: inherit; }
.t2-form input:focus { outline: 2px solid var(--md-primary-soft); border-color: var(--md-primary); }
.t2-form button { width: 100%; margin-top: 18px; justify-content: center; }
.t2-alert { padding: 10px 14px; border-radius: var(--md-radius); margin-top: 8px; font-size: 14px; }
.t2-alert-error { background: #fde7e7; color: #b91c1c; }
.t2-alert-success { background: #e7faec; color: #11643b; }

/* ============ EDIT MODE (admin preview) ============ */
.t2-editable { outline: 2px dashed transparent; outline-offset: 4px; transition: outline-color .15s; position: relative; }
.t2-editable:hover { outline-color: var(--md-primary); }
.t2-editable::after {
  content: attr(data-block-type); position: absolute; top: -10px; left: 8px;
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--md-primary); color: #fff; opacity: 0;
  transition: opacity .15s;
}
.t2-editable:hover::after { opacity: 1; }
