/* ============================================================
   Python-FR.net — Main Stylesheet
   Inspired by python.org design language
   ============================================================ */

/* ----- Custom Properties (python.org palette) -------------- */
:root {
    --color-blue: #3776ab;
    --color-blue-dark: #1e415e;
    --color-blue-medium: #2b5b84;
    --color-yellow: #ffd343;
    --color-yellow-hover: #f0c030;
    --color-default: #444;
    --color-white: #fff;
    --color-grey-lightest: #e6e8ea;
    --color-grey-lighter: #caccce;
    --color-grey: #666;
    --color-grey-dark: #333;
    --font-sans: "Source Sans 3", "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --radius: 6px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.12);
    --max-width: 1140px;
    --transition: 0.25s ease;
}

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

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-default);
    background-color: var(--color-white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: var(--color-blue);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--color-blue-dark);
}

ul, ol {
    list-style: none;
}

h1, h2, h3, h4 {
    line-height: 1.3;
    color: var(--color-grey-dark);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; margin-bottom: 1rem; }
h3 { font-size: 1.5rem; margin-bottom: 0.5rem; }

p {
    margin-bottom: 1rem;
}

p:last-child {
    margin-bottom: 0;
}

/* ----- Layout ---------------------------------------------- */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin-inline: auto;
    padding-inline: 1.5rem;
}

.content-readable {
    max-width: 800px;
    margin-inline: auto;
}

main {
    flex: 1;
}

/* ----- Ecosystem Banner ------------------------------------ */
.ecosystem-banner {
    background-color: var(--color-blue-dark);
    padding: 0.35rem 0;
    font-size: 0.8rem;
    border-bottom: 2px solid var(--color-yellow);
}

.ecosystem-inner {
    display: flex;
    justify-content: center;
}

.ecosystem-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.ecosystem-links a {
    color: rgba(255, 255, 255, 0.7);
    transition: color var(--transition);
    white-space: nowrap;
}

.ecosystem-links a:hover {
    color: var(--color-white);
}

.ecosystem-links a.ecosystem-current {
    color: var(--color-yellow);
    font-weight: 600;
}

.ecosystem-active {
    position: relative;
}

/* Yellow line above the active item */
.ecosystem-active::before {
    content: "";
    position: absolute;
    top: -0.35rem;
    left: 0;
    right: 0;
    height: 4px;
    background-color: var(--color-yellow);
}

/* Downward-pointing arrow below the line */
.ecosystem-active::after {
    content: "";
    position: absolute;
    top: calc(-0.35rem + 4px);
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--color-yellow);
}

/* ----- Header & Navigation --------------------------------- */
.site-header {
    background: linear-gradient(135deg, var(--color-blue-dark) 0%, var(--color-blue-medium) 100%);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-white);
    letter-spacing: -0.02em;
}

.logo-text:hover {
    color: var(--color-white);
}

.logo-accent {
    color: var(--color-yellow);
    font-weight: 400;
}

.logo-img {
    height: 60px;
    width: auto;
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
}

.lang-link {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
    padding: 0.15rem 0.3rem;
    border-radius: 3px;
    transition: color var(--transition), background-color var(--transition);
    text-decoration: none;
}

.lang-link:hover {
    color: var(--color-white);
}

.lang-link.lang-active {
    color: var(--color-blue-dark);
    background-color: var(--color-yellow);
}

.lang-link.lang-disabled {
    color: rgba(255, 255, 255, 0.3);
    cursor: default;
}

.lang-sep {
    color: rgba(255, 255, 255, 0.4);
}

/* Navigation */
.nav-list {
    display: flex;
    gap: 1.75rem;
}

.nav-list a {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.25rem 0;
    border-top: 2px solid transparent;
    border-bottom: 2px solid transparent;
    transition: color var(--transition), border-color var(--transition);
}

.nav-list a:hover {
    color: var(--color-white);
    border-top-color: var(--color-yellow);
    border-bottom-color: var(--color-yellow);
}

.nav-list a.active {
    color: var(--color-white);
    border-bottom-color: var(--color-yellow);
}

