/* ============================================================
   mathieuflamant.com — main stylesheet
   Mobile-first · Light/dark · Custom properties
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;1,400&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500&family=DM+Mono:wght@300;400&display=swap');

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */

:root {
  /* Typography */
  --serif: 'Lora', Georgia, serif;
  --sans:  'DM Sans', sans-serif;
  --mono:  'DM Mono', monospace;

  /* Layout */
  --max-width:  680px;
  --side:       clamp(1.25rem, 5vw, 2.5rem);
  --nav-height: 52px;

  /* Transitions */
  --t-fast:   0.15s ease;
  --t-medium: 0.25s ease;
  --t-theme:  0.3s ease;
}

/* ── Light theme (default) ── */
:root,
[data-theme="light"] {
  --bg:          #F5F3EF;
  --bg-card:     #EEEAE2;
  --bg-nav:      #F5F3EFee;
  --ink:         #1A1918;
  --ink-2:       #5A5753;
  --ink-3:       #9A9690;
  --amber:       #C8992A;
  --amber-bg:    #C8992A18;
  --border:      #E0DDD6;
  --border-2:    #C8C4BC;
  color-scheme:  light;
}

/* ── Dark theme ── */
[data-theme="dark"] {
  --bg:          #181715;
  --bg-card:     #232220;
  --bg-nav:      #181715ee;
  --ink:         #EDE9E1;
  --ink-2:       #A09C94;
  --ink-3:       #5E5A54;
  --amber:       #D4A853;
  --amber-bg:    #D4A85320;
  --border:      #2E2C29;
  --border-2:    #3E3C38;
  color-scheme:  dark;
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--sans);
  background-color: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--t-theme), color var(--t-theme);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ============================================================
   3. LAYOUT
   ============================================================ */

.wrap {
  max-width: calc(var(--max-width) + var(--side) * 2);
  margin: 0 auto;
  padding: 0 var(--side);
}

.section-label {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: color var(--t-theme);
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  transition: background var(--t-theme);
}

/* ============================================================
   4. NAVIGATION
   ============================================================ */

nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background var(--t-theme), border-color var(--t-theme);
}

.nav-inner {
  max-width: calc(var(--max-width) + var(--side) * 2);
  margin: 0 auto;
  padding: 0 var(--side);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-name {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
  letter-spacing: 0.01em;
  transition: color var(--t-theme);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  font-size: 13px;
  color: var(--ink-2);
  letter-spacing: 0.02em;
  transition: color var(--t-fast);
}

.nav-links a:hover { color: var(--ink); }

/* Theme toggle button */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-theme);
  flex-shrink: 0;
  position: relative;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--border-2);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  transition: opacity 0.2s, transform 0.2s;
}

.theme-toggle .icon-sun  { opacity: 1; transform: rotate(0deg); }
.theme-toggle .icon-moon { opacity: 0; transform: rotate(-30deg); }

[data-theme="dark"] .theme-toggle .icon-sun  { opacity: 0; transform: rotate(30deg); }
[data-theme="dark"] .theme-toggle .icon-moon { opacity: 1; transform: rotate(0deg); }

/* Hamburger (mobile) */
.nav-hamburger {
  display: none;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-hamburger-inner {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-justify-content: center;
  justify-content: center;
  width: 100%;
}

.nav-hamburger span {
  display: block;
  height: 1.5px;
  background: var(--ink-2);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
  margin-bottom: 4px;
}

.nav-hamburger span:last-child {
  margin-bottom: 0;
}

.nav-hamburger.open span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* Mobile nav drawer */
.nav-drawer {
  display: none;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
  transition: background var(--t-theme);
}

.nav-drawer.open { display: flex; }

.nav-drawer a {
  font-size: 15px;
  color: var(--ink-2);
  padding: 1rem var(--side);
  border-bottom: 1px solid var(--border);
  transition: color var(--t-fast);
}

.nav-drawer a:last-child { border-bottom: none; }
.nav-drawer a:hover { color: var(--ink); }

/* ============================================================
   5. HERO
   ============================================================ */

.hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
  transition: border-color var(--t-theme);
}

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 1.25rem;
  transition: color var(--t-theme);
}

.hero-title {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 5vw, 2.625rem);
  font-weight: 500;
  line-height: 1.18;
  color: var(--ink);
  max-width: 560px;
  transition: color var(--t-theme);
}

.hero-title em {
  font-style: italic;
  color: var(--amber);
  transition: color var(--t-theme);
}

.hero-body {
  margin-top: 1.25rem;
  font-size: 15.5px;
  color: var(--ink-2);
  max-width: 520px;
  line-height: 1.75;
  transition: color var(--t-theme);
}

.hero-body img {
  width: 100px;
  height: 100px;
  display: inline-block;
  border-radius: 50%;
  vertical-align: middle;
  margin: 4px 10px 0 0;
  float: left;
  border: 1px solid var(--border);
  background-size: cover;
  background-repeat: no-repeat;
}

