/* 잡웍스(JabWorks) 하이콘트라스트 흑백 모노크롬 · Three.js 리퀴드 크롬 디자인 시스템 */
@layer reset, tokens, base, layout, components;

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    overflow-x: clip;
  }

  body,
  h1,
  h2,
  h3,
  p,
  figure,
  blockquote,
  dl,
  dd {
    margin: 0;
  }

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

  button,
  a {
    font: inherit;
    color: inherit;
  }
}

@layer tokens {
  :root {
    --bg-black: #050505;
    --bg-elevated: #0c0c0d;
    --bg-hover: #141416;
    --ink-white: #ffffff;
    --ink-secondary: #a1a1aa;
    --ink-muted: #71717a;
    --line-hair: rgba(255, 255, 255, 0.14);
    --line-strong: rgba(255, 255, 255, 0.45);
    --font-display: 'SUIT', sans-serif;
    --font-sans: 'SUIT', sans-serif;
    --font-mono: 'SUIT', sans-serif;
    --max-width: 1320px;
    --radius-sharp: 0px;
    --radius-btn: 2px;
    --topbar-height: 88px;
  }
}

@layer base {
  body.site {
    background-color: var(--bg-black);
    color: var(--ink-white);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    letter-spacing: -0.015em;
    word-break: keep-all;
    overflow-wrap: break-word;
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
  }

  a {
    text-decoration: none;
  }

  button {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
  }

  :focus-visible {
    outline: 2px solid var(--ink-white);
    outline-offset: 3px;
  }

  section[id],
  article[id] {
    scroll-margin-top: 96px;
  }
}

@layer layout {
  .main {
    position: relative;
  }

  .section-head {
    max-width: var(--max-width);
    margin: 0 auto 44px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line-hair);
  }

  .section-head__title {
    font-family: var(--font-display);
    font-size: clamp(2.25rem, 4.2vw, 3.5rem);
    font-weight: 200;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: var(--ink-white);
  }
}

