:root {
  --paper: #F2F0E8;
  --card: #FBFAF5;
  --ink: #16140E;
  --muted: #8E8A7C;
  --orange: #FF5A2C;
  --green: #14B457;
  --green-deep: #0B8F42;
  --present: #2C6FF0;
  --shadow: #16140E;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Space Grotesk", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 8px clamp(14px, 2.5vw, 40px) 0;
}

.wrap {
  max-width: 1640px;
  margin: 0 auto;
}

/* ---------- Header ---------- */
.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 22px;
  margin-bottom: 14px;
}

.masthead h1 {
  font-size: clamp(39px, 5vw, 67px);
  line-height: 0.98;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

.masthead h1 em {
  font-style: normal;
  color: var(--orange);
}

.sub {
  font-size: 18px;
  color: var(--muted);
  max-width: 38ch;
  margin: 14px 0 0;
  line-height: 1.45;
  font-weight: 500;
}

.stamp {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  padding: 10px 14px;
  line-height: 1.3;
  white-space: nowrap;
  background: var(--card);
  box-shadow: 4px 4px 0 var(--ink);
}

.stamp span {
  color: var(--muted);
}

/* ---------- Section ---------- */
.section {
  margin-top: 46px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 30px;
}

.sec-num {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 23px;
  background: var(--ink);
  color: var(--paper);
  width: 46px;
  height: 46px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.section-head h2 {
  font-size: clamp(25px, 3vw, 35px);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin: 0;
  white-space: nowrap;
}

.sec-rule {
  flex: 1 1 auto;
  height: 3px;
  background: var(--ink);
  border-radius: 2px;
  opacity: 0.18;
}

.sec-weeks {
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  font-size: 16px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- Track layout ---------- */
.track {
  position: relative;
  width: 100%;
}

.track-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  padding: 18px 6px 14px;
}

.track-inner + .track-inner {
  margin-top: 40px;
}

/* ---------- Nodes ---------- */
.node {
  border: 2.5px solid var(--ink);
  box-shadow: 5px 5px 0 var(--shadow);
  flex: 0 0 auto;
}

/* Event box */
.node.event {
  background: var(--green);
  color: #fff;
  border-radius: 15px;
  padding: 20px 22px;
  width: 296px;
  min-width: 296px;
  max-width: 296px;
  height: 196px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: flex-start;
}

.node.event .name {
  font-weight: 700;
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

/* event color patterns */
.node.event.submission {
  background: var(--green);
  color: #fff;
  border-color: var(--ink);
}

.node.event.submission {
  position: relative;
}

.node.event.submission::after {
  content: "\2197";
  position: absolute;
  top: 12px;
  right: 14px;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 21px;
  line-height: 1;
  color: #fff;
  opacity: .85;
}

.node.event.presentation {
  background: #DCE8FF;
  color: var(--ink);
  border-color: var(--ink);
}

.node.event.presentation .week-tag {
  border-color: var(--ink);
  color: var(--ink);
}

.node.event.plain {
  background: #fff;
  color: var(--ink);
  border-color: var(--ink);
}

/* Week tag chip */
.week-tag {
  align-self: flex-start;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 22px;
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 7px;
  padding: 3px 11px;
  line-height: 1.4;
  white-space: nowrap;
}

/* Milestone pill */
.node.milestone {
  background: var(--orange);
  color: #fff;
  border-radius: 999px;
  padding: 20px 30px 20px 23px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 17px;
}

.node.milestone .marker {
  width: 23px;
  height: 23px;
  background: #fff;
  border: 2.5px solid var(--ink);
  transform: rotate(45deg);
  flex: 0 0 auto;
  border-radius: 3px;
}

.node.milestone .name {
  font-weight: 700;
  font-size: 32px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.node.milestone .week-tag {
  color: var(--orange);
}

/* Duration block */
.node.duration {
  background: var(--green-deep);
  color: #fff;
  border-radius: 15px;
  padding: 22px 27px 24px;
  min-width: 326px;
  min-height: 158px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.node.duration::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(135deg,
      rgba(255, 255, 255, 0) 0 13px,
      rgba(255, 255, 255, 0.14) 13px 26px);
}

.node.duration .dur-row {
  display: flex;
  align-items: center;
  gap: 9px;
  position: relative;
}

.node.duration .span-badge {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.03em;
  background: #fff;
  color: var(--green-deep);
  border: 2px solid var(--ink);
  border-radius: 7px;
  padding: 3px 11px;
  line-height: 1.4;
}

.node.duration .range {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 21px;
  color: #fff;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.node.duration .name {
  font-weight: 700;
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: -0.01em;
  position: relative;
  text-wrap: balance;
}

.node.duration .span-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #fff;
  font-size: 19px;
}

.node.duration .span-bar i {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.6);
}

.node.duration .span-bar b {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.node.duration .span-bar b.l {
  border-right: 7px solid rgba(255, 255, 255, 0.85);
}

.node.duration .span-bar b.r {
  border-left: 7px solid rgba(255, 255, 255, 0.85);
}

/* ---------- Arrows ---------- */
.arrow {
  position: relative;
  flex: 0 0 auto;
  width: 98px;
  height: 3px;
  align-self: center;
  margin: 0 3px;
}

.arrow .line {
  position: absolute;
  left: 0;
  right: 11px;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  background: var(--ink);
  border-radius: 2px;
}

.arrow .head {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 12px solid var(--ink);
}

.arrow .lab {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -150%);
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 17px;
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 3px 9px;
  white-space: nowrap;
  line-height: 1.35;
}

.arrow.soft .line {
  background: none;
  border-top: 3px dashed var(--ink);
  height: 0;
  top: 50%;
  opacity: 0.55;
}

.arrow.soft .head {
  border-left-color: var(--ink);
  opacity: 0.55;
}

.arrow.soft .lab {
  color: var(--muted);
  border-color: var(--muted);
}

/* ---------- Legend ---------- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  align-items: center;
  margin-top: 54px;
  padding-top: 22px;
  border-top: 3px solid var(--ink);
  font-size: 16px;
  font-weight: 600;
}

.legend .item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend .sw {
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--ink);
  flex: 0 0 auto;
}

.legend .sw.event {
  background: var(--green);
  border-radius: 6px;
}

.legend .sw.presentation {
  background: #DCE8FF;
  border-color: var(--ink);
  border-radius: 6px;
}

.legend .sw.plain {
  background: #fff;
  border-color: var(--ink);
  border-radius: 6px;
}

.legend .sw.duration {
  background: var(--green-deep);
  border-radius: 6px;
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0) 0 5px, rgba(255, 255, 255, 0.22) 5px 10px);
}

.legend .sw.arrow {
  border: none;
  background: none;
  width: 40px;
  display: flex;
  align-items: center;
  position: relative;
  height: 14px;
}

.legend .sw.arrow::before {
  content: "";
  position: absolute;
  left: 0;
  right: 10px;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  background: var(--ink);
  border-radius: 2px;
}

.legend .sw.arrow::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid var(--ink);
}

.legend .muted {
  color: var(--muted);
  font-weight: 500;
}

/* ---------- Interactivity ---------- */
.node {
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, opacity .22s ease, filter .22s ease;
}

.node:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--shadow);
}

