/* ============================================================
   pierrecalvet.fr — v3, editorial direction
   Spectral (variable serif) · IBM Plex Mono · warm cream + terracotta
   ============================================================ */

:root {
  /* Warm editorial palette — aged-paper cream + terracotta accent */
  --paper:        #f4ede0;
  --paper-2:      #ebe1cf;
  --paper-3:      #e2d6bb;
  --ink:          #1a1612;
  --ink-2:        #3d3329;
  --muted:        #8a7f6a;
  --rule:         #d2c7ad;
  --rule-soft:    #e2d8c0;
  --accent:       #a8341e;   /* deep terracotta */
  --accent-2:     #c46d4f;   /* warm rust */
  --code-bg:      #ebe2cb;

  --max-narrow:  600px;
  --prose-max:   880px;
  --reading-max: 42em;

  --font-serif: "Spectral", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-mono:  "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;

  --t-base: cubic-bezier(.2, 0, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:     #181410;
    --paper-2:   #221d16;
    --paper-3:   #2a2419;
    --ink:       #ede5d2;
    --ink-2:     #c8baa0;
    --muted:     #8b8067;
    --rule:      #3a3024;
    --rule-soft: #2b241b;
    --accent:    #d8755b;
    --accent-2:  #c46d4f;
    --code-bg:   #221d16;
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 1.7;
  font-weight: 400;
  font-feature-settings: "kern", "liga", "onum";   /* old-style figures */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

/* ---------- Wraps ---------- */
.wrap {
  width: 100%;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 4rem);
}
.wrap.narrow { max-width: var(--max-narrow); }
main { padding-bottom: 6rem; min-height: 50vh; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--rule);
  padding: 1.5rem 0;
  margin-bottom: 4rem;
}

.header-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2.5rem;
  flex-wrap: wrap;
  padding: 0 clamp(1.25rem, 5vw, 4rem);
  margin: 0 auto;
}

.brand {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { color: var(--accent); }

.site-nav {
  display: flex;
  gap: 2rem;
  font-size: 0.95rem;
}
.site-nav a {
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: color .15s var(--t-base), border-color .15s var(--t-base);
}
.site-nav a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--ink);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.012em;
}
h1 {
  font-size: clamp(2.5rem, 5.5vw, 3.8rem);
  font-weight: 500;
  margin: 0 0 1rem;
  line-height: 1.05;
}
h2 {
  font-size: 1.7rem;
  margin: 3rem 0 1rem;
  font-weight: 500;
}
h3 {
  font-size: 1.25rem;
  margin: 2rem 0 0.65rem;
  font-weight: 600;
}
h4 {
  font-size: 1.1rem;
  margin: 1.75rem 0 0.5rem;
  font-weight: 600;
}

p { margin: 0 0 1.2rem; }
.lead {
  font-size: 1.2rem;
  color: var(--ink);
  line-height: 1.55;
  margin-bottom: 1.5rem;
  font-weight: 400;
}
.kicker {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 2rem;
  font-style: italic;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color .15s var(--t-base);
}
a:hover { text-decoration-color: var(--accent); }

strong { font-weight: 600; color: var(--ink); }
em { font-style: italic; }

blockquote {
  margin: 2rem 0;
  padding: 0.5rem 0 0.5rem 1.5rem;
  border-left: 2px solid var(--accent);
  color: var(--ink-2);
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1.6;
}

ul, ol { padding-left: 1.5rem; margin: 0 0 1.2rem; }
li { margin-bottom: 0.45rem; }

::selection { background: var(--accent); color: var(--paper); }

/* ---------- Code ---------- */
code, pre {
  font-family: var(--font-mono);
  font-size: 0.85em;
}
p code, li code {
  background: var(--code-bg);
  padding: 0.1em 0.4em;
  border-radius: 2px;
  font-size: 0.82em;
  color: var(--ink);
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--rule-soft);
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  line-height: 1.55;
  margin: 1.5rem 0;
  font-size: 0.84rem;
  border-radius: 2px;
}
pre code {
  background: none; padding: 0; border-radius: 0;
  font-size: inherit; color: var(--ink);
}

