/* title.dev brand layer. Loaded from custom/templates/custom/header.tmpl on every
   page, after the theme stylesheet. Two jobs: install the typefaces forge-wide,
   and style the signed-out landing plate. Everything else is left to the theme. */

@import "/assets/fonts/fonts.css";

/* Forgejo exposes exactly these three font hooks; the !important is upstream's
   documented requirement (docs/contributor/customization.md "Customizing fonts"). */
:root {
  --fonts-proportional: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif !important;
  --fonts-monospace: "IBM Plex Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo,
    Consolas, "Liberation Mono", monospace !important;
}

/* The plate is the one loud thing on the site: a recorded-instrument metadata
   block. It keeps its violet ink ground in both themes, so the page a stranger
   sees is the same artifact either way. Contrast on this ground is verified in
   brand/tokens.json (white 15.4:1, mono label 7.6:1, action 5.6:1). */
.td-home {
  display: flex;
  justify-content: center;
  align-items: center;
  /* Fill the space between navbar and footer so the plate sits optically
     centred instead of stranded at the top of a tall empty page. */
  min-height: calc(100vh - 13rem);
  padding: clamp(1.5rem, 5vh, 4rem) 1rem;
}

.td-plate {
  --plate-ink: #2A1B4E;
  --plate-rule: #ffffff26;
  --plate-label: #C2ADE3;
  --plate-action: #FA7418;

  position: relative;
  width: min(46rem, 100%);
  background: var(--plate-ink);
  border: 1px solid #ffffff1f;
  border-radius: 6px;
  padding: clamp(1.5rem, 4vw, 2.75rem);
  box-shadow: 0 24px 60px -30px #00000090;
  overflow: hidden;
}

/* Inner hairline, echoing the ruled edge of the mark itself. */
.td-plate::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid #ffffff14;
  border-radius: 3px;
  pointer-events: none;
}

.td-plate__head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--plate-rule);
}

.td-plate__head img {
  width: 60px;
  height: 60px;
  flex: none;
}

.td-wordmark {
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  color: #fff;
}

.td-sub {
  margin: 0.3rem 0 0;
  font-family: var(--fonts-monospace);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--plate-label);
}

.td-lede {
  margin: 1.25rem 0 0;
  max-width: 34em;
  font-size: 1rem;
  line-height: 1.6;
  color: #E4DBF5;
}

/* Label-over-value cells, ruled like a drawing's title block. */
/* Two fixed columns, not auto-fit: four cells across three auto-fit columns
   leaves one ragged empty cell, which reads as a rendering fault rather than a
   title block. */
.td-fields {
  margin: 1.75rem 0 0;
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--plate-rule);
  border-left: 1px solid var(--plate-rule);
}

@media (min-width: 34rem) {
  .td-fields {
    grid-template-columns: repeat(2, 1fr);
  }
}

.td-field {
  padding: 0.85rem 1rem;
  border-right: 1px solid var(--plate-rule);
  border-bottom: 1px solid var(--plate-rule);
}

.td-field dt {
  font-family: var(--fonts-monospace);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--plate-label);
}

.td-field dd {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  line-height: 1.4;
  color: #fff;
}

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

.td-signin {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--plate-action);
  color: #1B1030;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.7rem 1.4rem;
  border-radius: 4px;
  text-decoration: none;
}

.td-signin:hover,
.td-signin:focus-visible {
  background: #FD9B55;
  color: #1B1030;
}

.td-note {
  font-family: var(--fonts-monospace);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--plate-label);
}

.td-plate a:focus-visible,
.td-signin:focus-visible {
  outline: 2px solid #FA7418;
  outline-offset: 3px;
}

/* The stamp: a recording impression overprinting the plate corner. Decorative,
   so it carries aria-hidden and no information that is not already in the text. */
/* Top-right, where a recording stamp actually lands on an instrument, and clear
   of the actions row. It must stay inside the plate: the plate clips overflow,
   so an overhanging stamp reads as a truncation bug. */
.td-stamp {
  position: absolute;
  top: 1.9rem;
  right: 1.9rem;
  transform: rotate(-7deg);
  border: 2px solid #A98BE8;
  border-radius: 4px;
  padding: 0.5rem 1.4rem;
  text-align: center;
  color: #A98BE8;
  opacity: 0.5;
  pointer-events: none;
  user-select: none;
}

.td-stamp::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid currentcolor;
  border-radius: 2px;
}

.td-stamp b {
  display: block;
  font-family: var(--fonts-monospace);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.td-stamp span {
  display: block;
  font-family: var(--fonts-monospace);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  margin-top: 0.15rem;
}

/* One orchestrated moment: the stamp presses in once, on load. */
@media (prefers-reduced-motion: no-preference) {
  .td-stamp {
    animation: td-press 620ms cubic-bezier(0.2, 0.9, 0.3, 1) both;
  }
  @keyframes td-press {
    from { opacity: 0; transform: rotate(-7deg) scale(1.35); }
    60%  { opacity: 0.62; }
    to   { opacity: 0.5; transform: rotate(-7deg) scale(1); }
  }
}

@media (max-width: 34rem) {
  .td-stamp {
    position: static;
    transform: none;
    display: inline-block;
    margin-top: 1.5rem;
    animation: none;
  }
}
