:root {
    --blue: #3182f6;
    --blue-deep: #1b64da;
    --blue-pale: #f4f8ff;
    --surface: #fdfefe;
    --surface-soft: #f5f7fa;
    --surface-paper: #f1f2ef;
    --text: #191f28;
    --text-soft: #4e5968;
    --text-muted: #8b95a1;
    --line: #e5e8eb;
    --line-blue: #d7e6fb;
    --warm: #bd684a;
    --mustard: #bc9346;
    --shadow-soft: 0 20px 60px rgba(38, 73, 117, 0.1);
    --radius: 8px;
    --gutter: 64px;
    --max: 1240px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    min-width: 320px;
    overflow-x: clip;
    scroll-behavior: smooth;
    scroll-padding-top: 68px;
}

body {
    display: flex;
    min-width: 320px;
    min-height: 100vh;
    overflow-x: hidden;
    flex-direction: column;
    color: var(--text);
    background: var(--surface);
    font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    letter-spacing: 0;
    word-break: keep-all;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
}

button {
    font: inherit;
}

header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 1005;
    background: rgba(253, 254, 254, 0.94);
    border-bottom: 1px solid rgba(25, 31, 40, 0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

nav {
    display: flex;
    width: min(var(--max), calc(100% - (var(--gutter) * 2)));
    min-height: 60px;
    margin: 0 auto;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.logo img {
    width: auto;
    height: 31px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
}

.nav-links li {
    position: relative;
}

.nav-links a {
    display: block;
    padding: 18px 13px 16px;
    color: #333d4b;
    border-bottom: 2px solid transparent;
    font-size: 0.9rem;
    font-weight: 650;
    text-decoration: none;
    transition: color 220ms var(--ease), border-color 220ms var(--ease);
}

.nav-links a:hover,
.nav-links a:focus-visible {
    color: var(--blue-deep);
    border-bottom-color: var(--blue);
    outline: none;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 1px);
    right: 0;
    min-width: 220px;
    padding: 8px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 18px 45px rgba(38, 73, 117, 0.14);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 220ms var(--ease), visibility 220ms var(--ease), transform 220ms var(--ease);
}

.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    padding: 11px 12px;
    border: 0;
    border-radius: 6px;
    font-size: 0.88rem;
}

.dropdown-menu a:hover,
.dropdown-menu a:focus-visible,
.dropdown-menu a.active {
    color: var(--blue-deep);
    background: var(--blue-pale);
    border-bottom-color: transparent;
}

.dropdown-menu a.active {
    font-weight: 750;
}

.hamburger,
.overlay {
    display: none;
}

.page-header {
    position: relative;
    overflow: hidden;
    margin-top: 60px;
    padding: clamp(32px, 3.5vw, 46px) var(--gutter) clamp(34px, 3.8vw, 50px);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.page-header::before,
.page-header::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

.page-header::before {
    top: 0;
    bottom: 0;
    left: max(var(--gutter), calc((100vw - var(--max)) / 2));
    width: 1px;
    background: #edf0f3;
}

.page-header::after {
    right: max(var(--gutter), calc((100vw - var(--max)) / 2));
    bottom: 0;
    width: clamp(140px, 21vw, 300px);
    height: 3px;
    background: var(--blue);
}

.page-header-inner {
    position: relative;
    z-index: 1;
    width: min(var(--max), 100%);
    margin: 0 auto;
}

.page-header-copy {
    max-width: 650px;
}

.page-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--blue-deep);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.12em;
}

.page-eyebrow::before {
    content: "";
    width: 24px;
    height: 1px;
    background: currentColor;
}

.page-header h1 {
    margin-top: 14px;
    color: var(--text);
    font-size: clamp(1.75rem, 2.6vw, 2.4rem);
    font-weight: 760;
    line-height: 1.14;
    letter-spacing: -0.035em;
    text-wrap: balance;
}