/* ---------- Eyebrows ---------- */
.page-eyebrow, .article-eyebrow {
  font-family: var(--font-serif);
  font-size: 0.78rem;
  font-weight: 500;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin: 0 0 1rem;
  display: block;
}
.article-eyebrow {
  color: var(--accent);
  font-style: italic;
  text-transform: none;
  letter-spacing: 0.05em;
  font-size: 0.92rem;
}
.article-eyebrow .cat-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.article-eyebrow .cat-link:hover {
  border-bottom-color: var(--accent);
}

/* ---------- HOME: lede ---------- */
.lede {
  margin: 1rem 0 2rem;
  max-width: var(--prose-max);
}
.lede h1 {
  font-size: clamp(2.6rem, 6.5vw, 4.2rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1;
  margin: 0 0 1.5rem;
}
.lede-bio {
  font-size: 1.15rem;
  color: var(--ink-2);
  line-height: 1.6;
  margin-bottom: 1rem;
}
.lede-bio:last-of-type { margin-bottom: 0; }

/* ---------- Portrait (press-style) ---------- */
.portrait {
  margin: 0;
  display: inline-block;
}
.portrait img {
  width: 280px;
  height: 350px;
  object-fit: cover;
  object-position: center 15%;
  border: 1px solid var(--rule);
  filter: contrast(1.02) saturate(0.92);
}
.portrait figcaption {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 0.5rem;
  text-align: left;
}

/* In-flow centered portrait (between sections) */
.portrait-inline {
  display: block;
  margin: 3rem auto;
  width: 280px;
}
.portrait-inline figcaption {
  text-align: center;
}

@media (max-width: 600px) {
  .portrait img { width: 100%; max-width: 240px; height: auto; aspect-ratio: 4/5; }
  .portrait-inline { width: 100%; max-width: 240px; }
}

/* ---------- HOME: ToC of articles ---------- */
.toc { margin: 4rem 0 2rem; }
.toc-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-top: 2px solid var(--ink);
  padding-top: 0.75rem;
  margin-bottom: 0.5rem;
}
.toc-head h2 {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin: 0;
  color: var(--ink);
}
.toc-head .more {
  font-size: 0.92rem;
  color: var(--accent);
  text-decoration: none;
  font-style: italic;
}
.toc-head .more:hover { text-decoration: underline; }

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc-row {
  display: grid;
  grid-template-columns: 70px 1fr 130px;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule-soft);
  align-items: baseline;
  margin: 0;
}
.toc-row:hover { background: rgba(168, 52, 30, 0.025); }
.toc-row:hover .toc-title { color: var(--accent); }

.toc-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  align-self: start;
  padding-top: 0.5rem;
}
.toc-main { min-width: 0; }
.toc-title {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.25;
  margin-bottom: 0.4rem;
  transition: color .2s var(--t-base);
}
.toc-excerpt {
  font-size: 0.97rem;
  color: var(--ink-2);
  line-height: 1.55;
  margin: 0;
  max-width: var(--reading-max);
}
.toc-meta {
  font-size: 0.83rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-align: right;
  align-self: start;
  padding-top: 0.5rem;
  font-variant-numeric: tabular-nums;
}
.toc-cat {
  color: var(--accent);
  font-style: italic;
}

@media (max-width: 780px) {
  .toc-row {
    grid-template-columns: 1fr;
    gap: 0.4rem;
    padding: 1.25rem 0;
  }
  .toc-num { padding: 0; }
  .toc-meta {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.6rem;
    text-align: left;
    padding: 0;
  }
  .toc-title { font-size: 1.25rem; }
}

/* ---------- BLOG INDEX ---------- */
.page-head { margin: 1rem 0 3.5rem; max-width: var(--prose-max); }

