:root {
  --ameba-red: #d30000;
  --ameba-pink: #e5355b;
  --ink: #242424;
  --paper: #f4f4f4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: sans-serif;
  line-height: 1.7;
}

main {
  display: flex;
  flex-direction: column;
}

.header-border {
  background-color: var(--ameba-pink);
}

.history-hero {
  min-height: 320px;
  display: grid;
  place-items: center;
  position: relative;
  background-position: center;
  background-size: cover;
  text-align: center;
  color: #fff;
}

.history-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(105, 0, 0, 0.82), rgba(20, 20, 20, 0.38));
}

.history-hero-copy {
  position: relative;
  z-index: 1;
  padding: 3rem 1.5rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.history-hero-copy h1 {
  margin: 0.15rem 0 0.5rem;
  color: #fff;
  font-size: clamp(2.4rem, 7vw, 5rem);
  letter-spacing: 0.08em;
}

.history-kicker,
.section-label,
.history-card-type {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.history-intro {
  max-width: 900px;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 2.5rem;
  text-align: center;
}

.history-intro h2,
.history-note h2 {
  margin: 0.4rem 0 1rem;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.activity-timeline {
  width: min(980px, calc(100% - 3rem));
  margin: 0 auto 4rem;
  padding: 2.5rem;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

.history-grid { order: 1; }
.activity-timeline { order: 2; }
.history-note { order: 3; }

.activity-timeline > h2 { margin: 0.4rem 0 0.8rem; text-align: center; }
.timeline-legend, .timeline-note { color: #666; font-size: 0.9rem; text-align: center; }
.timeline-years { display: grid; gap: 1rem; margin-top: 1.8rem; }
.timeline-period { overflow: hidden; border: 1px solid #e1e1e1; border-radius: 10px; background: #fff; }
.timeline-period summary { padding: 0.85rem 1rem; cursor: pointer; color: #8f0000; font-weight: 700; }
.timeline-period summary:hover { background: #fff4f5; }
.timeline-period-years { display: grid; gap: 1rem; padding: 0 1rem 1rem; }
.timeline-years section { padding: 0.9rem 1rem; border-left: 4px solid #e5355b; background: #fafafa; }
.timeline-years h3 { margin: 0 0 0.35rem; color: #b00000; }
.timeline-years p { margin: 0; color: #666; }
.timeline-years ul { margin: 0; padding-left: 1.25rem; }
.timeline-years li { padding: 0.15rem 0; }
.timeline-years time { margin-left: 0.5rem; color: #555; white-space: nowrap; }
.timeline-event-world { color: #b00000; font-weight: 700; }
.timeline-event-space { color: #a45a00; font-weight: 700; }
.timeline-event-mostra { color: #00796b; font-weight: 700; }
.timeline-event-internal { color: #666; }
.timeline-postponement { margin: 0.7rem 0 0; font-size: 0.78rem; line-height: 1.55; }

@media (max-width: 600px) {
  .activity-timeline { width: min(100% - 2rem, 980px); padding: 1.5rem; }
  .timeline-years time { display: block; margin-left: 0; }
}

.section-label,
.history-card-type {
  color: var(--ameba-red);
  font-size: 0.76rem;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  width: min(1180px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 1rem 0 5rem;
}

.history-card {
  overflow: hidden;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.13);
}

.history-card-image {
  min-height: 240px;
  background-position: center;
  background-size: cover;
}

.history-card-body {
  padding: 1.6rem 1.7rem 1.8rem;
}

.history-card-body h2 {
  margin: 0.35rem 0 0.65rem;
  font-size: 1.65rem;
}

.history-status {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid #bbb;
  border-radius: 999px;
  color: #666;
  font-size: 0.9rem;
  font-weight: 700;
}

a.history-status {
  border-color: #d30000;
  color: #d30000;
  text-decoration: none;
}

a.history-status:hover {
  background: #d30000;
  color: #fff;
}

.history-card-placeholder {
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(211, 0, 0, 0.96), rgba(72, 0, 0, 0.9)),
    repeating-linear-gradient(45deg, transparent 0 18px, rgba(255, 255, 255, 0.08) 18px 36px);
  color: #fff;
  text-align: center;
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.history-note {
  max-width: 900px;
  margin: 0 auto 5rem;
  padding: 2.5rem;
  background: #fff;
  border-left: 6px solid var(--ameba-red);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.09);
}

.history-back {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.65rem 1.15rem;
  border-radius: 999px;
  background: var(--ameba-red);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.history-back:hover {
  filter: brightness(0.86);
}

footer {
  padding: 1rem;
  background: var(--ameba-red);
  color: #fffdef;
  text-align: center;
}

footer a {
  color: #fff;
}

.fade-in-left,
.fade-in-right {
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-left {
  transform: translateX(-28px);
}

.fade-in-right {
  transform: translateX(28px);
}

.visible {
  opacity: 1;
  transform: translate(0, 0);
}

@media (max-width: 760px) {
  .history-hero {
    min-height: 240px;
  }

  .history-grid {
    grid-template-columns: 1fr;
    width: min(100% - 2rem, 620px);
  }

  .history-card-image {
    min-height: 190px;
  }

  .history-note {
    margin-right: 1rem;
    margin-left: 1rem;
    padding: 1.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in-left,
  .fade-in-right {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
