/* Reset, Theme, and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #000;
    color: #e7e7e7;
    min-height: 100vh;
    line-height: 1.5;
}

/* GRADIENT AND LAYER BLUR EFFECT */
.image-gradient {
    position: absolute;
    top: 0;
    right: 0;
    opacity: 0.5;
    z-index: -1;
}

.layer-blur {
    height: 0;
    width: 30rem;
    position: absolute;
    top: 20%;
    right: 0;
    box-shadow: 0 0 700px 15px white;
    rotate: -30deg;
    z-index: -1;
}

/* CONTAINER */
.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    overflow: hidden;
}

/* HEADER */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5rem;
}

header h1 {
    margin: 0;
    font-size: 3rem;
    font-weight: 300;
}

nav {
    display: flex;
    align-items: center;
    gap: 3rem;
    margin-left: -5%;
}

nav a {
    font-size: 1rem;
    letter-spacing: 0.1rem;
    transition: color 0.2s ease;
    text-decoration: none;
    color: inherit;
    z-index: 999;
}

nav a:hover {
    color: #a7a7a7;
}

.btn-signing {
    background-color: #a7a7a7;
    color: black;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    transition: 0.5s;
    cursor: pointer;
    z-index: 999;
}

.btn-signing:hover {
    background-color: white;
}

/* MAIN CONTENT */
main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(90vh - 6rem);
}

.content {
    max-width: 40rem;
    margin-left: 10%;
    z-index: 999;
}

.tag-box {
    position: relative;
    width: 18rem;
    height: 2.5rem;
    border-radius: 50px;
    background: linear-gradient(to right, #656565, #7f42a7, #6600c5, #5300a0, #757575, #656565);
    background-size: 200%;
    animation: animationGradient 2.5s linear infinite;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

@keyframes animationGradient {
    to {
        background-position: 200%;
    }
}

.tag-box .tag {
    position: absolute;
    inset: 3px;
    background-color: black;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.5s ease;
    cursor: pointer;
}

.tag-box .tag:hover {
    color: #5300a0;
}

.content h1 {
    font-size: 4rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    margin: 2rem 0;
    line-height: 1.2;
    text-shadow: 0 0 10px rgba(128, 128, 128, 0.418);
}

.description {
    font-size: 1.2rem;
    letter-spacing: 0.05em;
    max-width: 35rem;
    color: gray;
}

.buttons {
    display: flex;
    gap: 1rem;
    margin-top: 3rem;
}

.robot-3d {
    position: absolute;
    top: 0;
    right: -20%;
}

/* Section Styling */
.websites-section {
    text-align: center;
    padding: 60px 20px;
    max-width: 1200px;
    margin: 0 auto; /* Center the section */
}

#aluminum-properties-section {
    margin-top: 150px; /* Creates space from the top content */
}

.websites-section h1 {
    font-size: 36px;
    margin-bottom: 10px;
    text-shadow: 0 0 15px #b084f7;
}

.subtitle {
    color: #aaa;
    margin-bottom: 40px;
    margin-top: 10px;
    font-size: 0.9rem;
}

/* Aluminum Properties Section Styling */
.aluminum-properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 32px;
    margin: 40px auto 0 auto;
    max-width: 1200px;
}

.aluminum-property-card {
    background: rgba(176, 132, 247, 0.08);
    border: 1.5px solid #7a3cff33;
    border-radius: 18px;
    box-shadow: 0 0 24px 0 #7a3cff22;
    padding: 28px 26px 22px 26px;
    color: #e7e7e7;
    font-family: 'Poppins', system-ui, sans-serif;
    transition: transform 0.2s, box-shadow 0.2s;
    backdrop-filter: blur(6px);
    text-align: left;
}

.aluminum-property-card:hover {
    transform: translateY(-7px) scale(1.03);
    box-shadow: 0 0 32px 0 #b084f7;
    border-color: #b084f7;
}

.aluminum-property-card h2 {
    color: #b084f7;
    font-size: 1.3rem;
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-shadow: 0 0 8px #7a3cff44;
}

.aluminum-property-card p {
    color: #cfcfcf;
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 0;
}

/* Interactive Periodic Table Styling */
.periodic-table-grid {
    display: grid;
    grid-template-columns: repeat(18, 1fr);
    gap: 5px;
    max-width: 1100px;
    margin: 0 auto;
}

.element-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    padding: 5px;
    text-align: center;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    aspect-ratio: 1 / 1;
}

.element-card:hover {
    transform: scale(1.15);
    z-index: 10;
    border-color: #b084f7;
    box-shadow: 0 0 20px rgba(176, 132, 247, 0.7);
}

.element-card span { /* Atomic Number */
    font-size: 0.6em;
    color: #ccc;
    align-self: flex-start;
    padding-left: 3px;
}

.element-card strong { /* Symbol */
    font-size: 1.2em;
    font-weight: 600;
}

.element-card small { /* Name */
    font-size: 0.5em;
    color: #bbb;
    word-break: break-all;
}

