/* Polaroid memories — night-chart scrapbook, homepage first scroll */

.memories {
    position: relative;
    padding: 72px 0 88px;
    background: #F7F5F0;
    color: #f4efe4;
    overflow: hidden;
}

.memories__frame {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    background: linear-gradient(180deg, #153F46 0%, #1a4a52 28%, #12383e 100%);
    border-radius: 30px;
    padding: 56px 48px 64px;
    box-shadow:
        0 30px 60px rgba(13, 41, 51, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.07);
    overflow: hidden;
}

.memories__frame::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: 30px 30px 0 0;
    background: rgba(214, 167, 67, 0.35);
    z-index: 2;
}

.memories__chart {
    position: absolute;
    inset: 0;
    color: rgba(244, 239, 228, 0.11);
    pointer-events: none;
    z-index: 0;
}

.memories__chart svg:first-child {
    width: 100%;
    height: 100%;
    display: block;
}

.memories__chart-coast {
    stroke: rgba(214, 167, 67, 0.22);
    stroke-width: 1.2;
}

.memories__chart-coast--soft {
    stroke: rgba(244, 239, 228, 0.1);
    stroke-width: 0.9;
}

.memories__chart-dots circle {
    fill: rgba(214, 167, 67, 0.45);
}

.memories__compass {
    position: absolute;
    top: 22px;
    left: 22px;
    width: 56px;
    height: 56px;
    color: rgba(214, 167, 67, 0.42);
}

.memories__compass circle,
.memories__compass path {
    stroke: currentColor;
    stroke-width: 1.2;
    fill: currentColor;
}

.memories__compass circle {
    fill: none;
}

.memories__compass text {
    fill: currentColor;
    font-size: 8px;
    font-family: ui-monospace, "Courier New", Courier, monospace;
    letter-spacing: 0.12em;
    text-anchor: middle;
}

.memories__frame > .container {
    position: relative;
    z-index: 1;
}

.memories__kicker {
    margin: 0 0 8px;
    font-family: ui-monospace, "Courier New", Courier, monospace;
    font-size: 0.7rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: rgba(214, 167, 67, 0.68);
}

.memories__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin: 0 0 40px;
}

.memories__head h2 {
    color: #fff;
    font-size: 2.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.memories__head p:not(.memories__kicker) {
    margin: 0;
    max-width: 520px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.98rem;
}

.memories__ctas {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0;
}

.memories__stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 12px 36px;
    align-items: stretch;
}

.memories-gallery {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 32px 20px;
    align-items: start;
}

.memories-polaroid {
    position: relative;
    display: block;
    background: #FFFFFF;
    padding: 10px 8px 16px;
    box-shadow: 0 12px 28px rgba(6, 18, 22, 0.4);
    transform: rotate(-2deg);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.3, 1.1), box-shadow 0.4s ease;
    text-decoration: none !important;
}

.memories-polaroid::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 50%;
    width: 74px;
    height: 22px;
    transform: translateX(-50%) rotate(-3deg);
    background: rgba(214, 167, 67, 0.45);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    border-left: 1px dashed rgba(255, 255, 255, 0.5);
    border-right: 1px dashed rgba(255, 255, 255, 0.5);
    z-index: 1;
}

.memories-polaroid:nth-child(even)::before {
    transform: translateX(-50%) rotate(4deg);
    background: rgba(214, 167, 67, 0.34);
}

.memories-polaroid:nth-child(even) {
    transform: rotate(1.5deg);
    margin-top: 22px;
}

.memories-polaroid:nth-child(3n) {
    transform: rotate(-1deg);
    margin-top: 8px;
}

.memories-polaroid:nth-child(5n) {
    transform: rotate(2deg);
}

.memories-polaroid img {
    display: block;
    width: 100%;
    height: 168px;
    object-fit: cover;
    background: #d8cfc0;
    filter: saturate(0.96) contrast(1.05) sepia(0.06);
    transition: filter 0.4s ease;
}

.memories-polaroid figcaption {
    display: block;
    margin-top: 8px;
    padding: 0 2px;
    color: #3d4f56;
    font-style: italic;
    font-weight: 500;
    font-size: 0.78rem;
    line-height: 1.25;
    letter-spacing: 0.01em;
    text-align: center;
    min-height: 3.25em;
}

.memories-polaroid:hover,
.memories-polaroid:focus {
    transform: rotate(0deg) translateY(-6px) scale(1.04);
    box-shadow: 0 24px 48px rgba(6, 18, 22, 0.5);
    z-index: 2;
}

.memories-polaroid:hover img,
.memories-polaroid:focus img {
    filter: saturate(1.06) contrast(1.08) sepia(0);
}

