/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue: #2563eb;
    --blue-light: #3b82f6;
    --blue-dark: #1d4ed8;
    --bg: #f8fafc;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --amber: #f59e0b;
    --amber-light: #fef3c7;
    --green: #10b981;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--gray-900);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* === Header === */
.site-header {
    background: var(--white);
    border-bottom: 2px solid var(--blue);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.site-logo { display: flex; align-items: center; text-decoration: none; }
.logo-img { height: 40px; width: auto; }
.header-search { margin: 0; max-width: 300px; flex-shrink: 1; border-width: 1.5px; }
.header-search input { padding: 8px 14px; font-size: 0.85rem; }
.header-search button { padding: 8px 14px; font-size: 0.85rem; min-width: auto; }
.main-nav { display: flex; gap: 20px; }
.main-nav a { color: var(--gray-700); font-size: 0.9rem; font-weight: 500; }
.main-nav a:hover { color: var(--blue); text-decoration: none; }

/* === Breadcrumbs === */
.breadcrumbs {
    background: var(--white);
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.85rem;
    color: var(--gray-500);
}
.breadcrumbs a { color: var(--gray-500); }
.breadcrumbs a:hover { color: var(--blue); }
.breadcrumbs span { margin: 0 4px; }

/* === Main Content === */
main { flex: 1; padding: 24px 0 48px; }

h1 { font-size: 1.8rem; font-weight: 700; color: var(--gray-900); margin-bottom: 8px; }
h2 { font-size: 1.3rem; font-weight: 600; color: var(--gray-900); margin: 24px 0 12px; }
h3 { font-size: 1.1rem; font-weight: 600; margin: 16px 0 8px; }

.subtitle { color: var(--gray-500); font-size: 1rem; margin-bottom: 24px; }

/* === Cards === */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

/* === Letter Grid (A-Z pills) === */
.letter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 24px;
}
.letter-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: var(--blue);
    color: var(--white);
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
}
.letter-pill:hover { background: var(--blue-dark); color: var(--white); text-decoration: none; transform: scale(1.08); }
.letter-pill.active { background: var(--blue-dark); box-shadow: 0 0 0 3px rgba(37,99,235,0.3); }

/* === Length Cards (homepage) === */
.length-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin: 16px 0 24px;
}
.length-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--gray-900);
    transition: box-shadow 0.15s, transform 0.1s;
}
.length-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; color: var(--gray-900); }
.length-card .num { font-size: 1.6rem; font-weight: 700; color: var(--blue); }
.length-card .label { font-size: 0.85rem; color: var(--gray-500); }

/* === Word Grid === */
.word-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 16px 0;
}
.word-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    text-decoration: none;
    color: var(--gray-900);
    font-size: 0.9rem;
    font-weight: 500;
    transition: border-color 0.15s, background 0.15s;
}
.word-item:hover { border-color: var(--blue); background: #eff6ff; text-decoration: none; color: var(--gray-900); }
.word-item .len-badge {
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--gray-100);
    color: var(--gray-500);
    padding: 2px 6px;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
}

