:root {
  --bg-dark: #0e0e12;
  --parchment: #1a1612;
  --gold: #c6a75e;
  --gold-glow: rgba(198,167,94,0.35);
  --text-main: #f4f1ea;
  --text-muted: #b8b3a7;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: radial-gradient(circle at 20% 30%, #1b1b22, #0e0e12 70%);
  color: var(--text-main);
  font-family: "Spectral", serif;
  padding: 40px 40px;
  overflow-x: hidden;
}

/* Subtle rune background */
/*
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(198,167,94,0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: drift 60s linear infinite;
  z-index: 0;
}

@keyframes drift {
  from { transform: translateY(0px); }
  to { transform: translateY(-200px); }
}
*/

.header {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto 40px auto;
}

.header h1 {
  font-family: "Cinzel", serif;
  font-size: 2.8rem;
  letter-spacing: 2px;
  color: var(--gold);
  margin-bottom: 0px;
  text-shadow: 0 0 15px var(--gold-glow);
}

.header p {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.8;
  max-width: 700px;
}

/* GRID */

.grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 28px;
  max-width: 1300px;
  margin: 0 auto;
}

/* CARD */

.card {
  background: linear-gradient(145deg, #1a1612, #141217);
  border: 1px solid rgba(198,167,94,0.2);
  border-radius: 18px;
  padding: 28px;
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: radial-gradient(circle at top left, rgba(198,167,94,0.15), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.card:hover, .card.fullscreen {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--gold);
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}

.card:hover::before, .card.fullscreen::before {
  opacity: 1;
}

/* EXPANDED */

.card {
  background: linear-gradient(145deg, #1a1612, #141217);
  border: 1px solid rgba(198,167,94,0.2);
  border-radius: 18px;
  padding: 28px;
  transition: all 0.3s ease;
  position: relative;
  cursor: pointer;
}

.card:hover, .card.fullscreen {
  transform: translateY(-6px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}

/* Active expanding state */
.card.expanding {
  position: fixed;
  margin: 0;
  z-index: 999;
  border-radius: 18px;
  transition: 
    top 0.45s cubic-bezier(.22,.8,.25,1),
    left 0.45s cubic-bezier(.22,.8,.25,1),
    width 0.45s cubic-bezier(.22,.8,.25,1),
    height 0.45s cubic-bezier(.22,.8,.25,1),
    border-radius 0.3s ease,
    padding-bottom 0.45s cubic-bezier(.22,.8,.25,1);
  will-change: top, left, width, height;
  overflow: hidden;
}
.card.fullscreen {
  overflow-y: auto;
  border-radius: 18px;
}

.close-btn {
  display: none;
  position: absolute;
  top: 22px;
  right: 26px;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--gold);
  font-size: 26px;
  line-height: 34px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.close-btn::before {
  content: "×";
}

.card.fullscreen .close-btn {
  display: block;
}

.close-btn:hover {
  transform: scale(1.15);
  opacity: 0.9;
}

.card.fullscreen h2 {
  font-size: 3rem;
}

.card h2 {
  font-family: "Cinzel", serif;
  font-size: 1.6rem;
  color: var(--gold);
  margin-bottom: 14px;
  letter-spacing: 1px;
  transition: font-size 0.3s ease;
}

.tags {
  margin-bottom: 6px;
}

.tag {
  display: inline-block;
  border: 1px solid rgba(198,167,94,0.3);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 8px;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.spread {
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-main);
}

.description {
  line-height: 1.8;
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 800px;
}

/* Close button */

.expanded-text {
  display: block;
  opacity: 0;
  line-height: 1.8;
  font-size: 1rem;
  color: var(--text-main);
  margin-top: 20px;
  transition: opacity 0.3s ease;
}

.card.fullscreen .expanded-text {
  opacity: 1;
}

.card.fullscreen .description {
  /* opacity: 0; /* optional: fade out original description */
  transition: opacity 0.3s ease;
}

.card.expanding {
  position: fixed;
  z-index: 999;
  border-radius: 18px;
  overflow: hidden;
  transition: top 0.5s ease, left 0.5s ease, width 0.5s ease, height 0.5s ease, border-radius 0.3s ease;
}

.expanded-text {
  opacity: 0;
  transition: opacity 0.3s ease;
  height: 0;
}

.card.fullscreen .expanded-text {
  opacity: 1;
  height: auto;
}

.card.fullscreen .description {
  /*opacity: 0;*/
  transition: opacity 0.3s ease;
}

.card .close-btn {
  display: none;
}

.card.fullscreen .close-btn {
  display: block;
}

/* Link styling inside cards */
.card a {
  color: var(--gold);
  text-decoration: none;
  position: relative;
  /*font-weight: 600;*/
  transition: color 0.25s ease;
}

/* Subtle animated underline */
.card a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 4px; /* controls how far down it is */
  width: 100%;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
  box-shadow: 0 0 6px var(--gold-glow);
}

.card a:hover {
  color: #e7c97a; /* slightly brighter gold */
}

.card a:hover::after {
  transform: scaleX(1);
}

/* Optional: active state */
.card a:active {
  opacity: 0.8;
}

/* Restore indentation for lists in expanded text */
.expanded-text ul {
  padding-left: 1.2em; /* standard indentation */
  list-style-type: disc; /* solid bullet points */
}

/* Sub-bullet styling */
.expanded-text ul ul {
  list-style-type: circle; /* hollow circle */
}

.card.fullscreen {
  max-height: calc(100vh - 80px); /* keep card within viewport with margin */
  padding-right: 5px;     /* optional: avoid content hiding behind scrollbar */
}

@media (max-width: 400px) {
  body {
    padding: 20px;
  }
  .grid {
    grid-template-columns: 1fr; /* single-column layout on small screens */
    gap: 16px;
  }
}
@media (max-width: 600px) {
  .header h1 {
    font-size: 2rem;
  }
  .card h2 {
    font-size: 1.2rem;
  }
  .card .description,
  .card .expanded-text {
    font-size: 0.9rem;
  }
}

.header-sections.blurred, .grid.blurred .card:not(.fullscreen):not(.expanding) {
  filter: blur(5px);
  opacity: 0.4;
  transition: filter 0.35s ease, opacity 0.35s ease, transform 0.35s ease;
}

.grid.blurred .card:not(.fullscreen):not(.expanding) {
  transform: scale(0.94);
}

.card.fullscreen .card-content {
  overflow-y: auto;
  max-height: calc(100vh - 80px);
  padding-right: 20px;
}
.scroll-fade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.card.fullscreen .scroll-fade {
  opacity: 1;
}

.scroll-fade::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;

  background: linear-gradient(
    to bottom,
    rgba(20,18,23,0),
    rgba(20,18,23,0.95)
  );
}
.card {
  padding: 0px;
  overflow: hidden;
  overflow-y: hidden;
}
.card-content {
  padding: 28px;
}

.card-content::-webkit-scrollbar { width: 3px; }
.card-content::-webkit-scrollbar-track { background: transparent; }
.card-content::-webkit-scrollbar-thumb {
  background: rgba(198,167,94,0.6);
  border-radius: 3px;
}
.card-content::-webkit-scrollbar-thumb:hover { background: rgba(198,167,94,0.85); }

body::-webkit-scrollbar { width: 3px; }
body::-webkit-scrollbar-track { background: #0e0e12; }
body::-webkit-scrollbar-thumb {
  background: rgba(198,167,94,0.6);
  border-radius: 3px;
}
body::-webkit-scrollbar-thumb:hover { background: rgba(198,167,94,0.85); }

.expanded-text a {
  display: inline-block; /* ensures width is well-defined */
  position: relative;    /* needed for ::after */
  overflow: visible;     /* prevent clipping from parent overflow */
  z-index: 1;
}
.expanded-text {
  padding-bottom: 20px;
}
.expanded-text {
  pointer-events: none;
}

.card.fullscreen .expanded-text {
  pointer-events: auto;
}

@media (max-width: 768px) {
  .card.fullscreen h2 {
    font-size: 1.6rem;
    line-height: 1.3;
  }
}

.tag {
  display: inline-block;
  border: 1px solid rgba(198,167,94,0.3);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 8px;
  margin-bottom: 8px;
  letter-spacing: 1px;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.tag:hover {
  background: rgba(198,167,94,0.1);
  border-color: rgba(198,167,94,0.5);
  color: var(--text-main);
}

.header p {
  margin-top: .7em;
}

.header-sections {
  display: flex;
  gap: 60px;
  max-width: 1300px;
  margin: 0 auto 0px auto;
}

.header-section {
  flex: 1;
}

.header-section h1 {
  font-family: "Cinzel", serif;
  font-size: 2.8rem;
  letter-spacing: 2px;
  color: var(--gold);
  margin-bottom: 20px;
  text-shadow: 0 0 15px var(--gold-glow);
}

.header-section p {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.8;
  margin-top: 12px;
}

.timeline {
  position: relative;
  padding-left: 20px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: rgba(198,167,94,0.25);
}

.timeline-entry {
  position: relative;
  margin-bottom: 10px;
}

.timeline-entry:last-child {
  margin-bottom: 0;
}

.timeline-entry::before {
  content: "";
  position: absolute;
  left: -22.5px;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold-glow);
}

.timeline-date {
  font-family: "Cinzel", serif;
  font-size: 0.8rem;
  letter-spacing: 1.5px;
  color: var(--gold);
}

.timeline-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

@media (max-width: 700px) {
  .header-sections {
    flex-direction: column;
    gap: 40px;
  }
}

.timeline-title {
  color: var(--text-main);
}

.timeline-subtitle {
  color: var(--text-muted);
}

.timeline-role {
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.timeline-classes {
  color: var(--text-muted);
  font-size: 0.9rem;
}

@keyframes icon-pulse {
  0%    { transform: scale(1.100); }
  12.5% { transform: scale(1.156); }
  25%   { transform: scale(1.207); }
  37.5% { transform: scale(1.247); }
  50%   { transform: scale(1.300); }
  62.5% { transform: scale(1.247); }
  75%   { transform: scale(1.207); }
  87.5% { transform: scale(1.156); }
  100%  { transform: scale(1.100); }
}

.card.icon-pulsing::after {
  animation: icon-pulse 1s ease-in-out infinite;
}

.card::after {
  content: "";
  position: absolute;
  bottom: 14px;
  right: 18px;
  width: 32px;
  height: 32px;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23c6a75e' stroke-width='1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 15 6 6'/%3E%3Cpath d='m15 9 6-6'/%3E%3Cpath d='M21 16v5h-5'/%3E%3Cpath d='M21 8V3h-5'/%3E%3Cpath d='M3 16v5h5'/%3E%3Cpath d='m3 21 6-6'/%3E%3Cpath d='M3 8V3h5'/%3E%3Cpath d='M9 9 3 3'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: var(--icon-opacity, 0);
  transform: scale(var(--icon-scale, 1));
  transition: var(--icon-transition, opacity 0.2s ease, transform 0.2s ease);
}


.card.fullscreen::after,
.card.expanding::after {
  opacity: 0;
}

@keyframes scroll-hint-pulse {
  0%, 100% { opacity: 0.6; transform: translateY(0);   text-shadow: 0 0 10px var(--gold-glow); }
  50%       { opacity: 1;   transform: translateY(3px); text-shadow: 0 0 20px var(--gold), 0 0 40px var(--gold-glow); }
}

.scroll-hint {
  text-align: center;
  color: var(--gold);
  font-family: "Cinzel", serif;
  font-size: 1rem;
  letter-spacing: 2px;
  pointer-events: none;
  animation: scroll-hint-pulse 1.8s ease-in-out infinite;
  transition: opacity 0.6s ease;
  margin: 10px auto 20px auto;
  position: relative;
  z-index: 1;
}

.scroll-hint.hidden {
  opacity: 0 !important;
  animation: none;
}

.card.card:not(.fullscreen):not(.expanding) .expanded-text {
  padding-bottom: 0px;
  margin-top: 0px; /* these both defaulted to 20px and made cards too big */
}

.has-expanded .card::after {
  display: none;
}

html {
  background: #0e0e12;
}

.indicator-spacer {
  height: 20px;
}

.has-expanded .indicator-spacer {
  height: 0;
}