/* ============================================
   Calligraphy tile on work index
   ============================================ */

.work-tile__image-wrapper--calligraphy {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    background: #fafaf8;
    border: 1px solid var(--color-rule);
}

.work-tile__image--calligraphy {
    width: auto;
    height: 55%;
    max-width: 80%;
    object-fit: contain;
}


/* ============================================
   Shared calligraphy page elements
   ============================================ */

.cal-footer {
    padding: var(--space-xl) 0;
    text-align: center;
}

.cal-footer__text {
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-s);
}

.calligraphy-back {
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
    color: var(--color-text-muted);
    transition: color var(--duration-fast) ease;
}

.calligraphy-back:hover {
    color: var(--color-text);
}


/* ============================================
   Index (comparison page)
   ============================================ */

.cal-index {
    padding: var(--space-2xl) 0;
    max-width: 40ch;
}

.cal-index__intro {
    font-family: var(--font-serif);
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: var(--space-l);
}

.cal-index__nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-s);
    margin-bottom: var(--space-l);
}

.cal-index__link {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    color: var(--color-text);
    background-image: linear-gradient(var(--color-rule), var(--color-rule));
    background-size: 100% 1px;
    background-position: left bottom;
    background-repeat: no-repeat;
    padding-bottom: 2px;
    transition: background-image var(--duration-fast) ease;
}

.cal-index__link:hover {
    background-image: linear-gradient(var(--color-text-muted), var(--color-text-muted));
}


/* ============================================
   1. The Wall — dense full-bleed grid
   ============================================ */

.cw-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    margin: 0 calc(-1 * var(--gutter-tb, 1.5rem));
}

.cw-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafaf8;
}

.cw-cell__img {
    width: auto;
    height: 55%;
    max-width: 75%;
    object-fit: contain;
}

@media (min-width: 768px) {
    .cw-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        margin: 0 calc(-1 * var(--gutter-dk, 2rem));
    }
}

@media (min-width: 1200px) {
    .cw-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
}


/* ============================================
   2. The Living Wall — partial grid with swaps
   ============================================ */

.cl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 1px;
    background: var(--color-rule);
    margin: 0 calc(-1 * var(--gutter-tb, 1.5rem));
}

.cl-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafaf8;
}

.cl-cell__img {
    width: auto;
    height: 55%;
    max-width: 75%;
    object-fit: contain;
    transition: opacity 0.4s ease;
}

@media (min-width: 768px) {
    .cl-grid {
        grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
        margin: 0 calc(-1 * var(--gutter-dk, 2rem));
    }
}

@media (min-width: 1200px) {
    .cl-grid {
        grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
    }
}


/* ============================================
   3. The Field — loose spatial arrangement
   ============================================ */

.cf-stage {
    position: relative;
    width: 100%;
    height: max(85vh, 550px);
    overflow: hidden;
}

.cf-mark {
    position: absolute;
    width: clamp(50px, 8vw, 100px);
    height: auto;
    opacity: 0.85;
    pointer-events: none;
}

.page-calligraphy--field .detail-main {
    max-width: 55ch;
    padding: var(--space-xl) 0 var(--space-l);
}

.page-calligraphy--field .detail-back {
    margin-bottom: 0;
}


/* ============================================
   4. The Count — single mark procession
   ============================================ */

.cc-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 160px);
    padding: var(--space-xl) var(--space-m);
    user-select: none;
    -webkit-user-select: none;
}

.cc-mark {
    max-width: min(60vw, 420px);
    max-height: 40vh;
    width: auto;
    height: auto;
    transition: opacity 0.4s ease;
}

.cc-counter {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin-top: var(--space-l);
    tabular-nums: true;
    font-variant-numeric: tabular-nums;
}

.cal-footer--count {
    border-top: 1px solid var(--color-rule);
}

@media (min-width: 768px) {
    .cc-mark {
        max-width: min(45vw, 480px);
        max-height: 45vh;
    }
}