img.mf {
  background-image: url('/images/mathieu-flamant-portrait.jpg');
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 1.75rem;
  font-size: 13px;
  color: var(--ink);
  border-bottom: 1px solid var(--border-2);
  padding-bottom: 2px;
  transition: color var(--t-fast), border-color var(--t-fast);
}

.hero-cta:hover {
  color: var(--amber);
  border-color: var(--amber);
}

.hero-cta svg { transition: transform var(--t-fast); }
.hero-cta:hover svg { transform: translateX(3px); }

/* ============================================================
   6. WRITING / ARTICLE LIST
   ============================================================ */

.articles {
  padding: 2.75rem 0;
  border-bottom: 1px solid var(--border);
  transition: border-color var(--t-theme);
}

.article-list { display: flex; flex-direction: column; }

.article-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: start;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--t-theme);
}

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

.article-item:hover .article-title { color: var(--amber); }

.article-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 4px;
  transition: color var(--t-theme);
}

.article-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
  transition: color var(--t-fast);
}

.article-sub {
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 4px;
  line-height: 1.5;
  transition: color var(--t-theme);
}

.article-date {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 300;
  color: var(--ink-3);
  white-space: nowrap;
  padding-top: 2px;
  transition: color var(--t-theme);
}

/* ============================================================
   7. ABOUT
   ============================================================ */

.about {
  padding: 2.75rem 0;
  border-bottom: 1px solid var(--border);
  transition: border-color var(--t-theme);
}

.about-bio {
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.75;
  transition: color var(--t-theme);
}

.about-bio p + p { margin-top: 1rem; }
.about-bio strong { color: var(--ink); font-weight: 500; }

.about-facts {
  float: right;
  width: 42%;
  margin-left: 2rem;
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 767px) {
  .about-facts {
    float: none;
    width: 100%;
    margin-left: 0;
    margin-bottom: 1.5rem;
  }
}



.fact {
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: background var(--t-theme), border-color var(--t-theme);
}

.fact-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 3px;
  transition: color var(--t-theme);
}

.fact-value {
  font-size: 13.5px;
  color: var(--ink);
  font-weight: 500;
  transition: color var(--t-theme);
}

/* ============================================================
   8. NOW
   ============================================================ */

.now {
  padding: 2.75rem 0;
  border-bottom: 1px solid var(--border);
  transition: border-color var(--t-theme);
}

.now-list { display: flex; flex-direction: column; gap: 0.875rem; }

.now-item {
  display: flex;
  gap: 12px;
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.55;
  align-items: flex-start;
  transition: color var(--t-theme);
}

.now-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
  margin-top: 9px;
  transition: background var(--t-theme);
}

/* ============================================================
   9. CONTACT / NEWSLETTER
   ============================================================ */

.contact {
  padding: 2.75rem 0;
  border-bottom: 1px solid var(--border);
  transition: border-color var(--t-theme);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.contact-block { display: flex; flex-direction: column; gap: 0.75rem; }

.contact-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  transition: color var(--t-theme);
}

.contact-body {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.6;
  transition: color var(--t-theme);
}

.btn-linkedin {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  align-self: flex-start;
  transition: opacity var(--t-fast), background var(--t-theme), color var(--t-theme);
}

.btn-linkedin:hover { opacity: 0.8; }

.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.newsletter-form input[type="email"] {
  width: 100%;
  padding: 9px 12px;
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  outline: none;
  transition: border-color var(--t-fast), background var(--t-theme), color var(--t-theme);
}

.newsletter-form input[type="email"]::placeholder { color: var(--ink-3); }
.newsletter-form input[type="email"]:focus { border-color: var(--amber); }

.newsletter-form button {
  padding: 9px 16px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--amber);
  background: transparent;
  border: 1px solid var(--amber);
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  align-self: flex-start;
}

.newsletter-form button:hover {
  background: var(--amber);
  color: var(--bg);
}

.newsletter-note {
  font-size: 11.5px;
  color: var(--ink-3);
  transition: color var(--t-theme);
}

/* ============================================================
   10. FOOTER
   ============================================================ */

footer {
  padding: 1.75rem 0;
  transition: border-color var(--t-theme);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-name {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink-3);
  transition: color var(--t-theme);
}

.footer-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
}

.footer-links a {
  font-size: 12px;
  color: var(--ink-3);
  transition: color var(--t-fast);
}

.footer-links a:hover { color: var(--ink); }

/* ============================================================
   11. ARTICLE PAGE (article.html)
   ============================================================ */

.article-header {
  padding: 3.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
}

.article-header .article-tag { margin-bottom: 0.75rem; }

.article-header h1 {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 4vw, 2.125rem);
  font-weight: 500;
  line-height: 1.22;
  color: var(--ink);
  max-width: 600px;
  transition: color var(--t-theme);
}

