/* ===========================
   styles.css — Zane Morris
   =========================== */

/* --- Theme Variables --- */
:root {
  --drawer-bg: #e6e6e6;
  --bg: #f0f0f0;
  --color: #222;
  --topbar-bg: #f0f0f0;
  --topbar-border: #d0d0d0;
  --topbar-shadow: rgba(0, 0, 0, 0.1);
  --nav-link: #222;
  --subtitle: #a8280f;
  --divider: #aaa;
  --bio-color: #444;
  --btn-color: #222;
  --btn-border: #222;
  --btn-hover-bg: #222;
  --btn-hover-color: #f0f0f0;
  --card-bg: #fff;
  --card-border: #ddd;
  --card-img-bg: #e0e0e0;
  --card-p: #555;
  --tag-color: #666;
  --tag-border: #ccc;
  --tag-university-color: #2e6da4;
  --tag-university-border: #7aafd4;
  --lightbox-bg: rgba(240, 240, 240, 0.95);
  --caption-color: #555;
  --nav-color: #444;
  --nav-hover: #000;
  --close-color: #222;
  --close-hover: #000;
  --footer-color: #999;
  --toggle-color: #555;
  --gold: #d4a017;
}

[data-theme="dark"] {
  --drawer-bg: #252525;
  --bg: #1e1e1e;
  --color: #ddd;
  --topbar-bg: #1e1e1e;
  --topbar-border: #333;
  --topbar-shadow: rgba(0, 0, 0, 0.4);
  --nav-link: #ccc;
  --subtitle: #c84e35;
  --divider: #444;
  --bio-color: #aaa;
  --btn-color: #ccc;
  --btn-border: #555;
  --btn-hover-bg: #ccc;
  --btn-hover-color: #1e1e1e;
  --card-bg: #272727;
  --card-border: #333;
  --card-img-bg: #333;
  --card-p: #999;
  --tag-color: #888;
  --tag-border: #444;
  --tag-university-color: #5090bc;
  --tag-university-border: #3a6a99;
  --lightbox-bg: rgba(20, 20, 20, 0.95);
  --caption-color: #888;
  --nav-color: #aaa;
  --nav-hover: #fff;
  --close-color: #aaa;
  --close-hover: #fff;
  --footer-color: #555;
  --toggle-color: #aaa;
  --gold: #c9a84c;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

.footer {
  margin-top: auto;
}

/* --- Topbar --- */
.topbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 60px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  box-shadow: 0 2px 12px var(--topbar-shadow);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease,
    background 0.3s ease,
    border-color 0.3s ease;
}

.topbar.hidden {
  transform: translateY(-100%);
}

.topbar-home {
  padding-right: 13.75px;
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-links a {
  font-size: 14px;
  color: var(--nav-link);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.1s ease;
  min-width: 60px;
  text-align: center;
}

.nav-links a:hover {
  color: var(--subtitle);
}

/* --- Theme Toggle --- */
#theme-toggle {
  position: absolute;
  left: 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--toggle-color);
  padding: 4px;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    color 0.1s ease,
    opacity 0.1s ease;
  opacity: 0.7;
}

#theme-toggle:hover {
  opacity: 1;
  color: var(--subtitle);
}

/* --- Hero --- */
.hero {
  padding-top: 44px;
  padding-bottom: 0;
  text-align: center;
}

.hero h1 {
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 10px;
  animation: cardFadeUp 0.5s ease both 0.05s;
  padding: 0 clamp(24px, 4vw, 32px);
}

.hero .subtitle {
  animation: cardFadeUp 0.5s ease both 0.1s;
}
.hero .hero-divider {
  animation: cardFadeUp 0.5s ease both 0.15s;
}
.hero .hero-bio {
  animation: cardFadeUp 0.5s ease both 0.22s;
}
.hero .hero-profile {
  animation: cardFadeUp 0.5s ease both 0.3s;
}

.subtitle {
  font-weight: 400;
  color: var(--subtitle);
  padding: 0 clamp(24px, 4vw, 32px);
}

