/* 지능형 행정 플랫폼 — 카테고리 전용 하위 페이지 공통 */
:root {
  --ink: #243040;
  --ink-soft: #3a4658;
  --muted: #667086;
  --paper: #f7f5f8;
  --line: rgba(36, 48, 64, 0.1);
  --maroon: #7c5d93;
  --maroon-dark: #5f466f;
  --gold: #b89478;
  --page-pad: clamp(0.75rem, 4vw, 2rem);
  --platform-ok: #0d7a3f;
  --platform-err: #b02135;
}

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

body {
  font-family: "Noto Sans KR", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
  font-size: 16px;
}

a {
  color: var(--maroon);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.brand:hover,
.brand:focus-visible,
.brand:hover span,
.brand:focus-visible span {
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(250, 249, 246, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 0.65rem var(--page-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem 1rem;
  flex-wrap: wrap;
}

.brand {
  font-family: "Noto Serif KR", serif;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
}

.brand span {
  display: block;
  font-family: "Noto Sans KR", system-ui, sans-serif;
  font-size: 0.66rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: 0.18rem;
}

.links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--maroon-dark);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.8rem;
  border: 1px solid rgba(90, 53, 64, 0.22);
  border-radius: 2px;
  background: #fff;
  padding: 0.35rem 0.62rem;
}

.links a:hover {
  text-decoration: none;
  background: #f7f1eb;
}

/* 공통 메인 바로가기(시선 높이 고정) */
.topbar .links a[href="index.html"] {
  min-width: 4.8rem;
  padding: 0.42rem 0.78rem;
  border-radius: 999px;
  border: 1px solid rgba(236, 69, 152, 0.42);
  background: linear-gradient(180deg, #ffecf6 0%, #ffe1f0 100%);
  color: #7b2a57;
  box-shadow: 0 4px 12px rgba(227, 64, 146, 0.2);
  font-size: 0.78rem;
  gap: 0.34rem;
  white-space: nowrap;
}

.topbar .links a[href="index.html"]::before {
  content: "";
  width: 0.98rem;
  height: 0.98rem;
  border-radius: 50%;
  background: #ef3e9a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M12 4.2 3.8 11h1.9v8.1h4.9v-4.8h2.8v4.8h4.9V11h1.9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 72%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.topbar .links a[href="index.html"]:hover {
  background: linear-gradient(180deg, #ffe3f0 0%, #ffd5ea 100%);
  text-decoration: none;
}

@media (max-width: 900px) {
  .topbar .links a[href="index.html"] { min-width: 4.4rem; }
}

.wrap {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem var(--page-pad) 2.5rem;
}

.platform-breadcrumb {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.platform-breadcrumb a {
  font-weight: 700;
}

.platform-breadcrumb .sep {
  margin: 0 0.35rem;
  opacity: 0.65;
}

.platform-admin-toggle-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin: -0.2rem 0 0.55rem;
}

.section-label {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--maroon);
  font-weight: 700;
}

h1 {
  font-family: "Noto Serif KR", serif;
  font-size: clamp(1.2rem, 3vw, 1.65rem);
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 0.75rem;
}

.platform-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-bottom: 0.55rem;
}

.platform-title-row h1 {
  margin-bottom: 0;
}

.lead {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-bottom: 1.1rem;
  max-width: 52em;
}

.platform-sub-body {
  max-width: none;
  width: 100%;
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.65;
  margin-top: 0.5cm;
  margin-bottom: 0.95rem;
  counter-reset: platformEntry;
}

.platform-sub-body > * {
  margin: 0 0 0.68rem;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.platform-sub-body > *:last-child {
  margin-bottom: 0;
}

.platform-sub-body .platform-entry-heading {
  margin: 0 0 0.34rem;
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.45;
  counter-increment: platformEntry;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.platform-sub-body .platform-entry-heading::before {
  content: "(" counter(platformEntry) ") ";
}

.platform-sub-body .platform-entry-title-text {
  flex: 1 1 auto;
  min-width: 0;
}

.platform-sub-body .platform-entry-actions {
  display: none;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

body.platform-admin-on .platform-sub-body .platform-entry-actions {
  display: inline-flex;
}

.platform-sub-body .platform-entry-actions .btn {
  padding: 0.22rem 0.48rem;
  font-size: 0.72rem;
  line-height: 1.15;
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.platform-sub-body .platform-entry-actions .btn:focus,
.platform-sub-body .platform-entry-actions .btn:active {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.platform-sub-body .platform-entry-body {
  padding: 0.68rem 0.74rem;
  border: 1px solid rgba(124, 93, 147, 0.42);
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(20, 24, 32, 0.04);
}

.platform-sub-body .platform-entry-body a,
.platform-edit-body-editor a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.platform-category-links {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  align-items: center;
}

.platform-category-links a {
  font-size: 0.84rem;
  font-weight: 700;
}

.platform-sibling-nav {
  margin-top: 0.35rem;
  padding-top: 0.45rem;
  border-top: none;
  font-size: 0.8rem;
  color: var(--muted);
}

.platform-middle-box {
  display: none;
}

.platform-sibling-nav strong {
  color: var(--ink);
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.78rem;
}

.platform-sibling-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  align-items: center;
}

.platform-sibling-nav li {
  display: block;
}

.trust-mini {
  margin: 1.5rem 0 1rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
  border: 1px dashed rgba(90, 53, 64, 0.25);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.75);
}

.trust-mini strong {
  color: var(--ink);
}

.disclaimer {
  border-left: 3px solid var(--gold);
  padding: 0.75rem 0.95rem;
  background: #fff;
  border-radius: 0 4px 4px 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 1.25rem;
}

.disclaimer strong {
  color: var(--ink);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 1.1rem;
  margin-bottom: 1.1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.52rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 2px;
  text-decoration: none;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, var(--maroon) 0%, var(--maroon-dark) 100%);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.btn-primary:hover {
  opacity: 0.93;
  text-decoration: none;
  color: #fff;
}

.btn-ghost {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  background: #faf8fb;
  text-decoration: none;
}

.platform-back {
  margin-top: 1.35rem;
  margin-bottom: 0.35rem;
  font-size: 0.86rem;
}

.platform-back a {
  font-weight: 700;
}

.platform-wip-banner {
  background: linear-gradient(
    105deg,
    rgba(232, 212, 188, 0.55) 0%,
    rgba(214, 196, 228, 0.4) 48%,
    rgba(232, 218, 200, 0.5) 100%
  );
  border-bottom: 1px solid rgba(120, 92, 64, 0.22);
  padding: 0.58rem var(--page-pad);
}

.platform-wip-banner-inner {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  font-size: 0.81rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.55;
}

.platform-wip-banner-inner strong {
  color: var(--maroon-dark);
  font-weight: 800;
}

.platform-wip-pulse {
  display: inline-block;
  animation: platformWipPulse 1.35s ease-in-out infinite;
}

@keyframes platformWipPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.28;
  }
}

@media (prefers-reduced-motion: reduce) {
  .platform-wip-pulse {
    animation: none;
  }
}

/* —— 관리자 인증·편집 (platform-admin.js) —— */
.platform-admin-mount {
  margin-bottom: 0.85rem;
}

.platform-panel {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  padding: 0.95rem 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 0 rgba(36, 48, 64, 0.04);
}

.platform-panel h2 {
  font-size: 0.95rem;
  margin: 0 0 0.55rem;
  font-weight: 800;
  color: var(--maroon-dark);
}

.platform-panel label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.35rem;
  margin-top: 0.65rem;
}

.platform-panel label:first-of-type {
  margin-top: 0.35rem;
}

.platform-panel textarea {
  width: 100%;
  font: inherit;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  resize: vertical;
  min-height: 2.1rem;
}

.platform-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.35rem 0 0.65rem;
  line-height: 1.5;
}

