:root {
    --bg-overlay: rgba(12, 20, 14, 0.72);

    --panel-bg: rgba(28, 38, 32, 0.72);
    --panel-border: rgba(196, 165, 116, 0.28);
    --panel-shadow: 0 10px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);

    --text-primary: #e8e0d0;
    --text-muted: rgba(232, 224, 208, 0.72);

    --accent-gold: #c4a574;
    --accent-lavender: #9a8ab8;
    --accent-moss: #6b8f71;

    --graph-link: rgba(196, 165, 116, 0.65);
    --graph-link-hover: rgba(154, 138, 184, 0.85);
    --graph-node: rgba(196, 165, 116, 0.85);
    --graph-node-hover: rgba(212, 188, 140, 1);
    --graph-node-selected: rgba(154, 138, 184, 0.95);

    --font-display: "Lora", "Computer Modern Serif", serif;
    --font-body: "Computer Modern Serif", serif;

    --radius-panel: 18px;
    --radius-control: 12px;
}

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

html,
body {
    height: 100%;
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background: url("mystical-herb-garden-interior.jpg") center center / cover no-repeat fixed;

    display: flex;
    justify-content: center;

    padding: 24px;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

/* APP */

.app {
    width: 90%;
    height: 100%;
    max-width: 100%;
    position: relative;
    z-index: 1;

    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* GENERIC PANELS */

.gallery,
.graph-panel,
.info-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-panel);
    box-shadow: var(--panel-shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 20px;
}

/* TYPOGRAPHY */

h1,
h2 {
    font-family: var(--font-display);
    font-weight: 600;
    text-align: center;
    color: var(--text-primary);
}

h1 {
    font-size: 2.25rem;
    letter-spacing: 0.06em;
}

h2 {
    font-size: 1.45rem;
    margin-bottom: 12px;
    letter-spacing: 0.03em;
}

/* HEADER */

.header {
    flex: 0 0 auto;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 8px 0 4px;
}

.header h1 {
    margin-bottom: 0;
}

/* GALLERY */

.gallery {
    flex: 0 0 auto;
}

.gallery.splide {
    position: relative;
}

.gallery_container {
    margin-top: 8px;
}

.gallery_item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.gallery_item img {
    border-radius: 50%;
    width: 120px;
    height: 120px;
    object-fit: cover;
    display: block;
    border: 2px solid var(--panel-border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.gallery_item:hover {
    transform: translateY(-2px);
}

.gallery_item img:hover {
    border-color: var(--accent-gold);
    box-shadow: 0 0 20px rgba(196, 165, 116, 0.45);
}

.gallery_item--selected img {
    border-color: var(--accent-lavender);
    box-shadow:
        0 0 0 3px rgba(154, 138, 184, 0.35),
        0 0 24px rgba(196, 165, 116, 0.5);
}

.gallery_item span,
.gallery_label {
    margin-top: 10px;
    display: block;
    width: 100%;
    text-align: center;
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* Splide arrows */

.gallery .splide__arrow {
    background: rgba(28, 38, 32, 0.85);
    border: 1px solid var(--panel-border);
    opacity: 0.9;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.gallery .splide__arrow:hover {
    background: rgba(48, 58, 52, 0.95);
    box-shadow: 0 0 12px rgba(196, 165, 116, 0.35);
}

.gallery .splide__arrow svg {
    fill: var(--accent-gold);
}

/* MAIN CONTENT */

.main-content {
    flex: 1;

    display: flex;
    gap: 12px;

    min-height: 0;
}

/* GRAPH */

.graph-panel {
    flex: 7;

    display: flex;
    flex-direction: column;

    min-width: 0;
    min-height: 0;
}

.graph-panel h2 {
    flex-shrink: 0;
}

.controls {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-size: 0.9rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

select {
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: rgba(12, 18, 14, 0.65);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 11px 16px;
    border-radius: var(--radius-control);
    outline: none;
    min-width: 200px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select:hover,
select:focus {
    border-color: var(--accent-moss);
    box-shadow: 0 0 0 2px rgba(107, 143, 113, 0.25);
}

select option {
    background: #1a241e;
    color: var(--text-primary);
}

/* INFO */

.info-panel {
    flex: 3;

    display: flex;
    flex-direction: column;

    min-width: 0;
    min-height: 0;
}

.info-panel h2 {
    flex-shrink: 0;
}

#price::after{
    content: " R$/kg";
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* INNER CONTENT */

#graph {
    margin-top: 0;
    flex: 1;
    width: 100%;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: rgba(8, 14, 10, 0.35);
    box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.25);
}

#graph svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* D3 graph elements */

.link {
    stroke: var(--graph-link);
    stroke-width: 1.5px;
    transition: stroke 0.2s ease, stroke-width 0.2s ease;
}

.link:hover {
    stroke: var(--graph-link-hover);
    stroke-width: 2px;
}

.node {
    fill: var(--graph-node);
    stroke: rgba(232, 224, 208, 0.25);
    stroke-width: 1px;
    cursor: pointer;
    transition: fill 0.2s ease, filter 0.2s ease;
}

.node:hover {
    fill: var(--graph-node-hover);
    filter: drop-shadow(0 0 6px rgba(196, 165, 116, 0.5));
}

.node.selected {
    fill: var(--graph-node-selected);
    stroke: var(--accent-lavender);
    stroke-width: 2px;
    filter: drop-shadow(0 0 8px rgba(154, 138, 184, 0.55));
}

/* Tooltip */

#tooltip {
    position: fixed;
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
    padding: 10px 14px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    box-shadow: var(--panel-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: opacity 0.15s ease;
}

#tooltip strong {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--accent-gold);
}

/* Info box */

.info-panel h2 {
    margin-bottom: 6px;
}

.info_subtitle {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-style: italic;
    text-align: center;
    color: var(--text-primary);
    min-height: 1.6em;
    margin: 0 0 14px;
    opacity: 0.92;
    letter-spacing: 0.1em;
    text-shadow:
        0 0 24px rgba(196, 165, 116, 0.45),
        0 0 48px rgba(154, 138, 184, 0.25);
}

.info_subtitle.reveal {
    animation: subtitleReveal 1s ease forwards;
}

@keyframes subtitleReveal {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
        filter: blur(10px);
        text-shadow:
            0 0 6px rgba(196, 165, 116, 0.1),
            0 0 12px rgba(154, 138, 184, 0.05);
    }
    55% {
        opacity: 1;
        transform: translateY(0) scale(1.03);
        filter: blur(0);
        text-shadow:
            0 0 36px rgba(196, 165, 116, 0.7),
            0 0 64px rgba(154, 138, 184, 0.45);
    }
    100% {
        opacity: 0.92;
        transform: translateY(0) scale(1);
        filter: blur(0);
        text-shadow:
            0 0 24px rgba(196, 165, 116, 0.45),
            0 0 48px rgba(154, 138, 184, 0.25);
    }
}

.sabor_tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.flavor_tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--accent-gold);
    background: rgba(154, 138, 184, 0.18);
    border: 1px solid rgba(196, 165, 116, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.info_content {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.65rem 1.25rem;
    align-content: start;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-top: 4px;
    padding-right: 4px;
}

#info_imgs {
    grid-column: 1 / -1;
}

.info_prop {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.info_content > span:not(.info_prop) {
    color: var(--text-primary);
    line-height: 1.55;
    font-size: 0.98rem;
}

.info_content .sabor_tags {
    align-self: start;
}

/* MOBILE */

@media (max-width: 768px) {
    html,
    body {
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
    }

    body {
        background-attachment: scroll;
        padding: 12px;
    }

    .app {
        width: 100%;
        height: auto;
        min-height: 100%;
        gap: 10px;
    }

    .header {
        padding: 4px 0 2px;
    }

    .gallery,
    .graph-panel,
    .info-panel {
        padding: 14px;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.25rem;
        margin-bottom: 10px;
    }

    .main-content {
        flex: none;
        flex-direction: column;
        gap: 10px;
    }

    .graph-panel,
    .info-panel {
        flex: none;
    }

    .controls {
        margin-bottom: 10px;
    }

    #graph {
        flex: none;
        min-height: 42vh;
        height: 42vh;
    }

    .info_content {
        max-height: 40vh;
    }

    .gallery_item img {
        width: 96px;
        height: 96px;
    }

    select {
        min-width: 160px;
    }
}
