/* =========================================
   1. Design System & Tokens
   ========================================= */
/* On change Merriweather pour 'Space Grotesk' pour le côté Tech/Modern 
   et on garde Inter pour la lisibilité parfaite du corps de texte. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Space+Grotesk:wght@500;700&family=JetBrains+Mono&display=swap');

:root {
    /* --- Palette: Organic & Bold --- */
    /* On garde le crème mais on le chauffe un tout petit peu pour éviter le côté "clinique" */
    --color-cream: #FFFCF5;       
    --color-surface: #FFFFFF;     
    --color-ink: #121212;         /* Plus profond que le #1A1A1A */
    --color-subtle: #F2F0E9;      /* Pour les arrière-plans secondaires */
    
    /* --- Accents (Forest Theme) --- */
    --accent-primary: #388E3C;    /* Forest Green */
    --accent-secondary: #A5D6A7;  /* Light Moss Green */
    --accent-tertiary: #8D6E63;   /* Earthy Brown */
    --accent-dark: #2C3E50;       /* Deep Blue-Green for contrast */

    /* --- Geometry & Physics --- */
    --border-width: 2px;
    --border-std: var(--border-width) solid var(--color-ink);
    
    /* On augmente légèrement le radius pour adoucir le brutalisme */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 9999px;
    
    /* C'est ici que la magie opère : des ombres qui ont du caractère */
    --shadow-sm: 2px 2px 0px 0px var(--color-ink);
    --shadow-md: 4px 4px 0px 0px var(--color-ink);
    --shadow-hover: 6px 6px 0px 0px var(--color-ink);
    --shadow-active: 1px 1px 0px 0px var(--color-ink);

    /* --- Typography --- */
    --font-display: "Space Grotesk", sans-serif; /* Moderne, Tech, Fun */
    --font-body: "Inter", sans-serif;
    --font-mono: "JetBrains Mono", monospace;

    /* --- Animation (The "Bouncy" Feel) --- */
    /* Une courbe personnalisée pour donner une sensation de physique/poids */
    --ease-spring: cubic-bezier(0.25, 0.8, 0.25, 1);
}

html.dark {
    /* --- Dark Mode: Marine + Forest Accents --- */
    --color-cream: #0A161B;      /* Very dark blue marine */
    --color-surface: #101C22;    /* Slightly lighter marine for surfaces */
    --color-ink: #fff;           /* Pure white for text */
    --color-subtle: #162024;     /* Muted marine for subtle backgrounds */

    --accent-primary: #388E3C;   /* Forest Green */
    --accent-secondary: #A5D6A7; /* Light Moss Green */
    --accent-tertiary: #8D6E63;  /* Earthy Brown */

    --border-std: 2px solid #22313A;
    --shadow-sm: 2px 2px 0px 0px #000000;
    --shadow-md: 4px 4px 0px 0px #000000;
}

/* =========================================
   2. Global Resets & Layout
   ========================================= */

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    background-color: var(--color-cream);
    color: var(--color-ink);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Texture Overlay: Gardée car elle ajoute cette "authenticité" demandée */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    opacity: 0.4;
    mix-blend-mode: overlay;
}

/* Selection color for that extra detail */
::selection {
    background-color: var(--accent-secondary);
    color: black;
}

/* =========================================
   3. Modern Typography
   ========================================= */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--color-ink);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.1;
    letter-spacing: -0.03em; /* Tight tracking for modern look */
}

h1 { 
    font-size: clamp(2.5rem, 5vw, 4rem); 
    max-width: 20ch;
}

h2 { font-size: clamp(1.8rem, 3vw, 2.5rem); }

p {
    font-size: 1.05rem; /* Slightly larger for readability */
    color: var(--color-ink);
    opacity: 0.9;
    margin-bottom: 1.5rem;
    max-width: 65ch;
}

/* Links with a stylized heavy underline */
a:not(.btn) {
    color: var(--color-ink);
    text-decoration: none;
    background-image: linear-gradient(to top, var(--accent-secondary) 100%, transparent 0);
    background-size: 100% 30%;
    background-position: bottom;
    background-repeat: no-repeat;
    transition: background-size 0.3s var(--ease-spring);
}

a:not(.btn):hover {
    background-size: 100% 100%; /* Fill effect on hover */
}

/* =========================================
   4. Components: Buttons & Inputs
   ========================================= */

/* The "Tactile" Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    
    background-color: var(--color-surface);
    color: var(--color-ink);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    
    padding: 0.8rem 1.8rem;
    border: var(--border-std);
    border-radius: var(--radius-md); /* Softer corners */
    box-shadow: var(--shadow-md);
    
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s var(--ease-spring);
    position: relative;
    overflow: hidden;
}

.btn:hover:not(:disabled) {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-hover);
    background-color: var(--color-surface); 
    /* Subtle color tint on text or border could go here */
}

.btn:active:not(:disabled) {
    transform: translate(2px, 2px);
    box-shadow: var(--shadow-active);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--color-subtle);
    box-shadow: none;
    border-color: #ccc;
}

/* Variants */
.btn-primary {
    background-color: var(--accent-primary);
    color: white; /* Contrast text */
}
.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-primary);
    filter: brightness(110%);
}

.btn-secondary {
    background-color: var(--accent-secondary);
}

/* Inputs styling */
input, textarea, select {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    font-family: var(--font-body);
    background: var(--color-surface);
    border: var(--border-std);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    outline: none;
    color: var(--color-ink);
}

:global(html.dark) input,
:global(html.dark) textarea,
:global(html.dark) select {
    background: #101C22;
    color: #fff;
    border: 2px solid var(--accent-primary);
}

/* Date picker / calendar icon tweaks */
input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: none;
    opacity: 0.95;
}

/* Make the native select options visible & themed */
select option {
    color: var(--color-ink);
    background: var(--color-surface);
}

:global(html.dark) select option {
    color: #111; /* dark text on lighter option highlight */
    background: #fff; /* we'll invert the option to light so text's readable when highlighted */
}

/* For WebKit-based browsers the dropdown button sometimes hides when background is dark. Make it visible */
input::-webkit-datetime-edit, input::-webkit-datetime-edit-fields-wrapper, input::-webkit-inner-spin-button {
    color: inherit;
}

/* Add stronger focus outline in both themes so the date picker / select is obvious */
input:focus, textarea:focus, select:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(56,142,60,0.12); /* subtle green halo */
    border-color: var(--accent-primary);
}

input:focus, textarea:focus {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-primary);
}

/* =========================================
   5. Structure & Cards
   ========================================= */

/* Main Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Cards with "Pop" */
.card {
    background: var(--color-surface);
    border: var(--border-std);
    border-radius: var(--radius-md);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s var(--ease-spring), box-shadow 0.3s var(--ease-spring);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-4px) rotate(0.5deg); /* Tiny rotation adds playfulness */
    box-shadow: var(--shadow-hover);
    z-index: 2;
}

/* Navigation tweaks based on your screenshots */
nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 0;
}

.nav-logo {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.5rem;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Badge / Tags */
.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    font-weight: 600;
    border: var(--border-std);
    border-width: 1px;
    border-radius: var(--radius-pill);
    background-color: var(--accent-secondary);
    box-shadow: 2px 2px 0px var(--color-ink);
}

/* =========================================
   6. Utilities
   ========================================= */

.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.flex-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

/* API Code Block Look */
pre {
    background: var(--color-ink);
    color: var(--color-cream);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    border: 2px solid var(--accent-secondary); /* Fun border for code */
}