/* Nightfall Changelog (v4, Paper design system) — page-only styles. Linked only from changelog.html.
   Screens: see STYLEGUIDE.md "Version 2 foundation" and "Version 3".
   Parts from site.css: .frame, .fchips/.fchip, .btn-primary, .wrap, .page-content.

   Layout
     Mac / iPad landscape   date rail (sticky date + gold diamond on a vertical line) | entry cards
     iPad portrait          narrower rail
     Phones                 the date becomes a row above its cards; the line runs down the left edge
   Markers: New = XP teal, Improved = gold, Fixed = ember (colours are data: only these three meanings). */

/* ---------- Inner-page banner (same as game / classes / knight) ---------- */
.pbn {
  position: relative;
  background:
    radial-gradient(60% 80% at 75% 40%, rgba(138, 110, 60, 0.18) 0%, rgba(12, 11, 10, 0) 70%),
    linear-gradient(180deg, #12100D 0%, #0C0B0A 100%);
}

.pbn-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  min-height: 360px;
  padding-top: 76px; /* room for the hanging crest */
}

.pbn-copy {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 0 1 640px;
  min-width: 0;
}

.pbn-crumb {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--v2-dim);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 22px;
}

.pbn-crumb li + li::before {
  content: "›";
  padding-inline: 5px;
}

.pbn-crumb a {
  color: inherit;
}

.pbn-title {
  margin: 0;
  color: var(--v2-text-hero);
  font-family: var(--font-display);
  font-size: 58px;
  font-weight: 700;
  line-height: 62px;
}

.pbn-line {
  margin: 0;
  color: var(--v2-body);
  font-family: var(--font-body);
  font-size: 23px;
  line-height: 28px;
}

.pbn-pic {
  position: relative;
  flex: 0 0 auto;
  width: 460px;
  max-width: 100%;
  height: 240px;
  overflow: hidden;
  border: 1px solid var(--v2-line-strong);
  background: #0A0909;
  box-shadow: 0 0 0 5px #0A0908, 0 0 0 6px #4A3B22;
}

.pbn-pic > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 45%;
}

/* Status line slot in the hero (filled by site.js; shown on iPad portrait + iPhone portrait) */
.pbn-status {
  display: none;
}

/* ---------- Page body ---------- */
.chg-content {
  --rail: 168px;      /* date column */
  --rail-gap: 64px;   /* the line runs down the middle of this gap */
  --line-x: calc(var(--rail) + var(--rail-gap) / 2);
  padding-bottom: 104px;
}

/* Filter row + key */
.chg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  padding-top: 48px;
  padding-bottom: 40px;
}

.chg-filter .fchip {
  font-size: 15px;
}

.chg-key {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- New / Improved / Fixed markers ---------- */
.chg-mark {
  --mark: var(--color-gold);
  --mark-text: var(--color-gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 92px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--mark);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--mark) 12%, transparent);
  color: var(--mark-text);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.chg-new {
  --mark: var(--color-xp);
  --mark-text: var(--color-xp-text);
}

.chg-improved {
  --mark: var(--color-gold);
  --mark-text: var(--color-gold);
}

.chg-fixed {
  --mark: var(--color-ember);
  --mark-text: var(--color-ember-text);
}

/* ---------- Timeline ---------- */
.chg-list {
  position: relative;
}

.chg-day {
  position: relative;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  column-gap: var(--rail-gap);
  padding-bottom: 64px;
}

/* the vertical line, continuous from one day to the next */
.chg-day::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--line-x);
  width: 1px;
  background: var(--color-line);
}

.chg-day:first-child::before {
  top: 22px;
  background: linear-gradient(180deg, var(--gold-55) 0, var(--color-line) 240px);
}

.chg-day:last-child::before {
  bottom: 24px;
  background: linear-gradient(180deg, var(--color-line) 0, var(--color-line) calc(100% - 120px), rgba(74, 63, 48, 0) 100%);
}

.chg-day:first-child:last-child::before {
  background: linear-gradient(180deg, var(--gold-55) 0, var(--color-line) 50%, rgba(74, 63, 48, 0) 100%);
}

.chg-day[hidden],
.chg-entry[hidden] {
  display: none;
}

/* Date: sticky on the rail, with a diamond on the line */
.chg-date {
  position: sticky;
  top: calc(var(--sticky-offset, 0px) + 24px);
  align-self: start;
  display: block;
  margin: 0;
  text-align: right;
}

.chg-date time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.chg-date-day {
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 600;
  line-height: 44px;
  letter-spacing: 0.02em;
}

