/* ==========================================================
   Ink Paper 63 — Stylesheet
   ========================================================== */

.ip63-widget {
    position: relative;
    width: 100%;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* ── Stage ─────────────────────────────────────────────── */
.ip63-wrapper {
    position: relative;
    width: 100%;
    height: 560px;
    overflow: hidden;
    cursor: none;
    background: #f2e8c4;
    border-radius: 4px;
    /* Subtle paper-like shadow inside */
    box-shadow: inset 0 0 60px rgba(80,50,10,0.08);
}

/* ── Canvases ───────────────────────────────────────────── */
.ip63-canvas,
.ip63-wet-canvas,
.ip63-cursor-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.ip63-canvas        { z-index: 1; }
.ip63-wet-canvas    { z-index: 2; pointer-events: none; }
.ip63-cursor-canvas { z-index: 3; pointer-events: none; }

/* ── Brush cursor ───────────────────────────────────────── */
.ip63-cursor {
    position: absolute;
    top: 0; left: 0;
    width: 0; height: 0;
    pointer-events: none;
    z-index: 10;
    will-change: transform;
}

.ip63-brush-tip {
    position: absolute;
    width: 8px; height: 8px;
    border-radius: 50% 50% 60% 40% / 60% 60% 40% 40%;
    background: radial-gradient(circle at 35% 35%,
        rgba(255,255,255,0.5) 0%,
        rgba(20,18,25,0.9)   40%,
        rgba(10,8,14,1)       100%);
    transform: translate(-50%, -50%) rotate(-45deg);
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.ip63-brush-ring {
    position: absolute;
    width: 24px; height: 24px;
    border-radius: 50%;
    border: 1px dashed rgba(60,40,20,0.3);
    transform: translate(-50%, -50%);
    animation: ip63-ring-spin 4s linear infinite;
}

@keyframes ip63-ring-spin {
    from { transform: translate(-50%,-50%) rotate(0deg); }
    to   { transform: translate(-50%,-50%) rotate(360deg); }
}

/* ── Ink reservoir ──────────────────────────────────────── */
.ip63-reservoir {
    position: absolute;
    top: 12px;
    right: 14px;
    z-index: 8;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: all;
}

.ip63-res-bottle {
    font-size: 20px;
    line-height: 1;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.3));
}

