/* ============================================================
   kkaji.com — 까지 · まで · until
   wabi-sabi imperfect ceramic / japanese-minimal
   ============================================================ */

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

:root {
    --cream:      #faf8f4;  /* primary background — paper */
    --wash:       #f0ece4;  /* faint warm — section alternation */
    --stone:      #d8d0c4;  /* parchment gray — dividers */
    --earth:      #8a8070;  /* warm gray — secondary text */
    --ink:        #2a2a24;  /* ink dark — primary text, line art */
    --vermillion: #c45c3c;  /* sparse emphasis, filled markers */

    --serif:  'Cormorant Garamond', 'Lora', Georgia, serif;
    --sans:   'Noto Sans JP', 'Inter', -apple-system, sans-serif;
    --gothic: 'Zen Kaku Gothic New', 'Noto Sans JP', sans-serif;
}

html { scroll-behavior: smooth; }

body {
    background: var(--cream);
    color: var(--ink);
    font-family: var(--sans);
    font-weight: 300;
    font-size: 1rem;
    line-height: 2.0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Subtle ink-wash horizontal gradient applied at the body level */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(90deg, var(--cream) 0%, var(--wash) 100%);
    z-index: -2;
    pointer-events: none;
}

/* faint parchment grain */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(138,128,112,0.04) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(196,92,60,0.03) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

/* ============================================================
   Masthead — minimal nav (top-left brand mark)
   ============================================================ */
.masthead {
    position: fixed;
    top: 2rem;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    z-index: 50;
    font-family: var(--gothic);
    font-size: 1rem;
    color: var(--ink);
    opacity: 0.85;
}

.mast-mark {
    font-family: var(--serif);
    font-weight: 300;
    font-size: 1.4rem;
    line-height: 1;
}

.mast-divider {
    width: 1.5rem;
    height: 1px;
    background: var(--earth);
    opacity: 0.5;
}

/* ============================================================
   Dot timeline — fixed left column
   ============================================================ */
.dot-timeline {
    position: fixed;
    left: 3rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 2.2rem;
    z-index: 40;
    padding: 1rem 0;
}

.dot-timeline::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--stone);
    transform: translateX(-50%);
    z-index: -1;
}

.dot {
    display: block;
    width: 14px;
    height: 14px;
    position: relative;
    text-decoration: none;
}

.dot-mark {
    position: absolute;
    inset: 3px;
    width: 8px;
    height: 8px;
    border: 1px solid var(--earth);
    border-radius: 50%;
    background: var(--cream);
    transition: background 0.5s ease, border-color 0.5s ease, transform 0.5s ease;
}

.dot-mark.filled {
    background: transparent;
    border-color: var(--earth);
}

.dot.is-active .dot-mark {
    background: var(--vermillion);
    border-color: var(--vermillion);
    transform: scale(1.25);
}

.dot::after {
    content: attr(data-label);
    position: absolute;
    left: 1.6rem;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--gothic);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--earth);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.dot:hover::after,
.dot.is-active::after {
    opacity: 0.9;
}

/* ============================================================
   Approaching line — the core motif
   ============================================================ */
.approach-line {
    height: 1px;
    background: var(--ink);
    width: 0;
    margin: 0 0 3.5rem 0;
    transform-origin: left center;
    transition: width 1.8s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
}

.approach-line.is-visible[data-width="48"]  { width: 48%; }
.approach-line.is-visible[data-width="55"]  { width: 55%; }
.approach-line.is-visible[data-width="62"]  { width: 62%; }
.approach-line.is-visible[data-width="70"]  { width: 70%; }
.approach-line.is-visible[data-width="78"]  { width: 78%; }
.approach-line.is-visible[data-width="80"]  { width: 80%; }
.approach-line.is-visible[data-width="85"]  { width: 85%; }
.approach-line.is-visible[data-width="90"]  { width: 90%; }

