/* Shared layout rules for the 75 public pages that link this file.
   Load after base.css and before components.css.
   invoice-generator.html does not link this file. */

/* Source: length-converter.html line 95, selector .container. */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* Source: length-converter.html lines 100-202, header and navigation. */
.site-header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background var(--transition), border var(--transition);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    gap: 16px;
    flex-wrap: wrap;
}
.logo a {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}
.logo-icon { font-size: 28px; }
.logo-text {
    color: #2d6a9f;
    -webkit-text-fill-color: #2d6a9f;
}
[data-theme="dark"] .logo-text {
    color: #7fb8e8;
    background: linear-gradient(135deg, #7fb8e8, #a8d4f5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.main-nav ul { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.main-nav a {
    color: var(--text);
    font-weight: 500;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
    transition: border var(--transition), color var(--transition);
}
.main-nav a:hover { border-bottom-color: #245883; color: #245883; }
[data-theme="dark"] .main-nav a:hover { border-bottom-color: #a8d4f5; color: #a8d4f5; }
.main-nav .has-dropdown { position: relative; }
.main-nav .dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 0;
    min-width: 200px;
    box-shadow: var(--shadow);
    z-index: 100;
}
.main-nav .has-dropdown:hover .dropdown,
.main-nav .has-dropdown:focus-within .dropdown { display: block; }
.main-nav .dropdown a {
    display: block;
    padding: 8px 20px;
    border: none;
}
.main-nav .dropdown a:hover { background: var(--bg-alt); }
.dropdown-arrow { font-size: 10px; margin-left: 4px; }

.header-actions { display: flex; gap: 12px; align-items: center; }
.header-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 4px 8px;
    border-radius: 50%;
    color: var(--text);
    transition: background var(--transition);
}
.header-actions button:hover { background: var(--bg-alt); }

.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.mobile-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--text);
    border-radius: 3px;
    transition: var(--transition);
}
.mobile-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.mobile-toggle.active span:nth-child(2) { opacity: 0; }
.mobile-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Source: length-converter.html lines 207-265, search overlay.
   First .search-close block. The min-size continuation is components.css, source line 702. */
.search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: flex-start;
    padding-top: 80px;
    backdrop-filter: blur(4px);
}
.search-overlay.active { display: flex; }
.search-container {
    max-width: 600px;
    margin: 0 auto;
    width: 90%;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-hover);
    position: relative;
}
.search-container input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 18px;
    background: var(--bg);
    color: var(--text);
    transition: border var(--transition);
}
.search-container input:focus, .search-container input:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 1px; border-color: var(--primary-light); }
[data-theme="dark"] .search-container input:focus,
[data-theme="dark"] .search-container input:focus-visible {
    outline-color: #7fb8e8;
    border-color: #7fb8e8;
}
.search-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}
.search-results { margin-top: 16px; max-height: 400px; overflow-y: auto; }
.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition);
}
.search-result-item:hover { background: var(--bg-alt); }
.search-result-item .result-name { font-weight: 600; }
.search-result-item .result-category {
    font-size: 13px;
    color: var(--text-light);
    margin-left: 8px;
}

/* Source: length-converter.html lines 521-540, selector .breadcrumb. */
.breadcrumb {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 8px;
    row-gap: 4px;
    line-height: 1.5;
    max-width: 100%;
}
.breadcrumb a {
    color: #2d6a9f;
    text-decoration: none;
}
.breadcrumb a:hover {
    color: #245883;
    text-decoration: underline;
}

/* Source: length-converter.html lines 545-573, selector .site-footer. */
.site-footer {
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    padding: 48px 0 24px;
    margin-top: 40px;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 32px;
    margin-bottom: 32px;
}
.footer-col h4 { color: var(--text); margin-bottom: 12px; font-size: 18px; }
.footer-col p { color: var(--text-light); font-size: 14px; line-height: 1.6; }
.footer-col ul li { margin-bottom: 6px; }
.footer-col ul li a {
    color: var(--text-light);
    font-size: 14px;
    transition: color var(--transition);
    cursor: pointer;
}
.footer-col ul li a:hover { color: #245883; }
.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    text-align: center;
    font-size: 14px;
    color: var(--text-light);
}

/* Source: length-converter.html lines 578-600, @media (max-width: 768px).
   Tool-widget rules from this same media block are in components.css. */
@media (max-width: 768px) {
    .mobile-toggle { display: flex; flex: 0 0 auto; order: 2; }
    .logo { order: 1; margin-right: auto; min-width: 0; }
    .header-actions { order: 3; flex: 0 0 auto; }
    .main-nav {
        order: 4;
        display: none;
        width: 100%;
        padding: 16px 0;
        border-top: 1px solid var(--border);
    }
    .main-nav.active { display: block; }
    .main-nav ul {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    .main-nav .dropdown {
        position: static;
        display: none;
        border: none;
        padding-left: 24px;
        box-shadow: none;
    }
    .main-nav.active .dropdown { display: block; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
}

/* Source: length-converter.html lines 604-606, selector .container. */
@media (max-width: 480px) {
    .container { padding: 0 16px; }
}

/* Source: length-converter.html line 664, selector .search-result-item.
   Second block. Keeps source order after the first .search-result-item above. */
.search-result-item { color: inherit; text-decoration: none; }

/* Source: length-converter.html lines 668-671, @media (max-width: 480px).
   Input and button rules from this same media block are in components.css. */
@media (max-width: 480px) {
    .search-overlay { padding-top: 48px; padding-left: 8px; padding-right: 8px; box-sizing: border-box; }
    .search-container { width: 100%; padding: 16px; }
    .search-results { max-height: 45vh; }
    .header-actions button, .mobile-toggle { min-width: 44px; min-height: 44px; }
}

/* 320–390px: keep the logo and the three header controls on one row.
   The open menu still wraps underneath because .main-nav is order 4 and width 100%. */
@media (max-width: 390px) {
    .header-inner { gap: 8px; padding: 12px 0; }
    .logo a { font-size: 18px; gap: 6px; }
    .logo-icon { font-size: 22px; }
    .logo-text { white-space: nowrap; }
    .header-actions { gap: 4px; }
}
