/* =========================================================
   Cyriac Intesse · DA éditoriale suisse
   Grille à filets, angles droits, typo étroite et grasse.
   ========================================================= */
:root {
  --bg: #fafaf8;
  --bg-alt: #f1f0eb;
  --ink: #111110;
  --text: #1c1c1a;
  --muted: #6b6a66;
  --faint: #8f8e88;
  --rule: #111110;          /* filets structurants */
  --hair: #dcdbd5;          /* filets secondaires */
  --ok: #1f8a4c;
  --wip: #b45a00;
  --font: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --pad: clamp(18px, 2.2vw, 28px);
  color-scheme: light;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; border-radius: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.6; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
p { margin: 0; }
ul, ol, dl, dd, figure { margin: 0; padding: 0; list-style: none; }
a { color: var(--ink); text-decoration: none; }
strong { font-weight: 600; color: var(--ink); }
img { max-width: 100%; display: block; }
::selection { background: var(--ink); color: var(--bg); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 40px); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 14px; z-index: 100; }
.skip:focus { left: 8px; }

/* ===== Typo utilitaires ===== */
.meta { font-family: var(--mono); font-size: 12.5px; color: var(--muted); letter-spacing: 0; display: flex; align-items: center; gap: 8px; }
.num { font-family: var(--mono); font-size: 12px; color: var(--faint); font-weight: 400; }
.muted { color: var(--muted); }
.display {
  font-family: var(--font); font-stretch: 68%; font-weight: 800; text-transform: uppercase;
  font-size: clamp(3.4rem, 10.5vw, 9.6rem); line-height: .86; letter-spacing: -.015em;
}
.display--md { font-size: clamp(2.4rem, 6vw, 5.2rem); line-height: .9; }
.lead { font-size: clamp(1.05rem, 1.4vw, 1.2rem); line-height: 1.55; color: var(--text); max-width: 34em; }
.lead--muted { color: var(--muted); }
.link { font-size: 14.5px; border-bottom: 1px solid var(--hair); transition: border-color .2s; }
.link:hover { border-color: var(--ink); }

/* ===== Boutons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 28px;
  height: 50px; padding: 0 18px; background: var(--ink); color: var(--bg); border: 1px solid var(--ink);
  font: 600 15px var(--font); cursor: pointer; transition: background .25s, color .25s;
}
.btn span { transition: transform .25s; }
.btn:hover { background: var(--bg); color: var(--ink); }
.btn:hover span { transform: translateX(4px); }
.btn--line { background: transparent; color: var(--ink); }
.btn--line:hover { background: var(--ink); color: var(--bg); }

/* ===== Nav ===== */
.nav { position: sticky; top: 0; z-index: 50; background: rgb(250 250 248 / .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }
.nav__brand { font-weight: 800; font-stretch: 75%; text-transform: uppercase; font-size: 19px; letter-spacing: .01em; }
.nav__links { display: flex; height: 56px; }
.nav__links a { display: flex; align-items: center; gap: 8px; height: 100%; padding: 0 18px; font-size: 14.5px; font-weight: 500; border-left: 1px solid var(--hair); transition: background .2s, color .2s; }
.nav__links a:hover, .nav__links a.is-active { background: var(--ink); color: var(--bg); }
.nav__links a:hover .num, .nav__links a.is-active .num { color: var(--faint); }
@media (max-width: 760px) {
  .nav__links li:not(:last-child) { display: none; }
  .nav__links a { padding: 0 14px; }
}

/* ===== Grille éditoriale (filets = fond noir visible entre les cellules) ===== */
.hero { padding-top: 20px; padding-bottom: 96px; }
.grid {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1px; background: var(--rule); border: 1px solid var(--rule);
}
.cell { background: var(--bg); padding: var(--pad); position: relative; min-width: 0; }

.cell--title { grid-column: span 8; display: flex; flex-direction: column; justify-content: space-between; gap: 22px; }
.cell--title .display { font-size: clamp(2.5rem, 5vw, 4.6rem); line-height: .88; }
.line { display: block; overflow: hidden; padding: .14em 0 .04em; margin-top: -.14em; }
.line > span { display: inline-block; }
.js .line > span { transform: translateY(120%); animation: rise .9s cubic-bezier(.2,.75,.15,1) forwards; }
.js .line:nth-child(2) > span { animation-delay: .08s; }
@keyframes rise { to { transform: none; } }

.cell--intro { grid-column: span 4; display: flex; flex-direction: column; gap: 14px; }
.cell--intro .lead { font-size: 1.02rem; }
.cell--intro .cta { margin-top: auto; padding-top: 8px; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }

.cell--fact { grid-column: span 3; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; min-height: 124px; }
.fact { font-size: clamp(1.25rem, 1.9vw, 1.6rem); font-weight: 700; line-height: 1.15; color: var(--ink); letter-spacing: -.02em; }
.fact--num { font-stretch: 68%; font-weight: 800; font-size: clamp(2.6rem, 4vw, 3.6rem); line-height: .9; text-transform: uppercase; }
.dot { width: 8px; height: 8px; background: var(--ok); display: inline-block; animation: blink 2s steps(1) infinite; }
@keyframes blink { 50% { opacity: .25; } }

.cell--shot { grid-column: span 6; padding: 0; display: flex; flex-direction: column; }
.shot { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg-alt); border-bottom: 1px solid var(--rule); }
.shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; filter: grayscale(1) contrast(1.02); transition: filter .5s ease, transform .9s cubic-bezier(.2,.7,.2,1); }
.cell--shot:hover .shot img { filter: none; transform: scale(1.025); }
.shot__cap { display: flex; align-items: baseline; gap: 12px; padding: 16px var(--pad); font-weight: 700; font-size: 17px; color: var(--ink); transition: background .25s, color .25s; }
.shot__cap .muted { font-weight: 400; font-size: 14.5px; }
.shot__cap .arrow { margin-left: auto; transition: transform .25s; }
.cell--shot:hover .shot__cap { background: var(--ink); color: var(--bg); }
.cell--shot:hover .shot__cap .muted, .cell--shot:hover .shot__cap .num { color: var(--faint); }
.cell--shot:hover .arrow { transform: translateX(4px); }

