/* ============================================
   ALLSTATION LABORATORY — Main Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Crimson+Text:ital,wght@0,400;0,600;1,400&family=EB+Garamond:wght@300;400;500&family=Inter:wght@300;400;500&display=swap');

:root {
  --blue-primary:   #6B9AC4;
  --blue-light:     #A8C5E0;
  --blue-dark:      #4A7C9E;
  --blue-pale:      #E8F1F8;
  --brown-warm:     #8B7355;
  --brown-light:    #C4B5A0;
  --brown-pale:     #F5F0E8;
  --white:          #FFFFFF;
  --off-white:      #F8F9FA;
  --sand-beige:     #E8E3D5;
  --text-dark:      #2C3E50;
  --text-medium:    #546E7A;
  --text-light:     #7F9BA6;
  --nav-height:     64px;
  --max-width:      1200px;
  --radius:         8px;
  --shadow:         0 4px 20px rgba(0,0,0,0.08);
  --shadow-hover:   0 10px 32px rgba(107,154,196,0.22);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Crimson Text', Georgia, serif;
  color: var(--text-dark);
  background: transparent;
  overflow-x: hidden;
  line-height: 1.7;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--sand-beige); }
::-webkit-scrollbar-thumb { background: var(--blue-light); border-radius: 3px; }

/* ── NAVIGATION ── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--brown-warm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.nav-logo {
  font-family: 'Times New Roman', serif;
  font-size: 1.25rem;
  font-weight: 400;
  color: rgba(255,255,255,0.92);
  letter-spacing: 0.06em;
  transition: opacity 0.3s;
}
.nav-logo:hover { opacity: 0.75; }
.nav-links { display: flex; gap: 2.2rem; align-items: center; }
.nav-links a {
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  transition: color 0.25s;
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -3px; left: 0; right: 0;
  height: 1px;
  background: rgba(255,255,255,0.6);
  transform: scaleX(0);
  transition: transform 0.25s;
}
.nav-links a:hover { color: #fff; }
.nav-links a:hover::after,
.nav-links a.active::after { transform: scaleX(1); }
.nav-links a.active { color: #fff; }
.hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; padding: 4px; }
.hamburger span { display: block; width: 24px; height: 2px; background: rgba(255,255,255,0.9); border-radius: 2px; transition: all 0.3s; }
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ── LANDSCAPE BACKGROUND ── */
.landscape-bg {
  position: fixed; inset: 0; z-index: -2;
  background: linear-gradient(180deg,
    #b8d4e8 0%, #c9e0f0 15%,
    #d8ecd8 38%, #c8e0b8 55%,
    #b8d4a0 70%, #a8c888 85%, #98bc70 100%
  );
}
.landscape-svg {
  position: fixed; inset: 0; z-index: -1;
  width: 100%; height: 100%; opacity: 0.85;
}
.landscape-overlay {
  position: fixed; inset: 0; z-index: -1;
  background: rgba(0,0,0,0);
}

/* ── TRAIN ──
   Track sits at a fixed % from bottom.
   Train wheels sit ON the track (not above it).
   Home: track at 20% from bottom.
   Other pages: track at 10% from bottom.
*/
.train-track {
  position: fixed;
  left: 0; right: 0;
  height: 8px;
  z-index: 9;
  pointer-events: none;
}
/* train-container matches the track position exactly;
   the train SVG is positioned so wheels sit on the track line */
.train-container {
  position: fixed;
  left: 0;
  width: 100%;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
  /* height = train SVG height (75px) + a little room */
  height: 84px;
}
/* align bottom of train-container with top of track */
/* set per-page via inline style: bottom = track-bottom + 8px */

.train-wrapper {
  position: absolute;
  bottom: 0;           /* wheels at bottom of container = on the track */
  animation: trainJourney 16s ease-in-out forwards;
  opacity: 0;
}
@keyframes trainJourney {
  0%   { transform: translateX(-700px); opacity: 0; }
  4%   { opacity: 1; }
  93%  { opacity: 1; }
  100% { transform: translateX(calc(100vw + 700px)); opacity: 0; }
}

