:root {
  --bg: #111827;
  --fg: #f9fafb;
  --muted: #9ca3af;
  --accent: #38bdf8;
  --accent-2: #34d399;
  --line: #374151;
  --card: #1f2937;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  --bg-grad: linear-gradient(135deg, #111827, #1f2937);
  --bg-pattern: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><circle cx="2" cy="2" r="1" fill="%23374151" opacity="0.5"/></svg>');
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  color: var(--fg);
  background: var(--bg-grad), var(--bg-pattern);
  background-size: cover, 20px 20px; /* gradient fills, dotted pattern repeats */
  background-attachment: fixed; /* keeps the pattern static */
  background-blend-mode: overlay; /* blend the pattern with the gradient */
  line-height: 1.6;
  scroll-behavior: smooth;
}

/* Typography */
h1, h2, h3 {
  margin: 0 0 12px 0;
  line-height: 1.2;
}
h2 {
  text-transform: uppercase;
}
p {
  margin: 0 0 12px 0;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.small {
  font-size: 14px;
}
.subtle {
  color: var(--muted);
}
.tiny {
  font-size: 12px;
}

/* INTRO SECTION */
#intro {
  position: relative;
  padding: 100px 8% 40px;
  min-height: 100vh;
  background: rgba(31, 41, 55, 0.9); /* card bg with slight transparency */
  backdrop-filter: blur(8px); /* adds a subtle blur effect */
  box-shadow: var(--shadow);
}

.intro-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 50px;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
}

/* LEFT PANEL */
.intro-left {
  position: relative;
  text-align: left;
}
.intro-photo {
  width: 120px;
  border-radius: 16px;
  margin-bottom: 18px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}
#intro h1 {
  font-size: 40px;
  font-weight: 800;
}
.role {
  font-size: 18px;
  color: var(--fg);
  margin-top: 4px;
}

/* Intro logos */
.intro-logos {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.intro-logo {
  height: 24px;
  width: auto;
  object-fit: contain;
}

/* RIGHT PANEL */
.intro-right {
  font-size: 15px;
  color: var(--fg);
  position: relative;
  background: rgba(17, 24, 39, 0.85); /* bg with slight transparency */
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  backdrop-filter: saturate(1.05) blur(6px);
  overflow: hidden;
}
.intro-right p strong {
  font-weight: 700;
}
.intro-right::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(600px 200px at 100% 0%, rgba(56,189,248,0.1), transparent 60%),
    radial-gradient(500px 180px at 0% 100%, rgba(52,211,153,0.1), transparent 60%);
}
.intro-socials {
  display: flex;
  gap: 14px;
  margin-top: 20px;
}
.intro-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--fg);
  transition: all 0.2s ease;
}
.intro-socials a:hover {
  transform: translateY(-2px);
  background: #374151;
}
/* icon size inside social buttons */
.intro-socials iconify-icon {
  font-size: 20px; /* inherits color from the link */
  line-height: 1;
}

/* COUNTDOWN */
.countdown {
  text-align: center;
  margin-top: 60px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}
.countdown h3 {
  font-size: 18px;
  color: var(--fg);
  margin-bottom: 16px;
}
.time-grid {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}
.time-grid > div {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  min-width: 80px;
  box-shadow: var(--shadow);
}
.time-grid span {
  font-size: 22px;
  font-weight: 700;
  display: block;
}
.time-grid label {
  font-size: 11px;
  color: var(--muted);
}
.bar-bg {
  background: #111827;
  border-radius: 999px;
  overflow: hidden;
  height: 12px;
  max-width: 600px;
  margin: 10px auto;
}
#progress-bar {
  background: var(--accent-2);
  height: 100%;
  width: 0%;
  transition: width 0.6s ease;
}
#countdown {
  margin-top: 6px;
  color: var(--muted);
}

