/*
Theme Name: British Slang Dictionary
Theme URI: https://britishslangdictionary.net
Author: Jonathan Thomas
Author URI: https://anglotopia.net
Description: A custom WordPress theme for the British Slang Dictionary website featuring Union Jack colors, Lato typography, and a modern British design aesthetic.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: british-slang
Tags: dictionary, education, responsive, custom-colors
*/

/* ==========================================================================
   CSS RESET & BASE STYLES
   ========================================================================== */

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

/* ==========================================================================
   TYPOGRAPHY - Lato Font Family
   ========================================================================== */

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333333;
    background: #FFFFFF;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Lato', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

/* ==========================================================================
   UNION JACK COLOR SCHEME
   ========================================================================== */

:root {
    --color-blue: #012169;        /* Union Jack Blue */
    --color-red: #C8102E;         /* Union Jack Red */
    --color-white: #FFFFFF;       /* White */
    --color-light-gray: #F5F5F5;  /* Light backgrounds */
    --color-dark-text: #333333;   /* Dark text */
    --color-medium-gray: #7f8c8d; /* Medium gray for subtitles */
}

/* ==========================================================================
   LAYOUT & CONTAINERS
   ========================================================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.site-header {
    background: var(--color-white);
    color: var(--color-blue);
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-bottom: 3px solid var(--color-red);
}

.site-footer {
    background: var(--color-blue);
    color: var(--color-white);
    padding: 2rem 0;
    margin-top: 4rem;
}

/* ==========================================================================
   CARDS & ROUNDED ELEMENTS
   ========================================================================== */

.card {
    background: white;
    border-radius: 15px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   BUTTONS - Pill-shaped (50px border-radius)
   ========================================================================== */

.btn {
    display: inline-block;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background: var(--color-red);
    color: var(--color-white);
}

.btn-primary:hover {
    background: #a80d25;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(200, 16, 46, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--color-blue);
    border: 2px solid var(--color-blue);
}

.btn-secondary:hover {
    background: var(--color-blue);
    color: var(--color-white);
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */

.main-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-navigation ul {
    display: flex;
    list-style: none;
    gap: 1.2rem; /* Reduced from 2rem */
}

.main-navigation a {
    color: var(--color-blue);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem; /* Reduced font size */
    transition: color 0.3s ease;
}

.main-navigation a:hover {
    color: var(--color-red);
}

/* Dropdown Menu / Submenu Styles */
.main-navigation ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 10px 0;
    min-width: 220px;
    z-index: 1000;
    flex-direction: column;
    gap: 0;
    margin-top: 0; /* Removed gap */
    padding-top: 15px; /* Add padding instead */
}

.main-navigation ul ul a {
    padding: 12px 20px;
    display: block;
    font-size: 0.85rem;
    border-bottom: 1px solid #f0f0f0;
}

.main-navigation ul ul a:hover {
    background: var(--color-light-gray);
}

.main-navigation ul ul ul {
    top: 0;
    left: 100%;
    margin-top: 0;
    margin-left: 5px;
    padding-top: 10px;
}

.main-navigation li {
    position: relative;
}

/* Create invisible hover bridge between parent and submenu */
.main-navigation .menu-item-has-children:hover::before {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 0;
    right: 0;
    height: 15px;
    z-index: 999;
}

.main-navigation li:hover > ul {
    display: flex;
}

.main-navigation .menu-item-has-children > a::after {
    content: ' ▾';
    font-size: 0.7rem;
    margin-left: 4px;
}

.main-navigation ul ul .menu-item-has-children > a::after {
    content: ' ▸';
    float: right;
}

/* Mobile menu toggle - Hidden on desktop, shown on mobile only */
.menu-toggle {
    display: none;
    background: var(--color-blue);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

@media (min-width: 769px) {
    .menu-toggle {
        display: none !important;
    }
}

.menu-toggle:hover {
    background: var(--color-red);
}

/* Header Search */
.header-search {
    position: relative;
    margin-left: 30px;
}

.header-search .search-form {
    display: flex;
    align-items: center;
    gap: 5px;
    background: white;
    border: 2px solid var(--color-blue);
    border-radius: 50px;
    padding: 5px 5px 5px 15px;
    transition: all 0.3s ease;
}

.header-search .search-form:focus-within {
    border-color: var(--color-red);
    box-shadow: 0 0 0 3px rgba(213, 45, 63, 0.1);
}

.header-search .search-field {
    border: none;
    outline: none;
    padding: 8px 10px;
    font-size: 0.95rem;
    width: 250px;
    background: transparent;
}

.header-search .search-field::placeholder {
    color: #999;
}

.header-search .search-submit {
    background: var(--color-blue);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.header-search .search-submit:hover {
    background: var(--color-red);
    transform: scale(1.05);
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: white;
    border: 2px solid var(--color-blue);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    width: 350px;
    z-index: 1000;
    display: none;
}

.search-results-dropdown.active {
    display: block;
}

.search-result-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #f8f9fa;
}

.search-result-item a {
    text-decoration: none;
    color: var(--color-blue);
    font-weight: 600;
    display: block;
}

.search-result-item a:hover {
    color: var(--color-red);
}

.search-result-snippet {
    color: #666;
    font-size: 0.85rem;
    margin-top: 5px;
    line-height: 1.4;
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: #666;
}

.search-loading {
    padding: 20px;
    text-align: center;
    color: var(--color-blue);
}

/* Secondary Category Navigation */
.secondary-navigation {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 2px solid var(--color-light-gray);
    padding: 12px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
    overflow-y: hidden;
}

.secondary-navigation::-webkit-scrollbar {
    height: 6px;
}

.secondary-navigation::-webkit-scrollbar-track {
    background: transparent;
}

.secondary-navigation::-webkit-scrollbar-thumb {
    background: rgba(42, 64, 142, 0.3);
    border-radius: 3px;
}

.category-links {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: center;
    white-space: nowrap;
    min-width: fit-content;
}

.category-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: white;
    border: 2px solid var(--color-blue);
    border-radius: 50px;
    color: var(--color-blue);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    white-space: nowrap;
    flex-shrink: 0;
}

.category-link:hover {
    background: var(--color-blue);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(42, 64, 142, 0.2);
}

.category-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    background: var(--color-light-gray);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--color-blue);
    transition: all 0.3s ease;
}