/* ── HOME HERO ── */
.home-page { min-height: 100vh; display: flex; flex-direction: column; }
.hero {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100vh;
  padding: var(--nav-height) 2rem 0;
  text-align: center;
  position: relative;
}
.hero-content {
  position: relative; z-index: 2;
  animation: fadeUp 1.2s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
.allstation-title {
  font-family: 'Times New Roman', serif;
  font-size: clamp(4rem, 10vw, 8.5rem);
  font-weight: 300;
  color: #A8D4F0;
  letter-spacing: 0.12em;
  line-height: 1;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 20px rgba(0,0,0,0.7), 0 0 60px rgba(30,80,140,0.5), 0 4px 4px rgba(0,0,0,0.3);
}
.hero-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.78rem, 1.8vw, 1rem);
  font-weight: 300;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.95);
  text-shadow: 0 1px 8px rgba(0,0,0,0.55);
  margin-bottom: 0.35rem;
  animation: fadeUp 1.2s ease 0.2s both;
}
.hero-tagline {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 1.2rem;
  color: rgba(255,255,255,0.90);
  margin-top: 0.6rem;
  animation: fadeUp 1.2s ease 0.4s both;
}
.hero-divider { margin: 2rem auto; display: block; animation: fadeUp 1.2s ease 0.5s both; }
.hero-cta { display: flex; gap: 1.2rem; justify-content: center; flex-wrap: wrap; animation: fadeUp 1.2s ease 0.6s both; margin-top: 2rem; }
.btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.75rem 2rem;
  border-radius: 40px;
  border: 1.5px solid var(--blue-primary);
  transition: all 0.3s ease; cursor: pointer;
}
.btn-primary { background: var(--blue-primary); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(107,154,196,0.4); }
.btn-secondary { background: rgba(255,255,255,0.18); color: #ffffff; border-color: rgba(255,255,255,0.75); backdrop-filter: blur(4px); }
.btn-secondary:hover { background: rgba(255,255,255,0.30); transform: translateY(-2px); border-color: #ffffff; }

/* ── PAGES ── */
.page-content { padding-top: calc(var(--nav-height) + 3rem); padding-bottom: 8rem; min-height: 100vh; }
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 2.5rem 3rem;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 14px;
  box-shadow: 0 6px 40px rgba(0,0,0,0.16);
}
.page-header { margin-bottom: 3.5rem; animation: fadeUp 0.8s ease both; }
.page-header h1 { font-family: 'Times New Roman', serif; font-size: clamp(2rem, 4vw, 3rem); font-weight: 400; color: var(--text-dark); margin-bottom: 0.5rem; }
.page-header .header-sub { font-family: 'Inter', sans-serif; font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-light); }
.wavy-underline { display: block; margin: 0.6rem 0 0; }

/* ── SECTION DIVIDER (for projects page sections) ── */
.section-divider {
  margin: 3.5rem 0 2.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.section-divider h2 {
  font-family: 'Times New Roman', serif;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 400;
  color: var(--text-dark);
  white-space: nowrap;
}
.section-divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--blue-light), transparent);
}
.section-tag {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue-primary);
  background: var(--blue-pale);
  border: 1px solid var(--blue-light);
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
}

/* ── PROJECT CARDS ── */
.projects-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.project-card {
  background: var(--white);
  border: 2px solid var(--blue-primary);
  border-radius: var(--radius);
  padding: 1.8rem;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s;
  position: relative; overflow: hidden;
  animation: fadeUp 0.7s ease both;
}
.project-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(107,154,196,0.04) 0%, transparent 60%);
  pointer-events: none;
}
.project-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); border-color: var(--blue-dark); }
.project-image {
  width: 100%; height: 160px;
  background: var(--blue-pale); border-radius: 5px;
  margin-bottom: 1.2rem; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.project-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.project-card:hover .project-image img { transform: scale(1.04); }
.project-meta { font-family: 'Inter', sans-serif; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue-primary); margin-bottom: 0.5rem; }
.project-title { font-family: 'Times New Roman', serif; font-size: 1.12rem; font-weight: 400; color: var(--text-dark); margin-bottom: 0.7rem; line-height: 1.4; }
.project-summary { font-family: 'Crimson Text', serif; font-size: 0.98rem; color: var(--text-medium); line-height: 1.6; margin-bottom: 1rem; }
.project-finding { background: rgba(107,154,196,0.08); border-left: 3px solid var(--blue-primary); padding: 0.7rem 0.9rem; margin-bottom: 1.2rem; border-radius: 0 4px 4px 0; }
.project-finding strong { font-family: 'Inter', sans-serif; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--blue-dark); display: block; margin-bottom: 0.25rem; }
.project-finding p { font-family: 'Crimson Text', serif; font-size: 0.95rem; color: var(--text-dark); line-height: 1.5; }
.read-more { font-family: 'Inter', sans-serif; font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--blue-dark); font-weight: 500; display: inline-flex; align-items: center; gap: 0.4rem; transition: gap 0.25s, color 0.25s; }
.read-more:hover { color: var(--blue-primary); gap: 0.7rem; }
.project-card.placeholder { border-style: dashed; border-color: var(--brown-light); background: var(--brown-pale); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 280px; color: var(--text-light); }
.placeholder-icon { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.5; }
.project-card.placeholder .project-title { color: var(--text-light); font-style: italic; }

/* Article cards (slightly different style - warm toned) */
.articles-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.6rem; }
.article-card {
  background: var(--white);
  border: 1.5px solid var(--brown-light);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: fadeUp 0.7s ease both;
}
.article-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(139,115,85,0.18); }
.article-meta { font-family: 'Inter', sans-serif; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brown-warm); margin-bottom: 0.5rem; }
.article-title { font-family: 'Times New Roman', serif; font-size: 1.08rem; font-weight: 400; color: var(--text-dark); margin-bottom: 0.6rem; line-height: 1.45; }
.article-summary { font-family: 'Crimson Text', serif; font-size: 0.95rem; color: var(--text-medium); line-height: 1.6; margin-bottom: 1rem; }
.article-link { font-family: 'Inter', sans-serif; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brown-warm); font-weight: 500; display: inline-flex; align-items: center; gap: 0.4rem; transition: gap 0.25s, color 0.25s; }
.article-link:hover { color: var(--text-dark); gap: 0.7rem; }