.cell--stack { grid-column: span 8; display: flex; flex-direction: column; justify-content: space-between; gap: 20px; }
.stack { font-size: clamp(1.15rem, 1.8vw, 1.5rem); font-weight: 600; line-height: 1.4; color: var(--ink); letter-spacing: -.01em; }
.cell--now { grid-column: span 4; background: var(--ink); display: flex; flex-direction: column; justify-content: space-between; gap: 20px; }
.cell--now .meta { color: var(--faint); }
.now { color: var(--bg); font-size: clamp(1.25rem, 1.9vw, 1.6rem); font-weight: 600; line-height: 1.2; letter-spacing: -.015em; }

.cell--git { grid-column: span 8; }
.cell--contact { grid-column: span 4; display: flex; flex-direction: column; gap: 14px; }
.copy {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; margin-top: auto;
  padding: 14px; border: 1px solid var(--rule); background: transparent;
  font: 600 15px var(--font); color: var(--ink); cursor: pointer; text-align: left; transition: background .2s, color .2s;
}
.copy:hover { background: var(--ink); color: var(--bg); }
.copy__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.copy__hint { flex-shrink: 0; font-family: var(--mono); font-size: 12px; font-weight: 400; }
.copy.is-done .copy__hint { color: var(--ok); }
.cell--contact .link { align-self: flex-start; }

