/* ---------------------------------------------------------------
   Portfolio d'Aaron Lebrun
   Concept : une page de manuel (man) posée sous une façade de switch.
   --------------------------------------------------------------- */

@font-face {
  font-family: "Martian Mono";
  src: url("assets/fonts/martian-mono-latin-wdth-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-stretch: 75% 112.5%;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("assets/fonts/ibm-plex-mono-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("assets/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("assets/fonts/ibm-plex-mono-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #0f1210;
  --bg-2: #161a17;
  --ink: #dcd8c8;
  --ink-2: #9a9888;
  --rule: #2b302b;
  --accent: #ff7a1a;        /* orange câble de brassage */
  --accent-ink: #130b04;
  --led: #4be37a;           /* LED de lien */
  --amber: #ffb02e;         /* LED d'activité */
  --dot: rgba(220, 216, 200, .05);

  /* la façade reste du métal sombre dans les deux thèmes */
  --metal: #1b1e1c;
  --metal-hi: #2c302d;
  --metal-ink: #b9b7aa;

  --display: "Martian Mono", "Plex Mono", ui-monospace, monospace;
  --mono: "Plex Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;

  --gutter: clamp(1rem, 4vw, 3rem);
  --label: 13rem;
}

:root[data-theme="light"] {
  --bg: #efebdf;
  --bg-2: #e6e1d2;
  --ink: #191a16;
  --ink-2: #63624f;
  --rule: #c9c3b0;
  --accent: #c8450a;
  --accent-ink: #fff6ec;
  --led: #17863f;
  --amber: #a86400;
  --dot: rgba(25, 26, 22, .07);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 7.5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.5px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: clamp(.9rem, .84rem + .25vw, 1.02rem);
  line-height: 1.65;
  font-variant-ligatures: none;
}

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

a { color: inherit; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: .22em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: .5rem 1rem;
}
.skip:focus { left: 0; }

/* ----------------------------------------------------- LEDs */
.led {
  display: inline-block; width: 7px; height: 5px;
  background: #343a35; border-radius: 1px; vertical-align: middle;
}
.led--link { background: var(--led); box-shadow: 0 0 6px var(--led); }
.led--act { background: var(--amber); box-shadow: 0 0 6px var(--amber); animation: blink 1.3s steps(1) infinite; }

@keyframes blink {
  0%, 18% { opacity: 1; } 19%, 30% { opacity: .15; }
  31%, 55% { opacity: 1; } 56%, 62% { opacity: .15; }
  63%, 100% { opacity: 1; }
}

/* ----------------------------------------------------- Façade de switch */
.switch {
  position: sticky; top: 0; z-index: 20;
  background:
    linear-gradient(180deg, var(--metal-hi) 0, var(--metal) 14%, var(--metal) 86%, #0c0e0d 100%);
  border-bottom: 1px solid #000;
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .7);
  color: var(--metal-ink);
}
.switch__inner {
  max-width: 78rem; margin: 0 auto;
  padding: .55rem var(--gutter) .5rem;
  display: flex; align-items: center; gap: clamp(.75rem, 3vw, 2.5rem);
}
.switch__id {
  display: grid; gap: .3rem; flex: none;
  font-family: var(--display); font-stretch: 75%;
  font-size: .62rem; letter-spacing: .08em; line-height: 1;
}
.switch__model { font-weight: 700; font-size: .8rem; color: #e9e6d8; }
.switch__sys { display: flex; align-items: center; gap: .35em; color: #86867a; }
.switch__sys .led { --led: #4be37a; --amber: #ffb02e; }
.switch__sys .led + * { margin-left: .5em; }

.ports {
  flex: 1; display: flex; justify-content: center;
  gap: clamp(.15rem, 1.4vw, 1rem);
}
.port {
  --led: #4be37a; --amber: #ffb02e; --accent: #ff7a1a;
  display: grid; justify-items: center; gap: 3px;
  padding: .15rem .2rem; min-width: 2.4rem;
  text-decoration: none; color: #86867a;
  font-family: var(--display); font-stretch: 75%;
  font-size: .58rem; letter-spacing: .06em; text-transform: uppercase; line-height: 1;
}
.port__leds { display: flex; gap: 12px; }
.port__jack {
  position: relative; width: 34px; height: 25px;
  background: linear-gradient(180deg, #3b403c, #252926);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px #0a0b0a;
}
/* l'ouverture RJ45 */
.port__jack::before {
  content: ""; position: absolute; inset: 3px;
  background: #050605;
  clip-path: polygon(0 0, 100% 0, 100% 68%, 74% 68%, 74% 100%, 26% 100%, 26% 68%, 0 68%);
  transition: background .18s;
}
/* les huit contacts dorés */
.port__jack::after {
  content: ""; position: absolute; left: 7px; right: 7px; top: 3px; height: 6px;
  background: repeating-linear-gradient(90deg, #b99a4a 0 1px, transparent 1px 2.6px);
  opacity: .75; transition: opacity .18s;
}
.port__n { display: none; }
.port__label { transition: color .18s; }

.port:hover, .port.is-on { color: #f1eee0; }
.port:hover .port__jack::before { background: #3a2412; }
/* port branché = section courante */
.port.is-on .port__jack::before { background: var(--accent); }
.port.is-on .port__jack::after { opacity: 0; }
.port.is-on .led:first-child { background: var(--led); box-shadow: 0 0 6px var(--led); }
.port.is-on .led:last-child { background: var(--amber); box-shadow: 0 0 6px var(--amber); animation: blink 1.1s steps(1) infinite; }
.port:focus-visible { outline-offset: 1px; }

.mode {
  flex: none; display: grid; justify-items: center; gap: 4px;
  background: none; border: 0; padding: .2rem; cursor: pointer;
  color: #86867a; font-family: var(--display); font-stretch: 75%;
  font-size: .58rem; letter-spacing: .08em; line-height: 1;
}
.mode__key {
  width: 30px; height: 16px; border-radius: 2px;
  background: #0a0b0a; box-shadow: inset 0 0 0 1px #3b403c; position: relative;
}
.mode__key::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 10px; height: 10px;
  background: #b9b7aa; border-radius: 1px; transition: transform .2s;
}
:root[data-theme="light"] .mode__key::after { transform: translateX(14px); background: #ff7a1a; }
.mode:hover { color: #f1eee0; }

/* ----------------------------------------------------- Page */
.page {
  max-width: 78rem; margin: 0 auto;
  padding: 0 var(--gutter) 4rem;
}

.manline {
  display: flex; justify-content: space-between; gap: 1rem;
  margin: 0; padding: 1.4rem 0 0;
  color: var(--ink-2); font-size: .8rem; letter-spacing: .02em;
}
.manline--foot {
  max-width: 78rem; margin: 0 auto;
  padding: 1.5rem var(--gutter) 2.5rem;
  border-top: 1px solid var(--rule);
}

/* une section = intitulé man dans la marge + corps indenté */
.sec {
  display: grid; grid-template-columns: var(--label) minmax(0, 1fr);
  column-gap: 2rem;
  padding: clamp(2.5rem, 6vw, 4.5rem) 0;
  border-top: 1px solid var(--rule);
}
.sec--hero { border-top: 0; padding-top: clamp(1.5rem, 4vw, 3rem); }

.sec__h {
  margin: 0; align-self: start;
  position: sticky; top: 7.5rem;
  font-family: var(--display); font-stretch: 75%;
  font-size: .82rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
}
.sec__h::before {
  counter-increment: sec; content: counter(sec, decimal-leading-zero);
  display: block; color: var(--ink-2); font-weight: 400; margin-bottom: .3rem;
}
.page { counter-reset: sec; }

.sec__b { min-width: 0; max-width: 62rem; }
.sec__b > :first-child { margin-top: 0; }

h3 {
  font-family: var(--display); font-stretch: 87%;
  font-size: 1.15rem; font-weight: 700; line-height: 1.25; margin: 0 0 .5rem;
}
p { margin: 0 0 1rem; }
.prose { max-width: 44rem; }
.lead { font-size: 1.15em; line-height: 1.55; }
.note { color: var(--ink-2); font-size: .88em; }
code { font-family: inherit; }

/* ----------------------------------------------------- Hero */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(13rem, 17rem);
  gap: clamp(1.5rem, 4vw, 3.5rem); align-items: end;
  max-width: none;
}
.hero__name {
  margin: 0 0 1.4rem;
  font-family: var(--display); font-stretch: 75%; font-weight: 800;
  font-size: clamp(3.2rem, 11.5vw, 9.5rem);
  line-height: .86; letter-spacing: -.045em; text-transform: uppercase;
}
.hero__name span { display: block; }
.hero__name span:last-child { color: transparent; -webkit-text-stroke: 2px var(--ink); }
.hero__what { max-width: 34rem; font-size: 1.15em; line-height: 1.5; margin-bottom: 1.6rem; }
.hero__what strong { font-weight: 700; box-shadow: inset 0 -.5em 0 color-mix(in srgb, var(--accent) 32%, transparent); }
.hero__cta { display: flex; flex-wrap: wrap; gap: .75rem; margin: 0; }

.btn {
  display: inline-block; padding: .7rem 1.1rem;
  border: 1.5px solid var(--ink); text-decoration: none;
  font-weight: 500; line-height: 1.2;
  transition: background .15s, color .15s, transform .15s;
}
.btn::before { content: "→ "; }
.btn:hover { background: var(--ink); color: var(--bg); transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--accent); }
.btn--solid { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--solid:hover { background: var(--accent); color: var(--accent-ink); box-shadow: 4px 4px 0 var(--ink); }

.idcard { margin: 0; border: 1px solid var(--rule); background: var(--bg-2); }
.idcard__photo { position: relative; aspect-ratio: 3 / 4; overflow: hidden; border-bottom: 1px solid var(--rule); }
.idcard__photo img { width: 100%; height: 100%; object-fit: cover; display: block; filter: grayscale(1) contrast(1.05); }
.idcard__empty {
  position: absolute; inset: 0; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
  color: var(--ink-2); font-size: .8rem;
  background: repeating-linear-gradient(135deg, transparent 0 9px, var(--dot) 9px 10px);
}
.idcard__photo.is-empty img { display: none; }
.idcard__photo.is-empty .idcard__empty { display: flex; }

.kv { margin: 0; padding: .8rem .9rem; font-size: .82rem; line-height: 1.5; }
.kv div { display: grid; grid-template-columns: 4.6rem 1fr; gap: .5rem; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }

/* ----------------------------------------------------- Synopsis */
pre { margin: 0; font-family: inherit; white-space: pre-wrap; }
.synopsis {
  padding: 1.2rem 1.3rem; background: var(--bg-2);
  border-left: 3px solid var(--accent);
  font-size: 1.02em; line-height: 1.8; overflow-x: auto;
}
.synopsis b { font-weight: 700; }
.synopsis i, .opts dt i { font-style: normal; color: var(--accent); }
.synopsis u { text-decoration: underline; text-decoration-color: var(--ink-2); text-decoration-thickness: 1px; text-underline-offset: .25em; }

.opts dl { margin: 2rem 0 0; display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: .9rem 1.5rem; max-width: 48rem; }
.opts dt { font-weight: 500; }
.opts dd { margin: 0; }
.trace { margin-top: .8rem; color: var(--ink-2); font-size: .88em; line-height: 1.6; white-space: pre; overflow-x: auto; }
.trace .ok { color: var(--ink); }

/* ----------------------------------------------------- Tags */
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 1.5rem 0 0; }
.tags li { border: 1px solid var(--rule); padding: .15rem .6rem; font-size: .88em; }
.tags li::before { content: "#"; color: var(--accent); }

/* ----------------------------------------------------- Projets (fichiers) */
.file { border: 1px solid var(--rule); background: var(--bg-2); margin-bottom: 1.5rem; transition: border-color .2s; }
.file:hover { border-color: var(--ink-2); }
.file__bar {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .25rem 1rem;
  padding: .5rem 1rem; border-bottom: 1px solid var(--rule);
  font-size: .8rem; color: var(--ink-2);
}
.file__path b { color: var(--ink); font-weight: 500; }
.file__body { padding: 1.3rem 1rem 1.2rem; }
.file__body > p { max-width: 44rem; }
.file__body > :last-child { margin-bottom: 0; }
.file--empty { background: transparent; border-style: dashed; }

.spec { margin: 1.2rem 0 0; border-top: 1px solid var(--rule); }
.spec div { display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--rule); }
.spec div:last-child { border-bottom: 0; padding-bottom: 0; }
.spec--flush { margin-top: 0; border-top: 0; }
.spec--flush div:first-child { padding-top: 0; }
.spec dt { color: var(--ink-2); }
.spec dd { margin: 0; overflow-wrap: anywhere; }

/* ----------------------------------------------------- Figures et schéma réseau */
.fig { margin: 1.6rem 0 0; }
.fig img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); }
.fig figcaption { margin-top: .6rem; color: var(--ink-2); font-size: .86em; max-width: 46rem; }
.fig__scroll { overflow-x: auto; border: 1px solid var(--rule); background: var(--bg); padding: .8rem; }
.net { display: block; width: 100%; min-width: 40rem; height: auto; }
.net text { font-family: var(--mono); font-size: 12px; fill: var(--ink); }
.net .net__sm { font-size: 10.5px; fill: var(--ink-2); }
.net .net__acc { font-size: 11px; font-weight: 700; fill: var(--accent); }
.net__box { fill: var(--bg-2); stroke: var(--ink); stroke-width: 1.2; }
.net__frame { fill: none; stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 4 4; }
.net__line { fill: none; stroke: var(--ink); stroke-width: 1.3; }
.net__line--vpn { stroke-dasharray: 7 4; }
.net__tunnel { fill: none; stroke: var(--accent); stroke-width: 4; }

/* ----------------------------------------------------- À compléter */
.todo {
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--amber) 16%, transparent) 0 6px, transparent 6px 12px);
  outline: 1px dashed var(--amber); outline-offset: 1px;
  padding: 0 .35em; font-size: .9em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.todo::before { content: "à compléter · "; color: var(--amber); font-weight: 700; }

/* ----------------------------------------------------- Compétences */
.tablewrap { overflow-x: auto; }
.ifaces { width: 100%; border-collapse: collapse; margin: 1rem 0; min-width: 30rem; }
.ifaces caption { text-align: left; color: var(--ink-2); padding-bottom: .6rem; font-size: .88em; }
.ifaces th, .ifaces td { text-align: left; padding: .45rem 1rem .45rem 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.ifaces thead th { color: var(--ink-2); font-weight: 400; font-size: .8em; text-transform: uppercase; letter-spacing: .08em; border-bottom-color: var(--ink-2); }
.ifaces .grp th {
  padding-top: 1.6rem; border-bottom: 0;
  font-family: var(--display); font-stretch: 75%; font-size: .75rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--accent);
}
.ifaces td:last-child { color: var(--ink-2); padding-right: 0; }
.ifaces tbody tr:not(.grp):hover td { background: var(--bg-2); }

.st { white-space: nowrap; font-weight: 500; }
.st::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: .5em; vertical-align: .05em; }
.st--up::before { background: var(--led); }
.st--lrn::before { box-shadow: inset 0 0 0 1.5px var(--amber); }
.st--beg::before { background: linear-gradient(90deg, var(--led) 50%, transparent 50%); box-shadow: inset 0 0 0 1.5px var(--led); }

/* ----------------------------------------------------- Parcours (journal) */
.log { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.log li { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 1.5rem; padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.log li:first-child { padding-top: 0; }
.log time { color: var(--ink-2); white-space: nowrap; }
.log h3 { font-size: 1.02rem; margin-bottom: .25rem; }
.log p { margin: 0; }
.now {
  font-family: var(--mono); font-size: .7rem; font-weight: 500; letter-spacing: .04em;
  color: var(--led); border: 1px solid currentColor; padding: .05rem .4rem; margin-left: .4rem; vertical-align: .15em;
  white-space: nowrap;
}

/* ----------------------------------------------------- Contact */
.contact__big {
  font-family: var(--display); font-stretch: 75%; font-weight: 800;
  font-size: clamp(1.7rem, 5vw, 3.6rem); line-height: 1.05; letter-spacing: -.03em;
  margin-bottom: 2.2rem;
}
.contact__big a { color: var(--accent); overflow-wrap: anywhere; }
.contact__big .todo { font-family: var(--mono); font-size: 1rem; font-weight: 400; letter-spacing: 0; color: var(--ink); vertical-align: middle; }
.todo-link { text-decoration: none; pointer-events: none; }

.links { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); max-width: 44rem; }
.links li { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--rule); }
.links__k { color: var(--ink-2); }
.links a { overflow-wrap: anywhere; }

/* ----------------------------------------------------- Entrée en scène */
@media (prefers-reduced-motion: no-preference) {
  .hero__name span, .hero__what, .hero__cta, .idcard, .manline:not(.manline--foot) {
    animation: rise .7s cubic-bezier(.2, .7, .2, 1) both;
  }
  .manline:not(.manline--foot) { animation-delay: 0s; }
  .hero__name span:first-child { animation-delay: .08s; }
  .hero__name span:last-child { animation-delay: .18s; }
  .hero__what { animation-delay: .3s; }
  .hero__cta { animation-delay: .4s; }
  .idcard { animation-delay: .5s; }

  /* les ports s'allument un à un, comme un switch qui démarre */
  .port { animation: boot .4s steps(2) both; }
  .port:nth-child(1) { animation-delay: .10s; } .port:nth-child(2) { animation-delay: .17s; }
  .port:nth-child(3) { animation-delay: .24s; } .port:nth-child(4) { animation-delay: .31s; }
  .port:nth-child(5) { animation-delay: .38s; } .port:nth-child(6) { animation-delay: .45s; }
  .port:nth-child(7) { animation-delay: .52s; } .port:nth-child(8) { animation-delay: .59s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes boot { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .led--act, .port.is-on .led:last-child { animation: none; }
  * { transition: none !important; }
}

/* ----------------------------------------------------- Écrans moyens et petits */
@media (max-width: 62rem) {
  .sec { grid-template-columns: 1fr; row-gap: 1.2rem; }
  .sec__h { position: static; display: flex; gap: .7rem; align-items: baseline; }
  .sec__h::before { display: inline; margin: 0; }
  html { scroll-padding-top: 5.5rem; }
}

@media (max-width: 46rem) {
  .switch__id { display: none; }
  .switch__inner { gap: .4rem; padding-left: .5rem; padding-right: .5rem; }
  .ports { justify-content: space-between; gap: 0; }
  .port { min-width: 0; padding: .1rem; }
  .port__jack { width: 28px; height: 21px; }
  .port__jack::after { left: 6px; right: 6px; height: 5px; }
  .port__leds { gap: 8px; }
  .port__label { display: none; }
  .port__n { display: block; font-size: .62rem; }
  .mode__txt { display: none; }
  .mode__key { width: 26px; }
  :root[data-theme="light"] .mode__key::after { transform: translateX(10px); }

  .manline span:nth-child(2) { display: none; }
  .hero { grid-template-columns: 1fr; align-items: start; }
  .hero__name span:last-child { -webkit-text-stroke-width: 1.5px; }
  .idcard { display: grid; grid-template-columns: 7.5rem 1fr; align-items: stretch; }
  .idcard__photo { border-bottom: 0; border-right: 1px solid var(--rule); aspect-ratio: auto; min-height: 9rem; }
  .kv { align-self: center; }
  .kv div { grid-template-columns: 1fr; gap: 0; margin-bottom: .3rem; }
  .kv div:last-child { margin-bottom: 0; }

  .opts dl, .spec div, .log li, .links li { grid-template-columns: 1fr; gap: .15rem; }
  .opts dt { margin-top: .6rem; }
  .synopsis { font-size: .86em; padding: 1rem; }
  .btn { flex: 1 1 auto; text-align: center; }
  .ifaces { min-width: 0; font-size: .92em; }
  .ifaces th, .ifaces td { padding-right: .6rem; }
}

@media print {
  .switch, .hero__cta { display: none; }
  body { background: #fff; color: #000; }
  .sec { break-inside: avoid; }
}
