/* ═══════════════════════════════════════════════════════════
   Latlonics — Main Stylesheet
   Design: Clean professional / precision instrument aesthetic
   Fonts: DM Sans (UI)
═══════════════════════════════════════════════════════════ */

/* ── Variables ───────────────────────────────────────────── */
:root {
    --c-bg:         #f9fafb;
    --c-surface:    #ffffff;
    --c-surface2:   #f3f4f6;
    --c-border:     #e5e7eb;
    --c-border2:    #f0f1f3;
    --c-text:       #111827;
    --c-text-muted: #6b7280;
    --c-accent:     #16a34a;      /* brand green — logo, Ready badge, hero highlight */
    --c-action:     #2563eb;      /* interactive blue — buttons, links, focus */
    --c-accent2:    #2563eb;      /* links */
    --c-accent3:    #dc2626;      /* warning/destructive */
    --c-overlay:    rgba(249,250,251,0.92);

    --radius-sm:    4px;
    --radius:       8px;
    --radius-lg:    12px;

    --shadow:       0 1px 3px rgba(0,0,0,.07), 0 4px 12px rgba(0,0,0,.05);
    --shadow-lg:    0 8px 32px rgba(0,0,0,.12);

    --font-head:    'DM Sans', sans-serif;
    --font-body:    'DM Sans', sans-serif;

    --header-h:     60px;
    --container:    1400px;
    --sidebar-w:    300px;
    --transition:   .18s ease;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--c-action); text-decoration: none; }
a:hover { color: #1d4ed8; }
button { cursor: pointer; font-family: var(--font-body); }

/* ── Container ───────────────────────────────────────────── */
.container {
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: 24px;
}

/* ── Header ──────────────────────────────────────────────── */
.site-header {
    position: sticky; top: 0; z-index: 100;
    height: var(--header-h);
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.header-inner {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 32px;
}
.logo {
    display: flex; align-items: center; gap: 8px;
    color: var(--c-text); text-decoration: none;
    flex-shrink: 0;
}
.logo-mark {
    font-size: 22px;
    color: var(--c-accent);
    line-height: 1;
}
.logo-text {
    font-family: var(--font-head);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.5px;
}
.main-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}
.nav-link {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    color: var(--c-text-muted);
    transition: color var(--transition), background var(--transition);
}
.nav-link:hover, .nav-link.active {
    color: var(--c-text);
    background: var(--c-surface2);
}
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

/* ── Language Switcher ───────────────────────────────────── */
.lang-switcher { position: relative; }
.lang-current {
    display: flex; align-items: center; gap: 6px;
    background: var(--c-surface2);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: 14px;
    color: var(--c-text-muted);
    transition: color var(--transition), border-color var(--transition);
}
.lang-current:hover { color: var(--c-text); border-color: var(--c-border); }
.lang-dropdown {
    display: none;
    position: absolute; top: calc(100% + 6px); right: 0;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    min-width: 160px;
    list-style: none;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 200;
}
.lang-switcher.open .lang-dropdown { display: block; }
.lang-switcher.open .lang-current { color: var(--c-text); }
.lang-dropdown a {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    font-size: 14px;
    color: var(--c-text-muted);
    transition: background var(--transition), color var(--transition);
}
.lang-dropdown a:hover { background: var(--c-surface2); color: var(--c-text); }
.lang-dropdown a.current { color: var(--c-action); font-weight: 500; }

/* ── Mobile menu ─────────────────────────────────────────── */
.mobile-menu-btn {
    display: none;
    flex-direction: column; justify-content: center; align-items: center;
    gap: 4px; width: 36px; height: 36px;
    background: none; border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
}
.mobile-menu-btn span {
    display: block; width: 18px; height: 1.5px;
    background: var(--c-text-muted);
    transition: transform .2s, opacity .2s;
}

/* ── Hero ────────────────────────────────────────────────── */
.hero {
    padding: 40px 0 32px;
    text-align: center;
    border-bottom: 1px solid var(--c-border);
    background:
        radial-gradient(ellipse 60% 50% at 50% -10%, rgba(37,99,235,.06) 0%, transparent 70%),
        var(--c-bg);
}
.hero-label {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--c-accent);
    margin-bottom: 20px;
    padding: 4px 12px;
    border: 1px solid rgba(22,163,74,.3);
    border-radius: 100px;
}
.hero h1 {
    font-family: var(--font-body);
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 700;
    letter-spacing: -.5px;
    line-height: 1.15;
    margin-bottom: 16px;
}
.hero h1 em {
    font-style: normal;
    color: var(--c-accent);
}
.hero-sub {
    font-size: 18px;
    color: var(--c-text-muted);
    max-width: 520px;
    margin: 0 auto 36px;
}
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}
.hero-stat {
    text-align: center;
}
.hero-stat-num {
    font-family: var(--font-body);
    font-size: 28px;
    font-weight: 700;
    color: var(--c-text);
}
.hero-stat-label {
    font-size: 13px;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── Tool Grid ───────────────────────────────────────────── */
.tools-section { padding: 64px 0; }
.section-header {
    margin-bottom: 40px;
}
.section-header h2 {
    font-family: var(--font-body);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.3px;
    margin-bottom: 6px;
}
.section-header p {
    color: var(--c-text-muted);
    font-size: 15px;
}

.category-group { margin-bottom: 48px; }
.category-label {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--c-text-muted);
    margin-bottom: 16px;
}
.category-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--c-border);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.tool-card {
    display: block;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 20px;
    transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
    text-decoration: none;
    color: inherit;
}
.tool-card:hover {
    border-color: var(--c-action);
    transform: translateY(-2px);
    box-shadow: 0 0 0 3px rgba(37,99,235,.08), var(--shadow);
    color: inherit;
}
.tool-card.not-ready {
    opacity: .5;
    pointer-events: none;
}
.tool-card-header {
    display: flex; align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
}
.tool-card-name {
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    color: var(--c-text);
}
.tool-card-badge {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 100px;
    background: rgba(22,163,74,.1);
    color: var(--c-accent);
    font-weight: 600;
    letter-spacing: .5px;
    white-space: nowrap;
}
.tool-card-badge.soon {
    background: var(--c-surface2);
    color: var(--c-text-muted);
}
.tool-card-desc {
    font-size: 14px;
    color: var(--c-text-muted);
    line-height: 1.5;
}

