/* AID 공통 스타일.
   값 기준은 docs/DESIGN.md이다. Tailwind 유틸리티로 표현하기 어렵거나
   여러 화면에서 반복되는 규칙만 여기에 둔다. */

:root {
    --aid-navy: #03254b;
    --aid-blue: #3cace5;
    --aid-action: #075985;
    --aid-surface: #f8fafc;
    --aid-border: #cbd5e1;
    --aid-text: #0f172a;
    --aid-muted: #475569;
    --aid-blue-soft: #e1f2fa;
    --aid-blue-mist: #e8f0f7;
    --aid-indigo-soft: #e9edf8;
    --aid-slate-soft: #edf2f6;
    --aid-archive-bg: #f5f8fb;
    color-scheme: light;
}

body {
    /* 긴 한국어 제목이 어절 중간에서 끊기지 않도록 한다. */
    word-break: keep-all;
    line-height: 1.7;
}

/* 같은 페이지 안의 이동은 부드럽게 넘어간다. 고정 헤더에 가리지 않도록
   대상 요소에는 scroll-margin을 함께 준다(템플릿의 scroll-mt-16).
   동작 감소 설정에서는 즉시 이동한다. */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* ---------- 포커스와 건너뛰기 링크 ---------- */

a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(7, 89, 133, 0.55);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100;
    padding: 0.75rem 1rem;
    background: var(--aid-navy);
    color: #fff;
    font-weight: 600;
    transform: translateY(-120%);
}

.skip-link:focus {
    transform: translateY(0);
}

/* ---------- 내비게이션 ---------- */

.nav-link {
    position: relative;
    display: inline-block;
    padding: 0.25rem 0;
    color: var(--aid-muted);
    font-size: 0.95rem;
    transition: color 150ms ease;
}

.nav-link::after {
    position: absolute;
    right: 0;
    bottom: -0.35rem;
    left: 0;
    height: 2px;
    content: "";
    background: var(--aid-action);
    transform: scaleX(0);
    transition: transform 150ms ease;
}

.nav-link:hover {
    color: var(--aid-action);
}

.nav-link-active {
    color: var(--aid-navy);
    font-weight: 600;
}

.nav-link:hover::after,
.nav-link-active::after {
    transform: scaleX(1);
}

.mobile-nav-link {
    display: block;
    padding: 0.7rem 0.25rem;
    color: var(--aid-muted);
    min-height: 44px;
}

.mobile-nav-link-active {
    color: var(--aid-navy);
    font-weight: 600;
}

/* ---------- 버튼 ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.btn-primary {
    background: var(--aid-action);
    color: #fff;
}

.btn-primary:hover {
    background: var(--aid-navy);
}

.btn-secondary {
    border: 1px solid var(--aid-border);
    background: #fff;
    color: var(--aid-navy);
}

.btn-secondary:hover {
    border-color: var(--aid-action);
    color: var(--aid-action);
}

.btn-on-navy {
    background: #fff;
    color: var(--aid-navy);
}

.btn-on-navy:hover {
    background: #e0f2fe;
}

.btn[aria-disabled="true"],
.btn:disabled {
    background: #e2e8f0;
    border-color: #e2e8f0;
    color: #64748b;
    cursor: not-allowed;
}

/* ---------- 카드 ---------- */