/* GitLab */
.git__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; }
.git__stats { display: flex; flex-wrap: wrap; gap: 8px 48px; margin: 18px 0 22px; }
.git__stats dt { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.git__stats dd { font-stretch: 68%; font-weight: 800; font-size: 2.6rem; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; text-transform: uppercase; }
.gitlab__scroll { overflow-x: auto; scrollbar-width: thin; }
.gitlab__graph { display: grid; grid-auto-flow: column; grid-template-rows: auto repeat(7, auto); grid-auto-columns: minmax(0, 1fr); gap: 2px; min-width: 520px; }
.gitlab__month { grid-row: 1; font-family: var(--mono); font-size: 10.5px; color: var(--faint); white-space: nowrap; line-height: 1; padding-bottom: 6px; }
.gitlab__cell { aspect-ratio: 1; background: var(--bg-alt); opacity: 0; transition: opacity .35s ease; }
.gitlab.is-in .gitlab__cell { opacity: 1; }
.gitlab__cell:hover { outline: 1.5px solid var(--ink); }
.gitlab__cell[data-l="1"] { background: #c9c8c1; }
.gitlab__cell[data-l="2"] { background: #8f8e88; }
.gitlab__cell[data-l="3"] { background: #4a4945; }
.gitlab__cell[data-l="4"] { background: var(--ink); }

@media (max-width: 1000px) {
  .cell--title, .cell--intro { grid-column: span 12; }
  .cell--fact { grid-column: span 6; }
  .cell--stack, .cell--now, .cell--git, .cell--contact { grid-column: span 12; }
}
@media (max-width: 640px) {
  .cell--shot { grid-column: span 12; }
  .cell--fact { min-height: 120px; }
}

/* ===== Sections : colonne repère à gauche, contenu à droite ===== */
.section { border-top: 1px solid var(--rule); padding: 0 0 112px; }
.section__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; }
.section__side { grid-column: span 3; padding-top: 28px; }
.section__side .meta { position: sticky; top: 84px; font-size: 13px; color: var(--ink); }
.section__main { grid-column: span 9; padding-top: 24px; }
.section__main > .display { margin-bottom: 28px; }
.section__main > .lead { margin-bottom: 48px; }
.sub { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin: 72px 0 0; padding-bottom: 12px; }
@media (max-width: 860px) {
  .section__side, .section__main { grid-column: span 12; }
  .section__side .meta { position: static; }
}

/* ===== Lignes de projets ===== */
.rows { border-top: 1px solid var(--rule); }
.row {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) 140px 200px; gap: 8px 24px; align-items: baseline;
  padding: 28px 0; border-bottom: 1px solid var(--rule); position: relative; transition: background .25s, padding .3s;
}
.row__num { font-family: var(--mono); font-size: 13px; color: var(--faint); }
.row h3 { font-stretch: 72%; font-weight: 800; text-transform: uppercase; font-size: clamp(1.8rem, 3.6vw, 3rem); line-height: .95; letter-spacing: -.01em; }
.row__desc { margin-top: 12px; color: var(--muted); font-size: 15.5px; max-width: 46em; }
.row__stack { margin-top: 12px; font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.row__thumb { display: none; }
.row__kind { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.row__kind--wip { color: var(--wip); }
.row__link { font-size: 14.5px; font-weight: 600; justify-self: end; text-align: right; border-bottom: 1px solid transparent; transition: border-color .2s; word-break: break-all; }
.row__link:hover { border-color: currentColor; }
@media (hover: hover) and (min-width: 861px) {
  .rows[data-preview] .row:hover { background: var(--ink); padding-left: 16px; padding-right: 16px; }
  .rows[data-preview] .row:hover h3, .rows[data-preview] .row:hover .row__link, .rows[data-preview] .row:hover .row__stack { color: var(--bg); }
  .rows[data-preview] .row:hover .row__desc, .rows[data-preview] .row:hover .row__kind { color: #b9b8b2; }
}
.rows--sm .row h3 { font-size: clamp(1.4rem, 2.4vw, 2rem); }
@media (max-width: 860px) {
  .row { grid-template-columns: 40px minmax(0, 1fr); }
  .row__kind { grid-column: 2; }
  .row__link { grid-column: 2; justify-self: start; text-align: left; border-bottom-color: var(--hair); }
  .row__thumb { display: block; margin-top: 18px; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border: 1px solid var(--rule); }
}

/* aperçu qui suit la souris (desktop) */
.preview {
  position: fixed; left: 0; top: 0; z-index: 40; width: 360px; aspect-ratio: 16 / 10; pointer-events: none;
  border: 1px solid var(--rule); background: var(--bg-alt); overflow: hidden;
  opacity: 0; transform: translate3d(-999px, -999px, 0); transition: opacity .2s ease;
}
.preview img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.preview.is-on { opacity: 1; }

/* ===== Tableaux (compétences, parcours) ===== */
.table { border-top: 1px solid var(--rule); }
.table__row { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 8px 24px; padding: 20px 0; border-bottom: 1px solid var(--hair); }
.table__row:last-child { border-bottom-color: var(--rule); }
.table__row dt { font-weight: 700; color: var(--ink); }
.table__row dd { color: var(--muted); }
.table__row dd strong { color: var(--ink); font-weight: 600; }
.when { font-family: var(--mono); font-size: 13px; color: var(--muted); padding-top: 3px; }
.table__row h4 { font-size: 1.12rem; font-weight: 700; letter-spacing: -.015em; }
.where { font-size: 14.5px; color: var(--text); margin-top: 2px; }
.table__row div > p:not(.where) { color: var(--muted); font-size: 15.5px; margin-top: 8px; }
@media (max-width: 640px) { .table__row { grid-template-columns: 1fr; } }

.story { display: grid; gap: 18px; font-size: clamp(1.1rem, 1.6vw, 1.32rem); line-height: 1.55; color: var(--text); max-width: 40em; }
.story p:first-child::first-line { font-weight: 600; }

/* ===== Contact ===== */
.section--contact .lead { margin-top: 4px; }
.mega {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  margin: 36px 0 0; padding: 18px 0 22px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  font-stretch: 66%; font-weight: 800; text-transform: uppercase; font-size: clamp(3.2rem, 11vw, 9rem); line-height: .85; color: var(--ink);
  transition: background .3s, color .3s, padding .3s;
}
.mega span { font-stretch: 100%; font-weight: 300; transition: transform .3s; }
.mega:hover { background: var(--ink); color: var(--bg); padding-left: 20px; padding-right: 20px; }
.mega:hover span { transform: translateX(8px); }
.contact__cells { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--rule); }
.contact__cells li { display: flex; flex-direction: column; gap: 6px; padding: 18px 16px 20px 0; }
.contact__cells li + li { padding-left: 16px; border-left: 1px solid var(--hair); }
.contact__cells a { font-weight: 600; font-size: 15px; word-break: break-all; }
.contact__cells a:hover { text-decoration: underline; text-underline-offset: 4px; }
@media (max-width: 860px) {
  .contact__cells { grid-template-columns: 1fr 1fr; }
  .contact__cells li:nth-child(3) { padding-left: 0; border-left: 0; }
  .contact__cells li:nth-child(n+3) { border-top: 1px solid var(--hair); }
}

/* ===== Footer ===== */
.footer { border-top: 1px solid var(--rule); padding: 22px 0; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.footer a:hover { color: var(--ink); }

/* ===== Apparition au scroll (seulement si JS) ===== */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal, .gitlab__cell, .js .line > span { opacity: 1; transform: none; }
  .preview { display: none; }
}