/* Hamburger (mobile) */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger,
.hamburger::before,
.hamburger::after {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--color-white);
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
    position: relative;
}

.hamburger::before,
.hamburger::after {
    content: "";
    position: absolute;
    left: 0;
}

.hamburger::before { top: -7px; }
.hamburger::after  { top: 7px; }

/* ----- Hero Section ---------------------------------------- */
.hero {
    background: linear-gradient(135deg, var(--color-blue-medium) 0%, var(--color-blue) 50%, var(--color-blue-dark) 100%);
    color: var(--color-white);
    padding: 6rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-inner {
    position: relative;
    z-index: 2;
}

.hero h1 {
    color: var(--color-white);
    font-size: 2.75rem;
    margin-bottom: 1.25rem;
}

.hero-subtitle {
    font-size: 1.2rem;
    max-width: 680px;
    margin-inline: auto;
    margin-bottom: 2rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.7;
}

/* Floating geometric shapes in hero */
.hero-shapes {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.hero-shape {
    position: absolute;
    border: 2px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    animation: float 20s ease-in-out infinite;
}

.hero-shape-1 {
    width: 120px;
    height: 120px;
    top: 10%;
    left: 8%;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    border: none;
    background: rgba(255, 211, 67, 0.06);
    animation-delay: 0s;
}

.hero-shape-2 {
    width: 80px;
    height: 80px;
    top: 60%;
    right: 10%;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    border: none;
    background: rgba(55, 118, 171, 0.08);
    animation-delay: -5s;
}

.hero-shape-3 {
    width: 60px;
    height: 60px;
    bottom: 15%;
    left: 15%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    animation-delay: -10s;
}

.hero-shape-4 {
    width: 100px;
    height: 100px;
    top: 20%;
    right: 20%;
    border-radius: 50%;
    background: rgba(255, 211, 67, 0.04);
    animation-delay: -15s;
    animation-duration: 25s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-15px) rotate(5deg); }
    50% { transform: translateY(10px) rotate(-3deg); }
    75% { transform: translateY(-8px) rotate(2deg); }
}

/* ----- Page Header ----------------------------------------- */
.page-header {
    background: linear-gradient(135deg, var(--color-blue-dark) 0%, var(--color-blue-medium) 100%);
    color: var(--color-white);
    padding: 3.5rem 0;
    text-align: center;
}

.page-header h1 {
    color: var(--color-white);
    margin-bottom: 0;
}

/* ----- Sections -------------------------------------------- */
.section {
    padding: 4rem 0;
}

.section h2 {
    text-align: center;
    margin-bottom: 2rem;
}

.section-white {
    background-color: var(--color-white);
}

.section-alt {
    background-color: var(--color-grey-lightest);
}

/* ----- Rich Text ------------------------------------------- */
.rich-text h2 {
    text-align: left;
    font-size: 1.5rem;
    margin-top: 2rem;
}

.rich-text h3 {
    text-align: left;
    font-size: 1.25rem;
    margin-top: 1.5rem;
}

.rich-text ul,
.rich-text ol {
    list-style: disc;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.rich-text ol {
    list-style: decimal;
}

.rich-text li {
    margin-bottom: 0.35rem;
    line-height: 1.7;
}

.rich-text blockquote {
    border-left: 4px solid var(--color-yellow);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: var(--color-grey-lightest);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--color-grey);
    font-style: italic;
}

.rich-text a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ----- Article body ---------------------------------------- */
.article-intro {
    font-size: 1.15rem;
    color: var(--color-grey);
    line-height: 1.8;
    margin-bottom: 2rem;
}

.article-body .rich-text {
    margin-bottom: 1.5rem;
}

.article-body h2 {
    text-align: left;
}

.article-body h3 {
    text-align: left;
}

/* ----- Buttons --------------------------------------------- */
.btn {
    display: inline-block;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.75rem 2rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background-color var(--transition), transform var(--transition);
}

.btn-cta {
    background-color: var(--color-yellow);
    color: var(--color-grey-dark);
}

