@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Instrument+Serif:ital@0;1&display=swap");

:root {
  --bg: #f4f0e6;
  --bg-strong: #efe6d5;
  --ink: #1e1b16;
  --muted: #5b5347;
  --accent: #0b6e4f;
  --accent-2: #f76f51;
  --surface: #ffffff;
  --shadow: rgba(28, 24, 17, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff6e7 0%, #f4f0e6 45%, #ede5d7 100%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  opacity: 0.3;
  z-index: 0;
}

.bg-orb--a {
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(247, 111, 81, 0.8), rgba(247, 111, 81, 0));
  top: -140px;
  right: -120px;
}

.bg-orb--b {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(11, 110, 79, 0.8), rgba(11, 110, 79, 0));
  bottom: 40px;
  left: -80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 8vw 10px;
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
}

.back {
  position: absolute;
  left: 0;
  top: 28px;
  background-color: rgba(11, 110, 79, 0.08);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: 0% 100%;
  background-position: left center;
  color: var(--accent);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid rgba(11, 110, 79, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease,
    background-size 0.2s ease;
}

.home {
  position: absolute;
  right: 0;
  top: 28px;
  background-color: rgba(11, 110, 79, 0.08);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: 0% 100%;
  background-position: left center;
  color: var(--accent);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid rgba(11, 110, 79, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease,
    background-size 0.2s ease;
}

.back:hover,
.home:hover {
  transform: translateY(-2px);
  background-size: 100% 100%;
  color: #fff;
  box-shadow: 0 14px 30px var(--shadow);
}

.title {
  text-align: center;
}

.title h1 {
  margin: 0;
  font-size: clamp(26px, 3vw, 36px);
  font-family: "Instrument Serif", "Times New Roman", serif;
}

.title p {
  margin: 8px 0 0;
  color: var(--muted);
}

.content {
  padding: 24px 8vw 80px;
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 18px 40px var(--shadow);
}

.card--summary {
  position: static !important;
  top: auto !important;
  z-index: auto !important;
}

.card--collapsible {
  padding: 0;
  overflow: hidden;
  position: relative;
  z-index: 0;
}

.card__summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  cursor: pointer;
}

.card__summary h2 {
  margin: 0 0 6px;
}

.card__summary p {
  margin: 0;
}

.card__summary::-webkit-details-marker {
  display: none;
}

.summary__icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-strong);
  position: relative;
  flex-shrink: 0;
}

.summary__icon::before,
.summary__icon::after {
  content: "";
  position: absolute;
  background: var(--accent);
  border-radius: 2px;
}

.summary__icon::before {
  width: 16px;
  height: 2px;
  top: 17px;
  left: 10px;
}

.summary__icon::after {
  width: 2px;
  height: 16px;
  top: 10px;
  left: 17px;
  transition: transform 0.2s ease;
}

details[open] .summary__icon::after {
  transform: scaleY(0);
}

.card__body {
  padding: 0 24px 24px;
}

.card--stops {
  margin-top: 24px;
}

.card--schedule {
  margin-top: 24px;
}

.card--map {
  margin-top: 24px;
}

.card__header {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 24px;
}

.chip {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
}

.card__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 28px;
}

.card__grid h3 {
  margin: 0 0 6px;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.card__grid p {
  margin: 0;
  font-size: 16px;
}

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

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.status::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status--ok::before {
  background: #22c55e;
}

.status--off::before {
  background: #ef4444;
}

.note {
  margin-top: 24px;
  background: var(--bg-strong);
  border-radius: 18px;
  padding: 20px 24px;
}

.note h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.stops-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 320px));
  gap: 24px;
  justify-content: center;
}

.stops-col {
  text-align: left;
}

.stops-col h3 {
  margin: 0 0 14px;
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.thermo {
  list-style: none;
  margin: 0;
  padding: 0 0 0 20px;
  position: relative;
}

.thermo::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: rgba(30, 27, 22, 0.2);
}

.thermo__stop {
  position: relative;
  padding: 0 0 18px 10px;
}

.thermo__stop::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(11, 110, 79, 0.16);
}

.thermo__stop:last-child {
  padding-bottom: 0;
}

.thermo__stop:last-child::before {
  background: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(247, 111, 81, 0.2);
}

.thermo__label {
  display: block;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.schedule-grid--highlight {
  animation: schedulePulse 0.9s ease;
}

@keyframes schedulePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(11, 110, 79, 0.2);
  }
  100% {
    box-shadow: 0 0 0 18px rgba(11, 110, 79, 0);
  }
}

.now-panel {
  background: var(--bg-strong);
  border-radius: 18px;
  padding: 16px;
  border: 1px solid rgba(30, 27, 22, 0.08);
  margin-bottom: 18px;
}

