/* ===== ACCESSIBILITY: Screen reader only & Skip link ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    padding: 0.75rem 1rem;
    background: #1e3a5f;
    color: white;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 4px 4px;
    z-index: 9999;
    transition: top 0.2s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
    top: 0;
    outline: 3px solid #fbbf24;
    outline-offset: 3px;
}

#main-content:focus {
    outline: none;
}
#main-content:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* 키보드 초점 가시성 (KWCAG 11-2: 밝은 배경에서도 식별 가능한 실선) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible {
    outline: 3px solid #0f172a;
    outline-offset: 3px;
}

/* 어두운 헤더·푸터: 고대비(앰버) 링 */
header a:focus-visible,
header button:focus-visible,
footer a:focus-visible {
    outline: 3px solid #fbbf24;
    outline-offset: 3px;
}

/* ===== BASE STYLES ===== */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
}

/* ===== RESPONSIVE CONTAINER ===== */
.responsive-container {
    max-width: 1023px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Full width on small screens */
@media (max-width: 719px) {
    .responsive-container {
        max-width: none;
        padding: 0 1rem;
    }
}

/* ===== RESPONSIVE BREAKPOINTS ===== */
@media (min-width: 390px) {
    .responsive-container {
        padding: 0 1.25rem;
    }
}

@media (min-width: 720px) {
    .responsive-container {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1280px) {
    .responsive-container {
        padding: 0 2rem;
    }
}

/* ===== MOBILE OPTIMIZATIONS ===== */
@media (max-width: 719px) {
    /* Force single column layout */
    .grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Remove gap on mobile */
    .gap-8 {
        gap: 1rem !important;
    }
    
    /* Force full width for all containers */
    .max-w-md,
    .max-w-lg,
    .max-w-xl {
    max-width: 100% !important;
    min-width: 100% !important;
}

/* Force all form containers to single column */
.search-box .flex,
.status-check-box .flex {
    flex-direction: column !important;
}

/* Force cards to full width */
.search-box,
.status-check-box {
    width: 100% !important;
    max-width: none !important;
    min-width: 100% !important;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* ===== HERO SECTION ===== */
.hero-video {
    position: relative;
    width: 100%;
    height: 260px; /* 160px + 위아래 각 50px */
    overflow: hidden;
}

@media (max-width: 719px) {
    .hero-video {
        height: 300px; /* 부제 줄바꿈 시 세로 여유 */
    }
}

.hero-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(10, 20, 10, 0.3);
    color: white;
    text-align: center;
    padding: 1rem;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: visible;
}

/*
 * flex + align-items:center 자식은 기본 min-width:auto라
 * 긴 텍스트가 컨테이너 밖으로 팽창해 잘려 보일 수 있음 → min-width:0 필수
 */
.hero-content > * {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* 부제 래퍼: 모바일/데스크톱 스택 전환, KWCAG상 tabindex 없음 */
.hero-content > .hero-subtitle-wrap {
    display: block;
    min-width: 0;
    max-width: 100%;
}

/* 부제 모바일/데스크톱 전환은 index.html Tailwind(min-[720px]:)로 처리 */

.hero-title {
    font-weight: bold;
    margin-bottom: 0.4rem;
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.5s forwards;
    white-space: normal;
    max-width: 100%;
    word-break: keep-all;
    overflow-wrap: break-word;
    /* Responsive font sizes */
    font-size: 1.3rem; /* xs: 360px */
}

/* word-break: keep-all + 문장 내 <wbr> → 한국어 구절 단위로 줄바꿈 유도 */
.hero-subtitle {
    opacity: 0;
    animation: fadeInUp 1s ease-out 1s forwards;
    white-space: normal;
    max-width: 100%;
    word-break: keep-all;
    overflow-wrap: break-word;
    font-size: 1rem;
}

/* Hero responsive typography */
@media (min-width: 390px) {
    .hero-title { font-size: 1.5rem; }
}

@media (min-width: 720px) {
    .hero-title { font-size: 2rem; }
    .hero-subtitle { font-size: 1.125rem; }
}

@media (min-width: 1280px) {
    .hero-title { font-size: 2.5rem; }
    .hero-subtitle { font-size: 1.25rem; }
}

/* 부제·타이틀은 모든 뷰포트에서 줄바꿈 허용(한 줄 nowrap은 좁은 화면에서 잘림 유발) */

/* ===== CARD COMPONENTS ===== */
.search-box,
.status-check-box {
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.search-box:hover,
.status-check-box:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Responsive padding for cards */
@media (min-width: 390px) {
    .search-box, .status-check-box { padding: 1.25rem; }
    .feature-card { padding: 0.875rem; }
}

@media (min-width: 720px) {
    .search-box, .status-check-box { padding: 1.5rem; }
    .feature-card { padding: 1rem; }
}

@media (min-width: 1280px) {
    .search-box, .status-check-box { padding: 2rem; }
    .feature-card { padding: 1rem; }
}

/* ===== FORM ELEMENTS ===== */
.input-focus {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-focus:focus:not(:focus-visible) {
    outline: none;
}

.input-focus:focus-visible {
    outline: 3px solid #1e3a8a;
    outline-offset: 2px;
    border-color: #1e40af;
    box-shadow: 0 0 0 4px rgba(30, 64, 175, 0.2);
}

/* 활성: 실선 테두리 / 비활성: 점선·줄무늬 배경 → 색약 사용자도 상태를 색만으로 구분하지 않도록 (WCAG 지각 가능성) */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #ffffff;
    border: 2px solid #1e3a8a;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    border-color: #172554;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

/* 파란 그라데이션 버튼: 링 색이 배경과 겹치지 않도록 앰버 실선(심사 11-2) */
.btn-primary:focus-visible:not(:disabled) {
    outline: 3px solid #f59e0b;
    outline-offset: 4px;
    box-shadow: 0 0 0 2px #0f172a, 0 0 0 6px #fef3c7;
}

.btn-primary:disabled {
    background: repeating-linear-gradient(
        -45deg,
        #e5e7eb,
        #e5e7eb 5px,
        #f3f4f6 5px,
        #f3f4f6 10px
    );
    color: #1f2937;
    border: 2px dashed #52525b;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ===== FEATURE CARDS ===== */
.feature-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* ===== RESPONSIVE GRID ===== */
@media (max-width: 719px) {
    .feature-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

@media (min-width: 720px) and (max-width: 1023px) {
    .feature-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (min-width: 1024px) {
    .feature-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* ===== LOADING STATES ===== */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    border: 2px solid #f3f4f6;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== SUGGESTION BOX ===== */
#org-suggestions,
#status-org-suggestions {
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
}

/* 리스트 항목: 외곽선 없음, 배경색만. 첫/끝 항목 모서리는 ul의 rounded-lg와 맞춤 */
#org-suggestions li,
#status-org-suggestions li {
    padding: 0.75rem 1rem;
    cursor: pointer;
    outline: none;
    border: none;
    transition: background-color 0.2s;
}

#org-suggestions li:focus:not(:focus-visible),
#status-org-suggestions li:focus:not(:focus-visible) {
    outline: none;
}

#org-suggestions li:focus-visible,
#status-org-suggestions li:focus-visible {
    outline: 3px solid #1d4ed8;
    outline-offset: -3px;
    box-shadow: inset 0 0 0 2px #fbbf24;
    position: relative;
    z-index: 1;
}

#org-suggestions li:first-child,
#status-org-suggestions li:first-child {
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}

#org-suggestions li:last-child,
#status-org-suggestions li:last-child {
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

#org-suggestions li:hover {
    background-color: #eff6ff; /* blue-50 */
}

#status-org-suggestions li:hover {
    background-color: #f0fdf4; /* green-50 */
}

/* Hero animation with delay (custom for service site) */
.hero-line {
    opacity: 0;
    white-space: normal !important; /* 다른 스타일/캐시와 충돌 시에도 줄바꿈 유지 */
    max-width: 100%;
    width: 100%;
    min-width: 0;
    word-break: keep-all;
    overflow-wrap: break-word;
}
.hero-content.start .hero-line { animation: fadeInUp 0.5s ease-out forwards; }
.hero-content.start .hero-line.line1 { animation-delay: 0s; }
.hero-content.start .hero-line.line2 { animation-delay: 0.5s; }
.hero-content.start .hero-line.line3 { animation-delay: 1s; }

/* ===== Placeholder 대비 (WCAG 2.1 1.4.3, 본문 4.5:1) =====
   흰 입력 배경(#fff) 기준 #767676 ≈ 4.54:1 — 가능한 한 연한 ‘흐림’ 유지.
   Tailwind CDN preflight보다 우선하도록 !important (stylesheet가 head에서 먼저 와도 적용). */
input.input-focus::placeholder,
textarea.input-focus::placeholder {
    color: #767676 !important;
    opacity: 1 !important;
}