.year-section { margin-bottom: 3rem; }
.year-label {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.12em;
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.blog-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.blog-row {
  border-bottom: 1px solid var(--rule-soft);
  margin: 0;
}
.blog-row:last-child { border-bottom: 0; }
.blog-row-link {
  display: block;
  padding: 1.5rem 0;
  text-decoration: none;
  color: inherit;
  transition: background .15s var(--t-base);
}
.blog-row-link:hover .blog-title { color: var(--accent); }

.blog-title {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 0.5rem;
  transition: color .2s var(--t-base);
}
.blog-excerpt {
  font-size: 1rem;
  color: var(--ink-2);
  line-height: 1.55;
  margin: 0 0 0.6rem;
  max-width: var(--reading-max);
}
.blog-meta {
  font-size: 0.84rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-variant-numeric: tabular-nums;
}
.blog-meta .dot { color: var(--rule); }
.blog-cat { color: var(--accent); font-style: italic; }

/* ---------- ARTICLE PAGE ---------- */
.article {
  max-width: var(--prose-max);
  margin: 0 auto;
}
.article-head {
  margin-bottom: 3rem;
}
.article-head h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.2rem);
  margin: 0 0 1.25rem;
  letter-spacing: -0.022em;
  line-height: 1.08;
  font-weight: 500;
}
.article-byline {
  font-size: 0.95rem;
  color: var(--muted);
  font-style: italic;
  margin: 0;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.article-byline strong {
  font-weight: 500;
  color: var(--ink);
  font-style: normal;
}

/* Drop cap on first paragraph */
.prose .dropcap-target::first-letter {
  font-family: var(--font-serif);
  float: left;
  font-size: 4.5rem;
  font-weight: 500;
  line-height: 0.85;
  margin: 0.55rem 0.6rem -0.2rem -0.1rem;
  color: var(--accent);
}

.prose img { margin: 2rem auto; border: 1px solid var(--rule); }
.prose figure { margin: 2rem 0; }
.prose figcaption {
  text-align: center; font-size: 0.85rem;
  color: var(--muted); margin-top: 0.5rem;
  font-style: italic;
}
.prose .alignleft { float: left; margin: 0.5rem 1.75rem 1rem 0; max-width: 45%; }
.prose .alignright { float: right; margin: 0.5rem 0 1rem 1.75rem; max-width: 45%; }
.prose .aligncenter { margin-left: auto; margin-right: auto; }

@media (max-width: 600px) {
  .prose .alignleft, .prose .alignright {
    float: none; margin: 1rem auto; max-width: 100%;
  }
  .prose .dropcap-target::first-letter { font-size: 3.5rem; }
}

/* Article footer */
.article-foot {
  margin-top: 3.5rem;
  text-align: center;
}
.rule-ornament {
  width: 80px;
  height: 1px;
  border: 0;
  background: var(--rule);
  margin: 2rem auto 1.5rem;
  position: relative;
}
.rule-ornament::after {
  content: '§';
  position: absolute;
  top: -0.7rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--paper);
  padding: 0 0.5rem;
  color: var(--accent);
  font-size: 1rem;
  font-style: italic;
}
.article-sign {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--muted);
  margin: 0 0 1rem;
  font-size: 0.95rem;
}
.article-back-bio {
  font-size: 0.95rem;
  color: var(--ink-2);
  font-style: italic;
  max-width: 36rem;
  margin: 0 auto;
}

/* Article prev/next */
.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 3rem 0 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
.art-nav-cell-next { text-align: right; }
.art-prev, .art-next {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: color .15s var(--t-base);
}
.art-prev:hover, .art-next:hover {
  color: var(--accent);
  text-decoration: none;
}
.art-prev:hover .art-arrow-title,
.art-next:hover .art-arrow-title {
  color: var(--accent);
}
.art-arrow-label {
  display: block;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.art-arrow-title {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--ink);
  line-height: 1.3;
  font-weight: 500;
  transition: color .15s var(--t-base);
}

@media (max-width: 600px) {
  .article-nav { grid-template-columns: 1fr; gap: 1.5rem; }
  .art-nav-cell-next { text-align: left; }
}

/* ---------- À PROPOS ---------- */
.about-head {
  margin: 1rem 0 2rem;
  max-width: var(--prose-max);
}
.parcours { max-width: var(--prose-max); }

.parcours h2 {
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink);
  border-bottom: 2px solid var(--ink);
  padding-bottom: 0.5rem;
  margin: 3rem 0 1rem;
}

