/* Na jednej linii — layered on top of styles.css and kolo-zycia.css.
   Timeline is the centerpiece: birth → past events → today → future goals.
   Past events use a forest/sage tint; goals use sun/coral. */

:root {
  --past: oklch(43% 0.095 153);
  --past-soft: oklch(94% 0.04 145 / 0.7);
  --past-glow: oklch(43% 0.095 153 / 0.16);
  --future: oklch(60% 0.13 65);
  --future-soft: oklch(94% 0.05 80 / 0.7);
  --future-glow: oklch(60% 0.13 65 / 0.18);
  --today: oklch(35% 0.08 220);
  --today-soft: oklch(92% 0.025 220 / 0.7);
}

/* ---------- Step indicator: 6 steps ---------- */

.step-indicator-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.step-indicator-6 li {
  padding: 10px 10px;
  font-size: 0.78rem;
  gap: 8px;
}

.step-indicator-6 .step-num {
  width: 24px;
  height: 24px;
  font-size: 0.74rem;
}

/* ---------- Step 1: intro form ---------- */

.intro-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  max-width: 640px;
  margin: 4px auto 0;
}

.intro-form .step-helper {
  grid-column: 1 / -1;
  margin: 4px 0 0;
}

.field-large {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-large > span {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.field-large input {
  padding: 12px 14px;
  font-size: 1.05rem;
  font-family: inherit;
  color: var(--ink);
  background: oklch(99% 0.008 95);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.field-large input:focus {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 3px oklch(42% 0.1 153 / 0.18);
}

/* ---------- Timeline ---------- */

.timeline-wrap {
  position: relative;
  margin: 6px 0 28px;
  padding: 28px 18px 56px;
  background: oklch(99% 0.008 95 / 0.6);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: visible;
}

.timeline-wrap-result {
  margin: 0 0 24px;
}

.timeline {
  position: relative;
  height: 78px;
}

.timeline-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  transform: translateY(-50%);
  background: linear-gradient(
    to right,
    var(--past) 0%,
    var(--past) var(--today-pct, 50%),
    var(--future) var(--today-pct, 50%),
    var(--future) 100%
  );
  border-radius: 3px;
}

.timeline-arrow {
  position: absolute;
  top: 50%;
  right: -2px;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 7px 0 7px 12px;
  border-color: transparent transparent transparent var(--future);
}

/* Endpoint markers (birth + today). Birth is a filled dot, "today"
   is a pulsing ring so it's always findable on the line. */
.timeline-endpoint {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.timeline-endpoint.is-birth {
  --c: var(--past);
}

.timeline-endpoint.is-today {
  --c: var(--today);
}

.timeline-endpoint-dot {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--c);
  border: 3px solid var(--paper);
  box-shadow: 0 0 0 1px var(--c);
}

.timeline-endpoint-label {
  position: absolute;
  top: calc(50% + 18px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: Georgia, Times New Roman, serif;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-green);
  text-align: center;
  line-height: 1.2;
}

/* Birth sits at 0% — anchor its label to the LEFT of the dot so it
   doesn't overflow the timeline frame. */
.timeline-endpoint.is-birth .timeline-endpoint-label {
  left: 0;
  transform: translateX(0);
  text-align: left;
  max-width: 160px;
}

.timeline-endpoint-label small {
  display: block;
  margin-top: 2px;
  font-family: Manrope, system-ui, sans-serif;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Year markers (past = below the line, future = above).
   <button> reset so we don't get the native rectangle around the dot. */
.timeline-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.timeline-marker:focus-visible {
  outline: none;
}

.timeline-marker-pin {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--paper);
  border: 2.5px solid var(--c, var(--past));
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease);
}

.timeline-marker.is-past { --c: var(--past); }
.timeline-marker.is-future { --c: var(--future); }

.timeline-marker:hover .timeline-marker-pin,
.timeline-marker.is-active .timeline-marker-pin,
.timeline-marker:focus-visible .timeline-marker-pin {
  transform: scale(1.35);
  box-shadow: 0 0 0 6px oklch(from var(--c) l c h / 0.15);
}

/* Stack count badge for years with >1 events */
.timeline-marker-count {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  background: var(--c, var(--past));
  color: var(--paper);
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  border: 2px solid var(--paper);
}

.timeline-marker-year {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: Manrope, system-ui, sans-serif;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--c, var(--past));
  pointer-events: none;
}

.timeline-marker.is-past .timeline-marker-year {
  top: calc(50% + 14px);
}

.timeline-marker.is-future .timeline-marker-year {
  bottom: calc(50% + 14px);
}

