
/* 1. CSS Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* 2. 루트 & Body 설정 */
html {
  font-size: 16px; /* 기본 크기 */
  -webkit-text-size-adjust: 100%; /* 모바일 폰트 크기 자동 조절 방지 */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans KR", sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: #333;
  background-color: #fafafa;
  word-break: keep-all; /* 한글 단어 단위 줄바꿈 */
  overflow-wrap: break-word;
}

/* 3. 메인 콘텐츠 영역 */
main {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px;
  background-color: #fff;
}

/* 데스크톱에서 여백 확대 */
@media (min-width: 768px) {
  main {
    padding: 40px 32px;
  }
}

/* 4. 내비게이션 링크 (홈으로, 뒤로가기) */
main > a:first-child {
  display: inline-block;
  margin-bottom: 24px;
  padding: 8px 16px;
  font-size: 0.9rem;
  color: #555;
  text-decoration: none;
  background-color: #f5f5f5;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
  transition: background-color 0.2s ease;
}

main > a:first-child:hover {
  background-color: #e8e8e8;
  color: #333;
}

main > a:first-child:focus {
  outline: 2px solid #4285f4;
  outline-offset: 2px;
}

/* 5. 제목 스타일 */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  font-weight: 700;
  color: #222;
  margin-top: 1.5em;
  margin-bottom: 0.75em;
}

h1 {
  font-size: 1.8rem;
  margin-top: 0;
  padding-bottom: 12px;
  border-bottom: 2px solid #e0e0e0;
}

h2 {
  font-size: 1.5rem;
  margin-top: 2em;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.1rem;
}

h5, h6 {
  font-size: 1rem;
}

/* 데스크톱에서 제목 크기 확대 */
@media (min-width: 768px) {
  h1 {
    font-size: 2.2rem;
  }
  h2 {
    font-size: 1.75rem;
  }
  h3 {
    font-size: 1.4rem;
  }
}

/* 6. 문단 & 텍스트 */
p {
  margin-bottom: 1.2em;
  line-height: 1.8;
}

/* 7. 링크 */
a {
  color: #1a73e8;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

a:hover {
  color: #0d47a1;
}

a:focus {
  outline: 2px solid #4285f4;
  outline-offset: 2px;
  border-radius: 2px;
}

a:visited {
  color: #4a3aa3;
}

/* 8. 목록 */
ul, ol {
  margin: 1.2em 0;
  padding-left: 1.5em;
}

li {
  margin-bottom: 0.6em;
  line-height: 1.7;
}

/* 목차(nav) 내부 목록은 스타일 단순화 */
nav ul {
  list-style: none;
  padding-left: 0;
}

nav li {
  margin-bottom: 0.5em;
}

nav a {
  text-decoration: none;
  color: #1a73e8;
}

nav a:hover {
  text-decoration: underline;
}

/* 9. 이미지 */
img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5em auto;
  border-radius: 4px;
}

/* 10. 코드 & Pre */
code {
  font-family: "Courier New", Courier, monospace;
  font-size: 0.9em;
  background-color: #f5f5f5;
  padding: 2px 6px;
  border-radius: 3px;
  color: #b00020;
}

pre {
  background-color: #f5f5f5;
  padding: 16px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.5em 0;
}

pre code {
  background-color: transparent;
  padding: 0;
  color: inherit;
}

/* 11. 인용구 */
blockquote {
  margin: 1.5em 0;
  padding: 12px 20px;
  border-left: 4px solid #e0e0e0;
  background-color: #fafafa;
  color: #555;
  font-style: italic;
}

/* 12. 표 */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95rem;
}

th, td {
  padding: 12px;
  text-align: left;
  border: 1px solid #e0e0e0;
}

th {
  background-color: #f5f5f5;
  font-weight: 600;
  color: #222;
}

tr:nth-child(even) {
  background-color: #fafafa;
}

/* 13. Section & Article */
section, article {
  margin-bottom: 2.5em;
}

/* 14. Header & Footer */
header {
  margin-bottom: 2em;
}

footer {
  margin-top: 3em;
  padding-top: 2em;
  border-top: 1px solid #e0e0e0;
  font-size: 0.9rem;
  color: #666;
  line-height: 1.6;
}

footer p {
  margin-bottom: 0.5em;
}

footer a {
  color: #1a73e8;
}

/* 15. 시간 표시 */
time {
  font-size: 0.9rem;
  color: #666;
  font-style: italic;
}

/* 16. 강조 */
strong, b {
  font-weight: 700;
  color: #222;
}

em, i {
  font-style: italic;
}

/* 17. 수평선 */
hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 2em 0;
}

/* 18. 폼 요소 (문의 페이지 등) */
input, textarea, select, button {
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
}

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: #fff;
}

input:focus,
textarea:focus {
  outline: 2px solid #4285f4;
  outline-offset: 0;
  border-color: #4285f4;
}

button {
  padding: 10px 20px;
  background-color: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

button:hover {
  background-color: #0d47a1;
}

button:focus {
  outline: 2px solid #4285f4;
  outline-offset: 2px;
}

/* 19. 접근성 - 화면 리더 전용 텍스트 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 20. Skip to content 링크 */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* 21. 인쇄 스타일 */
@media print {
  body {
    background-color: #fff;
  }
  
  main {
    max-width: 100%;
    padding: 0;
  }
  
  a {
    text-decoration: none;
    color: #000;
  }
  
  nav, footer {
    display: none;
  }
}

/* 22. 모바일 추가 최적화 */
@media (max-width: 480px) {
  html {
    font-size: 15px; /* 작은 화면에서 약간 축소 */
  }
  
  h1 {
    font-size: 1.6rem;
  }
  
  h2 {
    font-size: 1.35rem;
  }
  
  table {
    font-size: 0.85rem;
  }
  
  th, td {
    padding: 8px;
  }
}
