/* ============================================================
   Home Page Styles — j1.silva Portfolio
   ============================================================ */

html, body {
  margin: 0; padding: 0;
  background: var(--bg-light);
  color: var(--ink-light);
  transition: background-color .55s ease, color .55s ease;
}

body:not(.projects-active):not(.research-active) { overflow: hidden; height: 100vh; }
body.projects-active { background-color: var(--bg-dark); color: var(--ink-dark); }
html:has(body.projects-active) { background-color: var(--bg-dark); }
body.research-active { background-color: #fff; color: var(--ink-light); }
html:has(body.research-active) { background-color: #fff; }

/* ── ANNOUNCEMENT BAR ── */
.announcement-bar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 28px;
  background: var(--bg-dark);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 28px;
  z-index: 200;
  overflow: hidden;
}

.announcement-text {
  white-space: nowrap;
}

.rotating-word {
  display: inline-block;
  min-width: 5.5em;
}
.rotating-word.fade-out {
  animation: wordOut .3s ease forwards;
}
.rotating-word.fade-in {
  animation: wordIn .3s ease forwards;
}
@keyframes wordOut {
  to { opacity: 0; transform: translateY(-4px); }
}
@keyframes wordIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

body.research-active .announcement-bar {
  background: #fff;
  color: #0a0a0a;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

/* ── LOGO ── */
.logo {
  position: fixed;
  top: 60px;
  left: 64px;
  color: var(--ink-light);
  cursor: pointer;
  z-index: 150;
  display: flex;
  align-items: center;
  transition: color .45s ease, top .45s cubic-bezier(.4,.1,.2,1),
              left .45s ease, transform .45s ease;
}
.logo svg { height: 28px; width: auto; display: block; }
body.projects-active .logo { color: var(--ink-dark); }
body.research-active .logo { color: var(--ink-light); }
body.scrolled .logo { top: 40px; left: 28px; transform: scale(0.72); transform-origin: left center; }

/* ── HERO ── */
.hero {
  position: relative;
  height: calc(100vh - 28px);
  margin-top: 28px;
  overflow: hidden;
  transition: height .55s cubic-bezier(.4,.1,.2,1);
}
body.projects-active .hero       { height: 50vh; overflow: visible; }
body.projects-active.scrolled .hero { height: 0; }
body.research-active .hero       { height: 50vh; overflow: visible; }
body.research-active.scrolled .hero { height: 0; }

.blob-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.braille-art {
  font-family: 'Space Grotesk', 'Noto Sans Symbols 2', system-ui, sans-serif;
  font-size: 22px;
  line-height: 20.8px;
  letter-spacing: -0.02em;
  white-space: pre;
  color: #d7ff47;
  transition: color .55s ease;
}
body.projects-active .braille-art { color: #fff; }
body.research-active .braille-art { color: #0a0a0a; }

/* ── ABOUT BLOCK ── */
.about-block {
  position: absolute;
  top: 84px; right: 64px;
  width: 380px;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  gap: 28px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--ink-light);
  transition: color .45s ease, opacity .45s ease, transform .45s ease;
}
body.projects-active .about-block { color: var(--ink-dark); }
body.research-active .about-block {
  color: var(--ink-light);
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}
body.scrolled .about-block {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}
.about-block .spark {
  width: 46px; height: 50px;
  flex-shrink: 0;
  margin-top: 2px;
  animation: spin 20s linear infinite;
}
.about-block .spark path {
  fill: var(--ink-light);
  transition: fill .45s ease;
}
body.projects-active .about-block .spark path { fill: var(--ink-dark); }
body.research-active .about-block .spark path { fill: var(--ink-light); }
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.about-block .copy { flex: 1; }
.about-block .copy p + p { margin-top: 18px; }
.about-block .about-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 26px;
  font-weight: 400;
  font-size: 15px;
  color: var(--muted-light);
  cursor: pointer;
  transition: color .2s;
}
body.projects-active .about-block .about-link { color: var(--muted-dark); }
body.research-active .about-block .about-link { color: var(--muted-light); }
.about-block .about-link:hover { color: currentColor; }
.about-block .about-link .arrow { transition: transform .2s; }
.about-block .about-link:hover .arrow { transform: translateX(4px); }

/* ── NAV MENU ── */
.nav-menu {
  position: fixed;
  top: 50%;
  left: 64px;
  right: 28px;
  transform: translateY(-50%);
  z-index: 100;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--ink-light);
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  transition: color .45s ease, background .45s ease,
              top .45s cubic-bezier(.4,.1,.2,1), transform .45s ease,
              left .45s ease, padding .45s ease;
}
body.projects-active .nav-menu { color: var(--ink-dark); }
body.research-active .nav-menu { color: var(--ink-light); }
body.scrolled .nav-menu {
  top: 28px;
  left: 0;
  right: 0;
  transform: none;
  padding: 12px 28px 12px 140px;
  background: var(--bg-dark);
}
body.research-active.scrolled .nav-menu {
  background: #fff;
  color: var(--ink-light);
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.nav-item {
  white-space: nowrap;
  line-height: 20px;
  transition: opacity .2s;
}
.nav-item.num {
  position: relative;
  opacity: .55;
  font-variant-numeric: tabular-nums;
  margin-right: 2px;
}
.nav-item.label {
  position: relative;
  opacity: .85;
  cursor: pointer;
  margin-right: 32px;
}
.nav-item.label:hover { opacity: 1; }
.nav-item.disabled { cursor: not-allowed; opacity: .4; }
.nav-item.disabled:hover { opacity: .5; }
.nav-item.num:has(+ .nav-item.label.is-active)::before {
  content: "";
  position: absolute;
  left: -12px; top: 50%;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--neon);
  box-shadow: 0 0 8px var(--neon);
  transform: translateY(-50%);
  animation: dotPulse 1.6s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--neon); }
  50%      { opacity: .3; box-shadow: 0 0 2px var(--neon); }
}
body.research-active .nav-item.num:has(+ .nav-item[data-key="research"].is-active)::before {
  background: var(--ink-light);
  box-shadow: 0 0 8px rgba(0,0,0,0.3);
  animation-name: dotPulseResearch;
}
@keyframes dotPulseResearch {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(0,0,0,0.3); }
  50%      { opacity: .3; box-shadow: 0 0 2px rgba(0,0,0,0.1); }
}