.article-header .article-meta {
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  transition: color var(--t-theme);
}

.article-header .article-meta img {
  width: 40px;
  height: 40px;
  display: block;
  border-radius: 50%;
  margin-right: 10px;
  float: left;
  margin-top: -1px;
  background-size: cover;
  background-repeat: no-repeat;
  border: 1px solid var(--border);
}

.article-body {
  padding: 2.5rem 0;
  max-width: var(--max-width);
}

.article-body p {
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink-2);
  margin-bottom: 1.5rem;
  transition: color var(--t-theme);
}

.article-body h2 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--ink);
  margin: 2.5rem 0 1rem;
  transition: color var(--t-theme);
}

.article-body blockquote {
  border-left: 3px solid var(--amber);
  padding: 0.25rem 0 0.25rem 1.25rem;
  margin: 2rem 0;
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.7;
  transition: border-color var(--t-theme), color var(--t-theme);
}

.article-body a {
  color: var(--ink);
  border-bottom: 1px solid var(--border-2);
  padding-bottom: 1px;
  transition: color var(--t-fast), border-color var(--t-fast);
}

.article-body a:hover {
  color: var(--amber);
  border-color: var(--amber);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 1.5rem;
  transition: color var(--t-fast);
}

.back-link:hover { color: var(--ink); }
.back-link svg { transition: transform var(--t-fast); }
.back-link:hover svg { transform: translateX(-3px); }

/* ============================================================
   12. PAGE LOAD ANIMATIONS
   ============================================================ */

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero-eyebrow { animation: fade-up 0.45s ease both; }
.hero-title   { animation: fade-up 0.45s 0.07s ease both; }
.hero-body    { animation: fade-up 0.45s 0.14s ease both; }
.hero-cta     { animation: fade-up 0.45s 0.21s ease both; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   13. RESPONSIVE — MOBILE FIRST
   ============================================================ */

/* Default styles above are mobile.
   Below we layer on tablet (560px+) and desktop (768px+). */

/* — Tablet+ (560px) — */
@media (min-width: 560px) {
  .hero { padding: 5rem 0 3.5rem; }
}

/* — Desktop (768px+) — */
@media (min-width: 768px) {
  .nav-links { display: flex; }
  .nav-hamburger { display: none; }
  .contact-grid { grid-template-columns: 1fr 1fr; }
}

/* — Mobile only (< 768px) — */
@media (max-width: 767px) {
  .nav-links { display: none; }
  .nav-hamburger { display: block; }

  .hero { padding: 2.5rem 0 2.5rem; }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

  .article-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .article-date { margin-top: 2px; }

  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   14. ARTICLE COMPONENTS
   ============================================================ */

.article-subtitle {
  font-size: 16px;
  color: var(--ink-2);
  line-height: 1.7;
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
  transition: color var(--t-theme), border-color var(--t-theme);
}

.tweet-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--amber);
  border-radius: 4px;
  padding: 1.5rem 1.75rem;
  margin: 2.5rem 0;
  transition: background var(--t-theme), border-color var(--t-theme);
}

.tweet-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.75rem;
  transition: color var(--t-theme);
}

.tweet-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15.5px;
  color: var(--ink);
  line-height: 1.7;
  transition: color var(--t-theme);
}

.tweet-author {
  margin-top: 0.75rem;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  transition: color var(--t-theme);
}

.pull-quote {
  margin: 3rem 0;
  padding: 1.25rem 0;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--border);
  transition: border-color var(--t-theme);
}

.pull-quote p {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--ink);
  font-style: italic;
  margin: 0;
  transition: color var(--t-theme);
}

.proof-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem 1.75rem;
  margin: 2.5rem 0;
  transition: background var(--t-theme), border-color var(--t-theme);
}

.proof-block-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.6rem;
  transition: color var(--t-theme);
}

.proof-block p {
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.7;
  margin: 0;
  transition: color var(--t-theme);
}

.proof-block strong { color: var(--ink); font-weight: 500; }

.article-closing {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  transition: border-color var(--t-theme);
}

.article-closing p {
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.7;
}

.author-line {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

.author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--amber);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 500;
  flex-shrink: 0;
  transition: background var(--t-theme), color var(--t-theme);
}

.author-avatar img {
  width: inherit;
  height: inherit;
  border-radius: inherit;
  background-size: cover;
  background-repeat: no-repeat;
  border: 1px solid var(--border);
}

.author-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  transition: color var(--t-theme);
}

.author-desc {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
  transition: color var(--t-theme);
}

/* ── Tweet screenshot ── */
.tweet-screenshot {
  margin: 2.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: border-color var(--t-theme);
}

.tweet-screenshot img {
  width: 100%;
  display: block;
  border-radius: 7px;
}

/* ── Nav drawer theme toggle row ── */
.nav-drawer-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem var(--side);
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  color: var(--ink-2);
}