/* ── ABOUT PAGE ── */
.about-section { margin-bottom: 4rem; animation: fadeUp 0.8s ease both; }
.about-section h2 { font-family: 'Times New Roman', serif; font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 400; color: var(--text-dark); margin-bottom: 0.4rem; }
.about-section p { font-family: 'Crimson Text', serif; font-size: 1.08rem; color: var(--text-medium); line-height: 1.85; max-width: 68ch; margin-bottom: 1.1rem; }
.about-divider { border: none; border-top: 1px solid var(--sand-beige); margin: 3.5rem 0; }
.about-creator { display: grid; grid-template-columns: 240px 1fr; gap: 3rem; align-items: start; }
.creator-photo { width: 100%; aspect-ratio: 3/4; border-radius: var(--radius); overflow: hidden; background: var(--blue-pale); border: 2px solid var(--blue-light); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; }
.creator-photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-placeholder { font-size: 4rem; opacity: 0.35; user-select: none; }
.creator-links { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1.5rem; }
.creator-link { font-family: 'Inter', sans-serif; font-size: 0.82rem; letter-spacing: 0.06em; color: var(--blue-dark); display: flex; align-items: center; gap: 0.5rem; transition: color 0.2s, gap 0.2s; }
.creator-link:hover { color: var(--blue-primary); gap: 0.8rem; }
.highlight-box { background: var(--blue-pale); border: 1px solid var(--blue-light); border-radius: var(--radius); padding: 1.2rem 1.5rem; margin: 1.5rem 0; }
.highlight-box p { font-style: italic; color: var(--blue-dark); margin: 0; }

/* ── FOOTER ── */
.footer { background: var(--brown-warm); color: rgba(255,255,255,0.85); padding: 2.5rem 2rem; text-align: center; position: relative; z-index: 5; }
.footer-inner { max-width: var(--max-width); margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 1.2rem; }
.footer-brand { font-family: 'Times New Roman', serif; font-size: 1.1rem; letter-spacing: 0.12em; color: rgba(255,255,255,0.7); }
.social-links { display: flex; gap: 2rem; align-items: center; flex-wrap: wrap; justify-content: center; }
.social-links a { font-family: 'Inter', sans-serif; font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255,255,255,0.75); display: flex; align-items: center; gap: 0.4rem; transition: color 0.25s; }
.social-links a:hover { color: #fff; }
.footer-copy { font-family: 'Inter', sans-serif; font-size: 0.72rem; letter-spacing: 0.06em; color: rgba(255,255,255,0.4); }

/* ── SCROLL REVEAL ── */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .articles-grid  { grid-template-columns: repeat(2, 1fr); }
  .about-creator  { grid-template-columns: 200px 1fr; gap: 2rem; }
}
@media (max-width: 768px) {
  .nav-links { display: none; position: fixed; top: var(--nav-height); left: 0; right: 0; background: var(--brown-warm); flex-direction: column; padding: 1.5rem 2rem; gap: 1.5rem; box-shadow: 0 8px 20px rgba(0,0,0,0.15); }
  .nav-links.open { display: flex; }
  .hamburger { display: flex; }
  .projects-grid { grid-template-columns: 1fr; }
  .articles-grid  { grid-template-columns: 1fr; }
  .about-creator  { grid-template-columns: 1fr; }
  .creator-photo  { width: 160px; aspect-ratio: 1/1; margin: 0 auto; }
}
@media (max-width: 480px) {
  .hero-cta { flex-direction: column; align-items: center; }
  .btn { width: 100%; max-width: 240px; text-align: center; justify-content: center; }
  .navbar { padding: 0 1.2rem; }
  .container { padding: 0 1.2rem; }
  .page-content { padding-top: calc(var(--nav-height) + 2rem); }
}

/* ── TRAIN FIXES ── */
/* Track: fixed only on homepage; absolute (at page bottom) on inner pages.
   Controlled via .track-fixed vs .track-absolute classes. */
.train-track {
  left: 0; right: 0;
  height: 8px;
  z-index: 9;
  pointer-events: none;
}
.track-fixed   { position: fixed;    bottom: 18%; }
.track-absolute { position: absolute; bottom: 100px; }  /* sits above footer */

/* Train container always matches track */
.train-container {
  left: 0; width: 100%;
  z-index: 10; pointer-events: none;
  overflow: visible;   /* allow SVG shadow to show */
  height: 90px;
}
.train-fixed    { position: fixed;    bottom: calc(18% + 8px); }
.train-absolute { position: absolute; bottom: 108px; }

/* Wrapper starts hidden, JS drives it */
.train-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  will-change: transform;
  /* NO CSS animation here — JS handles it via requestAnimationFrame */
}

/* Richer landscape overlay — less washed out */
.landscape-overlay {
  position: fixed; inset: 0; z-index: -1;
  background: rgba(0,0,0,0);
}