.hero-divider {
  width: 40px;
  border: none;
  border-top: 1px solid var(--divider);
  margin: 28px auto 44px;
}

.hero-bio {
  max-width: 640px;
  margin: -6px auto 0;
  text-align: justify;
  font-size: 14px;
  line-height: 1.7;
  color: var(--bio-color);
  padding: 0 clamp(24px, 4vw, 32px);
  box-sizing: border-box;
}

.hero-bio p {
  margin-bottom: 24px;
}

.hero-profile {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  column-gap: clamp(8px, 2vw, 16px);
  padding: 0 clamp(16px, 4vw, 32px) 60px;
  box-sizing: border-box;
  margin-top: 36px;
  max-width: 620px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.profile-img {
  width: min(230px, calc(100% - clamp(16px, 4vw, 32px)));
  object-fit: cover;
  object-position: top;
  display: block;
  justify-self: end;
  transition: box-shadow 0.3s ease;
}

.profile-img:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

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

.profile-btns .btn {
  width: min(140px, calc(100% - clamp(16px, 4vw, 32px)));
  text-align: center;
}

.btn {
  display: block;
  width: fit-content;
  margin: 0 auto;
  font-size: 13px;
  text-align: center;
  color: var(--btn-color);
  border: 1px solid var(--btn-border);
  padding: 8px 24px;
  text-decoration: none;
  transition:
    background 0.2s,
    color 0.2s,
    border-color 0.3s ease;
}

.btn:hover {
  background: var(--btn-hover-bg);
  color: var(--btn-hover-color);
}

/* --- Projects Grid --- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 0 clamp(16px, 4vw, 32px) 60px;
  max-width: 1200px;
  width: 100%;
  align-self: center;
}

.project-card {
  background: var(--card-bg);
  border: 1px solid rgba(150, 150, 150, 0.55);
  display: flex;
  flex-direction: column;
  animation: cardFadeUp 0.6s ease both;
  transition:
    background 0.3s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
  position: relative;
}

@keyframes cardFadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.project-card:hover {
  border-color: rgba(150, 150, 150, 0.75);
  box-shadow:
    0 0 0 0.1px,
    0 4px 16px rgba(0, 0, 0, 0.15);
}

.project-card[data-article] {
  border-color: var(--subtitle);
}

.project-card[data-article]:hover {
  box-shadow:
    0 0 0 0.75px var(--subtitle),
    0 4px 16px rgba(0, 0, 0, 0.15);
}

.project-img-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--card-img-bg);
  overflow: hidden;
  transition:
    background 0.3s ease,
    aspect-ratio 0.25s ease;
  position: relative;
}

.img-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.2s ease,
    background 0.2s ease;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-nav:hover {
  background: rgba(0, 0, 0, 0.6);
}

.img-prev {
  left: 6px;
}

.img-next {
  right: 6px;
}

.project-img-wrap:hover .img-nav {
  opacity: 1;
}

.img-dots {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.project-img-wrap:hover .img-dots {
  opacity: 1;
}

.img-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transition: background 0.2s;
}

.img-dot.active {
  background: #fff;
}

.project-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-body {
  padding: 16px 16px 8px;
  flex: 1;
  position: relative;
}

.project-body h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
}

.project-body p {
  font-size: 13px;
  color: var(--card-p);
  line-height: 1.6;
  transition: color 0.3s ease;
}

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

.tag {
  font-size: 11px;
  color: var(--tag-color);
  border: 1px solid var(--tag-border);
  padding: 3px 10px;
  letter-spacing: 0.03em;
  transition:
    color 0.3s ease,
    border-color 0.3s ease;
}

.tag-university {
  color: var(--tag-university-color);
  border-color: var(--tag-university-border);
}

.tag-award {
  color: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 6px 1px rgba(212, 160, 23, 0.2);
}

/* --- Article Inline Expand --- */
.project-card[data-article] {
  cursor: pointer;
}

.photo-img-bar {
  display: flex;
  max-height: 0;
  overflow: hidden;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: var(--subtitle);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  transition:
    max-height 0.4s ease,
    padding 0.4s ease;
}

.photo-img-bar-link {
  display: flex;
  align-items: center;
  opacity: 0.75;
  transition:
    opacity 0.2s,
    transform 0.2s;
}

.photo-img-bar-link:hover {
  opacity: 1;
  transform: scale(1.15);
}

.card-article {
  display: none;
}

/* --- Article Overlay --- */
.article-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--lightbox-bg);
  display: none;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.article-overlay.visible {
  opacity: 1;
}

