/*
 * Projects/Workbench/MNG/css/layout.css
 * Hero banner, main layout, map, search controls, loading spinner, footer
 */


/* ================================================================
   HERO BANNER
   ================================================================ */

#hero {
    position: relative;
    width: 100%;
}

#hero img {
    width: 100%;
    height: auto;
    display: block;
}


/* ================================================================
   MAIN LAYOUT
   ================================================================ */

#app {
    max-width: 1120px;
    margin: 0 auto;
    padding: 1.5rem 2rem 3rem;
}


/* ================================================================
   MAP — full width on top
   ================================================================ */

#map-container {
    position: relative;
    width: 100%;
    height: 640px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid var(--panel-identity-border);
    margin-bottom: 0;
}

#map {
    width: 100%;
    height: 100%;
}

/* ================================================================
   SEARCH — full-width bar below map
   ================================================================ */

#search-container {
    position: relative;
    width: 100%;
    margin-top: 0.75rem;
}

#place-search {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    font-family: var(--font-data);
    font-size: 1rem;
    border: 2px solid var(--panel-identity-border);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}

#place-search:focus {
    border-color: var(--panel-identity-accent);
}

#place-search::placeholder {
    color: var(--text-muted);
}

/* Search icon positioned inside input */
.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
    transition: color 0.2s;
}
#place-search:focus ~ .search-icon,
.search-icon.active {
    color: var(--panel-identity-accent);
}

/* Search results dropdown */
#search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 2px solid var(--panel-identity-border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    z-index: 100;
    max-height: 320px;
    overflow-y: auto;
    box-shadow: 0 4px 12px var(--card-shadow);
}

.search-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #EDE5D4;
    font-family: var(--font-data);
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: background 0.15s;
}

.search-item:hover {
    background: #EDE5D4;
}

.search-item .search-source {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-left: 0.5rem;
}

/* Natural Area results — visually distinct in dropdown */
.search-item-curated {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    border-left: 3px solid var(--panel-places-accent);
    background: rgba(58, 112, 104, 0.04);
}
.search-item-curated:hover {
    background: rgba(58, 112, 104, 0.1);
}
.search-item-curated .search-source {
    color: var(--panel-places-accent);
    font-weight: 600;
}
.search-item-name {
    /* no special styling needed — inherits from .search-item */
}
.search-item-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 0.4rem;
}


/* ================================================================
   COORDINATE CONTROLS — below map
   ================================================================ */

#search-controls-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* Coordinate inputs */
#controls {
    margin-bottom: 0.5rem;
}

#coord-input {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.coord-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--panel-identity-border);
    border-radius: 5px;
    padding: 0.4rem 0.6rem;
    background: var(--card-bg);
}

#coord-input label {
    font-family: var(--font-data);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

#coord-input input[type="text"] {
    width: 110px;
    padding: 0.45rem 0.6rem;
    font-family: var(--font-data);
    font-size: 0.9rem;
    border: 2px solid var(--panel-identity-border);
    border-radius: 4px;
    background: var(--card-bg);
    color: var(--text-primary);
    outline: none;
}

#coord-input input[type="text"]:focus {
    border-color: var(--panel-identity-accent);
}

/* Coordinate error message */
.coord-error {
    font-family: var(--font-data);
    font-size: 0.8rem;
    color: #B85450;
    margin-top: 0.3rem;
    line-height: 1.4;
}
.coord-error.hidden { display: none; }

/* Look Up icon button — primary action inside coord-group */
.lookup-icon-btn {
    width: 38px;
    height: 38px;
    background: var(--panel-living-accent) !important;
    border-color: var(--panel-living-accent) !important;
    color: #fff !important;
}

.lookup-icon-btn:hover {
    background: #3A6A3A !important;
    border-color: #3A6A3A !important;
    color: #fff !important;
}


/* ================================================================
   ICON BUTTON GROUP — locate, random, pins, favorite
   ================================================================ */

.icon-btn-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Map view controls — hidden during globe mode, shown by exitGlobe */
.map-view-group {
    display: none;          /* shown via JS after first lookup */
    align-items: center;
    gap: 0.35rem;
}
.map-view-group.visible {
    display: flex;
}

/* Vertical divider between map-view and navigation groups */
.icon-btn-divider {
    display: none;          /* mirrors map-view-group visibility */
    width: 1px;
    height: 22px;
    background: var(--panel-identity-border);
    margin: 0 0.15rem;
}
.map-view-group.visible ~ .icon-btn-divider {
    display: block;
}