.platform-hint code {
  font-size: 0.85em;
  background: rgba(36, 48, 64, 0.06);
  padding: 0.05rem 0.25rem;
  border-radius: 2px;
}

.platform-auth-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.45rem;
}

.platform-auth-row input[type="password"] {
  flex: 1 1 160px;
  min-width: 140px;
  font: inherit;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 2px;
}

.platform-auth #platform-auth-panel-logged-out {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.55rem;
  align-items: stretch;
}

.platform-auth-supabase-block {
  margin: 0.45rem 0 0.2rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(90, 53, 64, 0.18);
  border-radius: 4px;
  background: linear-gradient(180deg, #fff 0%, #faf8f6 100%);
  flex: 1 1 0;
  min-width: 0;
}

.platform-auth-block-title {
  margin: 0 0 0.4rem;
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--ink);
}

#platform-auth-supabase-row .btn.btn-primary {
  box-shadow: 0 2px 10px rgba(62, 36, 46, 0.3);
  outline: 2px solid rgba(90, 53, 64, 0.22);
  outline-offset: 1px;
}

.platform-auth-local-block {
  margin: 0.45rem 0 0.2rem;
  border: 1px dashed var(--line);
  border-radius: 4px;
  padding: 0.45rem 0.65rem 0.55rem;
  background: rgba(250, 248, 244, 0.95);
  flex: 1 1 0;
  min-width: 0;
}