/* Section sub-headers */
.section-subhead {
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
  font-size: 14px;
  margin-top: 40px;
  margin-bottom: -8px;
  text-align: center;
}

/* GENERIC SECTIONS */
section {
  padding: 80px 6%;
  border-bottom: 1px solid var(--line);
  background: rgba(31, 41, 55, 0.9); /* card bg with slight transparency */
  backdrop-filter: blur(8px); /* adds a subtle blur effect */
  position: relative; /* anchor for pseudo-element */
  scroll-margin-top: 70px; /* offset for sticky nav */
}

/* PUB ROW */
.pub-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 18px 18px 30px;
  max-width: 1200px;
  margin: 24px auto;
  box-shadow: var(--shadow);
}
.pub-rail {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  width: max-content;
}
.chip {
  background: #1e40af;
  color: #dbeafe;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.chip-primary {
  background: #166534;
  color: #d1fae5;
}
.pub-illustration img {
  border-radius: 12px;
  border: 1px solid var(--line);
  width: 100%;
  height: auto;
}
.gretsi-img {
  height: 250px; /* Set a fixed height */
  width: auto;   /* Allow width to adjust to maintain aspect ratio */
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.pub-body h3 {
  font-size: 28px; /* was 26px */
  line-height: 1.4; /* slightly increased for better readability */
}
.authors {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 8px;
}
.summary {
  color: var(--fg);
}
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.links-subhead {
  font-weight: 600;
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
  margin-bottom: -2px;
  width: 100%;
}
.ghost {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

/* COLLAB */
.collab-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  max-width: 1200px;
  margin: 0 auto;
}
.collab-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.collab-card img {
  width: 100%;
  height: auto;
  display: block;
}
.cc-body {
  padding: 14px;
}
.cc-body .meta {
  font-size: 13px;
  color: var(--muted);
}

/* WEEKLY */
.link-list {
  max-width: 900px;
  margin: 0 auto;
  padding-left: 18px;
}
.link-list li {
  margin: 8px 0;
}

/* ABOUT */
#about {
  background: #1f2937;
}
.about-container {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  max-width: 1100px;
  margin: 0 auto;
  align-items: center;
}
.about-photo {
  border-radius: 14px;
  box-shadow: var(--shadow);
  width: 100%;
}

/* CV */
#cv {
  background: linear-gradient(180deg, var(--card), #111827);
}
.cv-box {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px;
  box-shadow: var(--shadow);
}
.cta {
  display: inline-block;
  margin-top: 10px;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
}
.cta:hover {
  filter: brightness(1.1);
  text-decoration: none;
}

/* CONTACT */
.contact-card {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 30px;
}
.socials.center {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 14px;
}

/* TOP NAV */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 6%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-nav .brand {
  font-weight: 800;
  color: var(--fg);
  text-decoration: none;
}
.site-nav nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.site-nav nav a {
  color: var(--fg);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
}
.site-nav nav a:hover {
  background: #374151;
  text-decoration: none;
}

/* FOOTER */
footer {
  text-align: left;
  margin-top: 60px;
  border-top: 1px solid var(--line);
  padding: 20px 3%;
  background: rgba(31, 41, 55, 0.9); /* card bg with slight transparency */
  backdrop-filter: blur(8px); /* adds a subtle blur effect */
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}
footer a {
  color: var(--muted);
}
footer a:hover {
  color: var(--accent);
}
/* footer social container */
.footer-socials {
  display: flex;
  gap: 14px;
  justify-content: center;
}

/* reuse social button styles for footer */
.intro-socials a,
.footer-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--fg);
  transition: all 0.2s ease;
}
.intro-socials a:hover,
.footer-socials a:hover {
  transform: translateY(-2px);
  background: #374151;
}
/* icon size inside social buttons */
.intro-socials iconify-icon,
.footer-socials iconify-icon {
  font-size: 20px;
  line-height: 1;
}