/* Element Group Colors */
.alkali-metal { background-color: rgba(255, 109, 109, 0.2); }
.alkaline-earth-metal { background-color: rgba(255, 211, 109, 0.2); }
.transition-metal { background-color: rgba(109, 211, 255, 0.2); }
.post-transition-metal { background-color: rgba(109, 255, 179, 0.2); }
.metalloid { background-color: rgba(204, 153, 255, 0.2); }
.nonmetal { background-color: rgba(255, 153, 204, 0.2); }
.halogen { background-color: rgba(153, 255, 153, 0.2); }
.noble-gas { background-color: rgba(179, 109, 255, 0.2); }
.lanthanide { background-color: rgba(255, 182, 193, 0.2); }
.actinide { background-color: rgba(218, 112, 214, 0.2); }

/* Legend */
.legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 40px;
    padding: 0 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
}

.color-box {
    width: 18px;
    height: 18px;
    border-radius: 4px;
}

/* Loader overlay */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
    transition: opacity 1s ease, visibility 1s ease;
}

/* Spinner */
.spinner {
    width: 80px;
    height: 80px;
    border: 6px solid rgba(255, 255, 255, 0.1);
    border-top: 6px solid #a020f0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 20px #a020f0, 0 0 40px #a020f0;
    margin-bottom: 20px;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Glowing text */
.loading-text {
    font-size: 2rem;
    font-weight: bold;
    background: linear-gradient(90deg, #a020f0, #6a00ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px rgba(160, 32, 240, 0.7), 0 0 20px rgba(106, 0, 255, 0.6);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Hidden state */
#loader.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Main content (hidden behind loader initially) */
#content {
    opacity: 0;
    transition: opacity 1s ease;
    padding: 40px;
    text-align: center;
}

#content.show {
    opacity: 1;
}

/* Buttons */
#bottone1 {
    padding: 16px 33px;
    border-radius: 9px;
    background: #d5f365;
    border: none;
    font-family: inherit;
    text-align: center;
    cursor: pointer;
    transition: 0.4s;
    color: #000; /* Added for better visibility */
}

#bottone1:hover {
    box-shadow: 7px 5px 56px -14px #C3D900;
}

#bottone1:active {
    transform: scale(0.97);
    box-shadow: 7px 5px 56px -10px #C3D900;
}


/* TABLET & MOBILE RESPONSIVE */
@media (max-width: 1300px) {
    header {
        padding: 1rem 0.5rem;
    }

    .content {
        margin-top: 85%;
    }

    .robot-3d {
        scale: 0.6;
        top: -20%;
        right: 2%;
    }
}

@media (max-width: 768px) {
    header {
        padding: 1rem 0.1rem;
    }

    nav {
        display: none;
    }

    header h1 {
        font-size: 2rem;
    }

    .btn-signing {
        padding: 0.6rem 1.5rem;
    }

    .content {
        margin-top: 25rem;
        max-width: 30rem;
        margin-left: 10%;
    }

    .robot-3d {
        scale: 1;
        top: -25%;
        right: 0;
    }

    .tag-box {
        width: 12rem;
    }

    .content h1 {
        font-size: 2.5rem;
    }

    .description {
        font-size: 1rem;
    }

    .periodic-table-grid {
        gap: 3px;
    }
    .element-card strong { font-size: 0.8em; }
    .element-card small, .element-card span { font-size: 0.4em; }

}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .btn-signing {
        padding: 0.4rem 1rem;
    }

    .robot-3d {
        top: -28%;
        right: 0;
    }

    .content {
        max-width: 32rem;
        margin-left: 10%;
        margin-top: 15rem;
    }

    .tag-box {
        width: 15rem;
        height: 2rem;
    }

    .content h1 {
        font-size: 2rem;
        margin: 1rem 0;
    }
}

/* Source Section Styling */
.source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    margin-top: 40px;
    text-align: left;
}

.source-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    border-radius: 18px;
    padding: 25px;
    transition: 0.3s;
    box-shadow: 0 0 20px rgba(176, 132, 247, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.source-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 25px rgba(176, 132, 247, 0.5);
}

.source-card h2 {
    color: #fff;
    margin-bottom: 12px;
}

.source-card p {
    color: #bbb;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Button for Source Cards */
.visit-btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 10px;
    background: linear-gradient(90deg, #7a3cff, #b084f7);
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    transition: 0.3s;
}

.visit-btn:hover {
    box-shadow: 0 0 15px #b084f7;
}


/* Footer Styling */
footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 60px;
    border-top: 1px solid #2a2a2a;
    color: #888;
    font-size: 0.9rem;
}   

/* Source Section Styling */
.source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    margin-top: 40px;
    text-align: left;
}

.source-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    border-radius: 18px;
    padding: 25px;
    transition: 0.3s;
    box-shadow: 0 0 20px rgba(176, 132, 247, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.source-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 25px rgba(176, 132, 247, 0.5);
}