/* ── Tool Page Layout ────────────────────────────────────── */
.tool-page {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-w);
    gap: 24px;
    padding: 32px 0 64px;
    align-items: start;
}
.tool-main { min-width: 0; }
.tool-sidebar { display: flex; flex-direction: column; gap: 20px; }

.tool-header { margin-bottom: 20px; }
.tool-header h1 {
    font-family: var(--font-body);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -.3px;
    margin-bottom: 6px;
}
.tool-header p { color: var(--c-text-muted); font-size: 17px; }

.tool-breadcrumb {
    display: flex; align-items: center; gap: 6px;
    font-size: 15px;
    color: var(--c-text-muted);
    margin-bottom: 16px;
}
.tool-breadcrumb a { color: var(--c-text-muted); }
.tool-breadcrumb a:hover { color: var(--c-action); }
.tool-breadcrumb span { color: var(--c-text-muted); }
.tool-breadcrumb span:last-child { color: var(--c-text); font-weight: 500; }

.tool-card-wrap {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* ── Tool description ────────────────────────────────────── */
.tool-desc {
    grid-column: 1 / -1;
    margin-top: 0;
    padding-top: 48px;
    border-top: 1px solid var(--c-border);
    max-width: 720px;
}
.tool-desc-label {
    font-family: var(--font-head);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--c-text-muted);
    margin-bottom: 20px;
}
.tool-desc h3 {
    font-family: var(--font-head);
    font-size: 15px;
    color: var(--c-text);
    margin: 24px 0 6px;
}
.tool-desc p {
    font-size: 16px;
    color: var(--c-text-muted);
    line-height: 1.8;
    margin-bottom: 10px;
}
.tool-desc p:last-child { margin-bottom: 0; }
.tool-desc strong { color: var(--c-text); font-weight: 600; }
.tool-desc dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 20px;
    margin: 10px 0;
}
.tool-desc dt {
    font-family: var(--font-head);
    font-size: 14px;
    color: var(--c-accent);
    font-weight: 700;
    white-space: nowrap;
    padding-top: 2px;
}
.tool-desc dd {
    font-size: 16px;
    color: var(--c-text-muted);
    line-height: 1.7;
}

/* ── Map container ───────────────────────────────────────── */
.map-wrap {
    position: relative;
    height: 540px;
    background: var(--c-surface2);
}
.map-wrap > [id] { width: 100%; height: 100%; }

/* ── Output / results panel ──────────────────────────────── */
.output-panel {
    padding: 20px;
    border-top: 1px solid var(--c-border);
}
.output-empty {
    display: flex; align-items: center; gap: 10px;
    padding: 16px;
    background: var(--c-surface2);
    border-radius: var(--radius);
    color: var(--c-text-muted);
    font-size: 16px;
}
.output-empty .icon { font-size: 18px; }

.coord-result {
    display: grid;
    gap: 10px;
}
.coord-row {
    display: grid;
    grid-template-columns: 100px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--c-surface2);
    border-radius: var(--radius);
    border: 1px solid var(--c-border);
}
.coord-row-label {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--c-text-muted);
}
.coord-row-value {
    font-family: var(--font-head);
    font-size: 17px;
    color: var(--c-text);
    word-break: break-all;
}
.btn-copy {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    color: var(--c-text-muted);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 15px;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-copy:hover { border-color: var(--c-action); color: var(--c-action); }
.btn-copy.copied { border-color: var(--c-action); color: var(--c-action); }

/* ── Format tabs ─────────────────────────────────────────── */
.format-tabs {
    display: flex; gap: 4px;
    padding: 16px 20px 0;
}
.format-tab {
    background: var(--c-surface2);
    border: 1px solid var(--c-border);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    padding: 6px 14px;
    font-size: 16px;
    font-family: var(--font-body);
    font-weight: 500;
    color: var(--c-text-muted);
    transition: all var(--transition);
}
.format-tab:hover { color: var(--c-text); }
.format-tab.active {
    background: var(--c-surface);
    border-color: var(--c-border);
    color: var(--c-action);
    font-weight: 600;
}

/* ── Search bar ──────────────────────────────────────────── */
.map-search {
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
    z-index: 500; width: min(380px, calc(100% - 24px));
}
.map-search input {
    width: 100%;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 9px 14px;
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--c-text);
    outline: none;
    box-shadow: var(--shadow);
    transition: border-color var(--transition);
}
.map-search input::placeholder { color: var(--c-text-muted); }
.map-search input:focus { border-color: var(--c-action); }