/* center content inside left and right areas */
.intro-foot-left,
.intro-foot-right {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* REVEAL */
.reveal {
  opacity: 1; /* was 0 */
  transform: none; /* was translateY(14px) */
  transition: none; /* disable animation */
}
.revealed {
  opacity: 1;
  transform: none;
}

/* RESPONSIVE */
@media (max-width: 1100px) {
  .intro-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .intro-right {
    text-align: left;
    padding: 16px;
  }
  footer {
    flex-direction: column;
    gap: 10px;
  }
  .pub-row {
    grid-template-columns: 1fr;
    padding-left: 18px;
  }
  .pub-rail {
    display: none;
  }
  .collab-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 700px) {
  .collab-grid {
    grid-template-columns: 1fr;
  }
  .intro-photo {
    width: 100px;
  }
  .bar-bg {
    max-width: 90%;
  }
}

/* WRITING - FANTASY MOSAIC (center last row + proper hover scale) */
.writing-mosaic {
  display: grid;
  grid-template-columns: repeat(10, 1fr); /* 10 per row */
  gap: 26px;
  max-width: 1300px;
  margin: 40px auto;
  justify-items: center;
}

.writing-card {
  width: 110px;
  height: 110px;
  transform: translate(var(--x), var(--y)) rotate(var(--r));
  animation: floaty 6s ease-in-out infinite;
  will-change: transform;
}

.writing-card:hover .card-inner {
  transform: scale(1.12) translateY(-2px);
  box-shadow: 0 12px 36px rgba(0,0,0,0.4);
}

/* inner wrapper actually draws the tile and scales on hover */
.writing-card .card-inner {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.28s cubic-bezier(0.23, 1, 0.32, 1),
              box-shadow 0.28s ease, filter 0.25s ease;
}

.writing-card:hover .card-inner {
  transform: scale(1.12) translateY(-2px);  /* ← grows on hover */
  box-shadow: 0 12px 36px rgba(0,0,0,0.4);
}

.writing-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.85);
  transition: filter 0.25s ease;
}
.writing-card:hover img { filter: brightness(1); }

.card-label {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  padding: 4px;
  background: rgba(0,0,0,0.6);
  text-align: center;
  pointer-events: none;
}
.card-label h5 {
  font-size: 11px;
  margin: 0;
  color: var(--fg);
  line-height: 1.2;
}

/* gentle bob on the OUTER wrapper only */
@keyframes floaty {
  0%   { transform: translate(var(--x), var(--y)) rotate(var(--r)); }
  50%  { transform: translate(calc(var(--x) + 0px), calc(var(--y) - 4px)) rotate(calc(var(--r) * 1.2)); }
  100% { transform: translate(var(--x), var(--y)) rotate(var(--r)); }
}

/* FIX CLOSE BUTTON STYLE */
.close-modal {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.close-modal:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent);
}

/* === ARTICLE MODAL (SCROLLABLE READING VERSION) === */
.article-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 999;
  backdrop-filter: blur(6px);
}

.article-modal.active {
  opacity: 1;
  pointer-events: auto;
}

/* modal box */
.modal-content {
  background: var(--card);
  border-radius: 18px;
  padding: 40px 60px 80px; /* extra bottom padding fixes the cutoff */
  width: 90%;
  max-width: 900px;
  max-height: calc(90vh - 40px); /* a bit taller than before */
  overflow-y: auto; /* enables scrolling */
  color: var(--fg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  transform: scale(0.92) translateY(20px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  line-height: 1.7;
  scroll-padding-bottom: 100px; /* ensures the final paragraph clears the viewport */
}

.article-modal.active .modal-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* title */
#modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 22px;
  text-align: left;
  color: var(--fg);
}

/* text */
#modal-text {
  font-size: 16px;
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--fg);
  text-align: justify;
}

#modal-text p {
  margin-bottom: 1.3em;
}

#modal-text em {
  font-style: italic;
  color: inherit; /* no more green */
}