.chg-date-rest {
  margin-top: 8px;
  color: var(--color-dim);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.chg-date::after {
  content: "";
  position: absolute;
  top: 15px;
  right: calc(var(--rail-gap) / -2 - 7.5px);
  width: 14px;
  height: 14px;
  background: var(--color-night);
  border: 1px solid var(--color-gold);
  box-shadow: inset 0 0 0 3px var(--color-night), inset 0 0 0 7px var(--color-gold);
  transform: rotate(45deg);
}

.chg-entries {
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-width: 0;
}

/* ---------- Entry card ---------- */
.chg-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  padding: 28px 32px 30px;
  scroll-margin-top: calc(var(--sticky-offset, 0px) + 24px);
}

.chg-entry:has(> .chg-pic) {
  grid-template-columns: minmax(0, 1fr) 260px;
}

/* linked from Home (changelog.html#entry-id): gold frame */
.chg-entry:target {
  border-color: var(--color-gold);
}

.chg-entry:target::before {
  border-color: var(--gold-55);
}

.chg-entry-body {
  min-width: 0;
}

.chg-area {
  display: inline-flex;
  align-items: center;
  height: 26px;
  margin: 0 0 12px;
  padding: 0 10px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: var(--color-panel-raised);
  color: var(--color-dim);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.chg-entry-title {
  margin: 0 0 18px;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  line-height: 32px;
  letter-spacing: 0.03em;
}

.chg-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chg-items li {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.chg-items .chg-mark {
  margin-top: 1px;
}

.chg-text {
  color: var(--v2-body);
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 26px;
}

/* One small picture per entry, never with a label on it */
.chg-pic {
  position: relative;
  z-index: 3; /* above the frame's inner rule */
  display: block;
  align-self: start;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--color-line);
  background: #0A0909;
  box-shadow: 0 0 0 4px var(--color-panel), 0 0 0 5px var(--gold-22);
}

.chg-pic img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (hover: hover) {
  .chg-pic img {
    transition: transform 0.3s ease;
  }

  .chg-pic:hover {
    border-color: var(--gold-55);
  }

  .chg-pic:hover img {
    transform: scale(1.03);
  }
}

/* ---------- Closing Discord row ---------- */
.chg-follow-wrap {
  padding-top: 8px;
}

.chg-follow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
  max-width: 920px;
  margin: 0 auto;
  padding: 26px 32px;
}

.chg-follow-title {
  margin: 0 0 4px;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  line-height: 30px;
  letter-spacing: 0.03em;
}

.chg-follow-line {
  margin: 0;
  color: var(--color-dim);
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 24px;
}

.chg-follow-btn {
  flex: 0 0 auto;
}

/* ---------- iPad landscape (1024–1279) ---------- */
@media (max-width: 1279px) {
  .pbn-copy {
    flex-basis: 520px;
  }

  .pbn-pic {
    width: 420px;
    height: 220px;
  }

  .chg-content {
    --rail: 136px;
    --rail-gap: 56px;
  }

  .chg-entry:has(> .chg-pic) {
    grid-template-columns: minmax(0, 1fr) 220px;
  }
}

/* ---------- iPad portrait and below ---------- */
@media (max-width: 1023px) {
  .pbn-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 28px;
    min-height: 0;
    padding-top: 40px;
    padding-bottom: 44px;
  }

  .pbn-copy {
    flex-basis: auto;
  }

  .pbn-pic {
    width: 100%;
    height: 300px;
  }

  .chg-content {
    --rail: 96px;
    --rail-gap: 48px;
  }

  .chg-date-day {
    font-size: 38px;
    line-height: 40px;
  }

  .chg-date-rest {
    font-size: 13px;
    letter-spacing: 0.1em;
  }

  .chg-entry {
    padding: 24px 26px 26px;
  }

  /* the picture moves under the bullets so the text keeps its width */
  .chg-entry:has(> .chg-pic) {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }

  .chg-pic {
    width: 100%;
    max-width: 360px;
    aspect-ratio: 16 / 9;
  }

  .chg-entry-title {
    font-size: 24px;
    line-height: 30px;
  }

  .chg-text {
    font-size: 18px;
    line-height: 25px;
  }
}

/* iPad portrait: status line in the banner */
@media (min-width: 768px) and (max-width: 1023px) and (min-height: 501px), (min-width: 768px) and (max-width: 1023px) and (orientation: portrait) {
  .pbn-status {
    display: block;
  }

  .pbn-pic {
    height: 300px;
  }
}

