/* Define Theme and CSS Variables */
:root {
  --font-space-grotesk: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-instrument-serif: "Instrument Serif", Georgia, serif;
  --font-jetbrains-mono: "JetBrains Mono", monospace;
  --font-caveat: "Caveat", cursive;

  --paper: #c0c8d4;
  --card: #d8dee8;
  --ink: #111;
  --ink-soft: #333;
  --muted: #4a4a4a;
  --tape: rgba(255, 220, 120, 0.75);
  --photo-a: #d0c8b4;
  --photo-b: #dfd8c6;
}

* {
  box-sizing: border-box;
}

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-space-grotesk), system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

a {
  color: inherit;
}

/* stage Layout */
.stage {
  width: 100%;
  min-height: max(100vh, 920px);
  padding: clamp(20px, 4vw, 44px) clamp(18px, 4vw, 48px) 140px;
  position: relative;
  overflow: visible;
}

/* Hint Text at Top Right */
.hint {
  font-family: var(--font-jetbrains-mono), monospace;
  letter-spacing: .1em;
  color: var(--muted);
  text-align: right;
  z-index: 3;
  pointer-events: none;
  font-size: 10.5px;
  line-height: 1.5;
  position: absolute;
  top: clamp(20px, 4vw, 44px);
  right: clamp(18px, 4vw, 44px);
}

@media (max-width: 960px) {
  .hint {
    display: none;
  }
}

/* Hero Biography Section */
.hero {
  z-index: 1;
  pointer-events: none;
  max-width: 900px;
  position: relative;
}

.hero .links,
.hero .name .dot {
  pointer-events: auto;
}

.eyebrow {
  font-family: var(--font-jetbrains-mono), monospace;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
  font-size: 11px;
}

.eyebrow .live {
  vertical-align: 1px;
  background: #a83248;
  border-radius: 50%;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  animation: pulse 4s ease-in-out infinite;
  display: inline-block;
}

@keyframes pulse {
  50% {
    opacity: .5;
  }
}

.name {
  font-family: var(--font-instrument-serif), serif;
  letter-spacing: -.025em;
  color: var(--ink);
  margin: 0;
  font-size: clamp(56px, 13vw, 168px);
  font-weight: 400;
  line-height: .88;
}

.name em {
  color: var(--muted);
  font-style: italic;
}

.name .dot {
  color: transparent;
  cursor: pointer;
  display: inline-block;
  position: relative;
}

.name .dot:before {
  content: ".";
  color: var(--muted);
  transition: transform .2s cubic-bezier(.4, 1.6, .4, 1);
  position: absolute;
  bottom: 0;
  left: 0;
}

.name .dot:hover:before {
  transform: translateY(-.1em) rotate(12deg);
}

.sub {
  max-width: 54ch;
  color: var(--ink-soft);
  margin: clamp(14px, 2vw, 22px) 0 0;
  font-size: clamp(14px, 1.4vw, 17px);
  line-height: 1.55;
}

.sub b {
  font-weight: 600;
}

/* Links Section */
.links {
  font-family: var(--font-jetbrains-mono), monospace;
  z-index: 2;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: clamp(24px, 3vw, 36px);
  font-size: 13px;
  display: flex;
  position: relative;
}

.links a {
  border: 1.5px solid var(--ink);
  background: var(--card);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 10px 16px;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s, background .15s, color .15s;
}

.links a:hover {
  background: var(--ink);
  color: var(--card);
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px rgba(0, 0, 0, 0.25);
}

.links a:active {
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(1px, 1px);
}

/* Draggable Desk Objects */
.obj {
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  border: 1.5px solid var(--ink);
  background: var(--card);
  touch-action: none;
  transition: box-shadow .15s;
  position: absolute;
  box-shadow: 4px 4px rgba(0, 0, 0, 0.15);
}

.stage.ready .obj:not(.dragging) {
  transition: box-shadow .15s, left .45s cubic-bezier(.22, 1.2, .36, 1), top .45s cubic-bezier(.22, 1.2, .36, 1), transform .35s cubic-bezier(.4, 1.4, .4, 1);
}

.obj.dragging {
  cursor: grabbing;
  z-index: 50;
  transition: box-shadow .15s;
  box-shadow: 8px 12px 18px rgba(0, 0, 0, 0.25);
}

/* Standard Card styles */
.card {
  width: 260px;
  padding: 20px 18px;
}

.card h2 {
  font-family: var(--font-jetbrains-mono), monospace;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
  font-size: 10.5px;
  font-weight: 500;
}

.card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.card.dark {
  background: var(--ink);
  color: var(--paper);
}

.card.dark h2 {
  color: #888;
}

.card a {
  text-underline-offset: 3px;
  text-decoration: none;
  transition: transform .15s cubic-bezier(.25, 1, .5, 1);
  display: inline-block;
}

@media (hover: hover) {
  .card a:hover {
    transform: translate(4px);
  }
}

