/* Portail metal3d.org — palette et composants repris de la page purego. */

:root {
  color-scheme: light dark;
  --bg: #fcfbfa;
  --surface: #ffffff;
  --surface-alt: #f6f3f0;
  --text: #1c1917;
  --muted: #5f5a55;
  --border: #e6e2dd;
  --border-strong: #d6d0c9;
  --accent: #ea580c;
  --accent-strong: #c2410c;
  --accent-soft: rgba(234, 88, 12, 0.09);
  --code-bg: #f4f0ec;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.04), 0 10px 30px rgba(28, 25, 23, 0.05);
  --radius: 14px;
  --max: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12100e;
    --surface: #1a1715;
    --surface-alt: #211d1a;
    --text: #f4f0ec;
    --muted: #ada69f;
    --border: #312b26;
    --border-strong: #453d36;
    --accent: #ff7f2a;
    --accent-strong: #ff9a55;
    --accent-soft: rgba(255, 127, 42, 0.12);
    --code-bg: #201c19;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.2);
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-strong);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 650;
}

p {
  margin: 0;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.875em;
}

.container {
  width: min(100% - 3rem, var(--max));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100%;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
}

.skip-link:focus {
  top: 1rem;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.85rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.brand:hover {
  color: var(--text);
}

.brand img {
  width: 30px;
  height: auto;
  display: block;
}

.brand-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-meta small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.35rem;
  font-size: 0.925rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.site-nav a:hover {
  color: var(--accent);
}

.site-nav .nav-git {
  color: var(--accent);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(3.25rem, 8vw, 5.75rem) 0 clamp(2.75rem, 6vw, 4.5rem);
}

.hero::before {
  content: "";
  position: absolute;
  inset: -40% 30% 40% -20%;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 78%);
  pointer-events: none;
  z-index: 0;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.15rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 550;
  letter-spacing: 0.01em;
}

.eyebrow .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hero h1 {
  display: flex;
  align-items: center;
  gap: clamp(0.6rem, 1.5vw, 1rem);
  font-size: clamp(3rem, 8vw, 4.75rem);
  font-weight: 700;
  letter-spacing: -0.045em;
}

.hero h1 img {
  width: clamp(46px, 7vw, 64px);
  height: auto;
  display: block;
}

.hero-subtitle {
  margin-top: 1rem;
  font-size: clamp(1.2rem, 2.5vw, 1.55rem);
  font-weight: 550;
  letter-spacing: -0.015em;
}

.hero-lead {
  margin-top: 0.9rem;
  max-width: 46ch;
  color: var(--muted);
  font-size: 1.0625rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.62rem 1.15rem;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.button-primary {
  background: var(--accent);
  color: #fff;
}

.button-primary:hover {
  background: var(--accent-strong);
  color: #fff;
}

.button-ghost {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface);
}

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

/* ---------- Terminal card ---------- */

.terminal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.terminal-bar span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border-strong);
}

.terminal-bar .label {
  width: auto;
  height: auto;
  margin-left: auto;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font-size: 0.72rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.terminal pre {
  margin: 0;
  padding: 1.1rem 1.15rem;
  overflow-x: auto;
  background: transparent;
  color: var(--text);
  line-height: 1.75;
  font-size: 0.8rem;
}

.terminal .prompt {
  color: var(--accent);
  user-select: none;
}

.terminal .ok {
  color: #16a34a;
}

.terminal .dim {
  color: var(--muted);
}

@media (prefers-color-scheme: dark) {
  .terminal .ok {
    color: #4ade80;
  }
}

/* ---------- Sections ---------- */

.section {
  padding: clamp(2.75rem, 6vw, 4.5rem) 0;
  border-top: 1px solid var(--border);
}

.section-head {
  max-width: 62ch;
  margin-bottom: clamp(1.75rem, 4vw, 2.5rem);
}

.section-kicker {
  display: block;
  margin-bottom: 0.6rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.section h2 {
  font-size: clamp(1.65rem, 3.5vw, 2.15rem);
}

.section-intro {
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 1.03rem;
}

.section h2 {
  text-wrap: balance;
}

.section-more {
  margin-top: 1.5rem;
  font-size: 0.92rem;
  font-weight: 550;
}

/* ---------- Project cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.card {
  display: flex;
  flex-direction: column;
  padding: clamp(1.35rem, 3vw, 1.75rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  font-weight: 700;
}

.status {
  flex: none;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 550;
}

.status-active {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent);
}

.card-title {
  margin-top: 1rem;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.card-desc {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 0.28rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.15rem;
  margin-top: auto;
  padding-top: 1.2rem;
  font-size: 0.88rem;
  font-weight: 550;
}

.card-links a {
  text-decoration: none;
}

.card-links a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.card-more {
  justify-content: center;
  border-style: dashed;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
}

.card-more strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Posts ---------- */

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.post-card {
  display: flex;
  flex-direction: column;
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.post-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.post-date {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.post-title {
  margin-top: 0.55rem;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.post-title a {
  color: var(--text);
  text-decoration: none;
}

.post-title a:hover {
  color: var(--accent);
}

.post-summary {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.post-more {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ---------- Prose ---------- */

.prose {
  max-width: 62ch;
  margin-bottom: 2rem;
  color: var(--muted);
}

.prose p + p {
  margin-top: 1rem;
}

.prose a {
  font-weight: 500;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 2rem;
  padding: clamp(2rem, 5vw, 3rem) 0 1.5rem;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
}

.footer-brand img {
  width: 28px;
  height: auto;
}

.footer-about p {
  max-width: 42ch;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  gap: 0.45rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 550;
}

.footer-links a {
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-bottom {
  padding: 1.1rem 0 1.4rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---------- Variants ---------- */

.hero-small {
  padding-top: clamp(2.5rem, 6vw, 4rem);
  padding-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.hero-small h1 {
  font-size: clamp(2.2rem, 6vw, 3.5rem);
}

.hero-small .hero-lead {
  max-width: 58ch;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero h1 {
    font-size: clamp(2.75rem, 10vw, 4rem);
  }

  .footer-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }
}

@media (max-width: 640px) {
  .container {
    width: calc(100% - 2rem);
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .site-nav {
    gap: 0.9rem;
    font-size: 0.85rem;
  }

  .hero {
    padding-top: 2.5rem;
  }

  .cards,
  .post-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