.category-link:hover .category-count {
    background: white;
    color: var(--color-blue);
}

/* Logo Styles */
.site-branding {
    display: flex;
    align-items: center;
}

.logo-link {
    display: inline-block;
    line-height: 0;
    transition: opacity 0.3s ease;
}

.logo-link:hover {
    opacity: 0.9;
}

.site-logo {
    height: 75px;
    width: auto;
    display: block;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    /* Typography */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }

    /* Container padding */
    .container {
        padding: 15px;
    }

    .card {
        padding: 20px;
    }

    .btn {
        display: block;
        width: 100%;
        margin: 10px auto;
        max-width: 300px;
    }

    /* Mobile Navigation */
    .menu-toggle {
        display: block;
    }

    .main-navigation {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-navigation nav {
        width: 100%;
    }

    /* Mobile Search */
    .header-search {
        width: 100%;
        margin: 15px 0 0 0;
    }

    .header-search .search-field {
        width: 100%;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .search-results-dropdown {
        width: calc(100vw - 30px);
        left: 0;
        right: 0;
    }

    /* Mobile Secondary Navigation */
    .secondary-navigation {
        padding: 10px 0;
    }

    .category-links {
        gap: 8px;
        justify-content: flex-start;
    }

    .category-link {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .category-count {
        min-width: 20px;
        height: 20px;
        font-size: 0.65rem;
    }

    .main-navigation ul {
        display: none;
        flex-direction: column;
        gap: 0;
        width: 100%;
        margin-top: 1rem;
    }

    .main-navigation ul.toggled {
        display: flex;
    }

    .main-navigation li {
        width: 100%;
        border-bottom: 1px solid #e0e0e0;
    }

    .main-navigation a {
        display: block;
        padding: 15px;
    }

    /* Mobile Submenu Styles */
    .main-navigation ul ul {
        position: static;
        box-shadow: none;
        background: var(--color-light-gray);
        border-radius: 0;
        margin: 0;
        padding: 0;
        min-width: auto;
    }

    .main-navigation ul ul a {
        padding-left: 30px;
        font-size: 0.85rem;
    }

    .main-navigation ul ul ul a {
        padding-left: 45px;
    }

    .main-navigation li:hover > ul {
        display: none; /* Disable hover on mobile */
    }

    .main-navigation .menu-item-has-children > a::after {
        float: right;
        content: ' ▾';
        transition: transform 0.3s ease;
    }

    .main-navigation .submenu-open::after {
        transform: rotate(180deg);
    }

    /* Smaller logo on mobile */
    .site-logo {
        height: 40px;
    }

    /* Fix grid layouts - make them single column on mobile */
    [style*="grid-template-columns"] {
        display: block !important;
    }

    /* Single entry template - stack sidebar on mobile */
    .single-dictionary_entry .container > div,
    .single .container > div,
    .blog .container > div {
        display: block !important;
    }

    /* Sidebar on mobile */
    .sidebar {
        margin-top: 2rem;
    }

    /* Homepage hero */
    .dictionary-hero h1 {
        font-size: 2rem !important;
    }

    .dictionary-hero p {
        font-size: 1.2rem !important;
    }

    /* Book promotion - stack on mobile */
    .book-promotion [style*="grid-template-columns"] {
        display: block !important;
    }

    .book-promotion img {
        max-width: 200px !important;
        margin: 0 auto 1rem !important;
    }

    /* Word entry specific */
    article.card {
        padding: 15px !important;
    }

    /* Entry title smaller on mobile */
    .entry-title {
        font-size: 2rem !important;
    }

    /* Make inline styles responsive */
    [style*="padding: 40px"],
    [style*="padding: 30px"] {
        padding: 20px !important;
    }
}

/* ==========================================================================
   ADDITIONAL STYLING
   ========================================================================== */

/* Search form styling */
.search-form input[type="search"] {
    font-family: 'Lato', sans-serif;
}

.search-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Word cards hover effect */
.word-card:hover h3 a {
    color: var(--color-red);
}

/* Comments section */
.comment-list {
    list-style: none;
    padding: 0;
}

.comment {
    margin-bottom: 30px;
    padding: 25px;
    background: var(--color-light-gray);
    border-radius: 15px;
    border-left: 4px solid var(--color-red);
    transition: all 0.3s ease;
}

.comment:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.comment-author {
    font-weight: bold;
    color: var(--color-blue);
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.comment-meta {
    font-size: 0.85rem;
    color: var(--color-medium-gray);
    margin-bottom: 15px;
}

.comment-meta a {
    color: var(--color-red);
    text-decoration: none;
}

.comment-meta a:hover {
    text-decoration: underline;
}

.comment-content {
    line-height: 1.6;
    color: var(--color-dark-text);
}

.comment-content p {
    margin-bottom: 1rem;
}

.comment-reply-link {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 20px;
    background: var(--color-red);
    color: var(--color-white);
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.comment-reply-link:hover {
    background: #a80d25;
    transform: translateY(-2px);
}

.children {
    margin-left: 30px;
    margin-top: 20px;
}

/* Comment form */
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--color-light-gray);
    border-radius: 10px;
    font-family: 'Lato', sans-serif;
    font-size: 1rem;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

.comment-form input[type="text"]:focus,
.comment-form input[type="email"]:focus,
.comment-form input[type="url"]:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--color-red);
}

.comment-form textarea {
    min-height: 150px;
    resize: vertical;
}

.comment-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--color-blue);
    font-weight: 600;
}

.comment-form .form-submit {
    margin-top: 20px;
}

.comment-form .submit {
    background: var(--color-red);
    color: var(--color-white);
    padding: 12px 40px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.comment-form .submit:hover {
    background: #a80d25;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(200, 16, 46, 0.4);
}

/* Responsive grid improvements - Small phones */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    h1 { font-size: 1.5rem !important; }
    h2 { font-size: 1.3rem !important; }
    h3 { font-size: 1.1rem !important; }

    .container {
        padding: 10px;
    }

    .card {
        padding: 15px !important;
    }

    .browse-letters a {
        width: 40px !important;
        height: 40px !important;
        line-height: 40px !important;
        font-size: 0.9rem;
    }

    /* Further reduce title sizes on small screens */
    .entry-title {
        font-size: 1.5rem !important;
    }

    /* Smaller buttons on small phones */
    .btn {
        padding: 12px 25px !important;
        font-size: 1rem !important;
    }

    /* Book promotion images smaller */
    .book-promotion img {
        max-width: 150px !important;
    }
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

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

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mb-3 { margin-bottom: 3rem; }