@layer components {
  /* 상단 진행 막대 */
  .scrollbeam {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 60;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.06);
  }

  .scrollbeam__bar {
    display: block;
    width: 100%;
    height: 100%;
    transform-origin: 0 50%;
    transform: scaleX(0);
    background: var(--ink-white);
  }

  /* 공통 리빌 */
  .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .reveal--visible {
    opacity: 1;
    transform: translateY(0);
  }

  /* 각진 하이콘트라스트 버튼 */
  .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 22px;
    border-radius: var(--radius-btn);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  }

  .button--solid {
    background: var(--ink-white);
    color: var(--bg-black);
    border: 1px solid var(--ink-white);
  }

  .button--solid:hover {
    background: #e4e4e7;
    border-color: #e4e4e7;
    transform: translateY(-1px);
  }

  .button--muted {
    background: transparent;
    color: var(--ink-muted);
    border: 1px dashed rgba(255, 255, 255, 0.22);
    cursor: default;
  }

  /* 상단 고정 투명/모노크롬 헤더 */
  .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    height: var(--topbar-height);
    border-bottom: 1px solid transparent;
    transition: background-color 0.25s ease, border-color 0.25s ease, backdrop-filter 0.25s ease;
  }

  .topbar--scrolled {
    background: rgba(5, 5, 5, 0.84);
    backdrop-filter: blur(16px);
    border-bottom-color: var(--line-hair);
  }

  .topbar__inner {
    max-width: var(--max-width);
    height: 100%;
    margin: 0 auto;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 36px;
  }

  .topbar__brand {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
  }

  .topbar__logo {
    width: auto;
    height: 44px;
  }

  .topbar__nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 36px;
  }

  .topbar__link {
    font-size: 1.25rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    color: rgba(255, 255, 255, 0.78);
    transition: color 0.2s ease;
  }

  .topbar__link:hover {
    color: var(--ink-white);
  }

  .topbar__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 22px;
    border-radius: var(--radius-btn);
    border: 1px solid var(--line-strong);
    color: var(--ink-white);
    font-size: 1.25rem;
    font-weight: 500;
    flex-shrink: 0;
    transition: background-color 0.2s ease, color 0.2s ease;
  }

  .topbar__cta:hover {
    background: var(--ink-white);
    color: var(--bg-black);
  }

  /* Act 1: 풀스크린 Three.js 3D 크롬 히어로 */
  .hero {
    position: relative;
    min-height: 100svh;
    padding: 108px 28px 96px;
    display: grid;
    place-items: center;
    text-align: center;
    background: var(--bg-black);
    overflow-x: clip;
  }

  .hero__stage {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
  }

  .hero__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  .hero__inner {
    position: relative;
    z-index: 2;
    max-width: 1240px;
    width: 100%;
    will-change: transform, opacity;
  }

  .hero__title {
    display: grid;
    gap: 6px;
    font-family: var(--font-display);
    font-size: clamp(2.85rem, 8.6vw, 7.8rem);
    line-height: 0.96;
    letter-spacing: -0.045em;
  }

  .hero__mask {
    display: block;
    overflow: hidden;
    padding: 0.05em 0;
  }

  .hero__line {
    display: inline-block;
    will-change: transform;
  }

  .hero__line--light {
    font-weight: 100;
    color: var(--ink-white);
    animation: mask-up 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .hero__line--bold {
    font-weight: 900;
    color: var(--ink-white);
    animation: mask-up 0.85s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
  }

  .hero__foot {
    position: absolute;
    left: 28px;
    right: 28px;
    bottom: 28px;
    max-width: var(--max-width);
    margin: 0 auto;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 18px;
    border-top: 1px solid var(--line-hair);
  }

  .hero__meta,
  .hero__scroll {
    font-family: var(--font-mono);
    font-size: 1rem;
    letter-spacing: 0.08em;
    color: var(--ink-secondary);
  }

  .hero__scroll {
    color: var(--ink-white);
    transition: opacity 0.2s ease;
  }

  .hero__scroll:hover {
    opacity: 0.72;
  }

  /* Act 2: 풀블리드 헤어라인 작품 전시 */
  .works {
    padding: 104px 28px 112px;
    border-top: 1px solid var(--line-hair);
    background: var(--bg-black);
    overflow-x: clip;
  }

  /* 독립 최상위 .feature 블록 */
  .feature {
    max-width: var(--max-width);
    margin: 0 auto 40px;
    border: 1px solid var(--line-hair);
    background: var(--bg-elevated);
    display: grid;
    grid-template-columns: minmax(0, 1.38fr) minmax(0, 1fr);
    align-items: stretch;
    transition: border-color 0.25s ease;
  }

  .feature:hover {
    border-color: var(--line-strong);
  }

  .feature__plate {
    display: grid;
    border-right: 1px solid var(--line-hair);
  }

  .feature__media {
    aspect-ratio: 2 / 1;
    overflow: hidden;
    background: #050505;
  }

  .feature__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.16s ease;
  }

  .feature:hover .feature__img {
    transform: scale(1.02);
  }

  .feature__img--fading,
  .work__img--fading {
    opacity: 0.22;
  }

  .feature__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 24px;
    border-top: 1px solid var(--line-hair);
    background: var(--bg-black);
  }

  .feature__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
  }

  .feature__tab,
  .feature__zoom {
    min-height: 40px;
    padding: 6px 2px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--ink-muted);
    border-bottom: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
  }

  .feature__tab:hover,
  .feature__zoom:hover {
    color: var(--ink-white);
  }

  .feature__tab.feature__tab--active,
  .feature__tab.feature__tab--active:hover {
    color: var(--ink-white);
    border-bottom-color: var(--ink-white);
  }

  .feature__body {
    padding: 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 28px;
  }

  .feature__head {
    display: flex;
    align-items: center;
    gap: 18px;
  }

  .feature__icon {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    flex-shrink: 0;
    border: 1px solid var(--line-hair);
  }

  .feature__title {
    font-size: clamp(1.75rem, 2.5vw, 2.2rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
  }

  .feature__summary {
    margin-top: 6px;
    font-size: 1rem;
    color: var(--ink-secondary);
  }

  .feature__links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
  }

  /* 2열 디프티크 그리드 */
  .works__pair {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 40px;
  }

  /* 독립 최상위 .work 블록 */
  .work {
    border: 1px solid var(--line-hair);
    background: var(--bg-elevated);
    display: flex;
    flex-direction: column;
    transition: border-color 0.25s ease;
  }

  .work:hover {
    border-color: var(--line-strong);
  }

  .work__plate {
    display: grid;
  }

  .work__media {
    aspect-ratio: 2 / 1;
    overflow: hidden;
    background: #050505;
  }

  .work__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.16s ease;
  }

  .work:hover .work__img {
    transform: scale(1.02);
  }

  /* 말랑아웃 세로 플레이 화면 contain 처리 */
  .work__plate--portrait .work__media {
    padding: 16px;
    background: #0d0d0f;
  }

  .work__plate--portrait .work__img {
    object-fit: contain;
  }

  .work__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 24px;
    border-top: 1px solid var(--line-hair);
    border-bottom: 1px solid var(--line-hair);
    background: var(--bg-black);
  }

  .work__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
  }

  .work__tab,
  .work__zoom {
    min-height: 40px;
    padding: 6px 2px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--ink-muted);
    border-bottom: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
  }

  .work__tab:hover,
  .work__zoom:hover {
    color: var(--ink-white);
  }

  .work__tab.work__tab--active,
  .work__tab.work__tab--active:hover {
    color: var(--ink-white);
    border-bottom-color: var(--ink-white);
  }

  .work__body {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex: 1;
  }

  .work__title-row {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .work__icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    flex-shrink: 0;
    border: 1px solid var(--line-hair);
  }

  .work__title {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
  }

  .work__summary {
    margin-top: 4px;
    font-size: 1rem;
    color: var(--ink-secondary);
  }

  .work__links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: auto;
  }

  .work__link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 20px;
    border-radius: var(--radius-btn);
    border: 1px solid var(--line-hair);
    font-size: 1rem;
    font-weight: 500;
    color: var(--ink-white);
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  }

  .work__link.work__link--solid,
  .work__link.work__link--solid:hover {
    background: var(--ink-white);
    border-color: var(--ink-white);
    color: var(--bg-black);
    font-weight: 600;
  }

  .work__link.work__link--solid:hover {
    background: #e4e4e7;
    border-color: #e4e4e7;
    transform: translateY(-1px);
  }

  .work__link--muted {
    border: 1px dashed rgba(255, 255, 255, 0.22);
    color: var(--ink-muted);
    cursor: default;
  }

  /* Act 3: 3영역 타이포 스트립 & 스튜디오 정보 */
  .info {
    padding: 96px 28px 104px;
    border-top: 1px solid var(--line-hair);
    background: var(--bg-black);
  }

  .disciplines {
    max-width: var(--max-width);
    margin: 0 auto 88px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1px solid var(--line-hair);
    border-left: 1px solid var(--line-hair);
  }

  .disciplines__item {
    padding: 32px 28px;
    border-right: 1px solid var(--line-hair);
    border-bottom: 1px solid var(--line-hair);
    display: grid;
    gap: 10px;
    background: var(--bg-elevated);
  }

  .disciplines__num {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--ink-muted);
  }

  .disciplines__title {
    font-size: 1.45rem;
    font-weight: 600;
    letter-spacing: -0.02em;
  }

  .disciplines__desc {
    font-size: 1rem;
    color: var(--ink-secondary);
  }

  .colophon {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    gap: 24px;
  }

  .colophon__head {
    display: block;
  }

  .colophon__title {
    font-family: var(--font-display);
    font-size: clamp(2.25rem, 4.2vw, 3.5rem);
    font-weight: 200;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: var(--ink-white);
  }

  .colophon__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--line-hair);
  }

  .colophon__row {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 16px;
    padding: 20px 16px 20px 0;
    border-bottom: 1px solid var(--line-hair);
    align-items: baseline;
  }

  .colophon__term {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--ink-muted);
  }

  .colophon__val {
    font-size: 1rem;
    color: var(--ink-white);
    overflow-wrap: anywhere;
  }

  .colophon__val--mono {
    font-family: var(--font-mono);
  }

  .colophon__link {
    color: var(--ink-white);
    border-bottom: 1px solid var(--line-hair);
    transition: border-color 0.2s ease;
  }

  .colophon__link:hover {
    border-bottom-color: var(--ink-white);
  }

  /* 푸터 */
  .footer {
    border-top: 1px solid var(--line-hair);
    padding: 36px 28px 48px;
    background: var(--bg-black);
    overflow-x: clip;
  }

  .footer__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }

  .footer__brand {
    display: grid;
    gap: 10px;
  }

  .footer__logo {
    width: auto;
    height: 36px;
  }

  .footer__copy {
    font-size: 1rem;
    color: var(--ink-muted);
  }

  .footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
  }

  .footer__link {
    font-size: 1rem;
    color: var(--ink-secondary);
    transition: color 0.2s ease;
  }

  .footer__link:hover {
    color: var(--ink-white);
  }

  /* 라이트박스 모달 */
  .lightbox {
    width: min(92vw, 1080px);
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sharp);
    background: var(--bg-black);
    color: var(--ink-white);
    box-shadow: 0 32px 90px rgba(0, 0, 0, 0.9);
  }

  .lightbox::backdrop {
    background: rgba(0, 0, 0, 0.86);
    backdrop-filter: blur(8px);
  }

  .lightbox__panel {
    display: grid;
  }

  .lightbox__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--line-hair);
  }

  .lightbox__title {
    font-size: 1.15rem;
    font-weight: 600;
  }

  .lightbox__close {
    min-height: 40px;
    padding: 0 16px;
    border-radius: var(--radius-btn);
    border: 1px solid var(--line-hair);
    font-size: 1rem;
    color: var(--ink-secondary);
  }

  .lightbox__close:hover {
    border-color: var(--ink-white);
    color: var(--ink-white);
  }

  .lightbox__body {
    padding: 20px;
    display: flex;
    justify-content: center;
    background: #000000;
  }

  .lightbox__img {
    max-height: 76vh;
    width: auto;
  }
}

