/* 6-numeri fanzine — Mathematical whiteboard theme */

.pagina-fanzine.pagina-numeri {
    max-width: 860px;
}

/* Whiteboard wrapper */
.lavagna-wrapper {
    margin: 30px 0 40px;
}

/* The whiteboard itself */
.lavagna {
    position: relative;
    background-color: #f7f8ee;
    border: 2px solid #c4c6ae;
    border-radius: 3px;
    box-shadow:
        inset 0 0 80px rgba(190, 210, 160, 0.2),
        5px 5px 0 rgba(0, 0, 0, 0.07),
        6px 6px 0 rgba(0, 0, 0, 0.04);
    padding: 60px 50px 70px;
    min-height: 420px;
    overflow: visible;
    /* Dot grid — graph paper feel */
    background-image: radial-gradient(circle, rgba(0, 70, 30, 0.10) 1px, transparent 1px);
    background-size: 30px 30px;
}

/* Inner frame line */
.lavagna::before {
    content: '';
    position: absolute;
    inset: 10px;
    border: 1px solid rgba(150, 165, 120, 0.30);
    pointer-events: none;
    border-radius: 2px;
}

/* Marker tray at the bottom */
.lavagna::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 7px;
    background: linear-gradient(to right, #c0c2aa, #b0b298, #c0c2aa);
    border-top: 1px solid rgba(0, 0, 0, 0.10);
}

/* ---- Decorative math elements (positioned absolutely) ---- */

.lavagna-deco {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden; /* clips decorative formulas at board edges */
    user-select: none;
    border-radius: 3px;
}

.deco-formula {
    position: absolute;
    font-family: "Source Serif 4", Georgia, serif;
    font-style: italic;
    font-size: 0.78rem;
    line-height: 1.5;
    color: rgba(50, 80, 40, 0.20);
    white-space: nowrap;
}

.deco-symbol {
    position: absolute;
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 5.5rem;
    font-weight: 300;
    color: rgba(50, 80, 40, 0.09);
    line-height: 1;
}

.deco-axes {
    position: absolute;
}

/* ---- Header label on the board ---- */

.lavagna-titolo {
    position: relative;
    z-index: 1;
    text-align: center;
    font-family: "Caveat", "Source Serif 4", cursive;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: rgba(30, 60, 25, 0.40);
    margin-bottom: 28px;
    text-transform: lowercase;
}

.lavagna-titolo::after {
    content: '';
    display: block;
    width: 50%;
    height: 1px;
    background: rgba(30, 60, 25, 0.18);
    margin: 6px auto 0;
}

/* ---- Numbers grid ---- */

.numeri-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
    padding: 24px 0;
    overflow: visible;
}

/* ---- Individual number card ---- */

.numero-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #1a2e1c;
    padding: 6px 10px;
    cursor: pointer;
    /* transform and hover are handled entirely by JS */
    transition: transform 0.22s ease, color 0.2s ease;
}

.numero-card:hover {
    text-decoration: none;
    color: #0a2010;
}

/* The big written number */
.numero-value {
    font-family: "Caveat", "Source Serif 4", cursive;
    font-size: 4.4rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.01em;
    position: relative;
}

/* Chalk underline drawn below the number */
.numero-value::after {
    content: '';
    display: block;
    height: 2px;
    background: currentColor;
    opacity: 0.30;
    margin-top: 2px;
    border-radius: 1px;
    transform: scaleX(0.75);
    transform-origin: left;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.numero-card:hover .numero-value::after {
    transform: scaleX(1.05);
    opacity: 0.65;
}

/* Author name — appears on hover */
.numero-autore {
    font-family: "Source Serif 4", serif;
    font-size: 0.68rem;
    font-style: italic;
    color: #4a6640;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.28s ease, transform 0.28s ease;
    text-align: center;
    margin-top: 2px;
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.numero-card:hover .numero-autore {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Size variations (organic, handwritten feel) ---- */

.numero-card:nth-child(5n+1) .numero-value { font-size: 5.2rem; }
.numero-card:nth-child(5n+2) .numero-value { font-size: 3.6rem; }
.numero-card:nth-child(5n+3) .numero-value { font-size: 4.6rem; }
.numero-card:nth-child(5n+4) .numero-value { font-size: 5.8rem; }
.numero-card:nth-child(5n+5) .numero-value { font-size: 3.2rem; }

/* ---- Empty state ---- */

.lavagna-vuota {
    text-align: center;
    color: rgba(50, 80, 40, 0.38);
    font-style: italic;
    padding: 60px 20px;
    font-size: 1.05rem;
    font-family: "Source Serif 4", serif;
    width: 100%;
}

/* ---- Responsive ---- */

@media screen and (max-width: 700px) {
    .lavagna {
        padding: 40px 18px 60px;
    }

    .deco-formula { font-size: 0.62rem; }
    .deco-symbol  { font-size: 4rem; }

    /* Flatten all size variations on mobile */
    .numero-value,
    .numero-card:nth-child(5n+1) .numero-value,
    .numero-card:nth-child(5n+2) .numero-value,
    .numero-card:nth-child(5n+3) .numero-value,
    .numero-card:nth-child(5n+4) .numero-value,
    .numero-card:nth-child(5n+5) .numero-value {
        font-size: 3rem;
    }
}