.article-overlay-scroll {
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  display: flex;
  flex-direction: column;
  padding: 60px 24px;
  box-sizing: border-box;
  outline: none;
}

@media (max-width: 460px) {
  .article-overlay-scroll {
    width: 100%;
    height: 100%;
    overflow-y: scroll;
    display: flex;
    flex-direction: column;
    padding: 60px 24px 120px;
    box-sizing: border-box;
    outline: none;
  }
}

.article-overlay-panel {
  max-width: 800px;
  width: 100%;
  margin: auto;
  background: var(--card-bg);
  border: 1px solid var(--subtitle);
  box-shadow:
    0 0 0 0.75px var(--subtitle),
    0 8px 32px rgba(0, 0, 0, 0.15);
  transition:
    background 0.3s ease,
    border-color 0.3s ease;
  position: relative;
}

.article-overlay-img-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.article-overlay-img-slider {
  position: relative;
}

.article-overlay-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.article-img-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  opacity: 0;
  transition:
    opacity 0.2s ease 0.25s,
    background 0.2s ease;
}

.article-img-nav:hover {
  background: rgba(0, 0, 0, 0.6);
}

.article-img-prev {
  left: 10px;
}

.article-img-next {
  right: 10px;
}

.article-overlay-img-wrap:hover .article-img-nav {
  opacity: 1;
  transition:
    opacity 0.2s ease,
    background 0.2s ease;
}

.article-img-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.article-img-close:hover {
  background: rgba(0, 0, 0, 0.7);
}

.article-img-dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  z-index: 5;
}

.article-img-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transition: background 0.2s;
}

.article-img-dot.active {
  background: #fff;
}

.article-overlay-panel .photo-img-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: none;
  overflow: hidden;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.52);
  color: #fff;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.2s ease 0.25s;
}

.article-overlay-img-wrap:hover .photo-img-bar {
  opacity: 1;
  transition: opacity 0.3s ease;
}

.article-overlay-body {
  padding: 32px 32px 40px;
  max-width: 680px;
  margin: 0 auto;
}

.article-overlay-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}

.featured-star {
  display: none;
}

.project-body h3 .featured-star {
  padding-right: 10px;
}

.article-overlay-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--subtitle);
  margin-bottom: 16px;
}

.article-overlay-body .project-tags {
  padding: 0 0 23px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 23px;
}

.article-overlay-body h2 {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtitle);
  margin: 32px 0 10px;
}

.article-overlay-body h2:first-of-type {
  margin-top: 0;
}

.article-overlay-body p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--bio-color);
  margin-bottom: 14px;
}

.article-overlay-body ul {
  font-size: 14px;
  line-height: 1.8;
  color: var(--bio-color);
  padding-left: 20px;
  margin-bottom: 14px;
}

.article-close-footer {
  width: 100%;
  padding: 10px;
  background: rgba(128, 128, 128, 0.07);
  border: none;
  border-top: 1px solid var(--divider);
  color: var(--subtitle);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.article-close-footer:hover {
  background: rgba(128, 128, 128, 0.14);
  color: var(--subtitle);
}

/* --- Gallery --- */
.gallery {
  columns: 3;
  column-gap: 16px;
  padding: 0 clamp(12px, 4vw, 32px) 16px;
  max-width: 1200px;
  width: 100%;
  align-self: center;
}

.gallery-item {
  position: relative;
  break-inside: avoid;
  margin-bottom: 16px;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity 0.1s ease;
  pointer-events: none;
}

.gallery-item:hover::after {
  opacity: 0.1;
}

.gallery-item:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.gallery img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  display: block;
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}

.gallery img.loaded {
  opacity: 1;
  transform: translateY(0);
}