/* ── PROJECTS SECTION ── */
.projects-section {
  position: relative;
  z-index: 3;
  padding: 0 64px 80px;
  margin-top: 24px;
  background: var(--bg-dark);
  color: var(--ink-dark);
  opacity: 0;
  transition: opacity .55s ease;
}
body.projects-active .projects-section { opacity: 1; }
body.research-active .projects-section { display: none; }

.projects-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: var(--grid-gap);
  row-gap: 0;
}
.grid-column { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.top-fade {
  position: fixed;
  top: 28px; left: 0; right: 0;
  height: 140px;
  z-index: 90;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    var(--bg-dark) 0%,
    var(--bg-dark) 55%,
    rgba(0,0,0,0.85) 75%,
    rgba(0,0,0,0) 100%
  );
  opacity: 0;
  transition: opacity .4s ease;
}
body.scrolled .top-fade { opacity: 1; }
body.research-active .top-fade {
  background: linear-gradient(
    to bottom,
    #fff 0%,
    #fff 55%,
    rgba(255,255,255,0.85) 75%,
    rgba(255,255,255,0) 100%
  );
}

.close-btn {
  margin-left: auto;
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-dark);
  color: var(--ink-dark);
  border: none;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  font-family: var(--font-base);
  line-height: 1;
  transition: background .2s, opacity .35s ease;
}
.close-btn:hover { background: var(--surface-dark-hover); }
body.projects-active .close-btn { opacity: 1; pointer-events: auto; }
body.research-active .close-btn {
  opacity: 1; pointer-events: auto;
  background: rgba(10,10,10,0.08);
  color: var(--ink-light);
}
body.research-active .close-btn:hover { background: rgba(10,10,10,0.15); }