.now-panel--shake {
  animation: nowShake 0.5s ease;
}

@keyframes nowShake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

.now-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.now-panel__header h3 {
  margin: 0 0 4px;
}

.now-panel__header p {
  margin: 0;
}

.now-next {
  border: 1px solid rgba(11, 110, 79, 0.4);
  background-color: rgba(11, 110, 79, 0.08);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: 0% 100%;
  background-position: left center;
  color: var(--accent);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease,
    background-size 0.2s ease;
}

.now-next:hover:not(:disabled) {
  transform: translateY(-1px);
  background-size: 100% 100%;
  color: #fff;
  box-shadow: 0 10px 24px var(--shadow);
}

.now-next:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.now-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.now-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  padding: 8px 12px;
}

.now-time {
  font-weight: 700;
  min-width: 52px;
}

.now-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.now-chip--ida {
  background: var(--accent);
}

.now-chip--volta {
  background: var(--accent-2);
}

.now-in {
  color: var(--muted);
  font-size: 14px;
}

.schedule-row--next {
  background: rgba(11, 110, 79, 0.12);
}

.schedule-cell--next {
  font-weight: 700;
  color: var(--accent);
}

.schedule-filter {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.schedule-filter__button {
  border: 1px solid rgba(11, 110, 79, 0.4);
  background-color: rgba(11, 110, 79, 0.08);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: 0% 100%;
  background-position: left center;
  color: var(--accent);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease,
    background-size 0.2s ease;
}

.schedule-filter__button:hover,
.schedule-filter__button.is-active {
  transform: translateY(-1px);
  background-size: 100% 100%;
  color: #fff;
  box-shadow: 0 10px 24px var(--shadow);
}

.schedule-empty {
  margin: 6px 0 16px;
  display: none;
}

.schedule-block {
  background: var(--bg-strong);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(30, 27, 22, 0.08);
}

.schedule-block__title {
  background: var(--accent);
  color: #fff;
  padding: 12px 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 13px;
}

.schedule-block__head,
.schedule-block__sub,
.schedule-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.schedule-block__head {
  background: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid rgba(30, 27, 22, 0.12);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.schedule-block__sub {
  border-bottom: 1px solid rgba(30, 27, 22, 0.12);
  font-weight: 600;
}

.schedule-col__tag,
.schedule-col__sub,
.schedule-row span {
  padding: 8px 14px;
  text-align: center;
}

.schedule-block__head .schedule-col__tag:nth-child(2),
.schedule-block__sub .schedule-col__sub:nth-child(2),
.schedule-row span:nth-child(2) {
  border-left: 1px solid rgba(30, 27, 22, 0.12);
}

.schedule-block__rows {
  max-height: 420px;
  overflow-y: auto;
}

.schedule-row span {
  padding: 6px 14px;
  font-variant-numeric: tabular-nums;
}

.schedule-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.6);
}

.map {
  height: 520px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(30, 27, 22, 0.08);
}

.legend {
  display: flex;
  gap: 12px;
  margin: 0 0 16px;
  flex-wrap: wrap;
}

.legend-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
  flex-wrap: wrap;
}

.legend-bar .legend {
  margin: 0;
}

.legend__user {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(11, 110, 79, 0.4);
  background-color: rgba(11, 110, 79, 0.08);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: 0% 100%;
  background-position: left center;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease,
    background-size 0.2s ease;
}

.legend__user:hover:not(:disabled) {
  transform: translateY(-2px);
  background-size: 100% 100%;
  color: #fff;
  box-shadow: 0 10px 24px var(--shadow);
}

.legend__user:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-strong);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.legend__item::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.legend__item--ida::before {
  background: var(--accent);
}

.legend__item--vuelta::before {
  background: var(--accent-2);
}

.legend__item.is-active {
  background: var(--accent);
  color: #fff;
  border-color: rgba(11, 110, 79, 0.4);
}

.legend__item--vuelta.is-active {
  background: var(--accent-2);
  border-color: rgba(247, 111, 81, 0.4);
}

.legend__item.is-active::before {
  background: #fff;
}

@media (max-width: 900px) {
  .card__grid {
    grid-template-columns: 1fr;
  }

  .card--summary {
    position: static;
  }

  .stops-grid {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .topbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 16px 6vw 6px;
    justify-items: stretch;
  }

  .back {
    position: static;
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    text-align: center;
  }

  .home {
    position: static;
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    text-align: center;
  }

  .title {
    grid-column: 1 / -1;
    margin-top: 6px;
  }

  .map {
    height: 380px;
  }
}