/* === Stats grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin: 16px 0;
}
.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    text-decoration: none;
    color: var(--gray-900);
}
.stat-item:hover { border-color: var(--blue); text-decoration: none; }
.stat-item .count { font-weight: 700; color: var(--blue); }

/* === Definition page === */
.def-header { margin-bottom: 24px; }
.def-word { font-size: 2.2rem; font-weight: 800; color: var(--blue); text-transform: uppercase; letter-spacing: 2px; }
.def-meta { display: flex; gap: 16px; margin-top: 8px; flex-wrap: wrap; }
.def-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}
.def-badge.length { background: #dbeafe; color: #1e40af; }
.def-badge.category { background: #dcfce7; color: #166534; }
.def-badge.gender { background: #fef3c7; color: #92400e; }
.def-badge.pronun { background: #f3e8ff; color: #6b21a8; font-family: serif; font-style: italic; }

.def-section { margin: 24px 0; }
.def-text { font-size: 1.05rem; line-height: 1.7; color: var(--gray-700); }
.def-list { padding-left: 1.5em; }
.def-list li { margin-bottom: 8px; line-height: 1.6; color: var(--gray-700); }
.examples-list { list-style: none; padding: 0; }
.examples-list li { padding: 8px 16px; margin-bottom: 8px; border-left: 3px solid var(--blue-light); background: var(--gray-50); color: var(--gray-700); line-height: 1.6; border-radius: 0 var(--radius) var(--radius) 0; }

.letter-breakdown {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 12px 0;
}
.letter-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 36px;
    height: 44px;
    background: #dbeafe;
    border: 2px solid var(--blue);
    border-radius: 4px;
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: uppercase;
    line-height: 1;
    padding-top: 4px;
}
.letter-tile .tile-pts { font-size: 0.55rem; color: var(--blue-dark); }

.related-links { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.related-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--blue);
    color: var(--white);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
}
.related-link:hover { background: var(--blue-dark); color: var(--white); text-decoration: none; }

/* === SEO text === */
.seo-text { color: var(--gray-500); font-size: 0.95rem; line-height: 1.7; margin: 24px 0; }
.seo-text p { margin-bottom: 12px; }

/* === Search === */
.search-box {
    display: flex;
    gap: 0;
    max-width: 520px;
    margin: 20px 0;
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: 999px;
    overflow: visible;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.search-box input {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 999px 0 0 999px;
    font-size: 1rem;
    outline: none;
    background: transparent;
}
.search-box input:focus { outline: none; }
.search-wrap { position: relative; flex: 1; }
.search-wrap input { width: 100%; }
.search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.08);
    z-index: 200;
    max-height: 420px;
    overflow-y: auto;
    padding: 6px;
    animation: dropIn 0.15s ease-out;
}
@keyframes dropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.search-item {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 2px 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--gray-900);
    border-radius: 8px;
    transition: background 0.12s;
    cursor: pointer;
}
.search-item:hover, .search-item.active { background: #eff6ff; text-decoration: none; }
.search-item + .search-item { margin-top: 2px; }
.si-word {
    font-weight: 700;
    font-size: 1rem;
    color: var(--gray-900);
    letter-spacing: 0.5px;
    grid-column: 1;
    grid-row: 1;
}
.search-item:hover .si-word, .search-item.active .si-word { color: var(--blue); }
.si-len {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--blue);
    background: #dbeafe;
    padding: 2px 8px;
    border-radius: 999px;
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    white-space: nowrap;
}
.si-def {
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: 0.8rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}
.search-dropdown::-webkit-scrollbar { width: 6px; }
.search-dropdown::-webkit-scrollbar-track { background: transparent; }
.search-dropdown::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
.search-dropdown::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }
.search-box button {
    padding: 12px 20px;
    background: var(--blue);
    color: var(--white);
    border: none;
    border-radius: 0 999px 999px 0;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.search-box button:hover { background: var(--blue-dark); }

/* === Hero === */
.hero {
    text-align: center;
    padding: 40px 0 32px;
}
.hero h1 { font-size: 2.2rem; margin-bottom: 12px; }
.hero .subtitle { font-size: 1.1rem; }
.hero .search-box { margin: 20px auto; }

/* === Footer === */
.site-footer {
    background: var(--gray-900);
    color: var(--gray-300);
    padding: 40px 0 20px;
    margin-top: auto;
}
.footer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.footer-col h4 { color: var(--white); font-size: 0.95rem; margin-bottom: 12px; }
.footer-links { display: flex; flex-direction: column; gap: 6px; }
.footer-links a { color: var(--gray-300); font-size: 0.85rem; }
.footer-links a:hover { color: var(--white); }
.footer-text { font-size: 0.85rem; line-height: 1.6; margin-bottom: 8px; }
.footer-disclaimer { font-size: 0.75rem; opacity: 0.6; margin-top: 12px; font-style: italic; }
.lemme-card { background: var(--gray-50); border-left: 4px solid var(--blue); }
.lemme-link { font-size: 1.05rem; color: var(--gray-700); margin-bottom: 8px; }
.lemme-anchor { font-weight: 700; color: var(--blue); font-size: 1.1rem; }
.lemme-preview { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--gray-200); }
.lemme-preview h3 { font-size: 0.95rem; color: var(--gray-500); margin-bottom: 8px; }
.footer-alpha { display: flex; flex-wrap: wrap; gap: 6px; }
.footer-alpha a { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: rgba(255,255,255,0.08); border-radius: 6px; font-weight: 700; font-size: 0.85rem; transition: background 0.2s; }
.footer-alpha a:hover { background: var(--blue); color: #fff; }
.footer-bottom { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--gray-700); text-align: center; font-size: 0.8rem; }

/* === Conjugation === */
.conj-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 24px 0; }
.conj-card h3 { font-size: 1rem; color: var(--blue); margin-bottom: 8px; border-bottom: 2px solid var(--gray-100); padding-bottom: 6px; }
.conj-table { width: 100%; border-collapse: collapse; }
.conj-table tr + tr { border-top: 1px solid var(--gray-100); }
.conj-person { padding: 4px 8px 4px 0; color: var(--gray-500); font-size: 0.85rem; width: 80px; }
.conj-form { padding: 4px 0; font-weight: 600; font-size: 0.9rem; }

/* === Maillage links === */
.maillage { margin-top: 24px; }
.maillage-links { margin: 24px 0; font-size: 0.9rem; color: var(--gray-500); }
.maillage-links a { color: var(--blue); }

/* === 404 === */
.page-404 { text-align: center; padding: 80px 0; }
.page-404 .icon { font-size: 4rem; margin-bottom: 16px; }

/* === Responsive === */
@media (max-width: 768px) {
    .main-nav { display: none; }
    h1 { font-size: 1.4rem; }
    .hero h1 { font-size: 1.6rem; }
    .word-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
    .length-cards { grid-template-columns: repeat(3, 1fr); }
    .letter-pill { width: 36px; height: 36px; font-size: 0.85rem; }
    .def-word { font-size: 1.6rem; }
    .conj-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr; }
    .length-cards { grid-template-columns: repeat(2, 1fr); }
}
