:root{
  --bg: #f6f8fc;
  --surface: #ffffff;
  --border: rgba(15, 23, 42, 0.10); /* slate-ish */
  --text: #0f172a;
  --muted: rgba(15, 23, 42, 0.65);
  --primary: #2563eb;  /* school blue */
  --primary-2:#1d4ed8;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
}

*{ box-sizing: border-box; }
html, body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

/* 링크 */
a{ color: var(--primary); text-decoration:none; }
a:hover{ text-decoration: underline; }

/* 레이아웃 */
.container{
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
}


/* 상단 앱바(학교 느낌) */
.site-header{
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.navbar{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.brand{
  display:flex;
  align-items:center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: .02em;
}

.brand-badge{
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}

.nav-links{
  display:flex;
  gap: 10px;
  align-items:center;
}

.nav-links a{
  padding: 8px 10px;
  border-radius: 10px;
  color: rgba(15, 23, 42, 0.82);
}
.nav-links a:hover{
  background: rgba(37, 99, 235, 0.08);
  color: var(--text);
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor:pointer;
  box-shadow: 0 6px 18px rgba(15,23,42,0.06);
}
.btn-primary{
  border-color: rgba(37, 99, 235, 0.25);
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover{ background: var(--primary-2); }

/* 메인 히어로(학교 공지 느낌) */
.hero{
  padding: 34px 0 18px;
}
.hero-inner{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  padding: 26px;
  box-shadow: var(--shadow);
}
.hero h1{
  margin: 0 0 8px;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.2;
}
.hero p{
  margin: 0 0 14px;
  color: var(--muted);
  max-width: 70ch;
}
.hero-actions{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* 카드 그리드 */
.grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
  padding: 18px 0 40px;
}

.card{
  grid-column: span 6;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 6px 20px rgba(15,23,42,0.06);
}
.card h3{ margin: 0 0 6px; }
.card p{ margin: 0; color: var(--muted); }

@media (max-width: 820px){
  .nav-links{ display:none; } /* 모바일에선 햄버거로 바꾸면 좋음 */
  .card{ grid-column: span 12; }
}


/* ===== Form Page ===== */
.section{
  padding: 18px 0 40px;
}

.section-title{
  margin: 0 0 10px;
  font-size: 20px;
  letter-spacing: .01em;
}

.form-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 22px;
  box-shadow: var(--shadow);
}

.form-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full{
  grid-column: 1 / -1;
}

.label{
  font-size: 13px;
  color: var(--muted);
}

.input, .select, .textarea{
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}

.textarea{ min-height: 130px; resize: vertical; }

.input:focus, .select:focus, .textarea:focus{
  border-color: rgba(37, 99, 235, 0.40);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.help{
  font-size: 12px;
  color: rgba(15, 23, 42, 0.55);
}

.error{
  font-size: 12px;
  color: #b91c1c;
}

.form-actions{
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* Django form 기본 렌더링이랑 맞추기 */
.form-card input,
.form-card select,
.form-card textarea{
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

@media (max-width: 820px){
  .form-grid{ grid-template-columns: 1fr; }
}

/* ===== PDF Styles (WeasyPrint) ===== */
.pdf{
  background: #fff;
  color: #111827;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
}

.pdf .pdf-page{
  padding: 24px;
}

.pdf .pdf-title{
  margin: 0 0 14px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .02em;
}

.pdf .pdf-sub{
  margin: 0 0 18px;
  color: rgba(17,24,39,.70);
  font-size: 12px;
}

.pdf .pdf-box{
  border: 1px solid rgba(15,23,42,0.16);
  border-radius: 14px;
  padding: 18px;
}

.pdf .pdf-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pdf .pdf-row{
  padding: 10px 12px;
  border: 1px solid rgba(15,23,42,0.10);
  border-radius: 12px;
}

.pdf .pdf-row.full{
  grid-column: 1 / -1;
}

.pdf .pdf-label{
  font-size: 11px;
  color: rgba(17,24,39,.65);
  margin-bottom: 4px;
}

.pdf .pdf-value{
  font-size: 13px;
  color: #111827;
  white-space: pre-wrap;
}

/* Footer */
.pdf .pdf-footer{
  margin-top: 14px;
  font-size: 11px;
  color: rgba(17,24,39,.55);
}

/* A4 세팅 */
@page{
  size: A4;
  margin: 18mm;
}

/* Django 기본 위젯이 class 없어도 무조건 보이게 */
.form-card input,
.form-card select,
.form-card textarea{
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 14px;
}

.form-card textarea{
  min-height: 130px;
}

.tile-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.tile{
  border-radius: 16px;
  overflow:hidden;
  border: 4px solid #2b6cff;
  text-decoration:none;
  min-height: 160px;
  background: rgba(0,0,0,0.35);
  display:block;
}

.tile-inner{
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  padding:18px;
}

.tile-title{
  font-size: 44px;
  font-weight: 900;
  letter-spacing: 1px;
  color:#fff;
  text-transform: uppercase;
}

.tile-sub{
  margin-top:6px;
  color: rgba(255,255,255,0.85);
  font-weight: 700;
}

.tile-photo{
  background-size: cover;
  background-position: center;
  position: relative;
}

.tile-overlay{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  background: rgba(0,0,0,0.45);
}

.image-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.image-card{
  border: 2px solid rgba(80, 160, 255, 0.8); /* 테두리 */
  border-radius: 16px;
  overflow: hidden; /* 둥근 모서리 밖으로 안 나가게 */
  background: rgba(0,0,0,0.35);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.image-card:hover{
   transform: translateY(-2px);
  border-color: rgba(80, 160, 255, 1);
  box-shadow: 0 14px 40px rgba(0,0,0,0.45);
}
/* 
.image-card img{
  width:100%;
  height: 200px;
  object-fit: cover;
  display:block;
} */

.image-card img {
  width: 100%;
  height: 220px;          /* 원하는 높이 */
  object-fit: contain;    /* ✅ 안 짤림 */
  background: #111;       /* 남는 여백 색 */
  border-radius: 14px;
  display: block;
}


.image-card .cap{
  padding:10px 12px;
  color:#fff;
  font-weight:700;
}

@media (max-width: 820px){
  .tile-grid{
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
  .image-grid{
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
}

.post-thumb{
  width: 100%;
  height: 190px;        /* 썸네일 높이 (원하는대로 160~220) */
  object-fit: cover;    /* 꽉 차게(일부 크롭) */
  display: block;
  border-radius: 0;     /* 카드가 overflow:hidden이라 굳이 필요 없음 */
  border: 0;
  margin: 0;
}

.post-image {
  width: 100%;
  max-width: 720px;     /* 본문 최대 폭 */
  max-height: 420px;
  object-fit: contain; /* 잘리지 않게 전체 표시 */
  display: block;
  margin: 24px auto;
  border-radius: 16px;
  background: #f4f6f8;
  padding: 8px;
}

.card-list{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card img{
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(0,0,0,0.12);
}

/* ===== Comments UI ===== */
.comment-title{
  margin: 28px 0 12px;
  font-size: 18px;
  font-weight: 800;
}

.comment-section{
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-item{
  display: flex;
  gap: 12px;
  padding: 14px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(15,23,42,0.05);
}

.comment-avatar{
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  flex: 0 0 auto;
}

.comment-content{
  min-width: 0;
  flex: 1;
}

.comment-head{
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.comment-author{
  font-weight: 800;
}

.comment-time{
  color: var(--muted);
  font-size: 13px;
}

.comment-dot{
  color: rgba(15,23,42,0.25);
}

.comment-body{
  color: rgba(15,23,42,0.88);
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.comment-empty{
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed rgba(15,23,42,0.18);
  color: var(--muted);
  background: rgba(255,255,255,0.6);
}

/* comment form card */
.comment-form-card{
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.comment-form-title{
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 900;
  color: rgba(15,23,42,0.85);
}

.comment-form-card textarea{
  width: 100%;
  min-height: 120px;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 12px 12px;
  font-size: 14px;
  resize: vertical;
  outline: none;
}

.comment-form-card textarea:focus{
  border-color: rgba(37, 99, 235, 0.40);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.comment-actions{
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}