/* Tooltip: appears on hover/tap of marker */
.timeline-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 160px;
  max-width: 260px;
  padding: 10px 12px;
  background: oklch(20% 0.04 145);
  color: oklch(96% 0.012 95);
  border-radius: 10px;
  box-shadow: 0 12px 30px oklch(20% 0.04 145 / 0.3);
  font-size: 0.86rem;
  line-height: 1.35;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
}

.timeline-tooltip.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.timeline-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-style: solid;
}

.timeline-tooltip.points-down::after {
  bottom: -6px;
  border-width: 6px 5px 0 5px;
  border-color: oklch(20% 0.04 145) transparent transparent transparent;
}

.timeline-tooltip.points-up::after {
  top: -6px;
  border-width: 0 5px 6px 5px;
  border-color: transparent transparent oklch(20% 0.04 145) transparent;
}

.timeline-tooltip-year {
  font-family: Manrope, system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 4px;
}

.timeline-tooltip-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline-tooltip-list li {
  margin: 2px 0;
}

.timeline-tooltip-list li + li {
  padding-top: 4px;
  border-top: 1px solid oklch(96% 0.012 95 / 0.15);
  margin-top: 4px;
}

.timeline-tooltip-list .item-date {
  display: block;
  font-size: 0.72rem;
  opacity: 0.7;
  margin-top: 2px;
}

/* ---------- Entry block (events / goals) ---------- */

.entry-block {
  --accent: var(--past);
  --accent-soft: var(--past-soft);
  --accent-glow: var(--past-glow);
  margin: 0 0 8px;
  padding: 18px 18px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 30px oklch(32% 0.04 125 / 0.06);
  position: relative;
}

.entry-block-future {
  --accent: var(--future);
  --accent-soft: var(--future-soft);
  --accent-glow: var(--future-glow);
}

.entry-block::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  opacity: 0.85;
}

.entry-block-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.entry-block-label {
  margin: 0;
  font-family: Georgia, Times New Roman, serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--ink-green);
}

