/* =============================================
   TimeFrame — Cinematic historical time-travel UI
   ============================================= */

:root {
  --navy-deep: #0a0e1a;
  --navy-mid: #121828;
  --navy-light: #1a2236;
  --gold: #c9a84c;
  --gold-bright: #e8c96a;
  --gold-dim: #8a7340;
  --parchment: #f0e6d3;
  --parchment-dim: #c4b89a;
  --off-white: #faf7f2;
  --text-muted: #9a9488;
  --error: #c45c5c;
  --success: #6a9e6a;

  --font-display: "Cinzel", Georgia, serif;
  --font-body: "Lora", Georgia, serif;

  --radius: 4px;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--parchment);
  background: var(--navy-deep);
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(201, 168, 76, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 80%, rgba(26, 34, 54, 0.9) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(26, 34, 54, 0.7) 0%, transparent 40%);
  overflow-x: hidden;
}

/* Ambient portal glow */
.portal-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(120px);
  opacity: 0.15;
}

.portal-glow--top {
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
}

.portal-glow--bottom {
  bottom: -300px;
  right: -100px;
  background: #2a3a6a;
}

/* ---- Hero / Search ---- */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 4rem 1.5rem 3rem;
  max-width: 640px;
  margin: 0 auto;
}

.hero__tagline {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 0.75rem;
}

.hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 700;
  color: var(--gold-bright);
  text-shadow: 0 0 40px rgba(201, 168, 76, 0.3);
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.hero__subtitle {
  font-size: 1.05rem;
  color: var(--parchment-dim);
  font-style: italic;
  margin-bottom: 2.5rem;
}

.travel-form__label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.75rem;
}

.travel-form__row {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.travel-form__input {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  text-align: center;
  width: 180px;
  padding: 0.75rem 1rem;
  background: var(--navy-mid);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  color: var(--off-white);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.travel-form__input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2);
}

.travel-form__input::placeholder {
  color: var(--text-muted);
}

.travel-form__button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.85rem 1.75rem;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
  border: none;
  border-radius: var(--radius);
  color: var(--navy-deep);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.travel-form__button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(201, 168, 76, 0.4);
}

.travel-form__button:active {
  transform: translateY(0);
}

.travel-form__button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.travel-form__button-icon {
  font-size: 1.1rem;
}

.travel-form__hint {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---- Loading overlay ---- */
.loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(4px);
}

.loading__portal {
  text-align: center;
}

.loading__ring {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem;
  border: 2px solid var(--gold-dim);
  border-top-color: var(--gold-bright);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading__text {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Results ---- */
.results {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.year-banner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.year-banner__line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

.year-banner__year {
  font-family: var(--font-display);
  font-size: clamp(3rem, 12vw, 6rem);
  font-weight: 700;
  color: var(--off-white);
  text-shadow: 0 0 60px rgba(201, 168, 76, 0.25);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* ---- Timeline layout ---- */
.timeline {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0 2rem;
  align-items: start;
}

.timeline__spine {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 2rem;
  min-height: 100%;
}

.timeline__spine-line {
  width: 2px;
  flex: 1;
  min-height: 200px;
  background: linear-gradient(180deg, var(--gold-dim), var(--gold), var(--gold-dim));
  opacity: 0.5;
}

.timeline__spine-node {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 16px rgba(201, 168, 76, 0.6);
  margin-top: -7px;
}

/* ---- Panels ---- */
.panel-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(201, 168, 76, 0.2);
}

.panel-header__badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--navy-deep);
  background: var(--gold);
  padding: 0.25rem 0.75rem;
  border-radius: 2px;
  margin-bottom: 0.75rem;
}

.panel-header__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--off-white);
  margin-bottom: 0.25rem;
}

.panel-header__source {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.panel-content {
  min-height: 120px;
}

/* ---- History events ---- */
.history-summary {
  font-size: 0.95rem;
  color: var(--parchment-dim);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.event-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.event-item {
  position: relative;
  padding-left: 1.25rem;
  border-left: 2px solid var(--gold-dim);
}

.event-item::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 0.55rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}

.event-item__text {
  font-size: 0.92rem;
  color: var(--parchment);
  line-height: 1.55;
}

.wikipedia-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.5rem;
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.wikipedia-link:hover {
  border-bottom-color: var(--gold);
}

/* ---- Art cards (museum placards) ---- */
.art-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.art-card {
  background: var(--navy-mid);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s, transform 0.2s;
}

.art-card:hover {
  border-color: rgba(201, 168, 76, 0.35);
  transform: translateY(-2px);
}

.art-card__image-wrap {
  position: relative;
  background: var(--navy-light);
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.art-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.art-card__placard {
  padding: 1.25rem;
  border-top: 3px solid var(--gold-dim);
  background: linear-gradient(180deg, var(--navy-mid) 0%, rgba(18, 24, 40, 0.95) 100%);
}

.art-card__title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--off-white);
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.art-card__meta {
  font-size: 0.82rem;
  color: var(--parchment-dim);
  line-height: 1.6;
}

.art-card__meta dt {
  display: inline;
  font-weight: 600;
  color: var(--gold-dim);
}

.art-card__meta dt::after {
  content: ": ";
}

.art-card__meta dd {
  display: inline;
  margin: 0;
}

.art-card__meta dd::after {
  content: "\A";
  white-space: pre;
}

.art-card__link {
  display: inline-block;
  margin-top: 0.75rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  text-decoration: none;
}

.art-card__link:hover {
  text-decoration: underline;
}

/* ---- Messages ---- */
.message {
  padding: 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.6;
}

.message--error {
  background: rgba(196, 92, 92, 0.12);
  border: 1px solid rgba(196, 92, 92, 0.3);
  color: #e8a0a0;
}

.message--info {
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid rgba(201, 168, 76, 0.2);
  color: var(--parchment-dim);
}

/* ---- Footer ---- */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(201, 168, 76, 0.1);
}

.footer a {
  color: var(--gold-dim);
  text-decoration: none;
}

.footer a:hover {
  color: var(--gold);
}

/* ---- Utility ---- */
.hidden {
  display: none !important;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .timeline {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .timeline__spine {
    display: none;
  }

  .hero {
    padding-top: 2.5rem;
  }

  .travel-form__row {
    flex-direction: column;
    align-items: center;
  }

  .travel-form__input {
    width: 100%;
    max-width: 280px;
  }

  .travel-form__button {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  .year-banner__year {
    font-size: clamp(2.5rem, 15vw, 4rem);
  }
}