.gallery img.portrait {
  aspect-ratio: 2 / 3;
}

/* --- 2-column on smaller screens --- */
@media (max-width: 900px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery {
    columns: 2;
    column-gap: 12px;
  }

  .gallery-item {
    margin-bottom: 12px;
    break-before: auto !important;
  }
}

@media (max-width: 700px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Hamburger Button --- */
.hamburger {
  display: none;
  position: absolute;
  right: 20px;
  top: 0;
  bottom: 0;
  margin-top: auto;
  margin-bottom: auto;
  background: none;
  border: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  overflow: hidden;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--toggle-color);
  transition:
    transform 0.25s ease,
    opacity 0.2s ease,
    background 0.1s ease;
}

.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger.open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --- Mobile Menu Overlay --- */
.mobile-menu {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    background 0.3s ease;
}

.mobile-menu.open {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
}

.mobile-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.mobile-nav a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  letter-spacing: 0.05em;
  color: var(--nav-link);
  text-decoration: none;
  border-top: 1px solid var(--topbar-border);
  transition: color 0.1s ease;
}

.mobile-nav a:last-child {
  border-bottom: 1px solid var(--topbar-border);
}

.mobile-nav a:hover {
  color: var(--subtitle);
}

.mobile-menu-footer {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-theme-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--toggle-color);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition:
    color 0.1s ease,
    opacity 0.1s ease;
}

.mobile-theme-btn:hover {
  opacity: 1;
  color: var(--subtitle);
}

@media (max-width: 460px) {
  #theme-toggle,
  .nav-links {
    display: none;
  }
  .hamburger {
    display: flex;
  }
}

body[data-scroll-locked] {
  overflow: hidden;
  margin-right: 13.75px;
}

@media (max-width: 460px) {
  body[data-scroll-locked] {
    overflow: hidden;
    margin-right: 0px;
  }
}

@media (max-width: 460px) {
  .hero-profile {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 0 24px 40px;
  }

  .profile-img {
    width: 62%;
    justify-self: center;
  }

  .profile-btns {
    justify-content: center;
    gap: 12px;
    width: min(140px, 62%);
    margin: 0 auto;
  }

  .profile-btns .btn {
    width: 100%;
    padding-left: clamp(8px, 5%, 24px);
    padding-right: clamp(8px, 5%, 24px);
  }
}

/* --- Lightbox --- */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--lightbox-bg);
  display: none;
  z-index: 200;
  overscroll-behavior: none;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.lightbox.active {
  display: block;
}

.lightbox.visible {
  opacity: 1;
}

.lightbox-img-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.lightbox img {
  max-width: 75vw;
  max-height: 80vh;
  display: block;
  transition: opacity 0.08s ease;
}

/* --- Nav Zones --- */
.nav-zone {
  position: absolute;
  top: 0;
  height: 100%;
  z-index: 10;
  cursor: pointer;
}

.nav-zone::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s;
}

.nav-zone:hover::before {
  opacity: 1;
}

.left-zone {
  left: 0;
}
.right-zone {
  right: 0;
}

.left-zone::before {
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.18) 0%,
    transparent 100%
  );
}
.right-zone::before {
  background: linear-gradient(
    to left,
    rgba(0, 0, 0, 0.18) 0%,
    transparent 100%
  );
}

#caption {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  color: var(--caption-color);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.caption-title {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.caption-sub {
  font-size: 0.8rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.02em;
}

.nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 40px;
  cursor: pointer;
  color: var(--nav-color);
  user-select: none;
  z-index: 11;
  transition: color 0.2s;
}

.nav.nav-hover {
  color: var(--subtitle);
}

.left {
  left: var(--arrow-pos, 30px);
}
.right {
  right: var(--arrow-pos, 30px);
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  color: var(--close-color);
  transition: color 0.2s;
  z-index: 201;
}

@media (max-width: 460px) {
  .close-btn {
    top: 0;
    right: 20px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.close-btn:hover {
  color: var(--subtitle);
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 30px;
  font-size: 12px;
  color: var(--footer-color);
  transition: color 0.3s ease;
}
