@charset "utf-8";

/* =========================
ROOT VARIABLES
========================= */
:root{
--accent:#3d5123;
--line:#e2e2e2;
--connector:5rem;
--branch:1.875rem;
--gap:clamp(4rem,8vw,7rem);
--story-axis:1.25rem;
--story-axis-x:calc(var(--connector) / 2);
--timeline-axis-y:4.35rem;
--node-size:.875rem;
--node-glow:color-mix(in srgb,var(--accent, #3d5123) 30%,transparent);

--timeline-speed:.6s;
--timeline-ease:cubic-bezier(.22,.61,.36,1);
--node-speed:.45s;
--image-fade:.5s;
}

/* =========================
RATIO SYSTEM (RESTORED)
========================= */
.timeline.ratio-16-9{
--timeline-axis-y:4.35rem;
--timeline-track-padding:6rem;
--timeline-node-offset:-.55rem;
--timeline-year-offset:-1.5rem;
}

/* =========================
WORDPRESS SAFETY FIXES
========================= */

.timeline{
width:100%;
position:relative;
padding-top:1px;
min-height:1px;
}

.timeline-track{
position:relative;
display:block;
width:100%;
min-height: 2px;
}

.timeline::after{
content:"";
display:block;
clear:both;
}

/* =========================
NAV SAFETY + STYLING
========================= */

.timeline-nav{ display:none !important; }

.editorial-timeline .timeline-nav{
display:flex !important;
position:fixed;
left:30px;
top:50%;
transform:translateY(-50%);
flex-direction:column;
gap:10px;
font-size:.9rem;
z-index:100;
}

.editorial-timeline .timeline-nav button{
background:white;
border:none;
padding:6px 10px;
border-radius:6px;
cursor:pointer;
box-shadow:0 2px 6px rgba(0,0,0,.08);
transition:all .2s ease;
}

.editorial-timeline .timeline-nav button:hover{
background:var(--accent);
color:white;
}

.editorial-timeline .timeline-nav button.active-year{
background:var(--accent);
color:#fff;
box-shadow:0 4px 12px rgba(0,0,0,.15);
}

/* horizontal nav */

.editorial-timeline .timeline.horizontal ~ .timeline-nav,
.editorial-timeline:has(.timeline.horizontal) .timeline-nav{
position:relative;
left:auto;
top:auto;
transform:none;
flex-direction:row;
justify-content:center;
align-items:center;
gap:12px;
flex-wrap:wrap;
margin-bottom:2rem;
}

.editorial-timeline .timeline.horizontal ~ .timeline-nav button{
padding:8px 14px;
font-weight:600;
border-radius:20px;
}

/* =========================
LAYOUT CONTROLS (RESTORED)
========================= */

.editorial-timeline .timeline-layout-controls{
display:flex;
justify-content:center;
gap:10px;
margin-bottom:2rem;
}

.editorial-timeline .timeline-layout-controls button{
border:none;
padding:8px 14px;
background:white;
border-radius:6px;
cursor:pointer;
box-shadow:0 2px 6px rgba(0,0,0,.1);
}

.editorial-timeline .timeline-layout-controls button.active{
background:var(--accent);
color:white;
}

/* =========================
SPINE
========================= */

.timeline.editorial::before,
.timeline.story::before{
content:"";
position:absolute;
left:50%;
transform:translateX(-50%);
top:0;
bottom:0;
width:4px;
background:var(--line);
}

/* progress */

.progress{
position:absolute;
left:50%;
transform:translateX(-50%);
top:0;
width:4px;
height:0;
background:var(--accent);
transition:height .45s cubic-bezier(.22,.61,.36,1);
pointer-events:none;
}

/* =========================
EVENTS (CORE SYSTEM)
========================= */

.event{
display:grid;
grid-template-columns:1fr var(--connector) 1fr;
align-items:center;
margin-bottom:var(--gap);
position:relative;
}

/* node */

.node{
grid-column:2;
grid-row:1;
justify-self:center;
align-self:center;
width:var(--node-size);
height:var(--node-size);
background:var(--accent);
border-radius:50%;
position:relative;
transition:transform .3s ease, box-shadow .3s ease;
}

.node.active{
animation:nodePulse var(--node-speed) var(--timeline-ease);
transform:scale(1.35);
box-shadow:0 0 0 10px var(--node-glow);
}

@keyframes nodePulse{
0%{transform:scale(1);box-shadow:0 0 0 0 var(--node-glow);}
60%{transform:scale(1.4);box-shadow:0 0 0 14px transparent;}
100%{transform:scale(1.35);box-shadow:0 0 0 10px var(--node-glow);}
}

/* connector */

.connector{
grid-column:2;
grid-row:1;
height:2px;
background:var(--accent);
align-self:center;
}

.left .connector{justify-self:start;width:var(--branch);}
.right .connector{justify-self:end;width:var(--branch);}

/* =========================
CARDS
========================= */

.card{
width:100%;
max-width:80ch;
background:white;
border-radius:14px;
overflow:hidden;
box-shadow:0 20px 40px rgba(0,0,0,.1);
position:relative;
align-self:center;
grid-row:1;
opacity:0;
transform:translateY(30px);
transition:all var(--timeline-speed) var(--timeline-ease);
}

.card.visible{
opacity:1;
transform:none;
}

/* inline mode */

.event-inline .card{
background:transparent !important;
box-shadow:none !important;
border-radius:0 !important;
overflow:visible !important;
padding:0 !important;
}

.event-inline .media{
background:transparent !important;
}

/* placement */

.left .card{grid-column:1;justify-self:end;}
.right .card{grid-column:3;justify-self:start;}

/* =========================
HORIZONTAL MODE (RESTORED EXACT)
========================= */

.timeline.horizontal{
overflow-x:hidden;
overflow-y:visible;
}

.timeline.horizontal .timeline-track{
display:flex;
gap:clamp(2rem,5vw,4rem);
padding:var(--timeline-track-padding,4rem) 4rem;
overflow-x:auto;
scroll-snap-type:x proximity;
scroll-behavior:smooth;
position:relative;
}

.timeline.horizontal .timeline-track::before{
content:"";
position:absolute;
top:var(--timeline-axis-y);
left:0;
right:0;
height:4px;
background:var(--line);
}

.timeline.horizontal .timeline-progress-x{
position:absolute;
top:var(--timeline-axis-y);
left:0;
height:4px;
width:0;
background:var(--accent);
transition:width var(--node-speed) var(--timeline-ease);
}

.timeline.horizontal .event{
position:relative;
display:flex;
flex-direction:column;
align-items:center;
flex:0 0 clamp(26rem,38vw,44rem);
scroll-snap-align:center;
margin-bottom:0;
}

/* hide only vertical-specific elements */
.timeline.horizontal .progress,
.timeline.horizontal .connector{
  display:none;
}

.timeline.horizontal .year-marker{
position:absolute;
   top:var(--timeline-axis-y);
  transform:translate(-50%, calc(-120% + var(--timeline-year-offset)));
  margin:0;
  z-index:5;
  pointer-events:none;
  /*left:0; /* JS will override this */
}

.timeline.horizontal .year-marker span{
background:white;
padding:6px 14px;
border-radius:6px;
box-shadow:0 2px 6px rgba(0,0,0,.1);
font-size:.85rem;
white-space:nowrap;
}
/* align markers to nodes */
.timeline.horizontal .event{
  position:relative;
}



.timeline.horizontal .node{
position:absolute;
  top:var(--timeline-axis-y);
  left:50%;
  transform:translate(-50%, calc(-50% + var(--timeline-node-offset)));
}

.timeline.horizontal .card{
margin-top:2.5rem;
opacity:1 !important;
transform:none !important;
grid-column:auto !important;
justify-self:unset !important;
}

/* =========================
MEDIA
========================= */

.media{
background:#e8eef5;
aspect-ratio:var(--timeline-media-ratio,16/9);
overflow:hidden;
display:flex;
flex-direction:column;
}

.media img{
width:100%;
height:100%;
object-fit:cover;
opacity:0;
transition:opacity var(--image-fade) ease;
}

.media img.loaded{opacity:1;}
.media img.graphic{object-fit:contain;}

/* =========================
CONTENT
========================= */

.content{padding:1.3rem 1.4rem 1.6rem;}
.date{font-size:.8rem;color:#666;margin-bottom:.3rem;}
.title{font-size:1.3rem;margin:.3rem 0;}
.text{font-size:.95rem;line-height:1.5;max-height:4.5em;overflow:hidden;}

.card.expanded .text{max-height:none;}

.expand-toggle{
margin-top:.6rem;
font-size:.85rem;
font-weight:600;
color:var(--accent);
cursor:pointer;
}

/* =========================
YEAR MARKERS
========================= */

.year-marker{
display:flex;
justify-content:center;
margin:3rem 0 1rem;
position:relative;
}

.year-marker span{
font-size:1rem;
line-height:1;
padding:10px 20px;
background:white;
border-radius:5px;
box-shadow:0 2px 8px rgba(0,0,0,.08);
}

.year-marker::after{
content:"";
position:absolute;
left:50%;
transform:translateX(-50%);
bottom:-10px;
width:4px;
height:10px;
background:var(--accent);
}

/* =========================
ACCENT OVERRIDE
========================= */

.event .node[style]{
background: var(--accent) !important;
}

.event .node[style].active{
box-shadow: 0 0 0 10px var(--node-glow) !important;
}

/* =========================
EDITORIAL CARD FIX (CRITICAL)
========================= */

.timeline.editorial .event{
  align-items:stretch; /* 🔥 key fix */
}

.timeline.editorial .card{
  display:block !important;
  position:relative;
  opacity:1 !important;
  transform:none !important;
  visibility:visible !important;
}

.timeline.editorial .left .card{
  grid-column:1;
  justify-self:end;
}

.timeline.editorial .right .card{
  grid-column:3;
  justify-self:start;
}
/* =========================
IMAGE VISIBILITY FIX (CRITICAL)
========================= */

.timeline .media img{
  opacity:1 !important;
}