/*
 * monte piano additions for Forgejo, loaded on every page by templates/custom/header.tmpl
 * (independent of the theme a user picks): brand fonts and the start page (home.tmpl).
 * The start page and the navbar logo follow light/dark like the theme: dark for *-dark themes, and for
 * *-auto themes (montepiano-auto, forgejo-auto) when the system is dark.
 * Fonts: JetBrains Mono Bold, Instrument Sans Bold - subset to Latin, OFL licences next to them.
 */
@font-face {
  font-family: "MP Mono";
  src: url("../fonts/JetBrainsMono-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "MP Sans";
  src: url("../fonts/InstrumentSans-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --mp-granit: #1c252c;
  --mp-kalk: #f2f4f3;
  /* Light: page Kalk, ink Granit; ground = mountain and band */
  --mp-bg: var(--mp-kalk);
  --mp-ink: var(--mp-granit);
  --mp-ground: var(--mp-granit);
  --mp-fels: #5f6d77;
  --mp-text-2: #3b4852;
  --mp-accent: #d9475f;
  --mp-accent-text: #b8344c;
  --mp-accent-hover: #9b2c40;
  --mp-btn-text: #ffffff;
  --mp-on-ink: #e4e9eb;
  --mp-on-ink-muted: #93a1aa;
  --mp-ink-line: #2e3a42;
  --mp-mono: "MP Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --mp-sans: "MP Sans", "Helvetica Neue", Arial, sans-serif;
}

.mp-home {
  padding: 0 !important;
  margin: 0;
  background: var(--mp-bg);
  color: var(--mp-ink);
}

/* Dark: night sky behind the mountain, light ink, the pink of the logo for accents */
html[data-theme$="-dark"] {
  --mp-bg: #10161d;
  --mp-ink: var(--mp-kalk);
  --mp-fels: #93a1aa;
  --mp-text-2: #c3ccd2;
  --mp-accent-text: #f06a82;
  --mp-accent-hover: #f2879a;
  --mp-btn-text: #10161d;
}
@media (prefers-color-scheme: dark) {
  html[data-theme$="-auto"] {
    --mp-bg: #10161d;
    --mp-ink: var(--mp-kalk);
    --mp-fels: #93a1aa;
    --mp-text-2: #c3ccd2;
    --mp-accent-text: #f06a82;
    --mp-accent-hover: #f2879a;
    --mp-btn-text: #10161d;
  }
}

/* Navbar logo in dark mode: light tile, dark mountain (img/logo-dark.svg). Forgejo's navbar always loads
   img/logo.svg, so the dark one is a background of the link and the img is hidden. */
html[data-theme$="-dark"] #navbar-logo {
  background: url("../img/logo-dark.svg") center / 30px 30px no-repeat;
}
html[data-theme$="-dark"] #navbar-logo img {
  visibility: hidden;
}
@media (prefers-color-scheme: dark) {
  html[data-theme$="-auto"] #navbar-logo {
    background: url("../img/logo-dark.svg") center / 30px 30px no-repeat;
  }
  html[data-theme$="-auto"] #navbar-logo img {
    visibility: hidden;
  }
}

/* Forgejo's page frame keeps 16 px above the content and 80 px for the footer: on the start page it
   gets the same background, so no strip of the theme's page color shows (only visible in dark) */
.full.height:has(> .mp-home) {
  background: var(--mp-bg);
}

.mp-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
}

/* Hero */
.mp-hero {
  padding-top: clamp(40px, 7vw, 88px);
}
.mp-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.mp-mark {
  width: 48px;
  height: 40px;
  flex: none;
}
.mp-mark path {
  fill: var(--mp-ink);
}
.mp-word {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.mp-name {
  font-family: var(--mp-mono);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.02em;
}
.mp-descriptor {
  margin-top: 5px;
  font-family: var(--mp-mono);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mp-fels);
}
.mp-env {
  margin-left: 8px;
  padding: 4px 10px;
  border: 1px solid var(--mp-accent-text);
  border-radius: 6px;
  font-family: var(--mp-mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mp-accent-text);
}
.mp-eyebrow {
  margin: clamp(40px, 6vw, 72px) 0 12px;
  font-family: var(--mp-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mp-accent-text);
}
.mp-home h1.mp-claim {
  margin: 0;
  font-family: var(--mp-sans);
  font-weight: 700;
  font-size: clamp(40px, 7vw, 80px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: var(--mp-ink);
}
.mp-claim em {
  font-style: normal;
  color: var(--mp-accent-text);
}
.mp-lead {
  max-width: 34em;
  margin: 24px 0 0;
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.55;
  color: var(--mp-text-2);
}
.mp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}
.mp-home .mp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  padding: 12px 22px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.mp-home .mp-btn-accent {
  background: var(--mp-accent-text);
  color: var(--mp-btn-text);
}
.mp-home .mp-btn-accent:hover {
  background: var(--mp-accent-hover);
  color: var(--mp-btn-text);
}
.mp-home .mp-btn-ghost {
  border-color: var(--mp-ink);
  color: var(--mp-ink);
}
.mp-home .mp-btn-ghost:hover {
  background: var(--mp-ink);
  color: var(--mp-bg);
}
.mp-home .mp-btn:focus-visible {
  outline: 2px solid var(--mp-accent-text);
  outline-offset: 2px;
}

/* Mountain silhouette: same drawing and sizing rules as the website (MountainLine) */
.mp-mountain {
  position: relative;
  margin-top: clamp(24px, 4vw, 48px);
  margin-bottom: -1px;
  overflow: hidden;
}
.mp-mountain svg {
  position: relative;
  left: 50%;
  display: block;
  height: clamp(160px, 25vw, 360px);
  width: max(100%, 640px);
  transform: translateX(-50%);
}
.mp-mountain path {
  fill: var(--mp-ground);
}

/* Dark band */
.mp-band {
  background: var(--mp-ground);
  color: var(--mp-on-ink);
  padding: clamp(16px, 3vw, 40px) 0 clamp(48px, 7vw, 96px);
}
.mp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.mp-item {
  padding-top: 16px;
  border-top: 1px solid var(--mp-ink-line);
}
.mp-home .mp-item h2 {
  margin: 0 0 8px;
  font-family: var(--mp-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f06a82;
}
.mp-item p {
  margin: 0;
  line-height: 1.55;
  color: var(--mp-on-ink-muted);
}
@media (max-width: 767px) {
  .mp-grid {
    grid-template-columns: 1fr;
  }
}

/* Cursor on the flat summit */
.mp-blink {
  animation: mp-blink 1.1s steps(1, end) infinite;
}
@keyframes mp-blink {
  50% {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .mp-blink {
    animation: none;
  }
}
