/* marcandmiha.com — editorial timeline */

:root {
  --paper: #f6f1e8;
  --paper-deep: #ede5d4;
  --ink: #1f1a14;
  --ink-soft: #4a3f2f;
  --ink-faint: #8a7c66;
  --rule: #c9bea5;
  --accent: #8b2a1f;
  --accent-soft: #b8553f;
  --gold: #a8884c;
  
  --serif: 'Fraunces', 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, sans-serif;
  
  --max-width: 760px;
  --gutter: 2rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.6;
  font-size: 18px;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(circle at 20% 10%, rgba(168, 136, 76, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 42, 31, 0.03) 0%, transparent 50%);
  min-height: 100vh;
  position: relative;
}

/* Subtle paper grain */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.08 0 0 0 0 0.05 0 0 0 0.08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body > * {
  position: relative;
  z-index: 2;
}

/* ============ MASTHEAD ============ */

.masthead {
  padding: 6rem var(--gutter) 4rem;
  text-align: center;
  border-bottom: 1px solid var(--rule);
  position: relative;
}

.masthead::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 5px;
  background: var(--paper);
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
}

.masthead-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.masthead-eyebrow {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.masthead-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(3.5rem, 10vw, 7rem);
  line-height: 1;
  letter-spacing: -0.04em;
  font-variation-settings: "opsz" 144;
  margin-bottom: 1.5rem;
}

.amp {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  font-variation-settings: "opsz" 144, "wght" 400;
  font-size: 1.1em;
  margin: 0 0.05em;
}

.masthead-sub {
  font-style: italic;
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 480px;
  margin: 0 auto;
  font-weight: 300;
}

/* ============ YEAR RAIL ============ */

.year-rail {
  position: sticky;
  top: 0;
  background: rgba(246, 241, 232, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  z-index: 10;
  padding: 0.75rem 0;
}

.year-rail-inner {
  max-width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  padding: 0 var(--gutter);
  text-align: center;
  scrollbar-width: none;
}

.year-rail-inner::-webkit-scrollbar {
  display: none;
}

.year-pill {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  font-weight: 500;
  color: var(--ink-faint);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  margin: 0 0.15rem;
  border-radius: 2px;
  transition: color 0.2s, background 0.2s;
}

.year-pill:hover {
  color: var(--accent);
  background: var(--paper-deep);
}

.year-pill.active {
  color: var(--accent);
  font-weight: 600;
}

/* ============ TIMELINE ============ */

.timeline {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem var(--gutter) 6rem;
  position: relative;
}

/* Center spine */
.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    var(--rule) 8%,
    var(--rule) 92%,
    transparent 100%
  );
  z-index: 0;
}

@media (max-width: 720px) {
  .timeline::before {
    left: 20px;
  }
}

/* Year markers */
.year-section {
  position: relative;
  padding-top: 2rem;
}

.year-marker {
  text-align: center;
  margin: 4rem 0 3rem;
  position: relative;
  z-index: 2;
}

.year-marker::before,
.year-marker::after {
  content: '';
  display: inline-block;
  width: 30px;
  height: 1px;
  background: var(--gold);
  vertical-align: middle;
  margin: 0 1rem;
}

.year-marker-num {
  font-family: var(--serif);
  font-style: italic;
  font-size: 2.5rem;
  font-weight: 300;
  color: var(--accent);
  font-variation-settings: "opsz" 144;
  background: var(--paper);
  padding: 0 0.5rem;
}

@media (max-width: 720px) {
  .year-marker {
    text-align: left;
    padding-left: 50px;
  }
  .year-marker::before {
    display: none;
  }
  .year-marker::after {
    display: none;
  }
  .year-marker-num {
    background: var(--paper);
    padding: 0 0.5rem 0 0;
  }
}

/* Entries */
.entry {
  background: var(--paper);
  padding: 2rem;
  margin: 2rem 0;
  position: relative;
  z-index: 1;
  border: 1px solid transparent;
  transition: border-color 0.3s, transform 0.3s;
}

.entry:hover {
  border-color: var(--rule);
}