/* 진입 키프레임 */
@keyframes mask-up {
  0% {
    transform: translateY(112%);
  }
  100% {
    transform: translateY(0);
  }
}

/* 반응형 브레이크포인트 */
@media (max-width: 1024px) {
  .feature {
    grid-template-columns: 1fr;
  }

  .feature__plate {
    border-right: 0;
    border-bottom: 1px solid var(--line-hair);
  }

  .works__pair {
    grid-template-columns: 1fr;
  }

  .disciplines {
    grid-template-columns: 1fr;
  }

  .colophon__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    height: 76px;
  }

  .topbar__logo {
    height: 36px;
  }

  .topbar__nav {
    display: none;
  }

  .topbar__cta {
    margin-left: auto;
    min-height: 40px;
    padding: 0 16px;
    font-size: 1.0625rem;
  }

  .hero {
    padding: 96px 20px 104px;
  }

  .hero__title {
    font-size: clamp(2.15rem, 9.2vw, 3.4rem);
    line-height: 1.04;
  }

  .hero__foot {
    left: 20px;
    right: 20px;
    justify-content: center;
    text-align: center;
  }

  .hero__meta {
    letter-spacing: 0.03em;
  }

  .works,
  .info,
  .footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .feature__body,
  .work__body {
    padding: 20px;
  }

  .feature__bar,
  .work__bar {
    padding: 10px 18px;
  }

  .colophon__row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .footer__logo {
    height: 32px;
  }
}

/* 동작 감소 환경 대응 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
