/* ==========================================
   1. Core Layout & Base Component Rules
   ========================================== */
* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

:root {
    /* Semantic Color Tokens */
    --color-primary: #F5C30C;
    --color-modal-default: #fecb0f;
    --color-noun: #3B79E5;
    --color-verb: #E54A3B;
    --color-dark: #212121;
    --color-white: #ffffff;
    --color-scroll-thumb: #333333;
    --color-scroll-thumb-hover: #a3820a;

    /* Dynamic Composition Variable Wrappers */
    --modal-bg: var(--color-modal-default);
    --modal-text-color: var(--color-dark);
    --icon-bg: var(--color-modal-default);
}

body {
    background: var(--color-primary);
    font-family: "Libre Baskerville", serif;
}

main {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    position: relative;
    background: url(./images/title.svg);
    padding-right: 6vw; /* Applied requested layout layout override */
}

/* Structural SVG & Media Containers */
main svg {
    transform: translate(-3px, 0px);
    z-index: 2;
}

main svg, main #background {
    height: 90vw;
    max-height: 620px;
}

main #background {
    position: absolute;
    z-index: 1;
}

/* Merged Rough Structural Overlay Framework */
.rough-front, .rough-back {
    position: absolute;
    pointer-events: none;
}

.rough-front {
    height: 93vw;
    max-height: 680px;
    z-index: 3;
    margin-top: 2%;
}

.rough-back {
    height: 100vw;
    max-height: 720px;
    z-index: -1;
    margin-top: -2%;
    filter: hue-rotate(43deg); /* Integrated color shifting matrix filter */
}

/* ==========================================
   2. SVG Interactive Path Matrix
   ========================================== */
#paths path {
    transition: opacity 0.25s ease-in-out, fill 0.2s ease-in-out;
    opacity: 1;
    cursor: pointer;
    --path-hover: var(--color-dark);
}

/* Nouns mapped to Verb color tokens */
#paths path#frog-2, #paths path#cane, #paths path#choco,
#paths path#fan, #paths path#drawing, #paths path#dino, #paths path#yoshi {
    --path-hover: var(--color-verb);
}

/* Verbs mapped to Noun color tokens */
#paths path#frog, #paths path#case, #paths path#power,
#paths path#fan2, #paths path#cucumber, #paths path#pencil, #paths path#pen {
    --path-hover: var(--color-noun);
}

#paths path:hover {
    fill: var(--path-hover) !important;
    opacity: 1 !important;
}

#paths path.is-hidden {
    opacity: 0;
}

/* ==========================================
   3. Card Modal System Mechanics
   ========================================== */
.modal-overlay {
    position: fixed;
    inset: 0; /* Optimized shorthand layout properties */
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease-in-out;
    z-index: 100;
    padding: 32px;
    overflow-y: auto;
}

.modal-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--modal-bg);
    padding: 40px 30px;
    border-radius: 8px;
    width: 100%;
    max-width: 640px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    transform: scale(0.95);
    transition: transform 0.25s ease-out;
    margin-top: 50px;
    height: fit-content;
}

/* State Modification Selectors mapping runtime background configurations */
.modal-content.is-noun { --icon-bg: var(--color-verb); }
.modal-content.is-verb { --icon-bg: var(--color-noun); }

.modal-content.is-widescreen {
    max-width: 850px;
    overflow-y: auto;
}

.modal-overlay.is-active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    color: var(--modal-text-color);
    transition: color 0.2s ease, opacity 0.2s ease;
    z-index: 10;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 3px;
}

.modal-close:hover {
    opacity: 0.6;
}

.modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    text-align: center;
}

.modal-status-icon-container {
    margin-bottom: 20px;
    width: 100%;
}

.modal-status-icon {
    height: 50px;
    object-fit: contain;
    display: block;
    position: absolute;
    left: 12px;
    top: 15px;
    background: var(--icon-bg);
    border-radius: 6px;
    padding: 4px;
    transition: background-color 0.2s ease-in-out;
}

/* Typography & Content Layout Nodes */
.modal-banner-image {
    width: 100%;
    max-height: 280px;
    object-fit: contain;
    border-radius: 6px;
    display: block;
    margin-bottom: 10px;
}

.modal-main-image-wrapper {
    display: inline-block;
    padding: 10px;
    max-width: 220px;
}

.modal-single-image {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 10px;
    display: block;
}

.modal-word-title {
    margin: 5px 0 0 0;
    color: var(--modal-text-color);
    font-weight: 600;
    font-size: 38px;
    text-align: left;
}

.modal-text {
    font-size: 18px;
    line-height: 1.5;
    color: var(--modal-text-color);
    margin: 0;
}

.modal-body p {
    font-size: 16px;
    line-height: 1.6;
    color: var(--modal-text-color);
    text-align: justify;
    font-family: "Montserrat", sans-serif;
}

.modal-related-link {
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
    color: var(--modal-text-color);
    transition: opacity 0.2s ease;
    font-style: italic;
}

.modal-related-link:hover {
    text-decoration: underline;
    opacity: 0.6;
}

#welcomeContent {
    display: flex;
    flex-direction: column;
    row-gap: 1rem;
}
#welcomeContent h3{
    margin-top: 20px;
    text-align: left;
}

/* ==========================================
   4. Custom Scrollbars
   ========================================== */
.modal-content.is-widescreen::-webkit-scrollbar {
    width: 10px;
}

.modal-content.is-widescreen::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

.modal-content.is-widescreen::-webkit-scrollbar-thumb {
    background: var(--color-scroll-thumb);
    border-radius: 10px;
    border: 2px solid var(--color-modal-default);
}

.modal-content.is-widescreen::-webkit-scrollbar-thumb:hover {
    background: var(--color-scroll-thumb-hover);
}

.modal-content.is-widescreen {
    scrollbar-width: thin;
    scrollbar-color: var(--color-scroll-thumb) var(--color-modal-default);
}

/* ==========================================
   5. Global Trigger Interactivity Node
   ========================================== */
.info-trigger-btn {
    position: fixed;
    top: 25px;
    right: 25px;
    width: 45px;
    height: 45px;
    background: var(--color-dark);
    color: var(--color-modal-default);
    border: none;
    border-radius: 50%;
    font-family: "Libre Baskerville", serif;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    z-index: 90;
}

.info-trigger-btn:hover {
    opacity: .6;
}

.welcome-modal-open #infoModal {
    align-items: flex-start;
}

@media all and (min-width: 680px) {
    .modal-content {
        border-radius: 8px;
        height: auto;
        margin-top: 0;
    }
}

.references span {
    font-size: 14px;
    display: block;
    margin-bottom: .5rem;
    text-align: left;
}