/* ── Search & Filters ── */
.search-block { display: flex; flex-direction: column; gap: 12px; }
.search-form {
  display: flex;
  align-items: center;
  background: var(--surface-dark);
  border-radius: var(--card-radius);
  height: 40px;
  padding: 0 12px;
  gap: 8px;
  transition: background .25s;
}
.search-form:focus-within { background: var(--surface-dark-hover); }
.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--ink-dark);
  font-family: var(--font-base);
  min-width: 0;
}
.search-input::placeholder { color: var(--muted-dark); }
.search-submit {
  background: transparent;
  border: none;
  color: var(--ink-dark);
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  line-height: 1;
}
.filter-list { display: flex; flex-direction: column; margin-top: 4px; }
.filter-item {
  font-family: var(--font-base);
  font-size: 14px;
  color: var(--ink-dark);
  padding: 8px 0;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity .2s;
  user-select: none;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filter-item:hover { opacity: 1; }

/* ── Project Cards ── */
.project-card {
  display: block;
  text-decoration: none;
  cursor: pointer;
  color: inherit;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .55s ease, transform .55s ease;
}
body.projects-active .project-card {
  animation: cardIn .7s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: calc(var(--i, 0) * 35ms + 150ms);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card-media {
  width: 100%;
  overflow: hidden;
  border-radius: var(--card-radius);
  background: var(--surface-dark);
}
.card-media[data-ratio="landscape"] { aspect-ratio: 3 / 2; }
.card-media[data-ratio="square"]    { aspect-ratio: 1 / 1; }
.card-media[data-ratio="portrait"]  { aspect-ratio: 3 / 4; }
.card-media img {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: opacity .5s, transform .5s;
}
.project-card:hover .card-media img { opacity: .82; transform: scale(1.012); }
.project-card h2 {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.25;
  color: var(--ink-dark);
  margin: 8px 0 0;
  font-family: var(--font-base);
  transition: color .25s;
}
.project-card:hover h2 { color: #fff; }
.project-card p {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.25;
  color: var(--muted-dark);
  margin: 0;
  font-family: var(--font-base);
}

/* ── PROJECT MODAL ── */
.project-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg-dark);
  color: var(--ink-dark);
  display: flex;
  flex-direction: column;
  pointer-events: none;
  opacity: 0;
  transform: translateY(24px);
  visibility: hidden;
}
.project-modal.visible {
  visibility: visible;
  pointer-events: auto;
}
.project-modal.open {
  opacity: 1;
  transform: translateY(0);
  transition: opacity .4s cubic-bezier(.25,.1,.25,1),
              transform .45s cubic-bezier(.25,.1,.25,1);
}
.project-modal.closing {
  opacity: 0;
  transform: translateY(0);
  transition: opacity .5s cubic-bezier(.4,0,1,1),
              transform .5s cubic-bezier(.4,0,1,1);
}

.project-modal-bar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--bg-dark);
  border-bottom: 1px solid rgba(226,230,227,0.08);
  z-index: 10;
  flex-shrink: 0;
}
.project-modal-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-dark);
}
.project-modal-close {
  background: hsla(135, 7%, 89%, 0.1);
  border: none;
  color: var(--ink-dark);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-base);
  line-height: 1;
  transition: background .2s;
}
.project-modal-close:hover { background: hsla(135, 7%, 89%, 0.18); }

