/* ============================================================
   EDAM — Design Tokens, Reset, Typography
   v2.0 · Dark Minimal
   ============================================================ */

:root {
    /* ---- Surface — brand deep green-black ---------------
       Carried over from v1 (--primary-dark #0a1612). The green
       lives in the surfaces, not in accents: that keeps the
       brand present without reintroducing a "luxury template" look. */
    --bg: #0a1613;
    --bg-raised: #101f1a;
    --bg-sunken: #060f0c;
    --bg-inverse: #eef2f0;

    /* RGB channels of --bg, for scrims and translucent chrome */
    --bg-rgb: 10, 22, 19;

    /* ---- Foreground -------------------------------------
       Every value below is contrast-checked against --bg:
         --fg         16.35:1   (AAA)
         --fg-muted    7.33:1   (AAA, normal text)
         --fg-subtle   5.16:1   (AA,  normal text)
       --fg is deliberately not pure white — on dark surfaces
       #fff halates and makes long-form reading tiring. */
    --fg: #eef2f0;
    --fg-muted: #9aa6a0;
    --fg-subtle: #7e8a85;
    --fg-inverse: #0a1613;

    /* ---- Line: the only divider we use ------------------
       Faintly green so hairlines belong to the palette. */
    --line: rgba(184, 214, 200, 0.16);
    --line-strong: rgba(184, 214, 200, 0.34);
    --line-inverse: rgba(10, 22, 19, 0.14);

    /* ---- Accent: monochrome by design ------------------- */
    --accent: #eef2f0;
    --accent-ink: #0a1613;

    /* ---- Brand green: selection, focus, status only ------ */
    --brand: #2a4f41;
    --signal: #7fb79b;
    --danger: #d4695f;

    /* ---- Type families ---------------------------------- */
    --font-display: 'Inter Tight', 'Pretendard', -apple-system, BlinkMacSystemFont,
        'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    --font-body: 'Pretendard', 'Inter Tight', -apple-system, BlinkMacSystemFont,
        'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;

    /* ---- Type scale ------------------------------------- */
    --t-display: clamp(3.5rem, 9vw, 10.5rem);
    --t-h1: clamp(2.5rem, 5.5vw, 5.5rem);
    --t-h2: clamp(1.75rem, 3vw, 2.75rem);
    --t-h3: clamp(1.25rem, 1.6vw, 1.625rem);
    --t-lead: clamp(1.0625rem, 1.3vw, 1.3125rem);
    /* 섹션을 여는 한 문장. 그 아래 목록 항목보다는 커야 위계가 맞습니다. */
    --t-section-lead: clamp(1.375rem, 2.4vw, 2.125rem);
    --t-body: 1rem;
    --t-small: 0.875rem;
    --t-label: 0.6875rem;
    /* 상단 메뉴 전용. 라벨(11px)을 쓰면 화면 폭에 비해 너무 작습니다. */
    --t-nav: 0.8125rem;

    /* ---- Rhythm ----------------------------------------- */
    --pad-x: clamp(1.25rem, 5vw, 5rem);
    --max-w: 1600px;
    --section-y: clamp(6rem, 14vh, 13.75rem);
    --gap: clamp(1rem, 2vw, 2rem);

    /* ---- Motion ----------------------------------------- */
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
    --dur-fast: 240ms;
    --dur-base: 600ms;
    --dur-slow: 1000ms;

    /* ---- Chrome ----------------------------------------- */
    --header-h: 88px;
    --z-header: 100;
    --z-menu: 200;
}

@media (max-width: 768px) {
    :root {
        --header-h: 64px;
    }
}

/* ============================================================
   Reset
   ============================================================ */

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-h);
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-body);
    font-size: var(--t-body);
    font-weight: 400;
    line-height: 1.75;
    letter-spacing: -0.005em;
    word-break: keep-all;
    overflow-wrap: anywhere;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

body.is-locked {
    overflow: hidden;
}

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

/* 관리자에서 내용을 비우면 요소가 숨겨집니다.
   display 를 지정한 클래스가 hidden 을 덮어쓰지 않도록 강제합니다. */
[hidden] {
    display: none !important;
}

img,
video {
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

ul,
ol {
    list-style: none;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
    background: none;
    border: none;
}

button {
    cursor: pointer;
}

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

::selection {
    background: var(--brand);
    color: var(--fg);
}

:focus-visible {
    outline: 1px solid var(--fg);
    outline-offset: 3px;
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--line-strong);
}

/* ============================================================
   Typography primitives
   ============================================================ */

.display,
.h1,
.h2,
.h3 {
    font-family: var(--font-display);
    font-weight: 500;
    line-height: 0.96;
    text-wrap: balance;
}

.display {
    font-size: var(--t-display);
    letter-spacing: -0.045em;
    line-height: 0.92;
}

.h1 {
    font-size: var(--t-h1);
    letter-spacing: -0.035em;
}

.h2 {
    font-size: var(--t-h2);
    letter-spacing: -0.025em;
    line-height: 1.1;
}

.h3 {
    font-size: var(--t-h3);
    letter-spacing: -0.015em;
    line-height: 1.25;
    font-weight: 500;
}

/* Korean headlines need a touch more leading than Latin */
.display:lang(ko),
.h1:lang(ko) {
    line-height: 1.06;
}