/* ---------- PHONE (iPhone portrait + short landscape): date row above the cards ---------- */
@media (max-width: 767px), (max-height: 500px) and (orientation: landscape) {
  .chg-content {
    --line-x: 6px;
    padding-bottom: 64px;
  }

  .chg-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding-top: 28px;
    padding-bottom: 28px;
  }

  /* one sideways-scrolling chip row that bleeds to the screen edges */
  .chg-filter {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-left: calc(-1 * var(--pad-l));
    margin-right: calc(-1 * var(--pad-r));
    padding-left: var(--pad-l);
    padding-right: var(--pad-r);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .chg-filter::-webkit-scrollbar {
    display: none;
  }

  .chg-filter .fchip {
    flex: 0 0 auto;
  }

  .chg-key {
    gap: 8px;
  }

  .chg-day {
    grid-template-columns: minmax(0, 1fr);
    padding-left: 28px;
    padding-bottom: 44px;
  }

  .chg-day:first-child::before {
    top: 14px;
  }

  .chg-date {
    position: relative;
    top: auto;
    margin-bottom: 18px;
    text-align: left;
  }

  .chg-date time {
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
  }

  .chg-date-day {
    font-size: 30px;
    line-height: 32px;
  }

  .chg-date-rest {
    margin-top: 0;
    font-size: 14px;
  }

  .chg-date::after {
    top: 9px;
    right: auto;
    left: -27.5px; /* centred on the line at --line-x */
    width: 12px;
    height: 12px;
    box-shadow: inset 0 0 0 3px var(--color-night), inset 0 0 0 6px var(--color-gold);
  }

  .chg-entries {
    gap: 26px;
  }

  .chg-entry,
  .chg-entry:has(> .chg-pic) {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding: 20px 18px 22px;
  }

  .chg-area {
    margin-bottom: 10px;
  }

  .chg-entry-title {
    margin-bottom: 14px;
    font-size: 21px;
    line-height: 27px;
  }

  .chg-items {
    gap: 12px;
  }

  .chg-items li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .chg-items .chg-mark {
    justify-self: start;
    min-width: 0;
    height: 22px;
    font-size: 13px;
  }

  .chg-text {
    font-size: 17px;
    line-height: 24px;
  }

  .chg-pic {
    max-width: none;
    aspect-ratio: 16 / 9;
  }

  .chg-follow {
    flex-direction: column;
    align-items: stretch;
    padding: 22px 20px;
    text-align: center;
  }

  .chg-follow-title {
    font-size: 21px;
    line-height: 27px;
  }

  .chg-follow-line {
    font-size: 17px;
  }
}

/* iPhone portrait: banner like the other inner pages */
@media (max-width: 767px) {
  .pbn-inner {
    gap: 22px;
    padding-top: 28px;
    padding-bottom: 32px;
  }

  .pbn-copy {
    gap: 10px;
  }

  .pbn-crumb {
    font-size: 16px;
    line-height: 20px;
  }

  .pbn-title {
    font-size: 42px;
    line-height: 48px;
  }

  .pbn-line {
    font-size: 19px;
    line-height: 24px;
  }

  .pbn-pic {
    height: 200px;
  }
}

@media (max-width: 767px) and (min-height: 501px), (max-width: 767px) and (orientation: portrait) {
  .pbn-status {
    display: block;
  }

  .pbn-copy > nav {
    display: none;
  }

  .pbn-inner {
    gap: 18px;
    padding-top: 22px;
    padding-bottom: 26px;
  }

  .pbn-pic {
    height: 190px;
  }
}

/* iPhone landscape: banner side by side, markers back beside the text (there is room) */
@media (max-height: 500px) and (orientation: landscape) {
  .pbn-inner {
    flex-direction: row;
    align-items: center;
    gap: 24px;
    padding-top: 18px;
    padding-bottom: 22px;
  }

  .pbn-copy {
    flex: 0 1 380px;
    gap: 8px;
  }

  .pbn-title {
    font-size: 42px;
    line-height: 48px;
  }

  .pbn-pic {
    flex-shrink: 1;
    width: 320px;
    min-width: 0;
    height: 176px;
  }

  .chg-toolbar {
    flex-direction: row;
    align-items: center;
  }

  .chg-filter {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .chg-entry:has(> .chg-pic) {
    grid-template-columns: minmax(0, 1fr) 200px;
  }

  .chg-pic {
    aspect-ratio: 16 / 10;
  }

  .chg-items li {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 14px;
  }

  .chg-items .chg-mark {
    justify-self: stretch;
    min-width: 92px;
  }

  .chg-follow {
    flex-direction: row;
    align-items: center;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chg-pic img {
    transition: none;
  }
}