/* close button */
.close-modal {
  position: absolute;
  top: 18px;
  right: 22px;
  font-size: 26px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: 0.2s ease;
}

.close-modal:hover {
  color: var(--accent);
  transform: rotate(90deg);
}

/* scrollbar aesthetics */
.modal-content::-webkit-scrollbar {
  width: 8px;
}
.modal-content::-webkit-scrollbar-thumb {
  background-color: var(--accent);
  border-radius: 10px;
}
.modal-content::-webkit-scrollbar-track {
  background: transparent;
}

/* === OUTSIDE WORK SECTION === */
#outside-work {
  background: rgba(31, 41, 55, 0.9);
  backdrop-filter: blur(8px);
  padding: 80px 6%;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
}

.outside-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px 50px;
  margin: 60px auto;
  max-width: 1200px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 30px;
  transition: background 0.3s ease;
}

.outside-card:hover {
  background: rgba(40, 50, 65, 0.9);
}

.outside-card h3 {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  font-weight: 700;
  font-size: 28px;
  margin-bottom: 10px;
  color: var(--fg);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.outside-text p {
  color: var(--fg);
  font-family: inherit;
  line-height: 1.7;
  font-size: 16px;
  max-width: 900px;
}

.outside-media {
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: center;
}

/* AUDIO */
.audio-block {
  width: 100%;
  max-width: 520px;
}

.set-title {
  font-style: italic;
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 6px;
  text-align: center;
}

.outside-media audio {
  width: 100%;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* VIDEO */
.outside-media video {
  width: 100%;
  max-width: 1000px;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.outside-media video:hover {
  transform: scale(1.02);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
}

/* VIDEO GRID (for Chambre Noire) */
.outside-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 28px;
  justify-items: center;
}

/* Responsive */
@media (max-width: 900px) {
  .outside-card {
    padding: 30px 22px;
  }
  .outside-media video {
    max-width: 100%;
  }
}

/* === OUTSIDE WORK AUDIO/VIDEO IMPROVEMENTS === */

/* AUDIO PLAYER */
.outside-media audio {
  width: 100%;
  max-width: 520px;
  border-radius: 16px;
  background: #0f172a;
  border: 1px solid var(--line);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  height: 40px;
}

audio::-webkit-media-controls-panel {
  background-color: #0f172a;
}

audio::-webkit-media-controls-play-button,
audio::-webkit-media-controls-volume-slider-container,
audio::-webkit-media-controls-timeline {
  filter: invert(100%);
}

audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display {
  color: var(--fg);
  font-family: Inter, sans-serif;
}

/* VIDEO WRAPPER */
.video-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #000;
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Aspect ratios */
.video-wrapper.square {
  aspect-ratio: 1 / 1;
  max-width: 420px;
}
.video-wrapper.portrait {
  aspect-ratio: 9 / 16;
  max-width: 320px;
}

/* Hover subtle motion */
.video-wrapper:hover {
  transform: scale(1.03);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
}

/* SOUND HINT overlay */
.sound-hint {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--fg);
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  font-family: Inter, sans-serif;
}

.video-wrapper:hover .sound-hint {
  opacity: 1;
}

/* VIDEO GRID */
.outside-video-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 24px;
}

@media (max-width: 900px) {
  .outside-video-grid {
    flex-direction: column;
    align-items: center;
  }
  .video-wrapper.square,
  .video-wrapper.portrait {
    max-width: 100%;
  }
}

/* FULL-WIDTH TRIVIA VIDEO */
.video-wrapper.full {
  width: 100%;
  max-width: 1000px;
  aspect-ratio: 16 / 9;
}

/* === TWO VIDEO LAYOUT FOR CHAMBRE NOIRE === */
.outside-video-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
  justify-items: center;
  align-items: start;
}

.video-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

@media (max-width: 900px) {
  .outside-video-grid-2 {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}