/* ==========================================================================
   Contact : terminal zsh interactif (le message saisi alimente un mailto:)
   ========================================================================== */

.terminal {
  --term-bg: #fff;
  --term-titlebar: #f3f3f6;
  --term-fg: #1d1d1f;
  --term-muted: #7a7a85;
  --term-line: #0000001c;
  --term-hover: #0000000b;
  --term-green: #1c8f3a;
  --term-yellow: #a86f00;
  --term-red: var(--color-rts-red);
  --term-shadow: #0003;

  overflow: hidden;
  border: 1px solid var(--term-line);
  border-radius: 20px;
  background: var(--term-bg);
  color: var(--term-fg);
  box-shadow: 0 30px 60px -30px var(--term-shadow);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .terminal {
    --term-bg: #0e0e11;
    --term-titlebar: #1b1b20;
    --term-fg: #e8e8ec;
    --term-muted: #8e8e96;
    --term-line: #ffffff1a;
    --term-hover: #ffffff12;
    --term-green: #28c840;
    --term-yellow: #febc2e;
    --term-shadow: #0008;
  }
}

:root[data-theme="dark"] .terminal {
  --term-bg: #0e0e11;
  --term-titlebar: #1b1b20;
  --term-fg: #e8e8ec;
  --term-muted: #8e8e96;
  --term-line: #ffffff1a;
  --term-hover: #ffffff12;
  --term-green: #28c840;
  --term-yellow: #febc2e;
  --term-shadow: #0008;
}

.terminal-titlebar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--term-line);
  background: var(--term-titlebar);
}

.terminal-title {
  flex: 1;
  margin-right: 40px;
  color: var(--term-muted);
  font: 500 11px var(--font-mono);
  text-align: center;
}

.terminal-body {
  padding: 18px 10px 20px;
  font: 500 14px/1.6 var(--font-mono);
}

/* ---- Lignes de commande (liens, bouton copier, historique, saisie) ---- */
.terminal-line {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 6px 10px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  transition: background 0.2s;
}

button.terminal-line {
  width: 100%;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

a.terminal-line:hover,
a.terminal-line:focus-visible,
button.terminal-line:hover,
button.terminal-line:focus-visible {
  background: var(--term-hover);
  outline: 0;
}

.prompt {
  flex: none;
  color: var(--term-green);
}

.command {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--term-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.command b {
  color: var(--term-fg);
  font-weight: 500;
}

/* Libellé d'action affiché au survol (« Email ↗ », « Copier ⧉ »…) */
.terminal-line em {
  flex: none;
  color: var(--term-muted);
  font: 500 11px var(--font-mono);
  font-style: normal;
  opacity: 0;
  transition: opacity 0.2s;
}

a.terminal-line:hover em,
a.terminal-line:focus-visible em,
button.terminal-line:hover em,
button.terminal-line:focus-visible em {
  color: var(--term-fg);
  opacity: 1;
}

/* ---- Sorties ---- */
.terminal-output {
  margin: 0 0 4px;
  padding: 0 10px 0 44px;
  color: var(--term-fg);
}

.terminal-output b {
  color: var(--term-fg);
}

.terminal-output.is-success {
  color: var(--term-green);
}

.terminal-output.is-error {
  color: var(--term-red);
}

.clock {
  color: var(--term-yellow);
}

/* ---- Saisie ---- */
.terminal-input {
  position: relative;
  cursor: text;
}

.terminal-input input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--term-fg);
  font: inherit;
  caret-color: var(--term-fg);
}

/* Le placeholder n'apparaît qu'une fois le champ actif */
.terminal-input input::placeholder {
  color: transparent;
}

.terminal-input input:focus::placeholder {
  color: var(--term-muted);
}

/* Faux curseur clignotant, masqué dès que le vrai curseur prend le relais */
.terminal-cursor {
  position: absolute;
  top: 50%;
  left: 52px;
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  translate: 0 -50%;
  background: var(--term-fg);
  vertical-align: 0;
  animation: blink 1s steps(2) infinite;
}

.terminal-input:focus-within .terminal-cursor,
.terminal-input:has(input:not(:placeholder-shown)) .terminal-cursor {
  display: none;
}

/* ---- Responsive ---- */
@media (max-width: 820px) {
  .terminal-body {
    font-size: 12.5px;
  }

  .terminal-line em {
    display: none;
  }
}
