/* ===== 동아리 공동 사이트 — 학교/공식 스타일 ===== */
:root {
  --navy: #1d3461;
  --navy-deep: #13254a;
  --navy-soft: #e8edf6;
  --gold: #c9a227;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #dde2ea;
  --border-strong: #c5ccd8;
  --text: #1f2733;
  --muted: #667085;
  --red: #c0392b;
  --blue: #2457c5;
  --green: #2e7d4f;
  --orange: #c56a12;
  --gray: #7a8494;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --serif: 'Noto Serif KR', serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Noto Sans KR', system-ui, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
body.modal-open { overflow: hidden; }
main { flex: 1; }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ===== 헤더 ===== */
.topbar { background: var(--surface); border-top: 4px solid var(--navy); }
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 76px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); margin-right: auto; min-width: 0; }
.emblem {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--navy); color: #fff;
  font-family: var(--serif); font-weight: 700; font-size: 20px;
  box-shadow: inset 0 0 0 3px var(--navy), inset 0 0 0 5px var(--gold);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-family: var(--serif); font-size: 20px; color: var(--navy-deep); letter-spacing: -.01em; line-height: 1.3; }
.brand-text small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.auth-area { display: flex; align-items: center; gap: 8px; flex: none; }
.user-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; }

.mainnav { background: var(--navy); box-shadow: 0 2px 0 var(--gold); }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; }
.nav-list a {
  display: block; padding: 14px 22px; color: #dfe6f3; text-decoration: none; font-weight: 500;
  border-bottom: 3px solid transparent;
}
.nav-list a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.nav-list a.active { color: #fff; border-bottom-color: var(--gold); font-weight: 700; }

.nav-toggle { display: none; flex: none; width: 40px; height: 40px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 10px 9px; flex-direction: column; justify-content: space-between; cursor: pointer; }
.nav-toggle span { display: block; height: 2px; background: var(--navy); border-radius: 2px; }

/* ===== 히어로 ===== */
.hero {
  background:
    linear-gradient(120deg, rgba(19, 37, 74, .96), rgba(29, 52, 97, .9)),
    repeating-linear-gradient(45deg, transparent 0 12px, rgba(255, 255, 255, .03) 12px 24px);
  color: #fff; padding: 40px 0 44px;
}
.hero-kicker { margin: 0 0 6px; color: var(--gold); font-size: 12px; letter-spacing: .18em; font-weight: 700; }
.hero-title { margin: 0; font-family: var(--serif); font-size: clamp(26px, 4vw, 34px); line-height: 1.3; }
.hero-desc { margin: 8px 0 0; color: #c9d3e6; max-width: 620px; }

/* ===== 버튼 / 입력 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius); border: 1px solid transparent;
  font-weight: 500; font-size: 14.5px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .6; cursor: progress; }
.btn-sm { padding: 6px 12px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-deep); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--navy); color: var(--navy); }
.btn-outline { background: transparent; border-color: var(--navy); color: var(--navy); }
.btn-outline:hover { background: var(--navy-soft); }
.btn-danger { background: var(--surface); border-color: #e3b5b0; color: var(--red); }
.btn-danger:hover { background: #fbeeec; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 20px; line-height: 1; display: grid; place-items: center; color: var(--text);
}
.icon-btn:hover { border-color: var(--navy); color: var(--navy); }

.input, .form input, .form select, .form textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
}
.input:focus, .form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-soft); }
.form textarea { resize: vertical; min-height: 110px; }

/* ===== 배지 / 점 / 칩 ===== */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.6; white-space: nowrap; }
.badge-navy { background: var(--navy-soft); color: var(--navy); }
.badge-soft { background: #eef1f5; color: #3c4657; font-weight: 500; }
.badge-red { background: #fbe9e7; color: var(--red); }
.badge-orange { background: #fdf0e1; color: var(--orange); }
.badge-green { background: #e6f3eb; color: var(--green); }
.badge-gray { background: #eef0f3; color: var(--gray); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot-navy { background: var(--navy); }
.dot-green { background: var(--green); }
.dot-red { background: var(--red); }
.dot-orange { background: var(--orange); }
.dot-gray { background: var(--gray); }

/* ===== 패널 ===== */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.panel-title { margin: 0 0 14px; padding-bottom: 10px; border-bottom: 2px solid var(--navy); font-family: var(--serif); font-size: 17px; color: var(--navy-deep); }

/* ===== 홈 레이아웃 ===== */
.home { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; padding-top: 24px; padding-bottom: 48px; align-items: start; }
.side { display: grid; gap: 20px; }

/* ===== 달력 ===== */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-title { margin: 0 6px; font-family: var(--serif); font-size: 22px; color: var(--navy-deep); min-width: 140px; text-align: center; }

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 2px solid var(--navy); border-left: 1px solid var(--border); }
.cal-head { padding: 8px 0; text-align: center; font-weight: 700; font-size: 13px; background: #f7f9fc; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal-head.sun, .cal-cell.sun .cal-date { color: var(--red); }
.cal-head.sat, .cal-cell.sat .cal-date { color: var(--blue); }
.cal-cell {
  position: relative; min-height: 108px; padding: 6px; cursor: pointer;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.cal-cell:hover { background: #f8fafd; }
.cal-cell.other { background: #fafbfc; }
.cal-cell.other .cal-date { opacity: .4; }
.cal-date { font-size: 13px; font-weight: 500; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.today .cal-date { background: var(--navy); color: #fff !important; font-weight: 700; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--gold); }
.cal-events { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.chip {
  display: block; width: 100%; text-align: left; border: 0; cursor: pointer;
  font-size: 12px; line-height: 1.5; padding: 1px 6px; border-radius: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-left: 3px solid;
}
.chip-navy { background: var(--navy-soft); color: var(--navy-deep); border-color: var(--navy); }
.chip-green { background: #e6f3eb; color: #1f5a38; border-color: var(--green); }
.chip-red { background: #fbe9e7; color: #8f2a20; border-color: var(--red); }
.chip-orange { background: #fdf0e1; color: #8a4a0c; border-color: var(--orange); }
.chip-gray { background: #eef0f3; color: #4b5563; border-color: var(--gray); }
.chip:hover { filter: brightness(.96); }
.more { font-size: 11.5px; color: var(--muted); padding-left: 4px; }
.cal-dots { display: none; gap: 3px; justify-content: center; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }

/* ===== 다가오는 일정 / 바로가기 ===== */
.upcoming, .quick-links, .event-list { list-style: none; margin: 0; padding: 0; }
.up-item {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; background: none; border: 0; cursor: pointer;
  padding: 10px 4px; border-bottom: 1px dashed var(--border);
}
.upcoming li:last-child .up-item { border-bottom: 0; }
.up-item:hover .up-title { color: var(--navy); text-decoration: underline; }
.up-date { flex: none; width: 46px; text-align: center; border: 1px solid var(--border); border-top: 3px solid var(--navy); border-radius: 4px; padding: 2px 0; line-height: 1.2; }
.up-date b { display: block; font-size: 18px; color: var(--navy-deep); }
.up-date small { font-size: 11px; color: var(--muted); }
.up-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.up-title { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.up-body small { font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.quick-links a { display: flex; justify-content: space-between; padding: 11px 4px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); font-weight: 500; }
.quick-links li:last-child a { border-bottom: 0; }
.quick-links a:hover { color: var(--navy); padding-left: 8px; transition: padding .15s; }

.event-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 6px; background: none; border: 0; border-bottom: 1px solid var(--border); text-align: left; cursor: pointer; }
.event-row:hover { background: #f7f9fc; }
.event-row-title { flex: 1; font-weight: 500; }
.day-list { display: grid; gap: 16px; }

/* ===== 게시판 페이지 ===== */
.page { padding-top: 28px; padding-bottom: 56px; }
.page-head { padding-bottom: 18px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.crumb { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--navy); }
.page-head h1 { margin: 0; font-family: var(--serif); font-size: clamp(24px, 3.5vw, 30px); color: var(--navy-deep); position: relative; padding-left: 14px; }
.page-head h1::before { content: ''; position: absolute; left: 0; top: 18%; bottom: 18%; width: 4px; background: var(--gold); }
.page-desc { margin: 6px 0 0; color: var(--muted); }

.notice { display: flex; gap: 10px; align-items: baseline; padding: 12px 16px; margin-bottom: 18px; background: #fff8e6; border: 1px solid #ecd9a1; border-left: 4px solid var(--gold); border-radius: var(--radius); font-size: 14px; }
.notice strong { color: #8a6a0a; flex: none; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.toolbar-left { display: flex; gap: 8px; flex: 1; min-width: 0; max-width: 520px; }
.toolbar-left .input-select { width: auto; flex: none; }
.count { margin: 0 0 8px; font-size: 13.5px; color: var(--muted); }
.count strong { color: var(--navy); }

.board-table { width: 100%; border-collapse: collapse; background: var(--surface); border-top: 2px solid var(--navy); font-size: 14.5px; }
.board-table th { background: #f7f9fc; font-weight: 700; padding: 11px 12px; border-bottom: 1px solid var(--border-strong); text-align: center; white-space: nowrap; }
.board-table td { padding: 12px; border-bottom: 1px solid var(--border); text-align: center; }
.board-table td.col-main { text-align: left; font-weight: 500; }
.board-table th.col-main { text-align: left; }
.board-table .col-no { width: 64px; color: var(--muted); }
.board-table tbody tr { cursor: pointer; }
.board-table tbody tr:hover { background: #f8fafd; }
.board-table tbody tr:hover td.col-main { color: var(--navy); text-decoration: underline; }
.link { font-weight: 500; text-decoration: none; }
.link:hover { text-decoration: underline; }

.empty { padding: 48px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.empty.small { padding: 16px 8px; border: 0; background: none; font-size: 13.5px; }

/* ===== 포트폴리오 카드 ===== */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.p-card { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--navy); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.p-card-top h3 { margin: 0; font-size: 17px; color: var(--navy-deep); }
.p-owner { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.chips li { font-size: 12px; padding: 1px 8px; border-radius: 3px; background: var(--navy-soft); color: var(--navy); }
.p-desc { margin: 0; color: #3c4657; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.p-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }

/* ===== 모달 ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: grid; place-items: center; padding: 16px; z-index: 100; animation: fade .15s ease-out; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 8px; border-top: 4px solid var(--navy); box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { margin: 0; font-family: var(--serif); font-size: 18px; color: var(--navy-deep); }
.modal-body { padding: 20px; }
@keyframes fade { from { opacity: 0; } }

.tabs { display: flex; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.tab { flex: 1; padding: 10px; background: none; border: 0; border-bottom: 3px solid transparent; cursor: pointer; font-weight: 500; color: var(--muted); }
.tab.active { color: var(--navy); border-bottom-color: var(--navy); font-weight: 700; }

.form { display: grid; gap: 14px; }
.field label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 5px; }
.req { color: var(--red); }
.hint { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.form-error { margin: 0; color: var(--red); font-size: 14px; min-height: 0; }
.form-error:empty { display: none; }

.detail { display: grid; gap: 14px; }
.detail-title { margin: 0; font-size: 20px; color: var(--navy-deep); }
.detail-meta { margin: -8px 0 0; font-size: 13px; color: var(--muted); }
.dl { margin: 0; border-top: 1px solid var(--border); }
.dl-row { display: grid; grid-template-columns: 96px 1fr; border-bottom: 1px solid var(--border); }
.dl dt { padding: 9px 10px; background: #f7f9fc; font-weight: 500; font-size: 13.5px; color: #3c4657; }
.dl dd { margin: 0; padding: 9px 12px; font-size: 14px; }
.detail-body { white-space: pre-wrap; background: #fafbfc; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; font-size: 14.5px; }
.detail .btn-outline { justify-self: start; }
.detail-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 12px; border-top: 1px solid var(--border); }

/* ===== 토스트 ===== */
.toast-box { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--navy-deep); color: #fff; padding: 10px 18px; border-radius: var(--radius); font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); transition: opacity .35s; }
.toast.hide { opacity: 0; }

/* ===== 푸터 ===== */
.site-footer { background: #2a3140; color: #aab3c3; font-size: 13px; margin-top: auto; }
.footer-inner { padding: 24px 16px; }
.footer-inner strong { color: #fff; font-family: var(--serif); font-size: 15px; }
.footer-inner p { margin: 4px 0 0; }
.footer-inner .copy { color: #7d8699; }

/* ===== 반응형 ===== */
@media (max-width: 960px) {
  .home { grid-template-columns: minmax(0, 1fr); }
  .side { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}

@media (max-width: 760px) {
  .topbar-inner { min-height: 64px; gap: 10px; }
  .brand-text small { display: none; }
  .brand-text strong { font-size: 17px; }
  .emblem { width: 38px; height: 38px; font-size: 17px; }
  .nav-toggle { display: flex; }
  .mainnav { box-shadow: none; }
  .nav-list { display: none; flex-direction: column; padding: 4px 0; }
  .nav-list.open { display: flex; }
  .nav-list a { padding: 12px 4px; border-bottom: 1px solid rgba(255, 255, 255, .08); border-left: 3px solid transparent; }
  .nav-list a.active { border-bottom-color: rgba(255, 255, 255, .08); border-left-color: var(--gold); padding-left: 12px; }
  .user-chip { display: none; }

  .hero { padding: 28px 0 30px; }
  .panel { padding: 14px; }
  .cal-title { font-size: 18px; min-width: 0; }
  .cal-toolbar .btn-primary { width: 100%; }
  .cal-cell { min-height: 64px; padding: 4px 2px; align-items: center; }
  .cal-events { display: none; }
  .cal-dots { display: flex; }

  .toolbar-left { max-width: none; flex-basis: 100%; }
  .toolbar > .btn { width: 100%; }

  /* 표 → 카드형 목록 */
  .board-table, .board-table tbody, .board-table tr, .board-table td { display: block; width: 100%; }
  .board-table thead { display: none; }
  .board-table tr { padding: 12px 4px; border-bottom: 1px solid var(--border); }
  .board-table td { border: 0; padding: 2px 8px; text-align: left; display: flex; gap: 10px; font-size: 14px; }
  .board-table td::before { content: attr(data-label); flex: none; width: 72px; color: var(--muted); font-size: 13px; }
  .board-table td.col-main { order: -1; font-size: 15.5px; padding-bottom: 6px; }
  .board-table td.col-main::before { display: none; }
  .board-table .col-no { display: none; }
  .board-table tr { display: flex; flex-direction: column; }

  .dl-row { grid-template-columns: 80px 1fr; }
}

@media (max-width: 380px) {
  .auth-area .btn-primary { display: none; }
}
