﻿/* ============================================================
   MASAN PUUTYÖT - TUOTEKATALOGI (LOPULLINEN VIIMEISTELY)
   ============================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    background: #e6e3dd;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1a1917;
}

body {
    overflow-x: auto;
}

#masa-hero {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 40px 16px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 40px;
    background: radial-gradient(circle at 50% 10%, #edeae4 0%, #dbd7cf 100%);
}

.masa-a4 {
    position: relative;
    width: 210mm;
    height: 297mm;
    max-width: 210mm;
    max-height: 297mm;
    flex: 0 0 auto;
    background: #fdfbf7;
    overflow: hidden;
    padding: 12mm 13mm 10mm 13mm;
    color: #1a1917;
    box-shadow:
            0 1px 2px rgba(26, 25, 23, 0.05),
            0 4px 12px rgba(26, 25, 23, 0.08),
            0 16px 36px -4px rgba(26, 25, 23, 0.16),
            0 30px 60px -10px rgba(26, 25, 23, 0.12);
}

.masa-frame {
    position: absolute;
    left: 4.5mm; right: 4.5mm; top: 4.5mm; bottom: 4.5mm;
    border: 3px solid #1a1917;
    pointer-events: none;
    z-index: 10;
}

.masa-frame::after {
    content: "";
    position: absolute;
    left: 2mm; right: 2mm; top: 2mm; bottom: 2mm;
    border: 1px solid rgba(26, 25, 23, 0.75);
    pointer-events: none;
}

.corner {
    position: absolute;
    width: 15mm; height: 15mm;
    border-color: #1a1917;
    border-style: solid;
    pointer-events: none;
}

.corner-tl { top: -4px; left: -4px; border-width: 5px 0 0 5px; }
.corner-tr { top: -4px; right: -4px; border-width: 5px 5px 0 0; }
.corner-bl { bottom: -4px; left: -4px; border-width: 0 0 5px 5px; }
.corner-br { bottom: -4px; right: -4px; border-width: 0 5px 6.5px 0; }

.masa-header {
    position: relative;
    z-index: 2;
    margin: 0;
    padding: 0;
}

.masa-header h1 {
    margin: 0 0 4mm 0;
    padding: 0;
    text-align: center;
    font-size: 7mm;
    line-height: 1;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.masa-page-title {
    font-size: 4.2mm;
    font-weight: 900;
    letter-spacing: 0.04em;
    margin: 0 0 2mm 0;
    border-bottom: 2px solid #1a1917;
    padding-bottom: 1.2mm;
    text-transform: uppercase;
}

.masa-contact {
    margin: 0;
    padding: 0;
    font-size: 3.3mm;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.masa-contact a {
    color: #1a1917;
    text-decoration: none;
    text-transform: none;
    font-weight: 700;
}

.masa-content {
    position: relative;
    z-index: 2;
    margin-top: 2mm;
    height: 100%;
}

.masa-header + .masa-content {
    margin-top: 3mm;
    height: auto;
}

.masa-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 35%;
    column-gap: 5mm;
    align-items: stretch;
    width: 100%;
}

.masa-text,
.masa-lower-text {
    font-size: 3.1mm;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.masa-text p,
.masa-lower-text p {
    margin: 0 0 2.2mm 0;
    padding: 0;
}

.masa-text p:first-child {
    margin-top: 0;
}

.masa-lower-text {
    margin-top: 1mm;
}

.masa-product-list {
    font-size: 3.7mm;
    font-weight: 800;
    line-height: 1.35;
    padding-left: 6mm;
    margin: 0;
    text-transform: uppercase;
}

.masa-product-list li {
    margin-bottom: 3mm;
}

/* ============================================================
   KUVAGALLERIAT
   ============================================================ */

figure {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.img-wrapper {
    width: 100%;
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
    border: 2px solid #1a1917;
    background: #fdfbf7;
    box-shadow: 0 2px 6px rgba(26, 25, 23, 0.08);
}

.img-wrapper img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
    cursor: zoom-in;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.img-wrapper img:hover {
    opacity: 0.94;
    transform: scale(1.02);
}

figcaption {
    flex: 0 0 auto;
    margin: 1mm 0 0 0;
    text-align: center;
    font-size: 2.2mm;
    line-height: 1.1;
    font-weight: 900;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #1a1917;
}

.masa-side-image {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    display: flex;
}

.masa-side-image .img-wrapper {
    height: 100%;
}

.gallery-panorama {
    width: 100%;
    height: 72mm;
    margin: 2mm 0 4mm 0;
}

.gallery-2-landscape {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4mm;
    width: 100%;
    margin: 2mm 0 0 0;
}

.gallery-2-music {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4mm;
    width: 100%;
    margin: 2mm 0 0 0;
    height: 90mm;
}

.gallery-4-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 3mm 4mm;
    width: 100%;
    margin: 2mm 0 0 0;
    height: 145mm;
}

.gallery-6-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 2mm 4mm;
    width: 100%;
    margin: 2mm 0 0 0;
    height: 215mm;
}

/* Sivu 7: 4 isoa kelloa (2x2 ruudukko, täyttää sivun täydellisesti) */
.gallery-master-clock {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 3mm 4mm;
    width: 100%;
    margin: 2mm 0 0 0;
    height: 165mm;
}

/* Sivu 8: Symbolikellot (suuremmat kuvat) */
.gallery-symbols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr 1fr;
    gap: 2.5mm 3.5mm;
    width: 100%;
    margin: 2mm 0 0 0;
    height: 125mm;
}

/* ============================================================
   MODAALI JA TULOSTUS
   ============================================================ */

.masa-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0; top: 0;
    width: 100vw; height: 100vh;
    background-color: rgba(18, 17, 16, 0.88);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 24px;
    cursor: zoom-out;
}

.masa-modal.active {
    display: flex;
}

.masa-modal-content {
    max-width: 90vw;
    max-height: 80vh;
    border: 2px solid #fff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    object-fit: contain;
    cursor: default;
    border-radius: 2px;
}

.masa-modal-caption {
    margin-top: 14px;
    color: #f5f5f5;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
    cursor: default;
}

.masa-modal-close {
    position: absolute;
    top: 20px; right: 24px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 38px;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    padding: 4px 10px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.masa-modal-close:hover {
    transform: scale(1.15);
    opacity: 0.8;
}

@media screen and (max-width: 820px) {
    #masa-hero {
        padding: 20px 10px;
        align-items: flex-start;
    }
}

@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }
    html, body {
        width: 210mm;
        height: auto;
        margin: 0;
        padding: 0;
        background: #fff !important;
        color: #000 !important;
    }
    body {
        overflow: visible;
    }
    #masa-hero {
        width: 210mm;
        margin: 0;
        padding: 0;
        display: block;
        background: #fff !important;
        gap: 0;
    }
    .masa-a4 {
        width: 210mm !important;
        height: 297mm !important;
        min-width: 210mm;
        min-height: 297mm;
        max-width: none;
        max-height: none;
        margin: 0;
        background: #fff !important;
        box-shadow: none !important;
        overflow: hidden;
        page-break-after: always;
        break-after: page;
        page-break-inside: avoid;
    }
    .masa-frame, .masa-frame::after, .corner, .img-wrapper {
        border-color: #000 !important;
        box-shadow: none !important;
    }
    .img-wrapper img {
        cursor: default !important;
        transform: none !important;
    }
    .masa-contact a {
        color: #000 !important;
        text-decoration: none;
    }
    .masa-modal {
        display: none !important;
    }
}