.memories-route {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100%;
    padding: 6px 0 10px;
}

.memories-route__card {
    position: relative;
    background:
        radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.55), transparent 42%),
        #f3ead6;
    color: #3d3428;
    padding: 16px 16px 17px;
    border: 1px solid rgba(120, 90, 50, 0.28);
    box-shadow:
        inset 0 0 0 3px #f3ead6,
        inset 0 0 0 4px rgba(120, 90, 50, 0.2);
    border-radius: 3px;
}

.memories-route__pin {
    position: absolute;
    top: -7px;
    right: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #c45c26;
    box-shadow: 0 0 0 3px rgba(196, 92, 38, 0.18);
}

.memories-route__card h3 {
    margin: 0 0 6px;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #2f2a22;
}

.memories-route__card p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
    color: rgba(61, 52, 40, 0.78);
}

.memories-route__track {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    align-items: stretch;
    min-height: 180px;
    margin: 8px 0;
}

.memories-route__path {
    position: absolute;
    top: 8px;
    bottom: 8px;
    right: 2px;
    width: 28px;
    height: auto;
    overflow: visible;
}

.memories-route__path path {
    fill: none;
    stroke: rgba(214, 167, 67, 0.72);
    stroke-width: 1.6;
    stroke-dasharray: 3 5;
    stroke-linecap: round;
    stroke-dashoffset: 180;
    transition: stroke-dashoffset 1.5s ease;
}

.memories-route.is-in .memories-route__path path {
    stroke-dashoffset: 0;
}

.memories-route__days {
    list-style: none;
    margin: 0;
    padding: 10px 28px 10px 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

.memories-route__days li {
    position: relative;
    padding-left: 16px;
    font-size: 0.875rem;
    line-height: 1.4;
    color: rgba(244, 239, 228, 0.78);
}

.memories-route__days li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.45em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #D6A743;
    box-shadow: 0 0 0 3px rgba(214, 167, 67, 0.16);
}

.memories-route__days strong {
    display: block;
    font-family: ui-monospace, "Courier New", Courier, monospace;
    font-size: 0.64rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(214, 167, 67, 0.82);
    margin-bottom: 2px;
}

@media (max-width: 1199.98px) {
    .memories-gallery {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .memories__stage {
        grid-template-columns: minmax(0, 1fr) 200px;
    }
}

@media (max-width: 991.98px) {
    .memories__stage {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .memories-gallery {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .memories__head {
        flex-direction: column;
        align-items: flex-start;
    }

    .memories-route {
        flex-direction: row;
        align-items: stretch;
        gap: 16px;
        min-height: 0;
        padding: 0;
    }

    .memories-route__card {
        flex: 1 1 0;
    }

    .memories-route__track {
        flex: 1.1 1 0;
        min-height: 0;
        margin: 0;
    }

    .memories-route__path {
        display: none;
    }

    .memories-route__days {
        padding: 4px 0;
        gap: 8px;
    }
}

@media (max-width: 767.98px) {
    .memories {
        padding: 40px 0 120px;
    }

    .memories__frame {
        padding: 32px 0 44px;
        border-radius: 22px;
        max-width: none;
        margin: 0 8px;
    }

    .memories__frame::before {
        border-radius: 22px 22px 0 0;
    }

    .memories__compass {
        width: 40px;
        height: 40px;
        top: 14px;
        left: 14px;
    }

    .memories__head {
        padding: 0 20px;
    }

    .memories__head h2 {
        font-size: 1.55rem;
    }

    .memories-gallery {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 16px;
        padding: 18px 20px 20px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .memories-gallery::-webkit-scrollbar {
        display: none;
    }

    .memories-polaroid,
    .memories-polaroid:nth-child(even),
    .memories-polaroid:nth-child(3n),
    .memories-polaroid:nth-child(5n) {
        flex: 0 0 68%;
        margin-top: 0;
        transform: none;
        scroll-snap-align: center;
    }

    .memories-polaroid img {
        height: 190px;
    }

    .memories-route {
        flex-direction: column;
        margin: 0 20px 8px;
        gap: 12px;
        padding-bottom: 8px;
    }

    .memories-route__days {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0;
        gap: 10px 16px;
    }

    .memories-route__days li {
        flex: 1 1 calc(50% - 16px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .memories-polaroid,
    .memories-polaroid:hover,
    .memories-polaroid:focus,
    .memories-polaroid img,
    .memories-route__path path {
        transition: none;
        transform: none;
    }

    .memories-route__path path {
        stroke-dashoffset: 0;
    }
}