.lead {
    font-size: var(--t-lead);
    line-height: 1.65;
    letter-spacing: -0.01em;
    color: var(--fg);
}

/* 큰 제목 없이 섹션을 여는 문장.
   아래에 목록이 따라오므로 그보다 커야 읽는 순서가 맞습니다. */
/* 섹션 첫머리의 큰 문장.
   30ch(국문 15자) 로 묶어두니 화면 폭의 3분의 1만 쓰고
   오른쪽 3분의 2가 비어 글이 왼쪽에 몰려 보였습니다.
   국문 24자 남짓이면 두 줄로 떨어지며 폭의 절반을 씁니다. */
.section-lead--intro {
    max-width: 48ch;
    margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-lead {
    font-family: var(--font-display);
    font-size: var(--t-section-lead);
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: -0.02em;
    color: var(--fg);
    text-wrap: balance;
}

.body-text {
    color: var(--fg-muted);
    line-height: 1.8;
}

.body-text + .body-text {
    margin-top: 1.25em;
}

/* Uppercase meta label — the workhorse of this design */
.label {
    display: inline-block;
    font-family: var(--font-display);
    font-size: var(--t-label);
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    line-height: 1;
    color: var(--fg-muted);
    font-variant-numeric: tabular-nums;
}

.label--fg {
    color: var(--fg);
}

/* Section index: (01) (02) ... */
.index {
    font-family: var(--font-display);
    font-size: var(--t-label);
    font-weight: 500;
    letter-spacing: 0.12em;
    color: var(--fg-subtle);
    font-variant-numeric: tabular-nums;
}

.num {
    font-variant-numeric: tabular-nums;
}

.muted {
    color: var(--fg-muted);
}

.subtle {
    color: var(--fg-subtle);
}

/* ============================================================
   Links
   ============================================================ */

/* Underline that draws left → right on hover */
.link {
    position: relative;
    display: inline-block;
    padding-bottom: 2px;
}

.link::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: right center;
    transition: transform var(--dur-fast) var(--ease);
}

.link:hover::after,
.link:focus-visible::after {
    transform: scaleX(1);
    transform-origin: left center;
}

.link--static::after {
    transform: scaleX(1);
    transform-origin: left center;
}

.link--static:hover::after {
    transform-origin: right center;
    transform: scaleX(0);
}

/* Arrow link: "View all work ↗" */
.arrow-link {
    display: inline-flex;
    align-items: baseline;
    gap: 0.55em;
    font-family: var(--font-display);
    font-size: var(--t-small);
    letter-spacing: 0.04em;
    color: var(--fg);
    padding-bottom: 4px;
    border-bottom: 1px solid var(--line-strong);
    transition: border-color var(--dur-fast) var(--ease);
}

.arrow-link .arrow {
    display: inline-block;
    transition: transform var(--dur-fast) var(--ease);
}

.arrow-link:hover {
    border-bottom-color: var(--fg);
}

.arrow-link:hover .arrow {
    transform: translate(3px, -3px);
}

.arrow-link--down:hover .arrow {
    transform: translateY(3px);
}

/* ============================================================
   Buttons — rectangular, hairline, no fills unless primary
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75em;
    min-height: 56px;
    padding: 0 2rem;
    border: 1px solid var(--line-strong);
    font-family: var(--font-display);
    font-size: var(--t-small);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fg);
    background: transparent;
    transition: background var(--dur-fast) var(--ease),
        color var(--dur-fast) var(--ease),
        border-color var(--dur-fast) var(--ease);
}

.btn:hover:not(:disabled) {
    background: var(--fg);
    color: var(--bg);
    border-color: var(--fg);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn--primary {
    background: var(--fg);
    color: var(--bg);
    border-color: var(--fg);
}

.btn--primary:hover:not(:disabled) {
    background: transparent;
    color: var(--fg);
}

.btn--block {
    width: 100%;
}

/* ============================================================
   Rules
   ============================================================ */

.rule {
    height: 1px;
    background: var(--line);
    border: 0;
}

.rule--strong {
    background: var(--line-strong);
}

/* ============================================================
   Scroll reveal — base state applied by JS (adds .reveal-ready)
   Without JS everything stays visible.
   ============================================================ */

.reveal-ready [data-reveal] {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity var(--dur-base) var(--ease),
        transform var(--dur-base) var(--ease);
    transition-delay: var(--reveal-delay, 0ms);
    will-change: opacity, transform;
}

.reveal-ready [data-reveal].is-visible {
    opacity: 1;
    transform: none;
}

/* Line-mask reveal for headlines */
.reveal-mask {
    display: block;
    overflow: hidden;
}

.reveal-ready .reveal-mask > * {
    display: block;
    transform: translateY(110%);
    transition: transform var(--dur-slow) var(--ease);
    transition-delay: var(--reveal-delay, 0ms);
}

.reveal-ready .reveal-mask.is-visible > * {
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .reveal-ready [data-reveal],
    .reveal-ready .reveal-mask > * {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ============================================================
   Accessibility helpers
   ============================================================ */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1000;
    padding: 0.75rem 1.25rem;
    background: var(--fg);
    color: var(--bg);
    font-size: var(--t-small);
    transform: translateY(-120%);
    transition: transform var(--dur-fast) var(--ease);
}

.skip-link:focus {
    transform: none;
}