#platform-auth-supabase-row,
#platform-auth-local-row {
  margin-top: 0;
  flex: 1 1 auto;
  flex-wrap: nowrap;
}

#platform-auth-supabase-row input[type="password"],
#platform-auth-local-row input[type="password"] {
  min-width: 0;
}

@media (max-width: 900px) {
  .platform-auth #platform-auth-panel-logged-out {
    display: block;
  }

  .platform-auth-supabase-block,
  .platform-auth-local-block {
    display: block;
  }

  .platform-auth-block-title {
    margin-bottom: 0.4rem;
  }

  #platform-auth-supabase-row,
  #platform-auth-local-row {
    flex-wrap: wrap;
  }
}

.platform-auth-panel-admin {
  margin-top: 0.35rem;
}

.platform-saved-manager {
  margin-bottom: 0.75rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(36, 48, 64, 0.12);
  border-radius: 4px;
  background: #fcfcfd;
}

.platform-saved-manager h3 {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--ink);
}

.platform-saved-preview {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.platform-auth-details {
  margin: 0.45rem 0 0.65rem;
  border: 1px dashed var(--line);
  border-radius: 4px;
  padding: 0.45rem 0.65rem 0.55rem;
  background: rgba(250, 248, 244, 0.95);
  font-size: 0.82rem;
  color: var(--muted);
}

.platform-auth-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
  list-style: none;
}

.platform-auth-details summary::-webkit-details-marker {
  display: none;
}

.platform-auth-details-body {
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px dashed rgba(20, 24, 32, 0.1);
  line-height: 1.5;
}

.platform-auth-details-body p {
  margin: 0.35rem 0 0;
}

.platform-auth-mode {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0.55rem 0 0.35rem;
  padding: 0.28rem 0.55rem;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
}

.platform-auth-mode[data-mode="view"] {
  color: var(--muted);
  border-style: dashed;
}

.platform-auth-mode[data-mode="login"] {
  color: var(--maroon-dark);
  border-color: rgba(90, 53, 64, 0.35);
  background: rgba(90, 53, 64, 0.06);
}

.platform-auth-mode[data-mode="admin"] {
  color: var(--platform-ok);
  border-color: rgba(13, 122, 63, 0.35);
  background: rgba(13, 122, 63, 0.08);
}

.platform-status {
  min-height: 1.2rem;
  font-size: 0.83rem;
  margin-top: 0.45rem;
}

.platform-status.ok {
  color: var(--platform-ok);
}

.platform-status.err {
  color: var(--platform-err);
}

body.platform-admin-on .platform-editor textarea {
  border-color: rgba(124, 93, 147, 0.35);
}

.platform-edit-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin: 0.45rem 0 0.45rem;
}

.platform-edit-toolbar .btn {
  padding: 0.34rem 0.62rem;
  font-size: 0.76rem;
}

#platform-edit-file-input {
  font-size: 0.78rem;
}

.platform-edit-body-editor {
  min-height: 9rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  padding: 0.55rem 0.6rem;
  line-height: 1.6;
}

.platform-entry-desc-body p,
.platform-sub-body .platform-entry-body p {
  margin: 0 0 0.5rem;
}

.platform-entry-desc-body p:last-child,
.platform-sub-body .platform-entry-body p:last-child {
  margin-bottom: 0;
}