/* ── Sidebar widgets ─────────────────────────────────────── */
.sidebar-widget {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.sidebar-widget-head {
    padding: 12px 16px;
    border-bottom: 1px solid var(--c-border);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--c-text-muted);
}
.sidebar-widget-body { padding: 14px 16px; }

/* ── Ad placeholder ──────────────────────────────────────── */
.ad-placeholder {
    height: 90px;
    background: var(--c-surface2);
    border: 1px dashed var(--c-border);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    color: var(--c-text-muted);
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.ad-container { margin-block: 16px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
}
.btn-primary {
    background: var(--c-action);
    color: #ffffff;
    border-color: var(--c-action);
}
.btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}
.btn-ghost {
    background: transparent;
    color: var(--c-text-muted);
    border-color: var(--c-border);
}
.btn-ghost:hover {
    color: var(--c-text);
    border-color: var(--c-text-muted);
}

/* ── Form elements ───────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
    display: block;
    font-size: 15px;
    font-weight: 500;
    color: var(--c-text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.form-input {
    width: 100%;
    background: var(--c-surface2);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-family: var(--font-body);
    font-size: 17px;
    color: var(--c-text);
    outline: none;
    transition: border-color var(--transition);
}
.form-input:focus { border-color: var(--c-action); }
.form-input::placeholder { color: var(--c-text-muted); }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
    background: var(--c-surface);
    border-top: 1px solid var(--c-border);
    padding-top: 48px;
}
.footer-inner {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 48px;
    padding-bottom: 40px;
}
.footer-brand .logo { margin-bottom: 12px; }
.footer-tagline { font-size: 14px; color: var(--c-text-muted); }
.footer-links { display: flex; gap: 48px; }
.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-col h4 {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--c-text-muted);
    margin-bottom: 4px;
}
.footer-col a {
    font-size: 14px;
    color: var(--c-text-muted);
}
.footer-col a:hover { color: var(--c-text); }
.footer-tools-group { display: flex; gap: 32px; }
.footer-bottom {
    border-top: 1px solid var(--c-border2);
    padding: 16px 0;
}
.footer-bottom-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.footer-bottom p {
    font-size: 13px;
    color: var(--c-text-muted);
}
.footer-bottom-links {
    display: flex;
    gap: 20px;
}
.footer-bottom-links a {
    font-size: 13px;
    color: var(--c-text-muted);
}
.footer-bottom-links a:hover { color: var(--c-text); }

/* ── Related tools widget ────────────────────────────────── */
.related-tools { display: flex; flex-direction: column; gap: 8px; }
.related-tool-link {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px;
    background: var(--c-surface2);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--c-text-muted);
    transition: color var(--transition), background var(--transition);
    text-decoration: none;
}
.related-tool-link:hover { color: var(--c-text); background: var(--c-border); }
.related-tool-link svg { opacity: .4; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
    .tool-page {
        grid-template-columns: 1fr;
    }
    .tool-sidebar {
        display: none;
    }
}
@media (max-width: 768px) {
    .main-nav { display: none; }
    .mobile-menu-btn { display: flex; }
    .hero { padding: 28px 0 24px; }
    .tools-grid { grid-template-columns: 1fr 1fr; }
    .footer-inner { grid-template-columns: 1fr; gap: 32px; }
    .footer-links { flex-wrap: wrap; gap: 24px; }
    .footer-tools-group { flex-wrap: wrap; gap: 24px; }
    .footer-bottom-inner { flex-direction: column; gap: 8px; text-align: center; }
    .map-wrap { height: 380px; }
}
@media (max-width: 480px) {
    .tools-grid { grid-template-columns: 1fr; }
    .coord-row { grid-template-columns: 80px 1fr; }
    .coord-row .btn-copy { grid-column: 1/-1; }
}

/* ── Leaflet overrides ───────────────────────────────────── */
.leaflet-container {
    font-family: var(--font-body) !important;
    background: #e8eef5;
}
.leaflet-popup-content-wrapper {
    background: var(--c-surface);
    color: var(--c-text);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}
.leaflet-popup-tip { background: var(--c-surface); }
.leaflet-control-zoom a {
    background: var(--c-surface) !important;
    color: var(--c-text) !important;
    border-color: var(--c-border) !important;
}
.leaflet-control-zoom a:hover { background: var(--c-surface2) !important; }
