/* ---------- Local Bugrino (OTF) ---------- */
/* Put file at: fonts/bugrino.otf */
@font-face {
  font-family: 'Bugrino';
  src: url('fonts/bugrino.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---------- Font tokens ---------- */
:root {
  --title: 'Bugrino', serif;
  --desc: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- Base layout ---------- */
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  color: #fff;
  background: #000;
  font-family: var(--desc);
  font-weight: 400;
}

#p5-container {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
#p5-container::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 40%,
    rgba(0, 0, 0, 0) 38%,
    rgba(0, 0, 0, 0.35) 100%
  );
}

header {
  position: fixed;
  top: 0;
  width: 100%;
  text-align: right;
  padding: 20px;
  z-index: 3;
}
nav a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  margin: 0 15px;
  font-size: 1.05rem;
  transition: color 0.25s;
}
nav a:hover {
  color: #fff;
}

main {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 2;
}

.content h1 {
  font-family: var(--title);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: clamp(48px, 8vw, 120px);
  line-height: 0.95;
}
.content h2 {
  font-family: var(--desc);
  font-weight: 500;
  font-size: clamp(16px, 2.2vw, 28px);
  letter-spacing: 0.04em;
  opacity: 0.9;
  margin-top: 0.4rem;
}
.desc {
  font-family: var(--desc);
  letter-spacing: 0.02em;
  opacity: 0.9;
  margin-top: 0.6rem;
}
.hero-text {
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}

/* ---------- Projects overlay ---------- */
.projects-layer {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: auto;
}
.proj {
  --size: 175px;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  border: 0;
  padding: 0;
  cursor: pointer;
  background: transparent;
  opacity: 0.14;
  background-image: var(--bg);
  background-size: cover;
  background-position: center;
  mix-blend-mode: screen;
  filter: blur(0.3px) brightness(0.9);
  transform: translate(-50%, -50%) translateZ(0);
  transition: opacity 0.25s, transform 0.25s, filter 0.25s, box-shadow 0.25s,
    mix-blend-mode 0.25s;
  border-radius: 14px;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}
.proj:hover {
  opacity: 0.95;
  filter: none;
  transform: translate(-50%, -50%) translateY(-12px) scale(1.02);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  mix-blend-mode: normal;
}

/* ---------- Modal ---------- */
#proj-modal {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: none;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
}
#proj-modal[aria-hidden='false'] {
  display: block;
}

.pm-inner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(1100px, 92vw);
  max-height: 88vh;
  display: grid;
  grid-template-columns: 1fr 360px;
  background: rgba(10, 12, 10, 0.92);
  border: 1px solid rgba(120, 180, 140, 0.18);
  border-radius: 18px;
  overflow: hidden;
}
#pm-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pm-meta {
  padding: 20px;
  color: #e9efe9;
  font-family: var(--desc);
}
.pm-meta h3 {
  margin: 0 0 14px;
  font-size: 1.35rem;
  font-weight: 600;
}
.pm-actions {
  display: flex;
  gap: 10px;
}

/* Buttons */
.btn,
.btn:link,
.btn:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
  font-family: var(--desc);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: #0a0c0a;
  background: #9bb89b;
}
.btn:hover {
  filter: brightness(1.05);
}
.btn.ghost {
  background: transparent;
  color: #cfd9cf;
  border: 1px solid rgba(160, 200, 170, 0.35);
}
.btn.ghost:hover {
  background: rgba(160, 200, 170, 0.12);
}

/* Mobile */
@media (max-width: 900px) {
  .proj {
    --size: 160px;
  }
  .pm-inner {
    grid-template-columns: 1fr;
    width: min(1000px, 94vw);
  }
}
.back-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10;
  backdrop-filter: blur(4px);
}
/* caption box */
.proj-caption{
  position:absolute;
  left:50%;
  top:calc(100% + 8px);
  transform:translateX(-50%);
  padding:10px 12px;
  border-radius:10px;
  background:rgba(10,12,10,.72);
  border:1px solid rgba(120,180,140,.22);
  color:#e8eee8;
  font-family:var(--desc);
  text-align:center;
  backdrop-filter:blur(4px);
  box-shadow:0 8px 24px rgba(0,0,0,.35);
  opacity:0; pointer-events:none;
  transition:opacity .2s, transform .2s;
  /* auto-size to longer line, but cap width */
  width:max-content; max-width:60vw; white-space:nowrap;
}

/* title 13pt + subtitle 10pt */
.proj-caption .t{ font-size:13pt; font-weight:600; line-height:1; display:block; }
.proj-caption .s{ font-size:10pt; opacity:.9; line-height:1.25; display:block; }

/* show on hover */
.proj:hover .proj-caption{
  opacity:1; transform:translateX(-50%) translateY(2px);
}


.corner-link{
  position:fixed; bottom:18px; z-index:5;
  color:#e9efe9; text-decoration:none; font-family:var(--desc);
  font-weight:600; letter-spacing:.04em;
  padding:10px 14px; border-radius:10px;
  background:rgba(10,12,10,.55); border:1px solid rgba(120,180,140,.22);
  backdrop-filter:blur(4px); display:inline-flex; align-items:center; gap:10px;
}
.corner-link.left{ left:18px; }
.corner-link.right{ right:18px; }
.corner-link:hover{ background:rgba(10,12,10,.75); }

#speed-wrap{
  position:fixed; left:50%; bottom:16px; transform:translateX(-50%);
  z-index:6; display:flex; align-items:center; gap:10px;
  padding:8px 12px; border-radius:12px;
  background:rgba(10,12,10,.55); border:1px solid rgba(120,180,140,.22);
  backdrop-filter:blur(4px); font-family:var(--desc); color:#e9efe9;
}
#speed{ width:280px; }
#speed:focus{ outline:none; }
#speed-wrap label{ font-size:12px; opacity:.9; }
@media (max-width:600px){ #speed{ width:180px; } }