.icon-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    background: var(--card-bg);
    border: 2px solid var(--panel-identity-border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.icon-btn:hover {
    color: var(--panel-living-accent);
    border-color: var(--panel-living-accent);
    background: var(--panel-living-bg);
}

.icon-btn.active {
    color: #fff;
    background: var(--panel-living-accent);
    border-color: var(--panel-living-accent);
}

/* Favorite saved state — filled heart */
.icon-btn.fav-saved {
    color: #D94040;
    border-color: #D94040;
    background: #FFF0F0;
}
.icon-btn.fav-saved .icon-heart {
    fill: #D94040;
}
.icon-btn.fav-saved:hover {
    background: #FFE0E0;
    border-color: #B83030;
    color: #B83030;
}

/* ================================================================
   ICON TOOLTIPS — name + description on hover
   ================================================================ */

.icon-tooltip {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    padding: 0.5rem 0.75rem;
    background: var(--text-primary);
    color: #F7F3EC;
    border-radius: 5px;
    font-family: var(--font-data);
    font-size: 0.72rem;
    line-height: 1.45;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s 0.35s;
    z-index: 50;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

/* Arrow */
.icon-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: var(--text-primary);
}

.icon-tooltip strong {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1px;
    letter-spacing: 0.02em;
}

.icon-btn:hover .icon-tooltip {
    opacity: 1;
}

/* ================================================================
   FAVORITE POPOVER — save/remove choice at new location
   ================================================================ */

/* Suppress tooltip when popover is open */
.icon-btn:has(.fav-popover) .icon-tooltip {
    opacity: 0 !important;
    transition: none;
}

.fav-popover {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    border-radius: 6px;
    padding: 4px;
    z-index: 60;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    white-space: nowrap;
}

/* Arrow */
.fav-popover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: var(--text-primary);
}

.fav-popover-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.45rem 0.75rem;
    background: none;
    border: none;
    border-radius: 4px;
    font-family: var(--font-data);
    font-size: 0.78rem;
    font-weight: 600;
    color: #F7F3EC;
    cursor: pointer;
    transition: background 0.15s;
}

.fav-popover-item:hover {
    background: rgba(255, 255, 255, 0.12);
}

.fav-popover-item .lucide-icon {
    flex-shrink: 0;
}

.fav-popover-save {
    color: var(--panel-living-bg);
}

.fav-popover-remove {
    color: #F5A0A0;
}

#instructions {
    font-family: var(--font-data);
    font-size: 16px;
    color: var(--text-muted);
    margin-top: 0.3rem;
}


/* ================================================================
   LOADING
   ================================================================ */

#loading {
    text-align: center;
    padding: 3rem 1rem;
}

#loading p {
    font-family: var(--font-data);
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

.loading-message {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-style: italic;
    color: var(--text-secondary);
    min-height: 1.5em;
    transition: opacity 0.3s;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #DDD6C8;
    border-top-color: var(--panel-living-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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


/* ================================================================
   NAVIGATION BAR — below hero
   ================================================================ */

#site-nav {
    background: var(--text-primary);
}

.nav-container {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 2rem;
}

.nav-links {
    display: flex;
    align-items: center;
    flex: 1;
}

.nav-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.8rem 0;
    flex-direction: column;
    gap: 5px;
}

.nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 1px;
    transition: transform 0.3s, opacity 0.3s;
}

.nav-hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-hamburger.open span:nth-child(2) {
    opacity: 0;
}

.nav-hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.nav-link {
    font-family: var(--font-data);
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 1rem 1.4rem;
    transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    color: #fff;
    border-bottom: 2px solid var(--panel-living-accent);
}

#site-nav .nav-user {
    font-family: var(--font-data);
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5) !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 1rem 1.4rem;
    margin-left: auto;
}


/* ================================================================
   FOOTER — project grid + copyright
   ================================================================ */

#site-footer {
    background: var(--text-primary);
    color: rgba(255, 255, 255, 0.7);
    margin-top: 2rem;
}

.footer-container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 2rem;
}

.footer-mark {
    text-align: center;
    margin-bottom: 1.5rem;
}

.footer-mark img {
    height: 80px;
    width: auto;
}

.footer-brand {
    display: block;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.4rem;
    letter-spacing: 0.15em;
    color: #4A6741;
    margin-bottom: 0.25rem;
}

.footer-tagline {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: #8A9B7C;
    text-transform: uppercase;
}

.footer-projects {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.footer-project {
    display: block;
    padding: 0.9rem 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.2s;
}

.footer-project:hover {
    background: rgba(255, 255, 255, 0.1);
}

.footer-project-name {
    font-family: var(--font-data);
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.2rem;
}

.footer-project-desc {
    font-family: var(--font-data);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.4;
}

.footer-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin-bottom: 1.5rem;
}

.footer-copyright {
    text-align: center;
    margin-bottom: 1rem;
}

.footer-copyright p {
    font-family: var(--font-data);
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.25rem;
}

.footer-copyright a {
    color: var(--panel-living-accent);
    text-decoration: none;
}

.footer-copyright a:hover {
    text-decoration: underline;
}

.footer-license {
    font-size: 0.95rem;
}

.footer-green {
    text-align: center;
}

.footer-green p {
    font-family: var(--font-data);
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.5;
}


/* ================================================================
   PAGE CONTENT — About, Contact, etc.
   ================================================================ */