/* Polaroid Photo Card */
.photo {
  background: repeating-linear-gradient(135deg, var(--photo-a) 0 10px, var(--photo-b) 10px 20px);
  width: 280px;
  height: 350px;
  padding: 14px 14px 40px;
}

.photo-inner {
  background: var(--photo-a);
  width: 100%;
  height: 100%;
  font-family: var(--font-jetbrains-mono), monospace;
  color: #555;
  text-align: center;
  justify-content: center;
  align-items: center;
  padding: 8px;
  font-size: 10px;
  display: flex;
  position: relative;
  overflow: hidden;
}

.photo-inner img {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.photo-cap {
  font-family: var(--font-caveat), cursive;
  color: var(--ink);
  text-align: center;
  font-size: 17px;
  position: absolute;
  bottom: 8px;
  left: 10px;
  right: 10px;
}

/* Sticky Tape styling */
.tape {
  background: var(--tape);
  transform-origin: 50% 100%;
  pointer-events: auto;
  cursor: pointer;
  z-index: 2;
  border-left: 1px dashed rgba(0, 0, 0, 0.15);
  border-right: 1px dashed rgba(0, 0, 0, 0.15);
  width: 92px;
  height: 24px;
  transition: transform .5s cubic-bezier(.4, 1.4, .4, 1), opacity .5s;
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translate(-50%) rotate(-3deg);
}

.tape:before {
  content: "";
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.35), transparent 40%);
  position: absolute;
  inset: 0;
}

.tape:after {
  content: "";
  position: absolute;
  inset: -10px 0;
}

@media (hover: hover) {
  .photo:not(.peeled) .tape:hover {
    transform: translate(-50%) rotate(-6deg) translateY(-2px);
  }
}

.photo.peeled .tape {
  transform: translate(-50%) rotate(-22deg) translateY(-14px) scaleY(.92);
}

.photo.peeled .tape.flung {
  opacity: 0;
  transform: translate(-50%) rotate(-70deg) translate(-30px, -80px) scale(.9);
  pointer-events: none;
}

/* Photo Reaction when Tape is Peeled */
.photo.peeled:not(.dragging) {
  /* Gravity tilt when tape is loose */
  transform: rotate(12deg) translateY(10px) !important;
}

/* Footer layout */
.foot {
  font-family: var(--font-jetbrains-mono), monospace;
  color: var(--muted);
  background: linear-gradient(to top, var(--paper) 60%, transparent);
  pointer-events: none;
  z-index: 40;
  justify-content: space-between;
  gap: 16px;
  padding: 10px clamp(18px, 4vw, 44px);
  font-size: 11px;
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
}

.foot span a {
  pointer-events: auto;
  text-underline-offset: 3px;
  text-decoration: underline;
}

.foot .reset {
  pointer-events: auto;
  border: 1px solid var(--muted);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  background: transparent;
  border-radius: 2px;
  padding: 3px 10px;
  transition: background .15s, color .15s, border-color .15s;
}

.foot .reset:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.foot .reset:active {
  transform: scale(.96);
}

/* Focus visibility logic for accessibility */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* Responsive Overrides (Stacked Layout for Mobile/Tablet) */
@media (max-width: 960px) {
  .stage {
    padding-bottom: 160px;
    overflow: visible;
  }

  .hero {
    max-width: 100%;
  }

  .mobile-stack {
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 28px;
    margin-top: clamp(36px, 6vw, 52px);
    display: flex;
  }

  .obj {
    cursor: default;
    flex: 260px;
    max-width: 340px;
    display: block;
    position: static !important;
    top: auto !important;
    left: auto !important;
    box-shadow: 3px 3px rgba(0, 0, 0, 0.18) !important;
  }

  .obj.photo {
    flex: none;
    width: 280px;
    position: relative !important;
  }

  .obj:first-child {
    transform: rotate(-1.5deg) !important;
  }

  .obj:nth-child(2) {
    transform: rotate(2deg) !important;
  }

  .obj:nth-child(3) {
    transform: rotate(-1deg) !important;
  }

  .obj:nth-child(4) {
    transform: rotate(1.8deg) !important;
  }

  .obj:nth-child(5) {
    transform: rotate(-2deg) !important;
  }

  .obj:nth-child(6) {
    transform: rotate(1.2deg) !important;
  }

  .sub, .card p {
    font-size: 15px;
  }

  .card h2 {
    font-size: 12px;
  }

  .card a {
    padding: 4px 0;
  }
}