/* Bullet on the spine for each entry */
.entry::before {
  content: '';
  position: absolute;
  top: 2.5rem;
  left: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--accent);
  transform: translateX(-50%);
  z-index: 2;
}

@media (max-width: 720px) {
  .entry::before {
    left: -27px;
    transform: none;
  }
}

/* Alternating side layout on wider screens */
@media (min-width: 721px) {
  .entry-left {
    width: calc(50% - 2rem);
    margin-right: auto;
    text-align: right;
    padding-right: 2.5rem;
  }
  .entry-left::before {
    left: auto;
    right: -2.5rem;
    transform: translateX(50%);
  }
  .entry-right {
    width: calc(50% - 2rem);
    margin-left: auto;
    padding-left: 2.5rem;
  }
  .entry-right::before {
    left: -2.5rem;
    transform: translateX(-50%);
  }
}

@media (max-width: 720px) {
  .entry-left, .entry-right {
    margin-left: 40px;
    padding: 1.5rem;
  }
}

.entry-date {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.entry-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.75rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  color: var(--ink);
  font-variation-settings: "opsz" 36;
}

.entry-figure {
  margin: 1.5rem 0;
}

.entry-figure img {
  width: 100%;
  height: auto;
  display: block;
  filter: sepia(0.08) saturate(0.95);
  box-shadow: 
    0 1px 2px rgba(31, 26, 20, 0.08),
    0 8px 24px rgba(31, 26, 20, 0.12);
}

.entry-figure figcaption {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-style: italic;
  color: var(--ink-faint);
  margin-top: 0.6rem;
  line-height: 1.4;
  font-weight: 300;
}

.entry-body {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

.entry-body p + p {
  margin-top: 1rem;
  text-indent: 1.5em;
}

.entry-body p:first-child::first-letter {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 3.5em;
  float: left;
  line-height: 0.85;
  margin: 0.1em 0.08em -0.05em 0;
  color: var(--accent);
  font-variation-settings: "opsz" 144;
}

.entry-left .entry-body p:first-child::first-letter {
  float: none;
  font-size: 1em;
  margin: 0;
  color: inherit;
}

.entry-body h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.1rem;
  font-style: italic;
  margin: 1.5rem 0 0.5rem;
  color: var(--ink);
}

.entry-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.entry-body a:hover {
  background: var(--paper-deep);
}

.pull-quote {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 1.4rem;
  line-height: 1.4;
  color: var(--accent);
  margin: 2rem 0 0.5rem;
  padding: 1rem 0 1rem 1.5rem;
  border-left: 3px solid var(--gold);
  font-variation-settings: "opsz" 72;
}

.entry-left .pull-quote {
  border-left: none;
  border-right: 3px solid var(--gold);
  padding: 1rem 1.5rem 1rem 0;
}

/* ============ EMPTY STATE ============ */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--ink-soft);
}

.empty-state h2 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  margin-bottom: 1rem;
}

.empty-state code {
  background: var(--paper-deep);
  padding: 0.15em 0.4em;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

/* ============ COLOPHON ============ */

.colophon {
  border-top: 1px solid var(--rule);
  padding: 5rem var(--gutter) 4rem;
  text-align: center;
  background: var(--paper-deep);
}

.colophon::before {
  content: '❦';
  display: block;
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 2rem;
  font-family: var(--serif);
}

.colophon-line {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 2rem;
  color: var(--ink);
  margin-bottom: 1rem;
  font-variation-settings: "opsz" 72;
}

.colophon-meta {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 400;
}

/* ============ ENTRANCE ANIMATIONS ============ */

@media (prefers-reduced-motion: no-preference) {
  .masthead-eyebrow,
  .masthead-title,
  .masthead-sub {
    animation: rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  }
  .masthead-eyebrow { animation-delay: 0.1s; }
  .masthead-title { animation-delay: 0.25s; }
  .masthead-sub { animation-delay: 0.5s; }
  
  @keyframes rise {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  .entry {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s ease, transform 0.7s ease, border-color 0.3s;
  }
  
  .entry.in-view {
    opacity: 1;
    transform: translateY(0);
  }
  
  .year-marker {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }
  
  .year-marker.in-view {
    opacity: 1;
    transform: scale(1);
  }
}