.btn-cta:hover {
    background-color: var(--color-yellow-hover);
    color: var(--color-grey-dark);
    transform: translateY(-1px);
}

/* ----- Code block: blue text on yellow background ---------- */
.code-block {
    margin: 1.5rem 0;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid #e6e8ea;
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #306998;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
}

.code-copy-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: background var(--transition);
}

.code-copy-btn:hover {
    background: rgba(255,255,255,0.35);
}

.code-block pre {
    margin: 0;
    padding: 1.25rem;
    background: #FFF8E1;
    overflow-x: auto;
}

.code-block code {
    color: #306998;
    font-family: 'Source Code Pro', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ----- Sources block --------------------------------------- */
.sources-block {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--color-grey-lightest);
}

.sources-block h2 {
    font-size: 1.3rem;
    text-align: left;
    color: var(--color-blue-dark);
}

.sources-block ul {
    list-style: disc;
    margin-left: 1.5rem;
}

.sources-block li {
    margin-bottom: 0.5rem;
}

/* ----- Topic tree ------------------------------------------ */
.topic-tree ul {
    list-style: none;
    padding-left: 1.5rem;
}

.topic-tree > ul {
    padding-left: 0;
}

.topic-name {
    color: var(--color-blue-dark);
    font-size: 1.2rem;
    display: block;
    padding: 0.5rem 0 0.25rem;
}

.topic-introduction {
    padding: 0.5rem 0 0.5rem 0.5rem;
    color: var(--color-default);
    line-height: 1.7;
}

.topic-introduction h3 {
    color: var(--color-blue);
    font-size: 1rem;
    margin: 1rem 0 0.5rem;
}

.topic-introduction ul {
    list-style: none;
    padding-left: 0;
}

.topic-introduction li {
    padding: 0.35rem 0;
    border-left: 3px solid var(--color-yellow);
    padding-left: 0.75rem;
    margin-bottom: 0.35rem;
    line-height: 1.5;
}

.topic-introduction li a {
    font-weight: 600;
}

.article-intro-snippet {
    margin: 0.25rem 0 0;
    color: var(--color-grey);
    font-size: 0.9rem;
}

.topic-articles {
    list-style: none !important;
    padding-left: 1rem !important;
}

.topic-articles li {
    padding: 0.25rem 0;
    border-left: 3px solid var(--color-yellow);
    padding-left: 0.75rem;
    margin-bottom: 0.25rem;
}

.topic-articles li a {
    font-weight: 500;
}

.article-date {
    color: var(--color-grey);
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

/* ----- Article meta ---------------------------------------- */
.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    color: var(--color-grey);
}

.article-meta a {
    color: var(--color-blue);
}

.article-tag {
    display: inline-block;
    background: var(--color-grey-lightest);
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    color: var(--color-grey);
}

/* ----- Related articles ------------------------------------ */
.related-articles {
    margin-top: 3rem;
    padding: 1.5rem 2rem;
    background: var(--color-grey-lightest);
    border-radius: var(--radius);
}

.related-articles h2 {
    font-size: 1.2rem;
    text-align: left;
    color: var(--color-blue-dark);
    margin-bottom: 1rem;
}

.related-articles ul {
    list-style: none;
}

.related-articles li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-grey-lighter);
}

.related-articles li:last-child {
    border-bottom: none;
}

/* ----- Latest posts on home -------------------------------- */
.latest-posts-list {
    list-style: none;
}

.latest-post-item {
    display: block;
    padding: 1.25rem;
    margin-bottom: 1rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    transition: box-shadow var(--transition), transform var(--transition);
}

.latest-post-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: inherit;
}

.latest-post-item h3 {
    color: var(--color-blue-dark);
    margin-bottom: 0.25rem;
}

.latest-post-meta {
    font-size: 0.85rem;
    color: var(--color-grey);
    margin-bottom: 0.5rem;
}

.latest-post-intro {
    color: var(--color-grey);
    font-size: 0.95rem;
}

/* ----- Section cards on home ------------------------------- */
.section-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.section-card {
    display: block;
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    border-left: 4px solid var(--color-yellow);
    transition: box-shadow var(--transition), transform var(--transition);
}