.page-header p {
    max-width: 560px;
    margin-top: 12px;
    color: var(--text-soft);
    font-size: clamp(0.92rem, 1vw, 1rem);
    line-height: 1.72;
}

.portfolio-container {
    width: min(var(--max), calc(100% - (var(--gutter) * 2)));
    margin: 0 auto;
    padding: clamp(48px, 6vw, 76px) 0 clamp(96px, 10vw, 144px);
    flex-grow: 1;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(18px, 2.2vw, 30px);
    align-items: start;
}

.portfolio-item {
    position: relative;
    display: grid;
    overflow: hidden;
    aspect-ratio: 1;
    padding: 12px;
    place-items: center;
    cursor: pointer;
    background: #eef0f2;
    border: 1px solid #e0e4e8;
    border-radius: var(--radius);
    transition: transform 260ms var(--ease), border-color 260ms var(--ease), box-shadow 260ms var(--ease);
}

.portfolio-item::after {
    content: "크게 보기";
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 7px 10px;
    color: #333d4b;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(25, 31, 40, 0.08);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 650;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 220ms var(--ease), transform 220ms var(--ease);
}

.portfolio-item:hover,
.portfolio-item:focus-visible {
    transform: translateY(-3px);
    border-color: #cdd5df;
    box-shadow: 0 18px 42px rgba(38, 73, 117, 0.1);
    outline: none;
}

.portfolio-item:hover::after,
.portfolio-item:focus-visible::after {
    opacity: 1;
    transform: translateY(0);
}

.portfolio-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: opacity 220ms ease;
}

.portfolio-item:hover img {
    opacity: 0.96;
}

body[data-category="package"] .portfolio-item {
    background: #dce0e5;
}

.loading,
.no-images,
.error-message {
    grid-column: 1 / -1;
    display: grid;
    min-height: 240px;
    padding: 36px;
    place-items: center;
    color: var(--text-soft);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-align: center;
}

.loading::after {
    content: "";
    width: 28px;
    height: 28px;
    margin-top: 18px;
    border: 2px solid var(--line-blue);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: loading-spin 800ms linear infinite;
}

.no-images p,
.error-message {
    max-width: 520px;
    color: var(--text-soft);
    font-size: 1rem;
    line-height: 1.7;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    padding: 72px;
    background: rgba(245, 247, 250, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: lightbox-in 220ms ease-out;
}

.lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    position: relative;
    display: flex;
    width: min(1180px, 92vw);
    max-height: 84vh;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 84vh;
    object-fit: contain;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    transition: opacity 150ms ease;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    z-index: 2;
    display: grid;
    width: 46px;
    height: 46px;
    padding: 0;
    place-items: center;
    color: #333d4b;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #d9dee5;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    transition: color 200ms var(--ease), border-color 200ms var(--ease), transform 200ms var(--ease);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover,
.lightbox-close:focus-visible,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible {
    color: var(--blue-deep);
    border-color: var(--blue);
    outline: none;
}

.lightbox-close {
    top: -58px;
    right: 0;
    font-size: 1.55rem;
}

.lightbox-prev,
.lightbox-next {
    top: 50%;
    font-size: 1.65rem;
}

.lightbox-prev {
    left: -68px;
    transform: translateY(-50%);
}

.lightbox-next {
    right: -68px;
    transform: translateY(-50%);
}

.lightbox-prev:hover,
.lightbox-prev:focus-visible,
.lightbox-next:hover,
.lightbox-next:focus-visible {
    transform: translateY(-50%) scale(1.04);
}

.lightbox-counter {
    position: absolute;
    bottom: -52px;
    left: 50%;
    padding: 7px 15px;
    color: var(--text-soft);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    transform: translateX(-50%);
}

footer {
    margin-top: auto;
    padding: 48px var(--gutter) 30px;
    color: var(--text-soft);
    background: var(--surface);
    border-top: 1px solid var(--line);
}

.footer-bottom {
    display: flex;
    width: min(var(--max), 100%);
    margin: 0 auto;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    font-size: 0.78rem;
}

.footer-bottom p {
    line-height: 1.75;
}

.footer-bottom p:last-child {
    flex: none;
    color: var(--text-muted);
}

.mailto {
    color: var(--blue-deep);
    text-decoration: none;
}

.mailto:hover,
.mailto:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}