.cv-entry {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 2.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.cv-entry:last-of-type { border-bottom: 1px solid var(--rule); }
.cv-period {
  color: var(--accent);
  font-style: italic;
  font-size: 0.95rem;
  padding-top: 0.15rem;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}
.cv-body h3 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 600;
  font-family: var(--font-serif);
  color: var(--ink);
}
.cv-body p {
  margin: 0;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.6;
}

@media (max-width: 600px) {
  .cv-entry { grid-template-columns: 1fr; gap: 0.3rem; }
}

.formations { padding-left: 1.5rem; }
.formations li { margin-bottom: 0.6rem; }

.closing {
  margin-top: 3rem;
  font-size: 1.05rem;
  font-style: italic;
  color: var(--ink-2);
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

/* ---------- CONTACT FORM ---------- */
.contact-form {
  margin: 2rem 0;
}

/* Intent radio toggle */
.form-intent {
  border: 0;
  margin: 0 0 2rem;
  padding: 0;
}
.form-intent legend {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink);
  padding: 0;
  margin-bottom: 0.75rem;
}
.intent-option {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  margin-bottom: 0.6rem;
  cursor: pointer;
  transition: border-color .15s var(--t-base),
              background .15s var(--t-base);
}
.intent-option:last-child { margin-bottom: 0; }
.intent-option:hover {
  border-color: var(--accent-2);
}
.intent-option input[type="radio"] {
  margin: 0.4rem 0 0 0;
  accent-color: var(--accent);
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
}
.intent-option input[type="radio"]:checked ~ .intent-text strong {
  color: var(--accent);
}
.intent-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--paper);
  border-left-width: 3px;
}
.intent-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  line-height: 1.4;
}
.intent-text strong {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--ink);
  transition: color .15s var(--t-base);
}
.intent-text small {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
}
.form-row { margin-bottom: 1.5rem; }
.form-row label {
  display: block;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 0.45rem;
}
.form-row input,
.form-row textarea {
  display: block;
  width: 100%;
  padding: 0.75rem 0.9rem;
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 0;
  transition: border-color .15s var(--t-base), background .15s var(--t-base);
}
.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--paper);
}
.form-row textarea {
  resize: vertical;
  min-height: 160px;
  line-height: 1.55;
}

.btn-send {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 500;
  font-style: italic;
  padding: 0.85rem 2.5rem;
  background: var(--accent);
  color: var(--paper);
  border: 0;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background .15s var(--t-base);
}
.btn-send:hover { background: var(--ink); }

.hp-field {
  position: absolute; left: -10000px; top: auto;
  width: 1px; height: 1px; overflow: hidden;
}

.status-msg {
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  font-size: 1rem;
  font-style: italic;
  border-left: 3px solid;
}
.status-success {
  background: rgba(168, 52, 30, 0.06);
  border-color: var(--accent);
  color: var(--ink);
}
.status-error {
  background: rgba(196, 109, 79, 0.08);
  border-color: var(--accent-2);
  color: var(--ink);
}

/* ---------- FOOTER ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 6rem;
  padding: 2.5rem 0;
  font-size: 0.92rem;
  color: var(--muted);
}
.footer-line {
  margin: 0 0 0.5rem;
  font-style: italic;
}
.footer-mark {
  font-family: var(--font-mono);
  font-style: normal;
  font-weight: 500;
  color: var(--accent);
  margin-right: 0.5rem;
  letter-spacing: 0.05em;
}
.site-footer a {
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.site-footer a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.copyright {
  font-size: 0.85rem;
  margin: 0;
  color: var(--muted);
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  body { font-size: 17px; }
  .wrap { padding: 0 1.25rem; }
  .header-inner { gap: 0.75rem; padding: 0 1.25rem; }
  .site-header { padding: 1.1rem 0; margin-bottom: 2.5rem; }
  .brand { font-size: 1.1rem; }
  .site-nav { gap: 1.2rem; font-size: 0.92rem; }
}

/* ---------- Print ---------- */
@media print {
  body { background: white; color: black; }
  .site-header, .site-footer, .article-nav, .portrait { display: none; }
  a { color: black; text-decoration: underline; }
}
