/* =====================================================================
 * 울산대 교내 대회·공모전 모음 — 스타일
 * 색만 바꾸면 손쉽게 리브랜딩 가능
 * ===================================================================== */

:root {
  --navy: #143a5a;       /* 메인 컬러 (울산대 블루 계열) */
  --navy-dark: #0d2a44;
  --accent: #1d6fe0;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1f2733;
  --muted: #6b7686;
  --line: #e2e6ee;
  --soon: #d6363b;       /* 마감 임박 */
  --open: #128a4c;       /* 진행중 */
  --closed: #9aa3b1;     /* 마감됨 */
  --radius: 12px;
  --shadow: 0 2px 10px rgba(20, 40, 80, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕",
    system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* ── 헤더 ────────────────────────────────────────────────────────── */
header.site { background: var(--navy); color: #fff; }
header.site .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 14px;
  padding-bottom: 14px;
}
header.site a { color: #fff; }
.brand { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.brand small { display: block; font-size: 0.72rem; font-weight: 400; opacity: 0.8; }
nav.site a { margin-left: 16px; font-size: 0.92rem; opacity: 0.92; }
nav.site a:hover { opacity: 1; text-decoration: none; }

/* ── 히어로 ──────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #eaf1fb;
  padding: 22px 0 26px;
}
.hero h1 { margin: 0 0 6px; font-size: 1.5rem; }
.hero p { margin: 0; opacity: 0.9; font-size: 0.95rem; }

/* ── 광고 자리 (애드센스 승인 후 코드 삽입) ──────────────────────── */
.ad-slot { display: none; margin: 18px 0; }

/* ── 새 대회 알림 구독 (EmailOctopus 임베드 감싸기) ──────────────── */
.subscribe {
  background: #eef4fd;
  border: 1px solid #d4e3f7;
  border-radius: var(--radius);
  padding: 18px 16px;
  margin: 18px 0;
  text-align: center;
}
.subscribe h2 { margin: 0 0 4px; font-size: 1.05rem; color: var(--navy); }
.subscribe-desc { margin: 0 0 12px; font-size: 0.9rem; color: var(--muted); }
.subscribe-form { max-width: 520px; margin: 0 auto; }
.subscribe-note { margin: 10px 0 0; font-size: 0.78rem; color: var(--muted); }

/* ── 필터 패널 ───────────────────────────────────────────────────── */
.filters {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 18px 0;
}
.filters .row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.field select,
.field input[type="text"] {
  width: 100%;
  max-width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--text);
}
.filters .row2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.check { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; color: var(--muted); }
.actions { display: flex; gap: 8px; align-items: center; }
.result-meta { font-size: 0.9rem; color: var(--muted); }
.result-meta b { color: var(--navy); }

/* ── 버튼 ────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 600;
}
.btn:hover { background: #1659b8; text-decoration: none; color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 0.85rem; }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn-ghost:hover { background: #eef4fd; color: var(--accent); }

/* ── 카드 목록 ───────────────────────────────────────────────────── */
#list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 30px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
}
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.card-title { margin: 0 0 10px; font-size: 1.08rem; line-height: 1.35; }
.card-meta { list-style: none; margin: 0 0 10px; padding: 0; font-size: 0.88rem; color: var(--text); }
.card-meta li { padding: 2px 0; border-bottom: 1px dashed var(--line); }
.card-meta li:last-child { border-bottom: none; }
.card-meta b { display: inline-block; width: 44px; color: var(--muted); font-weight: 600; }
.card-note { margin: 0 0 10px; font-size: 0.85rem; color: var(--muted); }
.card-actions { margin-top: auto; display: flex; gap: 8px; padding-top: 8px; }

/* ── 배지·D-day ──────────────────────────────────────────────────── */
.badge { font-size: 0.74rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.badge-cat { background: #e6effb; color: var(--navy); }
.dday-wrap { display: flex; align-items: center; gap: 6px; }
.dday { font-size: 0.82rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; }
.dday-soon { background: #fde8e8; color: var(--soon); }
.dday-warn { background: #fdf0dc; color: #b5710f; }   /* D-4~7 주황 */
.dday-open { background: #e4f5ec; color: var(--open); }
.dday-closed { background: #eef0f3; color: var(--closed); }
.dday-none { background: #eef0f3; color: var(--muted); }
/* 마감 임박(D-3 이내) 강조 */
.soon-flag {
  font-size: 0.72rem; font-weight: 800; color: #fff;
  background: var(--soon); padding: 3px 8px; border-radius: 999px;
  white-space: nowrap;
}
.card-urgent { border-color: #f3a7aa; box-shadow: 0 0 0 1px #f3a7aa inset, var(--shadow); }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.note { font-size: 0.85rem; color: var(--muted); }

/* ── 면책 배너 ───────────────────────────────────────────────────── */
.disclaimer {
  background: #fff7e6;
  border: 1px solid #ffe3a3;
  color: #875c10;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.86rem;
  margin: 16px 0;
}

/* ── 콘텐츠/폼 (about·contact·privacy) ───────────────────────────── */
.prose {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin: 20px 0;
}
.prose h1 { font-size: 1.4rem; color: var(--navy); margin-top: 0; }
.prose h2 { font-size: 1.1rem; color: var(--navy); margin-top: 1.6em; }
.prose code { background: #eef0f3; padding: 1px 5px; border-radius: 4px; font-size: 0.88em; }
.prose ul { padding-left: 1.2em; }
.back-link { font-size: 0.9rem; }

.section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 20px 0;
}
.section h2 { margin-top: 0; font-size: 1.15rem; color: var(--navy); }
.form-grid { display: grid; gap: 10px; max-width: 560px; }
.form-grid label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.form-grid input, .form-grid textarea, .form-grid select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 0.95rem; font-family: inherit;
}
.form-grid textarea { min-height: 100px; resize: vertical; }

/* ── 푸터 ────────────────────────────────────────────────────────── */
footer.site {
  background: #fff;
  border-top: 1px solid var(--line);
  margin-top: 30px;
  padding: 24px 0;
  color: var(--muted);
  font-size: 0.86rem;
}
footer.site a { color: var(--muted); margin-right: 14px; }
footer.site .copyright { margin-top: 10px; opacity: 0.85; }

/* ── 반응형 ──────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .filters .row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #list { grid-template-columns: 1fr; }
}
/* ── 모바일(폰) 최적화 ──────────────────────────────────────────── */
@media (max-width: 480px) {
  .filters { padding: 14px; }
  .filters .row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  /* 검색칸은 한 줄 전체 */
  .filters .row .field:first-child { grid-column: 1 / -1; }
  /* 탭 타깃 ≥44px */
  .field select,
  .field input[type="text"] { min-height: 44px; font-size: 16px; } /* 16px=iOS 자동확대 방지 */

  .filters .row2 { gap: 12px; align-items: stretch; }
  .actions { width: 100%; flex-wrap: wrap; gap: 8px; }
  .actions .result-meta { width: 100%; }
  #btn-reset { flex: 1 1 40%; min-height: 44px; }
  #btn-ics { flex: 1 1 100%; min-height: 44px; text-align: center; }
  .check { padding: 8px 0; min-height: 44px; }
  .check input[type="checkbox"] { width: 20px; height: 20px; }

  /* 카드 버튼: 한 손 터치 쉽게 폭 넓힘 */
  .card-actions { flex-wrap: wrap; }
  .card-actions .btn { flex: 1 1 auto; min-height: 42px; display: inline-flex; align-items: center; justify-content: center; }

  /* 헤더 정리 */
  header.site .container { justify-content: center; text-align: center; }
  nav.site a { margin: 0 8px; }
  .hero h1 { font-size: 1.3rem; }
  .hero p { font-size: 0.9rem; }
}
