@import url('font.css');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
    font-family: Arial, sans-serif;
    overflow: hidden;
    /* desktop locked */
}

header {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background-color: #eee;
    font-size: 20px;
    z-index: 100;
    position: relative;
    padding-left: 15%;
}

.grid-wrapper {
    position: relative;
}

.grid-wrapper::before,
.grid-wrapper::after {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 180px;
    z-index: 2;
    pointer-events: none;
}

.grid-wrapper::before {
    top: 0;
    background: linear-gradient(to bottom, #eee, rgba(238, 238, 238, 0));
}

.grid-wrapper::after {
    bottom: 0;
    background: linear-gradient(to top, #eee, rgba(238, 238, 238, 0));
}

.grid-container {
    display: grid;
    width: 100vw;
    height: calc(100vh - 120px);
    grid-template-columns: 1fr 2fr 2fr 2fr 2fr 2fr 2fr 1fr;
    grid-template-rows: 1fr 2fr 2fr 1fr;
}

/* IMAGE TILES */
.img-half {
    position: relative;
    overflow: hidden;
    border: 1px solid #eee;
    opacity: 0.4;
    filter: grayscale(100%);
}

.img-half .layer {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1400ms ease-in-out;
    will-change: opacity;
}

.img-half .layer.is-active {
    opacity: 1;
}

/* MENU TILE BASE */
.menu {
    border: 1px solid #eee;
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    font-family: 'CG', sans-serif;
    letter-spacing: 0.08em;
    color: var(--t, #333);
    text-transform: uppercase;
    cursor: pointer;
    z-index: 200;
    transition: background-color 0.4s ease, color 0.4s ease, transform 0.3s ease;
    background: #d6d6d6;
    animation: menuPulse 4.8s ease-in-out infinite;
}

@keyframes menuPulse {

    0%,
    100% {
        background-color: #d6d6d6;
        color: var(--t, #333);
    }

    50% {
        background-color: var(--c);
        color: #fff;
    }
}

.menu::after {
    content: "";
    position: absolute;
    background: var(--c, #000);
    transition: background 0.4s ease;
    animation: barPulse 4.8s ease-in-out infinite;
}

@keyframes barPulse {

    0%,
    100% {
        background: var(--c);
        opacity: 1;
    }

    50% {
        background: #fff;
        opacity: 1;
    }
}

/* hover */
.menu:hover {
    animation: none;
    background-color: var(--c);
    color: #fff;
    transform: translateY(-3px);
}

.menu:hover::after {
    animation: none;
    background: #fff;
}

/* Stagger delays */
.menu-residential {
    animation-delay: 0s;
}

.menu-residential::after {
    animation-delay: 0s;
}

.menu-corporate {
    animation-delay: 3s;
}

.menu-corporate::after {
    animation-delay: 3s;
}

.menu-commercial {
    animation-delay: 6s;
}

.menu-commercial::after {
    animation-delay: 6s;
}

.menu-hospitality {
    animation-delay: 1.8s;
}

.menu-hospitality::after {
    animation-delay: 1.8s;
}

.menu-retails {
    animation-delay: 1s;
}

.menu-retails::after {
    animation-delay: 1s;
}

.menu-education {
    animation-delay: 5s;
}

.menu-education::after {
    animation-delay: 5s;
}

.menu-health {
    animation-delay: 6s;
}

.menu-health::after {
    animation-delay: 6s;
}

.menu-mall {
    animation-delay: 4.2s;
}

.menu-mall::after {
    animation-delay: 4.2s;
}

/* label */
.menu-label {
    display: inline-block;
    padding: 10%;
    font-size: 2.5vh;
}

/* vertical label */
.menu-v {
    writing-mode: vertical-rl;
}

.menu-v .menu-label {
    transform: rotate(180deg);
}

/* horizontal label */
.menu-h {
    writing-mode: horizontal-tb;
    transform: none;
}

/* bars */
.bar-bl::after {
    left: 0px;
    bottom: 12%;
    width: 22%;
    height: 10px;
}

.bar-blr::after {
    right: 0px;
    bottom: 12%;
    width: 22%;
    height: 10px;
}

.bar-tr::after {
    right: 0px;
    top: 12%;
    width: 22%;
    height: 10px;
}

.bar-rc::after {
    right: 12%;
    top: 90%;
    transform: translateY(-50%);
    width: 10px;
    height: 22%;
}

.bar-mbr::after {
    left: 12%;
    top: 89%;
    transform: translateY(-50%);
    width: 10px;
    height: 22%;
}

.bar-dt::after {
    right: 12%;
    bottom: 67%;
    transform: translateY(-50%);
    width: 10px;
    height: 22%;
}

/* FOOTER */
.footer-strip {
    width: 100%;
    height: 50px;
    background: linear-gradient(to top, #eee, #eee, rgba(238, 238, 238, 0));
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 5;
}

.footer-nav {
    display: flex;
    gap: 30px;
    justify-content: space-between;
    position: absolute;
    bottom: 30px;
    left: 100px;
    right: 100px;
    z-index: 10;
}

.nav-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.nav-label {
    position: absolute;
    bottom: 130%;
    color: #0080c6;
    padding-bottom: 5px;
    font-size: 25px;
    font-family: 'CG', sans-serif;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
    white-space: nowrap;
}

.nav-item:hover .nav-label {
    opacity: 1;
    transform: translateX(0);
}

.nav-dot {
    height: 1.3vh;
    width: 11.8vw;
    position: relative;
    background-color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    overflow: hidden;
}

.nav-dot::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background-color: #0080c6;
    transition: left 0.4s ease;
}

.nav-dot:hover::before {
    left: 0;
}

/* Hide desktop-only tiles */
.hide-mobile {}

/* ===================== MOBILE (ACCURATE) ===================== */
@media (max-width: 768px) {

  html, body{
    height: 100%;
    overflow: hidden; /* fixed viewport grid */
  }

  header{
    height: 70px;
    padding-left: 20px;
  }

  /* ✅ Show all tiles so bottom can be filled with images */
  .hide-mobile{
    display: block !important;
  }

  /* footer fixed */
  .footer-strip{
    display: none;
  }

  .extra-footer{
    height: 60px;
    background: #eee;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 5;
  }

  /* ✅ Mobile grid fills the screen and uses a strict height pattern */
  .grid-container{
    width: 100vw;
    height: calc(100dvh - 70px - 60px); /* viewport - header - footer */
    display: grid;
    grid-template-columns: repeat(4, 1fr);

    /* RULE:
       Row 1 = small images
       Row 2 = tall images  (like your screenshot)
       Row 3 = tall menus   (top 4 menus same height as row 2 images)
       Row 4 = small menus  (bottom 4 menus same height as row 1 images)
       Row 5-8 = images to fill remaining space (same size)
    */
    grid-template-rows: 0.85fr 1.35fr 1.35fr 0.85fr 1fr 1fr 1fr 1fr;

    gap: 8px;
    padding: 10px;
  }

  /* ✅ FORCE tiles to obey grid height (no square aspect) */
  .img-half,
  .menu{
    width: 100% !important;
    height: 120px !important;
  }

  .img-half{
    display: block !important;
    aspect-ratio: auto !important; /* kill square behavior */
    border: 1px solid #eee;
    opacity: 0.35;
    filter: grayscale(100%);
    overflow: hidden;
  }

  /* menus */
  .menu{
    writing-mode: horizontal-tb !important;
    transform: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 10px !important;
    border-radius: 10px;
    overflow: hidden;
  }

  /* remove inline margin styles from spans */
  .menu span,
  .menu .menu-label{
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    text-align: center;
    transform: none !important;
    font-size: clamp(12px, 3.5vw, 16px) !important;
    line-height: 1.1;
    letter-spacing: 0.12em;
  }

  /* ✅ Put menus exactly in the 2 menu rows */
  .menu-residential { grid-column: 1; grid-row: 3; }
  .menu-corporate   { grid-column: 2; grid-row: 3; }
  .menu-commercial  { grid-column: 3; grid-row: 3; }
  .menu-hospitality { grid-column: 4; grid-row: 3; }

  .menu-retails     { grid-column: 1; grid-row: 4; }
  .menu-education   { grid-column: 2; grid-row: 4; }
  .menu-health      { grid-column: 3; grid-row: 4; }
  .menu-mall        { grid-column: 4; grid-row: 4; }

  /* smaller bars */
  .bar-bl::after, .bar-blr::after, .bar-tr::after{
    height: 6px;
    width: 30%;
  }
  .bar-rc::after, .bar-mbr::after, .bar-dt::after{
    width: 6px;
    height: 30%;
  }
}


/* small phones */
@media (max-width: 420px) {
    .grid-container {
        gap: 6px;
        padding: 8px;
    }

    .menu {
        min-height: 70px;
    }

    .img-half {
        min-height: 70px;
    }
}