@keyframes loading-spin {
    to { transform: rotate(360deg); }
}

@keyframes lightbox-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 1024px) {
    :root {
        --gutter: 36px;
    }

    .portfolio-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lightbox-prev {
        left: 16px;
    }

    .lightbox-next {
        right: 16px;
    }
}

@media (max-width: 768px) {
    :root {
        --gutter: 20px;
    }

    body {
        font-size: 15px;
    }

    nav {
        width: calc(100% - (var(--gutter) * 2));
        min-height: 58px;
    }

    .logo img {
        height: 29px;
    }

    .hamburger {
        display: inline-flex;
        width: 42px;
        height: 42px;
        padding: 0;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 5px;
        background: transparent;
        border: 0;
        cursor: pointer;
        z-index: 1007;
    }

    .hamburger .bar {
        display: block;
        width: 22px;
        height: 2px;
        background: var(--text);
        transition: transform 220ms var(--ease), opacity 220ms var(--ease);
    }

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1000;
        background: rgba(25, 31, 40, 0.24);
        opacity: 0;
        visibility: hidden;
        transition: opacity 220ms var(--ease), visibility 220ms var(--ease);
    }

    .overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .nav-links {
        position: fixed;
        top: 58px;
        right: 0;
        z-index: 1006;
        display: flex;
        width: min(360px, 100%);
        padding: 12px;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: 0 0 var(--radius) var(--radius);
        box-shadow: 0 20px 44px rgba(38, 73, 117, 0.18);
        transform: translateY(-10px);
        opacity: 0;
        visibility: hidden;
        transition: transform 220ms var(--ease), opacity 220ms var(--ease), visibility 220ms var(--ease);
    }

    .nav-links.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-links a {
        padding: 13px 14px;
        border: 0;
        border-radius: 6px;
        font-size: 0.98rem;
    }

    .nav-links a:hover,
    .nav-links a:focus-visible {
        background: var(--blue-pale);
    }

    .dropdown-menu {
        position: static;
        display: none;
        min-width: 0;
        padding: 4px 0 4px 10px;
        background: transparent;
        border: 0;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .dropdown.open .dropdown-menu {
        display: block;
    }

    .page-header {
        margin-top: 58px;
        padding: 28px var(--gutter) 30px;
    }

    .page-header::before {
        left: var(--gutter);
    }

    .page-header::after {
        right: var(--gutter);
        width: 120px;
    }

    .page-header h1 {
        margin-top: 12px;
        font-size: clamp(1.65rem, 7vw, 2.05rem);
    }

    .page-header p {
        margin-top: 10px;
        font-size: 0.92rem;
    }

    .portfolio-container {
        width: calc(100% - (var(--gutter) * 2));
        padding: 42px 0 88px;
    }

    .portfolio-grid {
        gap: 18px;
    }

    .portfolio-item {
        padding: 8px;
    }

    .portfolio-item::after {
        display: none;
    }

    .lightbox {
        padding: 20px;
    }

    .lightbox-content {
        width: 100%;
        max-height: 80vh;
    }

    .lightbox-content img {
        max-height: 80vh;
    }

    .lightbox-close {
        top: 14px;
        right: 14px;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 42px;
        height: 42px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-counter {
        bottom: 14px;
    }

    footer {
        padding: 42px var(--gutter) 26px;
    }

    .footer-bottom {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }
}

@media (max-width: 520px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }

}

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

    .portfolio-item:hover,
    .portfolio-item:focus-visible {
        transform: none;
    }
}
