/* PARADISE 서버 규칙 페이지 전용 스타일.
   main 브랜치의 style.css, portal.css, theme.css에서 규칙 화면에 실제로 적용되는 값만 옮겼습니다. */

@font-face {
  font-family: NotoSansKR;
  src: url("../font/NotoSansKR-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #101010;
  --header: 68px;
  --panel-bg: #fff;
  --panel-raised: #f6f7f9;
  --panel-line: #e4e6e9;
  --panel-text: #181b20;
  --panel-muted: #656b73;
  --panel-accent: #1769ff;
}
html[data-theme="dark"] {
  --ink: #e5e9f0;
  --panel-bg: #14171c;
  --panel-raised: #1c2027;
  --panel-line: #343b47;
  --panel-text: #e5e9f0;
  --panel-muted: #a3adbc;
  --panel-accent: #85b4ff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); font-family: NotoSansKR, Arial, sans-serif; background: #fff; }
html[data-theme="dark"] body { background: var(--panel-bg); }
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
button, a, input, summary { -webkit-tap-highlight-color: transparent; }

/* 상단바 */
.topbar {
  position: fixed; z-index: 50; top: 0; left: 0;
  width: 100%; height: var(--header);
  display: flex; align-items: center;
  padding: 0 clamp(24px, 8vw, 128px); gap: 30px;
  background: rgba(255, 255, 255, 0.97); color: #111;
  border-bottom: 1px solid #ddd;
  transition: transform 0.35s ease, background 0.35s ease, color 0.35s ease;
}
html[data-theme="light"] .topbar { background: #fffffff5; color: #202630; border-color: #dde2e8; }
html[data-theme="dark"] .topbar { background: #1c2027f7; color: #e5e9f0; border-color: #343b47; }
.topbar.hidden { transform: translateY(-105%); }
.brand { width: 128px; display: flex; }
.brand img { width: 100%; height: auto; }
html[data-theme="dark"] .topbar .brand { color: #e5e9f0; }
.top-actions { display: flex; align-items: center; gap: 16px; margin-left: auto; font-size: 13px; }

/* 테마 선택 */
.site-theme { position: relative; display: inline-flex; align-items: center; gap: 5px; color: inherit; flex-shrink: 0; }
.site-theme .theme-trigger { display: inline-flex; align-items: center; gap: 7px; background: transparent; color: inherit; border: 0; padding: 8px 10px; min-height: 36px; font: inherit; font-size: 12px; cursor: pointer; border-radius: 6px; }
.site-theme .theme-menu { display: none; position: absolute; z-index: 200; right: 0; top: calc(100% + 8px); min-width: 135px; padding: 6px; background: var(--panel-raised); color: var(--panel-text); border: 1px solid #dde2e8; border-radius: 8px; box-shadow: 0 14px 28px #0002; }
html[data-theme="dark"] .site-theme .theme-menu { border-color: var(--panel-line); }
.site-theme .theme-menu.open { display: grid; }
.site-theme .theme-menu button { border: 0; background: transparent; color: inherit; text-align: left; padding: 10px 12px; border-radius: 5px; cursor: pointer; }
.site-theme .theme-menu button:hover, .site-theme .theme-menu button[aria-checked="true"] { background: #eef2f8; }
html[data-theme="dark"] .site-theme .theme-menu button:hover, html[data-theme="dark"] .site-theme .theme-menu button[aria-checked="true"] { background: #29313d; }

/* 본문 */
.portal-page {
  min-height: 100vh; padding: 124px 0 88px;
  color: var(--panel-text); background: var(--panel-bg); color-scheme: light;
}
html[data-theme="dark"] .portal-page { color-scheme: dark; }
.portal-page button { cursor: pointer; }
.portal-page :focus-visible { outline: 2px solid var(--panel-accent); outline-offset: 4px; }
.portal-page h1 { margin: 12px 0 28px; font-size: clamp(28px, 3vw, 36px); font-weight: 750; line-height: 1.3; letter-spacing: -.04em; }
.portal-page section[id] { scroll-margin-top: 100px; }
.portal-container { width: min(1100px, calc(100% - 48px)); margin-inline: auto; }
button:disabled { opacity: .5; cursor: wait; }

.feedback { font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; color: #1769ff; min-height: 20px; margin: 12px 0 0; }
.is-error { color: #bd332d; }
html[data-theme="dark"] .is-error { color: #ff9b95; }

/* 규정 버전 선택 */
.rules-tools { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-top: 32px; }
.rules-tools label { flex: 1 1 220px; min-width: 0; font-size: 12px; color: var(--panel-muted); }
.rules-tools select { max-width: 100%; }
.rules-version-label { display: flex; flex-direction: column; gap: 6px; min-width: 240px; font-weight: 650; }
#rules-version { width: 100%; min-height: 42px; padding: 9px 34px 9px 12px; border: 1px solid #cdd5df; border-radius: 9px; background: #fff; color: #182333; font: inherit; cursor: pointer; }
html[data-theme="dark"] #rules-version { background: var(--panel-raised); color: var(--panel-text); border-color: var(--panel-line); }
#rules-version:focus-visible { outline: 2px solid #1769ff; outline-offset: 2px; }

/* 목차와 규칙 본문 */
.rules-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 50px; margin-top: 35px; }
#rules-toc { position: sticky; top: 92px; align-self: start; }
#rules-toc a { display: block; padding: 13px 0; font-size: 12px; line-height: 1.8; border-bottom: 1px solid var(--panel-line); color: var(--panel-muted); }
#rules-toc a:hover { color: var(--panel-accent); }
.rules-chapter { margin-bottom: 50px; }
.rules-chapter h2 { font-size: 22px; margin-top: 0; padding-bottom: 16px; border-bottom: 1px solid var(--panel-line); }
.rule-entry { margin-bottom: 24px; }
.rule-entry h3 { font-size: 15px; margin: 20px 0 12px; color: #202832; }
.rule-entry p { font-size: 13px; line-height: 1.95; color: #4d5660; margin: 8px 0; }
html[data-theme="dark"] .rule-entry h3, html[data-theme="dark"] .rule-entry p { color: var(--panel-text); }
.mobile-rules-jump { display: none; }

/* 하단 */
.site-footer { background: #111; color: #aaa; padding: 48px; text-align: center; }
html[data-theme="light"] .site-footer { background: #f5f6f8; color: #647080; border-color: #dde2e8; }
html[data-theme="dark"] .site-footer { background: var(--panel-bg); color: var(--panel-muted); border-color: var(--panel-line); }
.site-footer img { width: 150px; }

@media (max-width: 1200px) and (min-width: 901px) {
  .topbar { padding-inline: 24px; gap: 18px; }
  .top-actions { gap: 10px; }
}
@media (max-width: 900px) {
  .topbar { padding: 0 22px; gap: 10px; }
}
@media (max-width: 700px) {
  .portal-page { padding-block: 104px 72px; }
  .portal-container { width: calc(100% - 36px); }
  .rules-tools label { flex-basis: 100%; }
  .rules-layout { grid-template-columns: 1fr; gap: 28px; }
  #rules-toc { display: none; }
  .rule-entry p { font-size: 14px; }
  .mobile-rules-jump { display: block; position: sticky; top: 78px; z-index: 2; padding: 10px 0; background: #fff; font-size: 13px; }
  .mobile-rules-jump::before { content: ''; position: absolute; inset: -78px -18px 0; z-index: -1; background: #fff; border-bottom: 1px solid var(--panel-line); }
  /* 목차 칸의 배경이 위로 깔려도 버전 선택과 안내 문구가 가려지지 않게 위에 둡니다. */
  .rules-tools, #rules-feedback { position: relative; z-index: 3; }
  .mobile-rules-jump select { display: block; width: 100%; height: 48px; margin-top: 8px; padding: 0 12px; border: 1px solid #ced3d9; border-radius: 8px; background: #fff; color: #181b20; font: inherit; font-size: 16px; }
  html[data-theme="dark"] .mobile-rules-jump, html[data-theme="dark"] .mobile-rules-jump::before { background: var(--panel-bg); }
  html[data-theme="dark"] .mobile-rules-jump select { background: var(--panel-raised); color: var(--panel-text); border-color: var(--panel-line); }
}
@media (max-width: 640px) {
  .rules-version-label { width: 100%; min-width: 0; }
}
@media (max-width: 600px) {
  .site-footer { padding: 36px 20px calc(36px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