.node:focus-visible {
  outline: 3px solid var(--present);
  outline-offset: 3px;
}

.node.is-selected {
  transform: translate(-3px, -3px);
  box-shadow: 9px 9px 0 var(--present);
}

.arrow {
  transition: opacity .22s ease, filter .22s ease;
}

.node.dim,
.arrow.dim {
  opacity: .24;
  filter: saturate(.5);
}

.node.past {
  filter: grayscale(.85);
  opacity: .5;
}

.node.past:hover {
  opacity: .7;
}

.node.past.dim {
  opacity: .18;
}

.legend .item[data-filter] {
  cursor: pointer;
  user-select: none;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 5px 10px;
  margin: -5px -2px;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.legend .item[data-filter]:hover {
  background: rgba(22, 20, 14, .07);
}

.legend .item[data-filter].is-on {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.legend .item[data-filter].is-on .muted {
  color: rgba(255, 255, 255, .7);
}

/* detail card */
.detail {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 40;
  width: min(338px, calc(100vw - 48px));
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: 16px;
  box-shadow: 7px 7px 0 var(--ink);
  padding: 18px 18px 16px;
  transform: translateY(18px) scale(.98);
  opacity: 0;
  pointer-events: none;
  transition: transform .2s ease, opacity .2s ease;
}

.detail.show {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.detail .d-cat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail .d-dot {
  width: 13px;
  height: 13px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  flex: 0 0 auto;
}

.detail .d-name {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.05;
  margin: 9px 0 13px;
  text-wrap: balance;
}

.detail .d-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 14px;
  font-size: 16px;
}

.detail .d-grid dt {
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
  align-self: center;
}

.detail .d-grid dd {
  margin: 0;
  font-weight: 600;
}

.detail .d-grid dd a {
  color: var(--present);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.detail .d-grid dd a:hover {
  color: var(--orange);
}

.detail .d-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: 2px solid var(--ink);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 21px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.detail .d-close:hover {
  background: var(--ink);
  color: #fff;
}

.hint {
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--muted);
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.hint .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--present);
  display: inline-block;
  flex: 0 0 auto;
}

@media print {

  .detail,
  .hint {
    display: none !important;
  }

  .node.dim,
  .arrow.dim {
    opacity: 1 !important;
    filter: none !important;
  }
}

@media print {
  body {
    background: #fff;
    padding: 24px;
  }

  .stamp,
  .node {
    box-shadow: 3px 3px 0 var(--ink);
  }
}