.entry-line {
    height: 1px;
    background: var(--earth);
    width: 0;
    margin-bottom: 1.25rem;
    opacity: 0.7;
    transition: width 1.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.entry-line.is-visible[data-width="48"] { width: 48%; }
.entry-line.is-visible[data-width="55"] { width: 55%; }
.entry-line.is-visible[data-width="62"] { width: 62%; }

/* ============================================================
   Hero
   ============================================================ */
.hero {
    min-height: 100vh;
    padding: 10rem 2rem 6rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.hero-inner {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding-left: 8rem;
    position: relative;
}

.hero-line {
    margin: 0 0 0 0;
    height: 1px;
    background: var(--ink);
    width: 0;
    position: relative;
}

.hero-line.is-visible {
    width: 85%;
}

.hero-domain {
    position: relative;
    margin-top: -1.6rem;
    padding-left: 86%;
    opacity: 0;
    transform: translateX(-12px);
    transition: opacity 1.2s ease 1.4s, transform 1.4s cubic-bezier(0.22, 1, 0.36, 1) 1.4s;
}

.hero.is-loaded .hero-domain {
    opacity: 1;
    transform: translateX(0);
}

.hero-domain-text {
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(0.95rem, 1.3vw, 1.1rem);
    letter-spacing: 0.18em;
    color: var(--ink);
    white-space: nowrap;
    display: inline-block;
}

.hero-meta {
    margin-top: 5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 1rem;
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--ink);
    line-height: 1.2;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 1.2s ease 1.8s, transform 1.4s cubic-bezier(0.22, 1, 0.36, 1) 1.8s;
}

.hero.is-loaded .hero-meta {
    opacity: 1;
    transform: translateY(0);
}

.meta-key {
    display: inline-block;
}

.meta-key[lang="ko"],
.meta-key[lang="ja"] {
    font-family: var(--serif);
}

.meta-sep {
    color: var(--earth);
    opacity: 0.5;
    font-size: 0.7em;
    margin: 0 0.25rem;
    transform: translateY(-0.2em);
    display: inline-block;
}

.hero-tag {
    margin-top: 2.5rem;
    max-width: 28rem;
    font-family: var(--gothic);
    font-weight: 300;
    font-size: 0.95rem;
    line-height: 1.9;
    color: var(--earth);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1.2s ease 2.2s, transform 1.4s cubic-bezier(0.22, 1, 0.36, 1) 2.2s;
}

.hero.is-loaded .hero-tag {
    opacity: 1;
    transform: translateY(0);
}

.scroll-cue {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    transition: opacity 0.8s ease 2.8s;
}

.hero.is-loaded .scroll-cue {
    opacity: 0.5;
}

.scroll-cue-text {
    font-family: var(--gothic);
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    color: var(--earth);
    text-transform: lowercase;
}

.scroll-cue-line {
    width: 1px;
    height: 32px;
    background: linear-gradient(to bottom, var(--earth), transparent);
    animation: scrollCue 2.4s ease-in-out infinite;
}

@keyframes scrollCue {
    0%, 100% { transform: scaleY(1); transform-origin: top; opacity: 0.6; }
    50%      { transform: scaleY(0.4); transform-origin: top; opacity: 1; }
}

/* ============================================================
   Sections — progressive density
   ============================================================ */
.section {
    width: 100%;
    padding-left: 8rem;
    padding-right: 2rem;
    position: relative;
}

/* progressive padding — sparse → dense */
.section-1     { padding-top: 10rem; padding-bottom: 10rem; }
.section-2     { padding-top: 8rem;  padding-bottom: 8rem;  }
.section-3     { padding-top: 6rem;  padding-bottom: 6rem;  }
.section-enso  { padding-top: 5rem;  padding-bottom: 5rem;  }
.section-final { padding-top: 4rem;  padding-bottom: 8rem;  }

.section + .section {
    /* faint dividing wash — alternation */
}

.section-2, .section-enso {
    background: linear-gradient(90deg, var(--cream) 0%, var(--wash) 100%);
}

.vessel {
    max-width: 600px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 1.2s ease, transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.vessel-narrow {
    max-width: 460px;
    text-align: center;
}

.eyebrow {
    font-family: var(--gothic);
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.25em;
    color: var(--earth);
    text-transform: uppercase;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.eyebrow span[lang] {
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 300;
    text-transform: none;
    letter-spacing: 0.05em;
    color: var(--ink);
}

.lead {
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(1.25rem, 2vw, 1.55rem);
    line-height: 1.7;
    color: var(--ink);
    margin-bottom: 1.5rem;
    letter-spacing: 0.005em;
}

.lead em {
    font-style: italic;
    color: var(--vermillion);
    font-weight: 400;
}

.section-title {
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(2rem, 4.2vw, 3rem);
    line-height: 1.2;
    color: var(--ink);
    margin-bottom: 2rem;
    letter-spacing: 0.005em;
}

.vessel p {
    font-family: var(--sans);
    font-weight: 300;
    font-size: 1rem;
    line-height: 2.0;
    color: var(--ink);
    margin-bottom: 1.5rem;
}

.vessel p:last-child { margin-bottom: 0; }

.ko, .ja {
    font-family: var(--serif);
    font-weight: 400;
    color: var(--ink);
    padding: 0 0.1em;
}

/* ============================================================
   Parallel rows (Korean / Japanese / English)
   ============================================================ */
.parallel {
    margin-top: 3rem;
    border-top: 1px solid var(--stone);
}

.parallel-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1.4fr;
    gap: 1.5rem;
    padding: 1.4rem 0;
    border-bottom: 1px solid var(--stone);
    align-items: baseline;
}

.parallel-orig {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 1.4rem;
    color: var(--ink);
    line-height: 1.4;
}

.parallel-mid {
    font-family: var(--serif);
    font-weight: 300;
    font-size: 1.2rem;
    color: var(--earth);
    line-height: 1.4;
}

.parallel-en {
    font-family: var(--gothic);
    font-weight: 300;
    font-size: 0.85rem;
    color: var(--earth);
    letter-spacing: 0.05em;
    font-style: italic;
}

/* ============================================================
   Entries — example list (denser as we scroll)
   ============================================================ */
.entries {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

.entry {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease, transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.entry-orig {
    font-family: var(--serif) !important;
    font-weight: 400 !important;
    font-size: 1.5rem !important;
    line-height: 1.5 !important;
    color: var(--ink) !important;
    margin-bottom: 0.4rem !important;
}

.entry-orig strong, .entry-mid strong {
    font-weight: 500;
    color: var(--vermillion);
    font-style: normal;
}

.entry-mid {
    font-family: var(--serif) !important;
    font-weight: 300 !important;
    font-size: 1.2rem !important;
    color: var(--earth) !important;
    margin-bottom: 0.4rem !important;
    line-height: 1.5 !important;
}

.entry-en {
    font-family: var(--gothic) !important;
    font-weight: 400 !important;
    font-size: 0.85rem !important;
    letter-spacing: 0.12em !important;
    text-transform: uppercase !important;
    color: var(--earth) !important;
    margin-bottom: 1rem !important;
}

.entry-note {
    font-family: var(--sans) !important;
    font-weight: 300 !important;
    font-size: 0.95rem !important;
    line-height: 1.95 !important;
    color: var(--ink) !important;
    opacity: 0.8 !important;
    margin-bottom: 0 !important;
}

.entry-note em {
    font-family: var(--serif);
    font-style: italic;
    color: var(--vermillion);
}

/* ============================================================
   Enso fragment
   ============================================================ */
.section-enso .vessel { text-align: center; }

.enso-wrap {
    margin: 2rem auto 2.5rem;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.enso-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.enso-path {
    stroke-dasharray: 320;
    stroke-dashoffset: 320;
    transition: stroke-dashoffset 2.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.enso-svg.is-visible .enso-path {
    stroke-dashoffset: 0;
}

.enso-caption {
    font-family: var(--serif);
    font-weight: 300;
    font-style: italic;
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--ink);
    max-width: 24rem;
    margin: 0 auto 0.75rem;
}

.enso-caption.faint {
    color: var(--earth);
    font-size: 0.85rem;
    font-style: normal;
    letter-spacing: 0.1em;
    margin-top: 1rem;
}

/* ============================================================
   Final section — signature
   ============================================================ */
.signature {
    margin-top: 3.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.signature-mark {
    font-family: var(--serif);
    font-weight: 300;
    font-size: 1.6rem;
    color: var(--vermillion);
    letter-spacing: 0.04em;
}

.signature-line {
    flex: 1;
    height: 1px;
    background: var(--earth);
    opacity: 0.5;
    width: 0;
    transition: width 1.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.signature-line.is-visible[data-width="40"] { width: 40%; }

/* ============================================================
   Footer
   ============================================================ */
.footer {
    padding: 6rem 2rem 4rem;
    padding-left: 8rem;
    border-top: 1px solid var(--stone);
    background: var(--cream);
}

.footer-inner {
    max-width: 600px;
    margin: 0 auto;
}

.footer-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.footer-domain {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 1.1rem;
    color: var(--ink);
    letter-spacing: 0.1em;
}

.footer-dot {
    width: 4px;
    height: 4px;
    background: var(--earth);
    border-radius: 50%;
    opacity: 0.5;
}

.footer-meta {
    font-family: var(--gothic);
    font-weight: 300;
    font-size: 0.85rem;
    color: var(--earth);
    letter-spacing: 0.1em;
}

.footer-meta[lang] {
    font-family: var(--serif);
    font-size: 1rem;
    font-weight: 400;
}

.footer-sub {
    font-family: var(--gothic);
    font-weight: 300;
    font-size: 0.8rem;
    color: var(--earth);
    line-height: 1.8;
    opacity: 0.8;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .dot-timeline { left: 1rem; gap: 1.6rem; }
    .dot::after { display: none; }

    .masthead { top: 1.25rem; right: 1.25rem; }

    .hero { padding: 8rem 1.5rem 5rem; }
    .hero-inner { padding-left: 3rem; }
    .section { padding-left: 3rem; padding-right: 1.5rem; }
    .footer { padding-left: 3rem; padding-right: 1.5rem; }

    .section-1 { padding-top: 6rem; padding-bottom: 6rem; }
    .section-2 { padding-top: 5rem; padding-bottom: 5rem; }
    .section-3 { padding-top: 4.5rem; padding-bottom: 4.5rem; }
    .section-enso  { padding-top: 4rem; padding-bottom: 4rem; }
    .section-final { padding-top: 3.5rem; padding-bottom: 6rem; }

    .parallel-row {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }

    .hero-domain {
        padding-left: 0;
        margin-top: 1.25rem;
    }
}

@media (max-width: 540px) {
    .dot-timeline { left: 0.6rem; gap: 1.3rem; }
    .hero-inner, .section, .footer { padding-left: 2.25rem; }
    .hero-meta { font-size: clamp(1.6rem, 8vw, 2.4rem); gap: 0.5rem; }
    .enso-wrap { width: 150px; height: 150px; }
}
