/* ===== Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: 'Inter', Helvetica, Arial, sans-serif;
  font-size: 10pt; line-height: 1.2; font-weight: 500; color: #000; background: #fff;
  padding: 1vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; border: none; cursor: pointer; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: #000; }
.fade-in { animation: fade .8s; }
@keyframes fade { 0% { opacity: 0 } 50% { opacity: 0 } 100% { opacity: 1 } }

/* ===== Top nav ===== */
.topnav { position: fixed; top: 1vh; left: 1vh; right: 1vh; z-index: 20;
  display: flex; justify-content: space-between; align-items: flex-start; }
.topnav__group { display: flex; gap: 4px; }
.topnav__btn { display: inline-block; padding: 7px 16px; background: #EFEFEF; white-space: nowrap; cursor: pointer; }
.topnav__btn:hover { background: #d4d4d4; }
.topnav__btn.active { background: #000; color: #fff; }
.topnav__bio { position: relative; display: inline-block; padding: 7px 16px; white-space: nowrap; cursor: pointer; }
.topnav__bio-ghost { visibility: hidden; }
.topnav__bio-full { position: absolute; top: 0; left: 0; z-index: 10; padding: 7px 16px; background: #000; color: #fff; white-space: nowrap; }
.topnav__bio-more { display: none; }
.topnav__bio-more a { text-decoration: underline; }
.topnav__bio--expandable:hover .topnav__bio-full { width: 40vw; white-space: normal; }
.topnav__bio--expandable:hover .topnav__bio-more { display: inline; animation: fade-s .4s; }
@keyframes fade-s { from { opacity: 0 } to { opacity: 1 } }

/* ===== Views: hiệu ứng lật 3D như trang mẫu ===== */
.container { padding-top: 100px; perspective: 1000px; --front-h: calc(100vh - 100px - 2vh); }
.flipper { position: relative; transition: transform .6s; transform-style: preserve-3d; min-height: var(--front-h); }
.container.flipped .flipper { transform: rotateY(180deg); }

.front { position: absolute; top: 0; left: 0; width: 100%; height: var(--front-h);
  display: flex; align-items: flex-end; opacity: 1; z-index: 9; transition: opacity .5s; }
.container.flipped .front { opacity: .05; z-index: -9; pointer-events: none; }

.back { display: none; position: absolute; top: 0; left: 0; width: 100%;
  transform: rotateY(180deg); opacity: .05; z-index: -1; transition: opacity .5s; }
.back.is-shown { display: block; }
.back.is-active { position: relative; opacity: 1; z-index: 9; }
.container:not(.flipped) .back { pointer-events: none; }
.home { width: 100%; display: flex; justify-content: space-between; align-items: flex-end; gap: 1vh; }
.logo { flex: 1; min-width: 0; line-height: 0; }
.logo svg { width: 100%; height: auto; display: block; overflow: visible; }
.logo text { font-family: 'Inter Tight', 'Inter', Helvetica, sans-serif; font-weight: 700; letter-spacing: -0.02em; fill: #000; }
.squares { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.square { width: 6vw; min-width: 48px; aspect-ratio: 1; overflow: hidden; background: #EFEFEF; }
.square img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ===== Portfolio ===== */
.controls { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 24px; flex-wrap: wrap; }
.filters, .viewswitch { display: flex; flex-wrap: wrap; gap: .4rem .3rem; }
.filterButton { padding: 2px 13px; background: #EFEFEF; line-height: 1.5; }
.filterButton:hover { background: #d4d4d4; }
.filterButton.active { background: #000; color: #fff; }

.grid { display: flex; gap: 1vh; align-items: flex-start; }
.grid__col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.useblock { background: #fff; }
.usecredits { margin-top: 5px; }
.usecredits h2 { font: inherit; }
.studiocredit { margin-left: .5em; color: #BABABA; }

.carousel { position: relative; overflow: hidden; border-radius: 4px; touch-action: pan-y; background: #f4f4f4; }
.carousel-track { display: flex; transition: transform .3s ease; }
.carousel img { width: 100%; flex-shrink: 0; display: block; user-select: none; -webkit-user-drag: none; }
.carousel-ui { position: absolute; left: 8px; bottom: 8px; display: flex; gap: 4px; align-items: center; font-size: 10px;
  opacity: 0; transition: opacity .2s; }
.carousel:hover .carousel-ui { opacity: 1; }
.carousel-ui button, .carousel-counter { background: #fff; padding: 3px 8px; }
.carousel-ui button:hover { background: #d4d4d4; }

.list { margin: 60px 0 100px; }
.projItem { border-bottom: 1px solid #2f2b28; }
.projTitle { display: grid; grid-template-columns: repeat(12, 1fr); gap: 0 1vh; padding: 10px 4px; cursor: pointer; transition: background .15s, color .15s; }
.projTitle p:nth-child(1) { grid-column: span 5; }
.projTitle p:nth-child(2) { grid-column: span 5; }
.projTitle p:nth-child(3) { grid-column: span 2; text-align: right; }
.projTitle:hover { background: #000; color: #fff; }
.projItem.open .projTitle { background: #000; color: #fff; }
.projContent { display: none; overflow-x: auto; white-space: nowrap; padding-bottom: 10px; }
.projItem.open .projContent { display: block; }
.projContent img { height: 300px; margin-right: 5px; display: inline-block; vertical-align: top; }

/* ===== Information ===== */
.info-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2rem 1vh; padding-bottom: 60px; }
.info-col > * + .info-sec { margin-top: 3.6em; }
.info-sec p { margin: 0; }
.info-sec .title { margin-bottom: 1.2em; }
.info-sec a { display: block; width: fit-content; transition: margin .2s; }
.info-sec a[href]:hover { margin-left: 2px; }
.info-sec .text { white-space: pre-line; max-width: 60ch; }
.info-sec .text a { display: inline; text-decoration: underline; }

/* ===== Mobile ===== */
@media (max-width: 900px) {
  .info-col { grid-column: span 6 !important; }
}
@media (max-width: 640px) {
  .topnav { position: static; flex-wrap: wrap; justify-content: flex-start; gap: 4px; margin-bottom: 30px; }
  .topnav__group { display: contents; }
  .topnav__btn, .topnav__bio, .topnav__bio-full { padding: 9px 12px; }
  .topnav__bio--expandable:hover .topnav__bio-full { width: calc(100vw - 2vh); }
  .container { padding-top: 0; }
  .square { width: 14vw; }
  .info-col { grid-column: 1 / -1 !important; }
  .projTitle p:nth-child(2) { display: none; }
  .projTitle p:nth-child(1) { grid-column: span 10; }
  .projContent img { height: 200px; }
}