.project-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-modal-nav {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background: var(--bg-dark);
  border-top: 1px solid rgba(226,230,227,0.08);
}
.project-nav-btn {
  background: none;
  border: none;
  color: var(--ink-dark);
  font-family: var(--font-display);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  opacity: .6;
  transition: opacity .2s;
}
.project-nav-btn:hover { opacity: 1; }
.project-nav-btn .nav-arrow {
  font-size: 18px;
  transition: transform .2s;
}
.project-nav-btn.prev:hover .nav-arrow { transform: translateX(-3px); }
.project-nav-btn.next:hover .nav-arrow { transform: translateX(3px); }
.project-nav-btn .nav-label { font-size: 13px; color: hsla(135,7%,89%,0.5); }

/* ── RESPONSIVE ── */

@media (max-width: 1200px) {
  .logo { left: 32px; }
  .about-block { right: 32px; width: 320px; font-size: 15px; }
  .nav-menu { left: 32px; top: 50%; }
  .nav-item { font-size: 14px; }
  .projects-section { padding: 0 32px 80px; }
}

@media (max-width: 1024px) {
  .logo { left: 24px; }
  .about-block { right: 24px; width: 300px; font-size: 14px; gap: 20px; }
  .about-block .spark { width: 38px; height: 42px; }
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-menu { left: 24px; top: 50%; }
  .nav-item { font-size: 13px; }
  .projects-section { padding: 0 24px 80px; }
}

@media (max-width: 768px) {
  .announcement-bar { font-size: 11.5px; padding: 0 14px; }

  .logo { top: 44px; left: 20px; }
  .logo svg { height: 22px; }
  body.scrolled .logo { top: 32px; left: 16px; transform: scale(0.78); }

  .braille-art { font-size: 15px; line-height: 14.2px; }

  .about-block {
    top: auto; bottom: 88px;
    left: 20px; right: 20px;
    width: auto; font-size: 14px;
    line-height: 1.2; gap: 14px;
    z-index: 10;
  }
  .about-block .spark { width: 32px; height: 36px; }
  .about-block .copy p + p { margin-top: 12px; }
  .about-block .about-link { margin-top: 16px; font-size: 14px; }
  body.projects-active .about-block {
    opacity: 0; transform: translateY(-8px); pointer-events: none;
  }

  .nav-menu {
    top: 50%;
    left: 20px;
    right: 14px;
    font-size: 13px;
    gap: 6px;
  }
  body.projects-active .nav-menu {
    top: 80px;
    transform: none;
  }
  body.scrolled .nav-menu {
    top: 28px; left: 0; right: 0;
    transform: none;
    padding: 10px 16px 10px 108px;
    border-bottom: 1px solid rgba(226,230,227,0.07);
  }

  .nav-item.num { display: none !important; }
  .nav-item.label { margin-right: 18px; }
  .nav-item.disabled { display: none !important; }

  .hero { height: calc(100svh - 28px); }
  body.projects-active .hero { height: 28vh; }

  .projects-section { padding: 0 20px 80px; }
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .close-btn { width: 28px; height: 28px; font-size: 12px; }
  body.scrolled .top-fade { top: 80px; height: 100px; }

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

@media (max-width: 480px) {
  .logo { top: 40px; left: 16px; }
  .logo svg { height: 20px; }

  .braille-art { font-size: 11px; line-height: 10.4px; }

  .about-block {
    font-size: 13px; bottom: 80px; gap: 12px;
    left: 16px; right: 16px;
  }
  .about-block .spark { width: 26px; height: 30px; }
  .about-block .about-link { display: none; }

  .nav-menu { left: 16px; right: 16px; top: 50%; gap: 4px; }
  .nav-item.label { font-size: 13px; margin-right: 14px; }

  body.projects-active .hero { height: 22vh; }
  body.projects-active .nav-menu { top: 56px; }

  .projects-section { padding: 0 16px 60px; }
  .projects-grid { grid-template-columns: 1fr; }
  .grid-column { gap: 20px; }

  .search-form { height: 36px; }
  .search-input { font-size: 13px; }
  .filter-item { font-size: 13px; padding: 6px 0; }

  .project-card h2 { font-size: 14px; margin-top: 6px; }
  .project-card p { font-size: 13px; }
}