.aid-card {
    display: block;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

a.aid-card:hover,
.aid-card-hover:hover {
    border-color: var(--aid-blue);
    box-shadow: 0 8px 24px -16px rgba(3, 37, 75, 0.45);
}

/* ---------- 배지 ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-neutral { background: #f1f5f9; color: #334155; }
.badge-brand { background: #e0f2fe; color: var(--aid-action); }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #b91c1c; }

/* ---------- 본문 서식 ---------- */

.aid-prose {
    max-width: 720px;
    color: #1e293b;
    white-space: pre-line;
}

.aid-prose a {
    color: var(--aid-action);
    text-decoration: underline;
}

/* ---------- 활동 아카이브 소개 ----------
   홈의 파랑·흰색 체계와 이어지도록 네이비, 하늘색, 청회색, 옅은
   인디고만 사용한다. 명도와 채도 차이로 활동을 구분한다. */

.activity-cover {
    background:
        linear-gradient(90deg, rgba(3, 37, 75, 0.045) 1px, transparent 1px),
        var(--aid-archive-bg);
    background-size: 5rem 100%;
}

.activity-soft-section {
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    background: var(--aid-surface);
}

.activity-tone-blue {
    border-color: #86c7e5;
    background: var(--aid-blue-soft);
    color: var(--aid-navy);
}

.activity-tone-mist {
    border-color: #9bb7cb;
    background: var(--aid-blue-mist);
    color: #173d5c;
}

.activity-tone-indigo {
    border-color: #9caed4;
    background: var(--aid-indigo-soft);
    color: #263c70;
}

.activity-tone-slate {
    border-color: #a8bac8;
    background: var(--aid-slate-soft);
    color: #284155;
}

.activity-text-link {
    border-bottom: 2px solid currentColor;
}

.activity-arrow {
    display: inline-block;
    transition: transform 180ms ease;
}

.group:hover .activity-arrow,
.activity-text-link:hover .activity-arrow {
    transform: translateX(0.3rem);
}

.activity-text-link:hover .activity-arrow {
    transform: translateY(0.2rem);
}

.activity-route {
    position: relative;
}

.activity-route::before {
    position: absolute;
    top: 50%;
    right: 12%;
    left: 12%;
    height: 2px;
    content: "";
    background: rgba(3, 37, 75, 0.18);
    transform: rotate(-8deg);
}

.activity-route-step {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 10.5rem;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    padding: 1.25rem;
    border: 1px solid;
    border-radius: 1.125rem;
    box-shadow: 0 14px 30px -25px rgba(3, 37, 75, 0.8);
    transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 220ms ease;
}

.activity-route-step::after {
    position: absolute;
    top: -2.25rem;
    right: -2rem;
    width: 7rem;
    height: 7rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    content: "";
    opacity: 0.18;
    transition: transform 300ms ease;
}

.activity-route-step:hover {
    transform: translateY(-0.35rem) rotate(-1deg);
    box-shadow: 0 22px 38px -26px rgba(3, 37, 75, 0.7);
}

.activity-route-step:hover::after {
    transform: scale(1.2) translate(-0.35rem, 0.35rem);
}

.activity-route-number {
    position: absolute;
    top: 1rem;
    left: 1.25rem;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    opacity: 0.75;
}

.activity-route-step strong {
    font-size: 1.35rem;
    line-height: 1.25;
}

.activity-route-step > span:last-child {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.78;
}

.activity-track {
    display: flex;
    min-height: 21rem;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem;
    border: 1px solid;
    border-radius: 1.125rem;
    transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 220ms ease;
}

.activity-track:hover {
    transform: translateY(-0.35rem);
    box-shadow: 0 22px 35px -28px rgba(3, 37, 75, 0.75);
}

.activity-track-label {
    display: inline-flex;
    padding: 0.25rem 0.55rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.activity-track h3 {
    margin-top: 1.25rem;
    color: var(--aid-navy);
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1.25;
}

.activity-track p {
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

.activity-track dl {
    margin-top: 2rem;
    border-top: 1px solid currentColor;
}

.activity-track dl > div {
    display: grid;
    grid-template-columns: 3.25rem 1fr;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid;
    border-color: rgba(3, 37, 75, 0.18);
    font-size: 0.82rem;
}

.activity-track dt {
    font-weight: 800;
}

.activity-program {
    position: relative;
    display: flex;
    min-height: 22rem;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: 1.75rem;
    border: 1px solid transparent;
    border-radius: 1.25rem;
    transition: box-shadow 220ms ease, border-color 220ms ease;
}

.activity-program::after {
    position: absolute;
    right: -4rem;
    bottom: -5rem;
    width: 15rem;
    height: 15rem;
    border: 2px solid currentColor;
    border-radius: 999px;
    content: "";
    opacity: 0.13;
    transition: transform 360ms cubic-bezier(0.16, 1, 0.3, 1);
}

.activity-program:hover {
    border-color: currentColor;
    box-shadow: 0 24px 44px -34px rgba(3, 37, 75, 0.9);
}

.activity-program:hover::after {
    transform: translate(-1.25rem, -0.75rem) scale(1.08);
}

.activity-program-navy {
    background: var(--aid-navy);
    color: #fff;
}

.activity-program-mist {
    background: var(--aid-blue-mist);
    color: #173d5c;
}

.activity-program-indigo {
    background: var(--aid-indigo-soft);
    color: #263c70;
}

.activity-program-index {
    position: relative;
    z-index: 1;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    opacity: 0.72;
}

.activity-program div,
.activity-program-link {
    position: relative;
    z-index: 1;
}

.activity-program p {
    font-size: 0.9rem;
    font-weight: 800;
}

.activity-program h3 {
    margin-top: 0.55rem;
    font-size: clamp(1.75rem, 3.1vw, 2.75rem);
    font-weight: 800;
    line-height: 1.18;
    letter-spacing: -0.025em;
}

.activity-program-link {
    align-self: flex-start;
    padding-bottom: 0.15rem;
    border-bottom: 1px solid currentColor;
    font-size: 0.9rem;
    font-weight: 700;
}

.activity-index-row {
    position: relative;
    transition: background-color 180ms ease, padding 180ms ease;
}

.activity-index-row:hover,
.activity-index-row:focus-visible {
    background: var(--aid-surface);
}

.activity-preview {
    pointer-events: none;
    position: absolute;
    top: 0;
    right: 0;
    display: none;
    width: 18rem;
    height: 18rem;
    overflow: hidden;
    border: 1px solid;
    border-radius: 1.125rem;
    opacity: 0;
    transform: translateY(0.75rem) rotate(1deg);
    transition: opacity 180ms ease, transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.activity-index-row:hover .activity-preview,
.activity-index-row:focus-visible .activity-preview {
    opacity: 1;
    transform: none;
}

.activity-browse {
    display: grid;
    min-height: 8.5rem;
    grid-template-columns: auto 1fr auto;
    align-items: end;
    gap: 1rem;
    padding: 1.25rem;
    border: 1px solid;
    border-radius: 1rem;
    transition: box-shadow 180ms ease, border-color 180ms ease;
}

.activity-browse:hover {
    border-color: currentColor;
    box-shadow: 0 18px 32px -27px rgba(3, 37, 75, 0.8);
}

.activity-browse > span:first-child {
    align-self: start;
    font-size: 0.75rem;
    font-weight: 800;
}

.activity-browse strong {
    font-size: 1.25rem;
    color: var(--aid-navy);
}

@media (min-width: 1024px) {
    .activity-preview {
        display: flex;
    }
}

@media (prefers-reduced-motion: reduce) {
    .activity-route-step:hover,
    .activity-track:hover,
    .activity-route-step:hover::after,
    .activity-program:hover::after,
    .group:hover .activity-arrow,
    .activity-text-link:hover .activity-arrow,
    .activity-index-row:hover .activity-preview,
    .activity-index-row:focus-visible .activity-preview {
        transform: none;
    }
}

/* 표와 코드가 화면 밖으로 밀려나지 않도록 해당 영역만 스크롤한다. */
.scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---------- 필터 칩 ---------- */

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--aid-border);
    border-radius: 9999px;
    background: #fff;
    color: var(--aid-muted);
    font-size: 0.875rem;
    transition: border-color 150ms ease, color 150ms ease;
}

.chip:hover {
    border-color: var(--aid-action);
    color: var(--aid-action);
}

/* 선택 상태는 색뿐 아니라 굵기와 체크 표시로도 구분한다. */
.chip-active {
    border-color: var(--aid-action);
    background: var(--aid-action);
    color: #fff;
    font-weight: 700;
}

.chip-active:hover {
    color: #fff;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------- 단계형 화면 구성 ----------
   홈은 한 화면에 한 단계씩 보여 준다. 내용이 없는 단계까지 전체 높이로
   그리면 빈 화면만 남으므로, 내용이 있는 단계에만 .step-full을 붙인다. */

.step {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 5rem;
    padding-bottom: 5rem;
}

.step-full {
    /* 모바일 주소창이 접히고 펴질 때 높이가 튀지 않도록 svh를 쓴다. */
    min-height: 100vh;
    min-height: 100svh;
}

/* 고정 헤더 높이만큼 빼서 첫 화면이 정확히 한 화면에 들어가도록 한다. */
.step-hero {
    min-height: 100vh;
    min-height: 100svh;
}

.step-label {
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--aid-blue);
}

.step-label-dark {
    color: var(--aid-action);
}

/* ---------- 스크롤 등장 ----------
   JS가 없거나 실패하면 .js가 붙지 않아 내용이 처음부터 보인다.
   애니메이션은 전달 수단이 아니라 장식이므로 숨김 상태를 기본값으로 두지 않는다. */

.js .reveal {
    opacity: 0;
    transform: translateY(1.5rem);
    transition:
        opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: var(--reveal-delay, 0s);
    will-change: opacity, transform;
}

.js .reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* ---------- Hero 배경 장식 ---------- */

.hero-grid {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 30%, transparent 75%);
}

.hero-glow {
    filter: blur(80px);
    opacity: 0.45;
}

@media (prefers-reduced-motion: reduce) {
    .js .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ---------- 첫 화면 위에 얹히는 내비게이션 ----------
   어두운 Hero 위에서는 투명하게 두고, 스크롤하거나 모바일 메뉴를 열면
   흰 배경으로 바꾼다. 상태 전환은 .is-solid 한 곳에서만 관리한다. */

.nav-overlay {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    border-bottom: 1px solid transparent;
    background: transparent;
    transition: background-color 250ms ease, border-color 250ms ease;
}

.nav-overlay.is-solid {
    border-bottom-color: #f3f4f6;
    background: #fff;
}

.nav-overlay:not(.is-solid) .nav-brand {
    color: #fff;
}

.nav-overlay:not(.is-solid) .nav-brand-sub,
.nav-overlay:not(.is-solid) .nav-icon {
    color: rgba(255, 255, 255, 0.75);
}

.nav-overlay:not(.is-solid) .nav-link {
    color: rgba(255, 255, 255, 0.85);
}

.nav-overlay:not(.is-solid) .nav-link:hover,
.nav-overlay:not(.is-solid) .nav-link-active {
    color: #fff;
}

.nav-overlay:not(.is-solid) .nav-link::after {
    background: #fff;
}

.nav-overlay:not(.is-solid) .btn-primary {
    background: #fff;
    color: var(--aid-navy);
}

.nav-overlay:not(.is-solid) .btn-primary:hover {
    background: #e0f2fe;
}

.nav-overlay:not(.is-solid) .nav-icon:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* ---------- 월간 캘린더 ----------
   요일 칸은 내용 길이와 상관없이 항상 같은 너비를 가진다.
   table-fixed 없이 두면 일정이 있는 요일만 넓어져 달력이 비뚤어진다. */

.cal-table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
}

.cal-table th,
.cal-table td {
    width: 14.2857%;
    border: 1px solid #e2e8f0;
}

.cal-event {
    display: block;
    width: 100%;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.5;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 묶음 메뉴와 단독 메뉴 사이의 구분선. */
.nav-divider {
    display: flex;
    align-items: center;
    padding-left: 1.5rem;
    border-left: 1px solid #e2e8f0;
}

.nav-overlay:not(.is-solid) .nav-divider {
    border-left-color: rgba(255, 255, 255, 0.25);
}

/* ---------- 게시판 표 ----------
   번호·제목·작성자·작성일·조회수를 가진 일반적인 게시판 형태다.
   좁은 화면에서는 제목만 남기고 보조 열을 숨긴다. */

.board-table {
    width: 100%;
    border-collapse: collapse;
}

.board-table thead th {
    padding: 0.75rem 0.5rem;
    border-top: 2px solid var(--aid-navy);
    border-bottom: 1px solid var(--aid-border);
    background: var(--aid-surface);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--aid-muted);
    white-space: nowrap;
}

.board-table tbody td {
    padding: 0.875rem 0.5rem;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9375rem;
    vertical-align: middle;
}

.board-table tbody tr:hover {
    background: var(--aid-surface);
}

/* 상단 고정 글은 배경으로 한 번 더 구분한다. */
.board-table tbody tr.is-pinned {
    background: #f0f9ff;
}

.board-cell-num,
.board-cell-meta {
    text-align: center;
    color: var(--aid-muted);
    font-size: 0.8125rem;
    white-space: nowrap;
}

.board-title-link {
    display: inline-block;
    color: var(--aid-navy);
    font-weight: 500;
}

.board-title-link:hover {
    color: var(--aid-action);
    text-decoration: underline;
}

/* 댓글 수는 제목 옆에 작게 붙인다. */
.board-comment-count {
    margin-left: 0.375rem;
    color: var(--aid-action);
    font-size: 0.8125rem;
    font-weight: 700;
}

/* 어두운 첫 화면 위에서는 로그인(기본 버튼)이 흰 박스로 바뀐다.
   회원가입까지 흰 박스가 되면 둘이 구분되지 않으므로 테두리만 남긴다. */
.nav-overlay:not(.is-solid) .btn-secondary {
    border-color: rgba(255, 255, 255, 0.5);
    background: transparent;
    color: #fff;
}

.nav-overlay:not(.is-solid) .btn-secondary:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}