.entry-block-count {
  margin-left: auto;
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

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

.entry-list:empty {
  margin-bottom: 0;
}

/* Each row: title + year + (optional date toggle) + remove */
.entry-row {
  display: grid;
  grid-template-columns: 1fr 100px 36px 32px;
  gap: 8px;
  align-items: center;
  padding: 8px 8px 8px 12px;
  background: oklch(98% 0.012 96 / 0.7);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 180ms var(--ease), background 180ms var(--ease);
  animation: entry-in 240ms var(--ease);
}

@keyframes entry-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.entry-row:hover,
.entry-row.is-highlight {
  border-color: var(--accent);
  background: var(--paper);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.entry-row input[type="text"],
.entry-row input[type="number"],
.entry-row input[type="date"] {
  width: 100%;
  padding: 7px 10px;
  font-size: 0.94rem;
  font-family: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
}

.entry-row input:hover {
  border-color: var(--line);
}

.entry-row input:focus {
  outline: none;
  border-color: var(--accent);
  background: oklch(99% 0.008 95);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.entry-row input[type="number"] {
  text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.entry-row input[type="number"]::-webkit-outer-spin-button,
.entry-row input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.entry-row input[type="date"] {
  font-size: 0.86rem;
}

.entry-date-toggle {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease);
  font-size: 0.92rem;
}

.entry-date-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.entry-date-toggle.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.entry-row.has-fulldate {
  grid-template-columns: 1fr 150px 36px 32px;
}

.entry-remove {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
}

.entry-remove svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.entry-remove:hover {
  background: oklch(58% 0.13 35 / 0.12);
  color: oklch(58% 0.13 35);
}

.entry-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: 1px dashed var(--accent);
  border-radius: 9px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms var(--ease);
}

.entry-add svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.entry-add:hover {
  background: var(--accent-soft);
}

/* ---------- Step 3 / 5: helpers under each entry ---------- */

.entry-list-helpers {
  gap: 12px;
}

.entry-helper-row {
  padding: 12px;
  background: oklch(98% 0.012 96 / 0.7);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: entry-in 240ms var(--ease);
}

.entry-helper-anchor {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.entry-helper-year {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.entry-helper-title {
  font-family: Georgia, Times New Roman, serif;
  font-size: 1.02rem;
  font-weight: 500;
  color: var(--ink-green);
}

.entry-helper-input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.94rem;
  line-height: 1.45;
  color: var(--ink);
  background: oklch(99% 0.008 95);
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.entry-helper-input::placeholder {
  color: oklch(60% 0.02 145);
  font-style: italic;
}

.entry-helper-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.entry-empty {
  margin: 6px 0;
  color: var(--muted);
  font-style: italic;
  font-size: 0.92rem;
}

/* ---------- Step 4 / 5: context recap (events + helpers shown for inspiration) ---------- */

.context-recap {
  margin: 0 0 18px;
  padding: 12px 16px;
  background: oklch(98% 0.012 96 / 0.7);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.context-recap > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: Manrope, system-ui, sans-serif;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--past);
  user-select: none;
}

.context-recap > summary::-webkit-details-marker {
  display: none;
}

.context-recap > summary::marker {
  display: none;
}

.context-recap-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  background: var(--past-soft);
  color: var(--past);
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

.context-recap-chevron {
  margin-left: auto;
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: transform 220ms var(--ease);
}

.context-recap[open] .context-recap-chevron {
  transform: rotate(180deg);
}

.context-recap-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.context-recap-item {
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.context-recap-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.context-recap-head .entry-helper-year {
  background: var(--past-soft);
  color: var(--past);
}

.context-recap-title-text {
  font-family: Georgia, Times New Roman, serif;
  font-size: 0.96rem;
  font-weight: 500;
  color: var(--ink-green);
  line-height: 1.3;
}

.context-recap-helpers {
  margin: 2px 0 0;
  font-size: 0.84rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.4;
}

.context-recap-empty {
  list-style: none;
  margin: 8px 0 0;
  color: var(--muted);
  font-style: italic;
  font-size: 0.9rem;
}

/* ---------- Step 6: result view ---------- */

.line-result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

.notes-block-full {
  display: block;
  margin-top: 8px;
}

.line-result-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 14px;
  background: oklch(99% 0.008 95 / 0.7);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.line-result-side:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.line-result-side.is-past {
  --accent: var(--past);
  --accent-soft: var(--past-soft);
  --accent-glow: var(--past-glow);
}

.line-result-side.is-future {
  --accent: var(--future);
  --accent-soft: var(--future-soft);
  --accent-glow: var(--future-glow);
}

.line-result-side h3 {
  margin: 0 0 4px;
  font-family: Georgia, Times New Roman, serif;
  font-size: 1.02rem;
  font-weight: 500;
  color: var(--ink-green);
  display: flex;
  align-items: center;
  gap: 8px;
}

.line-result-side h3::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.line-result-card {
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.line-result-card-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.line-result-card-year {
  display: inline-flex;
  padding: 1px 7px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.line-result-card-title {
  font-family: Georgia, Times New Roman, serif;
  font-size: 0.98rem;
  color: var(--ink-green);
  font-weight: 500;
}

.line-result-card-helpers {
  font-size: 0.86rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.4;
}

.line-result-empty {
  margin: 0;
  color: var(--muted);
  font-style: italic;
  font-size: 0.9rem;
}

.grid-caption {
  margin: 0 0 22px;
  text-align: center;
  font-size: 0.84rem;
  color: var(--muted);
}

/* ---------- Mobile ---------- */

@media (max-width: 760px) {
  .step-indicator-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
  }

  .step-indicator-6 li {
    padding: 8px 4px;
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }

  .step-indicator-6 .step-name {
    font-size: 0.66rem;
    line-height: 1.1;
  }

  .step-indicator-6 .step-num {
    width: 22px;
    height: 22px;
  }

  .intro-form {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* Timeline: scale down + horizontal scroll for many markers */
  .timeline-wrap {
    padding: 22px 14px 50px;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  .timeline {
    min-width: 100%;
    height: 70px;
  }

  .timeline-endpoint-label {
    font-size: 0.74rem;
  }

  .timeline-endpoint-label small {
    font-size: 0.6rem;
  }

  .timeline-marker-year {
    font-size: 0.66rem;
  }

  /* Entry rows: stack title above year on phones */
  .entry-row,
  .entry-row.has-fulldate {
    grid-template-columns: 1fr 36px 32px;
    grid-template-areas:
      "title  toggle remove"
      "year   year   year";
    gap: 6px 8px;
  }

  .entry-row > input[type="text"] {
    grid-area: title;
  }

  .entry-row > input[type="number"],
  .entry-row > input[type="date"] {
    grid-area: year;
  }

  .entry-row > .entry-date-toggle {
    grid-area: toggle;
  }

  .entry-row > .entry-remove {
    grid-area: remove;
  }

  .line-result {
    grid-template-columns: 1fr;
  }

  .context-recap-list {
    grid-template-columns: 1fr;
  }
}

/* Print/screen-reader friendly: hide tooltip when not visible */
.timeline-tooltip[hidden] {
  display: none !important;
}