.about-hero-image {
    max-width: 700px;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.about-hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

.page-content {
    margin-bottom: 1.5rem;
}

.page-heading {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.page-content p {
    font-family: var(--font-data);
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 0.75rem;
    max-width: 700px;
}

.page-content strong {
    color: var(--text-primary);
}

.about-content a {
    color: var(--panel-living-accent);
    text-decoration: none;
}

.about-content a:hover {
    text-decoration: underline;
}

.about-content em {
    font-style: italic;
    color: var(--text-primary);
}

.about-cheer {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--panel-living-accent);
    margin-top: 0;
    margin-bottom: 0.25rem;
}

.about-signoff {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-top: 2rem;
}

.about-mark {
    height: 120px;
    width: auto;
}


/* ================================================================
   SOURCES PAGE
   ================================================================ */

.sources-content {
    max-width: 780px;
}

.sources-intro {
    font-family: var(--font-data);
    font-size: 22px;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 0.75rem;
    max-width: 700px;
}

/* Source sections — mirrors .fg-panel structure */
.source-section {
    margin-bottom: 1.5rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5),
                0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Panel backgrounds on source sections */
.source-section.panel-physical  { background: var(--panel-physical-bg); border: 1px solid var(--panel-physical-border); }
.source-section.panel-eco       { background: var(--panel-eco-bg); border: 1px solid var(--panel-eco-border); }
.source-section.panel-living    { background: var(--panel-living-bg); border: 1px solid var(--panel-living-border); }
.source-section.panel-identity  { background: var(--panel-identity-bg); border: 1px solid var(--panel-identity-border); }
.source-section.panel-narrative { background: var(--panel-narrative-bg); border: 1px solid var(--panel-narrative-border); }

/* Section header — mirrors .fg-panel-header */
.source-section-header {
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.source-section-header h3 {
    font-family: var(--font-data);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.03em;
    margin: 0;
}

/* Icon + heading colors by panel */
.source-section.panel-physical .source-section-header  { color: var(--panel-physical-accent); }
.source-section.panel-eco .source-section-header        { color: var(--panel-eco-accent); }
.source-section.panel-living .source-section-header     { color: var(--panel-living-accent); }
.source-section.panel-identity .source-section-header   { color: var(--panel-identity-accent); }
.source-section.panel-narrative .source-section-header  { color: var(--panel-narrative-accent); }

/* Source cards — mirrors .fg-card */
.source-card {
    background: var(--card-bg);
    border-radius: 6px;
    padding: 1rem 1.3rem;
    margin: 0 1rem 0.75rem;
    box-shadow: 0 1px 2px rgba(44, 36, 22, 0.12), 0 3px 8px rgba(44, 36, 22, 0.08);
    border: 2px solid rgba(0, 0, 0, 0.06);
}

.source-card:last-child {
    margin-bottom: 1rem;
}

/* Panel-specific card borders — same pattern as .fg-card */
.source-section.panel-physical .source-card  { border-color: var(--panel-physical-border); }
.source-section.panel-eco .source-card       { border-color: var(--panel-eco-border); }
.source-section.panel-living .source-card    { border-color: var(--panel-living-border); }
.source-section.panel-identity .source-card  { border-color: var(--panel-identity-border); }
.source-section.panel-narrative .source-card { border-color: var(--panel-narrative-border); }

.source-name {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.source-name a {
    color: var(--panel-living-accent);
    text-decoration: none;
}

.source-name a:hover {
    text-decoration: underline;
}

.source-org {
    font-family: var(--font-data);
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.source-role {
    font-family: var(--font-data);
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.source-card p {
    font-family: var(--font-data);
    font-size: 19px;
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 0;
    max-width: none;
}

.sources-content a {
    color: var(--panel-living-accent);
    text-decoration: none;
}

.sources-content a:hover {
    text-decoration: underline;
}

.sources-closing {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--panel-identity-border);
    max-width: 700px;
}

.sources-closing p {
    font-family: var(--font-data);
    font-size: 20px;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 0.75rem;
}


/* ================================================================
   CONTACT FORM
   ================================================================ */

.contact-form {
    max-width: 600px;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-family: var(--font-data);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.3rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.9rem;
    font-family: var(--font-data);
    font-size: 0.88rem;
    color: var(--text-primary);
    background: var(--card-bg);
    border: 2px solid var(--panel-identity-border);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--panel-identity-accent);
}

.form-group textarea {
    resize: vertical;
    min-height: 140px;
    line-height: 1.6;
}

.form-submit {
    font-family: var(--font-data);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    background: var(--panel-living-accent);
    color: #fff;
    border: 2px solid var(--panel-living-accent);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.form-submit:hover {
    background: #3A6A3A;
}

.form-submit:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Success / Error messages */
.form-message {
    max-width: 600px;
    padding: 0.8rem 1.2rem;
    border-radius: 6px;
    font-family: var(--font-data);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.form-success {
    background: #E8F5E9;
    border: 2px solid var(--panel-living-border);
    color: #2E5A2E;
}

.form-error {
    background: #FFF3E0;
    border: 2px solid #D4A76A;
    color: #8B4513;
}