.ip63-res-track {
    width: 8px;
    height: 50px;
    background: rgba(80,50,10,0.12);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(80,50,10,0.2);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.ip63-res-fill {
    width: 100%;
    height: 80%;         /* updated by JS */
    border-radius: 3px;
    background: linear-gradient(to top, #1a1018, #3a2838);
    transition: height 0.4s ease, background 0.4s ease;
}

/* Reservoir empty state */
.ip63-reservoir.empty .ip63-res-fill {
    background: linear-gradient(to top, #888, #aaa);
}

.ip63-dip-btn {
    font-size: 0.58rem;
    padding: 3px 6px;
    border-radius: 6px;
    border: 1px solid rgba(80,50,10,0.3);
    background: rgba(242,232,196,0.85);
    color: #4a3010;
    cursor: pointer;
    white-space: nowrap;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
    display: none;   /* shown by JS when near-empty */
}

.ip63-dip-btn:hover    { background: rgba(220,200,150,0.95); }
.ip63-reservoir.low .ip63-dip-btn { display: block; }

/* ── Overlay UI ─────────────────────────────────────────── */
.ip63-overlay-ui {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

/* ── Bottom panel ───────────────────────────────────────── */
.ip63-bottom {
    padding: 12px 16px 14px;
    background: linear-gradient(transparent 0%, rgba(60,35,5,0.35) 100%);
    pointer-events: none;
}

.ip63-info { text-align: center; margin-bottom: 8px; }

.ip63-title {
    margin: 0 0 4px;
    font-size: 1.05rem;
    font-weight: 700;
    color: rgba(60,35,8,0.85);
    text-shadow: 0 1px 0 rgba(255,240,200,0.6);
    letter-spacing: 0.06em;
    font-family: Georgia, 'Times New Roman', serif;
    text-transform: uppercase;
}

.ip63-desc {
    margin: 0;
    font-size: 0.8rem;
    color: rgba(60,35,8,0.6);
    font-family: Georgia, serif;
    font-style: italic;
    line-height: 1.5;
}

/* ── Navigation ─────────────────────────────────────────── */
.ip63-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    pointer-events: all;
    margin-bottom: 8px;
}

.ip63-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(80,50,10,0.25);
    background: rgba(242,232,196,0.5);
    color: rgba(60,35,8,0.7);
    font-size: 14px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
}

.ip63-btn:hover {
    background: rgba(220,200,150,0.7);
    border-color: rgba(80,50,10,0.4);
}

.ip63-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ip63-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: rgba(80,50,10,0.25);
    border: none; padding: 0;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.ip63-dot.active, .ip63-dot:hover {
    background: rgba(30,20,35,0.75);
    transform: scale(1.5);
}

/* ── Progress bar ───────────────────────────────────────── */
.ip63-progress-track {
    width: 60%;
    max-width: 280px;
    height: 2px;
    background: rgba(80,50,10,0.15);
    border-radius: 1px;
    margin: 0 auto;
    overflow: hidden;
}

.ip63-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3a2010, #8b5030);
    border-radius: 1px;
    transition: width 0.5s ease;
}

/* ── Hint ───────────────────────────────────────────────── */
.ip63-hint {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 6;
    color: rgba(80,50,10,0.38);
    font-size: 0.9rem;
    text-align: center;
    pointer-events: none;
    font-family: Georgia, serif;
    font-style: italic;
    letter-spacing: 0.04em;
    transition: opacity 0.7s;
    text-shadow: 0 1px 2px rgba(255,240,200,0.5);
}

.ip63-hint.hidden { opacity: 0; }

/* ── Ink drip animation (cursor when dipping) ───────────── */
@keyframes ip63-drip {
    0%   { transform: translate(-50%,-50%) scale(1) rotate(-45deg); }
    30%  { transform: translate(-50%,-20%) scale(1.3) rotate(-45deg); }
    60%  { transform: translate(-50%,-50%) scale(0.9) rotate(-45deg); }
    100% { transform: translate(-50%,-50%) scale(1) rotate(-45deg); }
}

.ip63-cursor.dipping .ip63-brush-tip {
    animation: ip63-drip 0.5s ease-in-out;
}

/* ── Lightbox ───────────────────────────────────────────── */
.ip63-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.ip63-lightbox.active {
    opacity: 1;
    pointer-events: all;
}

.ip63-lb-bg {
    position: absolute;
    inset: 0;
    background: rgba(20,12,4,0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.ip63-lb-box {
    position: relative;
    z-index: 1;
    width: min(720px, 92vw);
    max-height: 92vh;
    overflow-y: auto;
    background: rgba(245,238,215,0.97);
    border: 1px solid rgba(80,50,10,0.2);
    border-radius: 4px;
    padding: 36px 32px 28px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.5),
                inset 0 0 40px rgba(80,50,10,0.04);
    transform: scale(0.93) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34,1.15,0.64,1);
}

.ip63-lightbox.active .ip63-lb-box {
    transform: scale(1) translateY(0);
}

.ip63-lb-close {
    position: absolute;
    top: 14px; right: 18px;
    background: none; border: none;
    color: rgba(80,50,10,0.4);
    font-size: 26px; line-height: 1;
    cursor: pointer; padding: 0;
    font-family: Georgia, serif;
    transition: color 0.18s;
}

.ip63-lb-close:hover { color: rgba(60,30,5,0.85); }

.ip63-lb-img-wrap {
    text-align: center;
    margin-bottom: 20px;
}

.ip63-lb-img {
    max-width: 100%;
    max-height: 58vh;
    object-fit: contain;
    border-radius: 2px;
    display: block;
    margin: 0 auto;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18),
                0 1px 4px rgba(80,50,10,0.2);
    animation: ip63-img-in 0.6s cubic-bezier(0.34,1.2,0.64,1) both;
}

@keyframes ip63-img-in {
    from { opacity: 0; transform: scale(0.94); filter: blur(8px); }
    to   { opacity: 1; transform: scale(1);    filter: none; }
}

.ip63-lb-info { text-align: center; }

.ip63-lb-title {
    margin: 0 0 8px;
    font-size: 1.3rem;
    font-weight: 700;
    color: rgba(40,22,5,0.88);
    font-family: Georgia, 'Times New Roman', serif;
    letter-spacing: 0.05em;
}

.ip63-lb-desc {
    margin: 0;
    font-size: 0.88rem;
    color: rgba(60,40,10,0.6);
    font-family: Georgia, serif;
    font-style: italic;
    line-height: 1.65;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .ip63-wrapper { height: 380px; cursor: auto; }
    .ip63-cursor  { display: none; }
    .ip63-title   { font-size: 0.9rem; }
    .ip63-lb-box  { padding: 28px 16px 22px; background: #f5eed7; }
    .ip63-reservoir { right: 8px; top: 8px; }
}

@media (max-width: 480px) {
    .ip63-wrapper { height: 280px; }
}