.section-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
    color: inherit;
}

.section-card h3 {
    color: var(--color-blue-dark);
    margin-bottom: 0.5rem;
}

.section-card p {
    color: var(--color-grey);
    font-size: 0.95rem;
}

/* ----- Search ---------------------------------------------- */
.search-form {
    margin-bottom: 2rem;
}

.search-input-group {
    display: flex;
    gap: 0.5rem;
    max-width: 600px;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--color-grey-lightest);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font-sans);
    transition: border-color var(--transition);
    outline: none;
}

.search-input:focus {
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px rgba(55, 118, 171, 0.15);
}

.search-summary {
    margin-bottom: 1.5rem;
    color: var(--color-grey);
    font-size: 0.95rem;
}

.search-results {
    list-style: none;
}

.search-result-item {
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--color-grey-lightest);
}

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

.search-result-item h3 {
    margin-bottom: 0.25rem;
}

.search-result-item p {
    color: var(--color-grey);
    font-size: 0.95rem;
    margin-bottom: 0;
}

.search-no-results {
    color: var(--color-grey);
    padding: 2rem 0;
    text-align: center;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem 0;
}

.pagination-info {
    color: var(--color-grey);
    font-size: 0.9rem;
}

/* ----- Legal Page ------------------------------------------ */
.legal-header {
    background: linear-gradient(135deg, var(--color-blue-dark) 0%, var(--color-blue-medium) 100%);
    padding: 2.5rem 0;
    text-align: center;
}

.legal-header h1 {
    color: var(--color-white);
    font-size: 2rem;
    margin: 0;
}

.legal-section {
    padding: 3rem 0;
}

.legal {
    background-color: var(--color-white);
    border-radius: var(--radius);
    padding: 2rem 2.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    max-width: 800px;
    margin: 0 auto;
}

.legal h2 {
    font-size: 1.3rem;
    color: var(--color-blue-dark);
    margin-top: 1.5rem;
    margin-bottom: 0.6rem;
}

.legal h2:first-child {
    margin-top: 0;
}

.legal p {
    margin-bottom: 0.6rem;
}

.legal blockquote {
    margin: 0.5rem 0 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--color-grey-lightest);
    border-left: 4px solid var(--color-blue);
    border-radius: 0 4px 4px 0;
    font-style: normal;
}

.legal blockquote a {
    color: var(--color-blue);
    text-decoration: underline;
}

.legal blockquote a:hover {
    color: var(--color-blue-dark);
}

/* ----- Footer ---------------------------------------------- */
.site-footer {
    background-color: var(--color-blue-dark);
    color: rgba(255, 255, 255, 0.7);
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.9rem;
}

.site-footer a {
    color: rgba(255, 255, 255, 0.85);
}

.site-footer a:hover {
    color: var(--color-yellow);
}

/* ----- Responsive ------------------------------------------ */
@media (max-width: 768px) {
    h1 { font-size: 1.85rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    .hero { padding: 3.5rem 0; }
    .hero h1 { font-size: 2rem; }
    .hero-subtitle { font-size: 1.05rem; }

    .section { padding: 2.5rem 0; }

    .section-cards {
        grid-template-columns: 1fr;
    }

    /* Ecosystem banner */
    .ecosystem-links {
        gap: 0.75rem;
        font-size: 0.75rem;
    }

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

    .main-nav {
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, var(--color-blue-dark) 0%, var(--color-blue-medium) 100%);
        box-shadow: var(--shadow-md);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s ease;
    }

    .main-nav.open {
        max-height: 400px;
    }

    .nav-list {
        flex-direction: column;
        gap: 0;
        padding: 0.5rem 1.5rem;
    }

    .nav-list li a {
        display: block;
        padding: 0.75rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-list li:last-child a {
        border-bottom: none;
    }

    .search-input-group {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .header-inner {
        height: 56px;
    }

    .main-nav {
        top: 56px;
    }

    .logo-text {
        font-size: 1.2rem;
    }

    .ecosystem-banner {
        display: none;
    }
}