.source-card h2 {
    color: #fff;
    margin-bottom: 12px;
}

.source-card p {
    color: #bbb;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Button for Source Cards */
.visit-btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 10px;
    background: linear-gradient(90deg, #7a3cff, #b084f7);
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    transition: 0.3s;
}

.visit-btn:hover {
    box-shadow: 0 0 15px #b084f7;
}


/* Footer Styling */
footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 60px;
    border-top: 1px solid #2a2a2a;
    color: #888;
    font-size: 0.9rem;
}

/*-- NEW PERIODIC TABLE & MODAL STYLES --*/

/* Smaller Periodic Table Grid */
.periodic-table-grid {
    display: grid;
    grid-template-columns: repeat(18, minmax(0, 1fr));
    gap: 4px;
    max-width: 1100px;
    margin: 40px auto 0 auto;
}

.element-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    border-radius: 6px;
    padding: 2px;
    text-align: center;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    aspect-ratio: 1 / 1;
    min-height: 40px; /* Ensures a minimum height */
}

.element-card:hover {
    transform: scale(1.2);
    z-index: 10;
    border-color: #b084f7;
    box-shadow: 0 0 15px rgba(176, 132, 247, 0.6);
}

.element-card.placeholder {
    background: transparent;
    backdrop-filter: none;
    cursor: default;
}
.element-card.placeholder:hover {
    transform: none;
    border-color: transparent;
    box-shadow: none;
}

/* Smaller text inside cards */
.element-card span { font-size: 0.6em; color: #ccc; align-self: flex-start; padding-left: 2px; }
.element-card strong { font-size: 1em; font-weight: 600; }
.element-card small { font-size: 0.45em; color: #bbb; word-break: break-all; }

/* Element Group Colors (Unchanged) */
.alkali-metal { background-color: rgba(255, 109, 109, 0.2); }
.alkaline-earth-metal { background-color: rgba(255, 211, 109, 0.2); }
.transition-metal { background-color: rgba(109, 211, 255, 0.2); }
.post-transition-metal { background-color: rgba(109, 255, 179, 0.2); }
.metalloid { background-color: rgba(204, 153, 255, 0.2); }
.nonmetal { background-color: rgba(255, 153, 204, 0.2); }
.halogen { background-color: rgba(153, 255, 153, 0.2); }
.noble-gas { background-color: rgba(179, 109, 255, 0.2); }
.lanthanide { background-color: rgba(255, 182, 193, 0.2); }
.actinide { background-color: rgba(218, 112, 214, 0.2); }

/* NEW -- Element Information Modal -- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.modal-overlay.visible {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: #1a1a1a;
    border-radius: 20px;
    padding: 30px 40px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 0 40px rgba(176, 132, 247, 0.4);
    border: 1px solid #444;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}
.modal-overlay.visible .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    color: #888;
    cursor: pointer;
    transition: color 0.2s;
}
.modal-close:hover { color: #fff; }

.modal-header {
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid #333;
    padding-bottom: 20px;
    margin-bottom: 20px;
}
.modal-number { font-size: 1.5rem; color: #888; }
.modal-header h2 { font-size: 2.5rem; color: #b084f7; text-shadow: 0 0 10px #7a3cff; }
.modal-symbol { font-size: 3rem; font-weight: bold; color: #fff; }

.modal-body p {
    font-size: 1.1rem;
    color: #ccc;
    margin-bottom: 12px;
}
.modal-body p strong { color: #fff; }
.summary-text {
    margin-top: 20px;
    font-size: 1rem;
    line-height: 1.6;
    color: #aaa;
}

/* From Uiverse.io by gharsh11032000 */ 
.animated-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px 36px;
  border: 4px solid;
  border-color: transparent;
  font-size: 16px;
  background-color: inherit;
  border-radius: 100px;
  font-weight: 600;
  color: greenyellow;
  box-shadow: 0 0 0 2px greenyellow;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.animated-button svg {
  position: absolute;
  width: 24px;
  fill: greenyellow;
  z-index: 9;
  transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.animated-button .arr-1 {
  right: 16px;
}

.animated-button .arr-2 {
  left: -25%;
}

.animated-button .circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  background-color: greenyellow;
  border-radius: 50%;
  opacity: 0;
  transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.animated-button .text {
  position: relative;
  z-index: 1;
  transform: translateX(-12px);
  transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.animated-button:hover {
  box-shadow: 0 0 0 12px transparent;
  color: #212121;
  border-radius: 12px;
}

.animated-button:hover .arr-1 {
  right: -25%;
}

.animated-button:hover .arr-2 {
  left: 16px;
}

.animated-button:hover .text {
  transform: translateX(12px);
}

.animated-button:hover svg {
  fill: #212121;
}

.animated-button:active {
  scale: 0.95;
  box-shadow: 0 0 0 4px greenyellow;
}

.animated-button:hover .circle {
  width: 220px;
  height: 220px;
  opacity: 1;
}