@media (max-width: 560px) {
  .stage {
    padding-bottom: 140px;
  }

  .links {
    gap: 8px;
  }

  .links a {
    box-shadow: 2px 2px 0 var(--ink);
    padding: 10px 14px;
    font-size: 13px;
  }

  .mobile-stack {
    flex-direction: column;
    align-items: stretch;
    gap: 22px;
  }

  .obj {
    flex: auto;
    width: 100%;
    max-width: none;
  }

  .obj.photo {
    align-self: center;
    width: min(75vw, 300px);
  }

  .eyebrow {
    font-size: 12px;
  }

  .sub, .card p {
    font-size: 16px;
    line-height: 1.6;
  }

  .card h2 {
    font-size: 12px;
  }

  .card a {
    padding: 5px 0;
  }

  .foot .reset {
    padding: 10px 18px;
  }
}

/* Reduced Motion preferences */
@media (prefers-reduced-motion: reduce) {
  .hint {
    color: var(--ink-soft);
  }
  
  *, :before, :after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

/* ==========================================================================
   Subpages Common Styling (Projects & Events)
   ========================================================================== */
.subpage-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 44px) 0 140px;
}

.back-link {
  font-family: var(--font-jetbrains-mono), monospace;
  font-size: 13px;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 24px;
  border: 1.5px solid var(--ink);
  background: var(--card);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 8px 14px;
  transition: transform .15s, box-shadow .15s, background .15s, color .15s;
}

.back-link:hover {
  background: var(--ink);
  color: var(--card);
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px rgba(0, 0, 0, 0.25);
}

.back-link:active {
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(1px, 1px);
}

.subpage-container .hero {
  max-width: 100%;
}

.subpage-container .hero .name {
  font-size: clamp(48px, 9vw, 96px);
  margin-bottom: 8px;
}

.subpage-container .hero .sub {
  margin-top: 8px;
  color: var(--muted);
}

/* ==========================================================================
   Projects Grid & Filtering
   ========================================================================== */
.filter-section {
  margin-top: 36px;
  border-bottom: 1.5px solid var(--ink);
  padding-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-label {
  font-family: var(--font-jetbrains-mono), monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: var(--muted);
}

.pills-container {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  font-family: var(--font-jetbrains-mono), monospace;
  font-size: 12px;
  background: var(--card);
  border: 1.5px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  padding: 6px 14px;
  cursor: pointer;
  border-radius: 20px;
  transition: transform .15s, box-shadow .15s, background .15s, color .15s;
}

.pill:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}

.pill.active {
  background: var(--ink);
  color: var(--card);
  box-shadow: none;
  transform: none;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.project-card {
  border: 1.5px solid var(--ink);
  background: var(--card);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 24px 20px;
  border-radius: 8px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform .2s, box-shadow .2s, opacity .3s, scale .3s;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 6px 8px 0 rgba(0, 0, 0, 0.15);
}

.project-card.hidden {
  display: none !important;
}

.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.project-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  font-family: var(--font-jetbrains-mono), monospace;
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--muted);
  border-radius: 4px;
  padding: 2px 6px;
}

.project-link {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  font-size: 12px;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.project-link:hover {
  background: var(--ink);
  color: var(--card);
}

.project-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.project-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.project-title {
  font-family: var(--font-space-grotesk), sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.project-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
  flex-grow: 1;
}

/* ==========================================================================
   Accordion & Collapsible Event Cards
   ========================================================================== */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 32px;
}

.event-card {
  border: 1.5px solid var(--ink);
  background: var(--card);
  box-shadow: 4px 4px 0 var(--ink);
  border-radius: 8px;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}

.event-card:hover {
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.15);
}

.event-header-row {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: var(--card);
  user-select: none;
}

.event-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.status-badge {
  font-family: var(--font-jetbrains-mono), monospace;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1.5px solid var(--ink);
  font-weight: 600;
}

.status-badge.active {
  background: #e2f0d9;
  color: #385723;
}

.status-badge.completed {
  background: var(--paper);
  color: var(--muted);
}

.event-title {
  font-family: var(--font-space-grotesk), sans-serif;
  font-size: 18px;
  font-weight: 700;
}

.event-chevron {
  font-size: 16px;
  transition: transform .3s ease;
}

.event-card.expanded .event-chevron {
  transform: rotate(180deg);
}

.event-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height .3s cubic-bezier(0.4, 0, 0.2, 1), opacity .3s ease;
  border-top: 0 solid var(--ink);
  background: rgba(255, 255, 255, 0.12);
}

.event-card.expanded .event-body {
  max-height: 2000px;
  opacity: 1;
  border-top-width: 1.5px;
}

.event-content-inner {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.event-section-title {
  font-family: var(--font-jetbrains-mono), monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin: 0 0 8px;
}

.event-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
}

.code-path {
  font-family: var(--font-jetbrains-mono), monospace;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--ink);
  border-radius: 4px;
  padding: 8px 12px;
  display: inline-block;
  word-break: break-all;
  margin: 4px 0;
}

.event-media {
  margin-top: 12px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
  max-width: 500px;
  box-shadow: 3px 3px 0 var(--ink);
}

.event-media img {
  width: 100%;
  height: auto;
  display: block;
}
