/* ============================================================
   components.css — reusable controls: buttons, icon buttons,
   theme toggle, cards, tags/chips, badges.
   ============================================================ */

/* ---------- Buttons ---------- */
.button {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  background: var(--bg-card);
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.button:hover {
  text-decoration: none;
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: var(--on-accent);
}

.button.primary:hover {
  color: var(--on-accent);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 40%, transparent);
}

/* ---------- Icon button ---------- */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  background: var(--bg);
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  transition: border-color 0.2s ease, transform 0.1s ease;
}

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

.theme-toggle:active {
  transform: scale(0.92);
}

/* ---------- Card ---------- */
.card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.35rem 1.4rem;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow-lg);
}

.card-top {
  margin-bottom: 0.7rem;
}

.card-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-sm);
}

.card h3 {
  font-size: 1.08rem;
  margin-bottom: 0.45rem;
}

.card h3 a {
  color: var(--text);
}

.card h3 a:hover {
  color: var(--accent);
  text-decoration: none;
}

.card p {
  color: var(--text-muted);
  font-size: 0.91rem;
  line-height: 1.6;
  flex-grow: 1;
}

/* ---------- Command palette ---------- */
.palette-hint {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.15rem;
  padding: 0 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.palette-hint:hover {
  border-color: var(--accent);
}

.palette-hint kbd,
.palette-esc {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--text) 22%, transparent);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 14vh 1rem 0;
}

.palette {
  width: 100%;
  max-width: 540px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: palette-in 0.14s ease-out;
}

@keyframes palette-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.palette-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.palette-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.98rem;
}

.palette-input::placeholder {
  color: var(--text-muted);
}

.palette-esc {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.08rem 0.4rem;
}

.palette-list {
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  max-height: 320px;
  overflow-y: auto;
}

.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.palette-item.selected {
  background: var(--accent-soft);
}

.palette-item-label {
  font-size: 0.92rem;
  color: var(--text);
}

.palette-item.selected .palette-item-label {
  color: var(--accent);
}

.palette-item-hint {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 45%;
}

.palette-empty {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .palette-hint {
    display: none;
  }

  .palette-overlay {
    padding-top: 8vh;
  }
}

/* ---------- Shared modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(10, 14, 22, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.modal-overlay.open {
  opacity: 1;
}

.modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(880px, 100%);
  max-height: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.985);
  transition: transform 0.16s ease;
}

.modal-overlay.open .modal-panel {
  transform: none;
}

.modal-close {
  position: absolute;
  top: 0.7rem;
  right: 0.75rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.modal-close:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.modal-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 1.1rem 1.25rem 1.25rem;
}

@media (max-width: 640px) {
  .modal-overlay {
    padding: 0.5rem;
  }

  .modal-panel {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: var(--radius-md);
  }
}

/* Link-styled button (e.g. "View full archive") */
.link-button {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
  color: var(--accent);
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- News archive modal ---------- */
.modal-archive .modal-panel {
  width: min(640px, 100%);
  height: min(80vh, 680px);
}

.archive-title {
  font-size: 1.15rem;
  margin: 0 2.4rem 0.1rem 0; /* clear the close button */
}

.archive-sub {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 0.9rem;
}

.modal-archive .filter-chips {
  margin-bottom: 1rem;
}

.archive-groups {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.4rem;
}

.archive-year {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 1.1rem 0 0.5rem;
}

.archive-group:first-child .archive-year {
  margin-top: 0;
}

/* archive rows may wrap — the one-line clamp applies to the page list only */
.archive-list .hl-row {
  white-space: normal;
}

/* ---------- Segmented switch ---------- */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.seg-btn {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  padding: 0.24rem 0.9rem;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.seg-btn:hover {
  color: var(--accent);
}

.seg-btn.active {
  color: var(--accent);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

/* ---------- PDF résumé viewer ---------- */
.modal-resume .modal-panel {
  height: min(92vh, 1100px);
}

.pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding-right: 2.6rem; /* clear the close button */
  margin-bottom: 0.9rem;
}

.pdf-pager {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.pdf-pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.pdf-pager-btn:hover:not([disabled]) {
  color: var(--accent);
  border-color: var(--accent);
}

.pdf-pager-btn[disabled] {
  opacity: 0.4;
  cursor: default;
}

.pdf-page-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.pdf-pages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 4px;
  text-align: center;
}

.pdf-page-canvas {
  display: block;
  margin: 0 auto 0.6rem;
  box-shadow: var(--shadow);
  border-radius: 2px;
}

.pdf-status {
  color: var(--text-muted);
  font-size: 0.92rem;
  padding: 2rem 0;
}

/* ---------- Lightbox (photography) ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 130; /* above the shared modal (120) — Footprints opens it from there */
  background: rgba(8, 10, 18, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.lightbox-panel {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  max-width: 100%;
  max-height: 100%;
}

.lightbox-figure {
  margin: 0;
  text-align: center;
  max-width: min(1000px, 82vw);
}

.lightbox-img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: var(--radius-md);
  display: block;
  margin: 0 auto;
}

.lightbox-caption {
  color: #cbd3e1;
  font-size: 0.88rem;
  margin-top: 0.6rem;
}

.lightbox-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.15rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.lightbox-btn[hidden] {
  display: none; /* the author display would otherwise beat [hidden] */
}

/* prev/next are anchored to the lightbox VIEWPORT, not the photo — a fixed
   distance from the screen edges, vertically centered, so they sit in the
   exact same place for every image regardless of aspect ratio */
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
}

.lightbox-prev {
  left: 1.1rem;
}

.lightbox-next {
  right: 1.1rem;
}

.lightbox-close {
  position: absolute;
  top: 1.1rem;
  right: 1.2rem;
}

@media (max-width: 640px) {
  .lightbox {
    padding: 1rem;
  }

  .lightbox-panel {
    gap: 0.4rem;
  }

  .lightbox-figure {
    max-width: 88vw;
  }

  .lightbox-prev {
    left: 0.5rem;
  }

  .lightbox-next {
    right: 0.5rem;
  }
}

/* ---------- Scroll progress bar ---------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 60;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.08s linear;
}

/* ---------- Filter chips ---------- */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.2rem;
}

.chip {
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.32rem 0.95rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.chip:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.chip.active {
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

/* ---------- Contact form ---------- */
.form-title {
  font-size: 1.05rem;
  margin: 2rem 0 0.9rem;
}

.contact-form {
  display: grid;
  gap: 0.9rem;
  max-width: 640px; /* balanced: narrower than the column, never edge-to-edge */
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.form-field {
  display: grid;
  gap: 0.3rem;
}

.form-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.form-field input,
.form-field textarea {
  font-family: var(--font-body);
  font-size: 0.94rem;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.8rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-field textarea {
  resize: vertical;
  min-height: 7rem;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.75;
}

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.form-status {
  font-size: 0.9rem;
  margin: 0;
}

.form-status.ok {
  color: var(--ok);
}

.form-status.err {
  color: var(--err);
}

.contact-form .button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Honeypot: invisible to humans, tempting to bots */
.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ---------- Tech badges ---------- */
.tech-badges {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.9rem;
}

.tech-badges li {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 0.14rem 0.55rem;
  border-radius: var(--radius-sm);
}

.tech-badges.lg li {
  font-size: 0.8rem;
  padding: 0.25rem 0.7rem;
  border-radius: 8px;
}

/* Manual row break inside a chip list — used to balance two-row groups */
.tech-badges li.chip-break {
  flex-basis: 100%;
  height: 0;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
}
