/* Glass diamond + rounded P — adapts to light / dark mode */

/* Logo name color: see brand-palette.css (--brand-teal / --brand-white) */

.diamond-logo-scene {
  --logo-size: 56px;
  --logo-glass-bg: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(0, 180, 200, 0.06) 100%
  );
  --logo-glass-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 0 12px rgba(0, 229, 204, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.35);
  --logo-outline-stroke: rgba(255, 255, 255, 0.9);
  --logo-fill-tint: rgba(255, 255, 255, 0.07);
  --logo-inner-stroke: rgba(255, 255, 255, 0.3);

  width: var(--logo-size);
  height: var(--logo-size);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  background: var(--logo-glass-bg);
  backdrop-filter: blur(10px) saturate(1.4);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  box-shadow: var(--logo-glass-shadow);
  transition:
    background 0.25s ease,
    box-shadow 0.25s ease;
}

.diamond-logo-scene--sm {
  --logo-size: 44px;
}

body:not(.dark-mode) .diamond-logo-scene {
  --logo-glass-bg: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.72) 0%,
    rgba(220, 240, 248, 0.4) 55%,
    rgba(180, 220, 235, 0.28) 100%
  );
  --logo-glass-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 10px rgba(0, 140, 160, 0.14),
    0 0 0 1px rgba(0, 130, 150, 0.22);
  --logo-outline-stroke: rgba(0, 105, 125, 0.62);
  --logo-fill-tint: rgba(0, 150, 170, 0.08);
  --logo-inner-stroke: rgba(0, 120, 140, 0.28);
}

body.dark-mode .diamond-logo-scene {
  --logo-glass-bg: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.14) 0%,
    rgba(255, 255, 255, 0.04) 45%,
    rgba(0, 180, 200, 0.08) 100%
  );
  --logo-glass-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 0 14px rgba(0, 229, 204, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.32);
}

.diamond-logo-wrap {
  width: 100%;
  height: 100%;
}

.diamond-logo-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

.box-fill {
  fill: var(--logo-fill-tint);
  opacity: 0;
}

.box-mid,
.box-shine {
  pointer-events: none;
}

.box-rim {
  pointer-events: none;
}

.box-inner {
  opacity: 0;
  pointer-events: none;
  stroke: var(--logo-inner-stroke);
}

.box-outline {
  fill: none;
  stroke: var(--logo-outline-stroke);
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-dasharray: var(--box-len, 360);
  stroke-dashoffset: var(--box-len, 360);
  transition: stroke 0.25s ease;
}

.p-fill {
  opacity: 0;
}

.p-stroke {
  stroke-dasharray: var(--p-len, 200);
  stroke-dashoffset: var(--p-len, 200);
}

.diamond-logo-wrap.logo-ready .box-outline {
  animation: logoDrawStroke 0.65s ease forwards;
}

.diamond-logo-wrap.logo-ready .box-fill {
  animation: logoFadeIn 0.4s ease forwards 0.35s;
}

.diamond-logo-wrap.logo-ready .box-mid,
.diamond-logo-wrap.logo-ready .box-inner {
  animation: logoFadeIn 0.35s ease forwards 0.5s;
}

.diamond-logo-wrap.logo-ready .p-stroke {
  animation: logoDrawStroke 1.4s cubic-bezier(0.4, 0, 0.2, 1) forwards 0.75s;
}

.diamond-logo-wrap.logo-ready .p-fill {
  animation: logoFadeIn 0.4s ease forwards 2s;
}

@keyframes logoDrawStroke {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes logoFadeIn {
  to {
    opacity: 1;
  }
}

.diamond-logo-link {
  display: flex !important;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.diamond-logo-link:hover .diamond-logo-scene {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 0 18px rgba(0, 229, 204, 0.32),
    0 0 0 1px rgba(255, 255, 255, 0.48);
}

body:not(.dark-mode) .diamond-logo-link:hover .diamond-logo-scene {
  box-shadow:
    inset 0 1px 0 #fff,
    0 0 14px rgba(0, 150, 170, 0.22),
    0 0 0 1px rgba(0, 130, 150, 0.3);
}

.logo-container {
  display: flex;
  align-items: center;
}

.logo-container .name-reveal,
.diamond-mini-name {
  font-family: 'Courier New', monospace;
  font-weight: 800;
  font-size: 14px;
  color: var(--logo-name-color);
  letter-spacing: 1px;
  text-shadow: 0 0 12px var(--logo-name-glow);
  white-space: nowrap;
  transition: color 0.25s ease, text-shadow 0.25s ease;
}

.logo-container .name-reveal {
  position: static;
  transform: none;
  opacity: 1;
}

.diamond-mini-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(2, 12, 18, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 200, 180, 0.12);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

body:not(.dark-mode) .diamond-mini-bar {
  background: rgba(255, 255, 255, 0.92);
  border-bottom-color: rgba(0, 130, 150, 0.15);
}

.diamond-mini-home {
  margin-left: auto;
  font-size: 12px;
  color: rgba(0, 229, 204, 0.7);
  text-decoration: none;
  font-family: 'Courier New', monospace;
}

.diamond-mini-bar .mini-bar-menu-btn {
  flex: 0 0 auto;
  margin-left: 8px;
}

.diamond-mini-home--with-menu {
  margin-left: auto;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .diamond-mini-home--with-menu {
    font-size: 11px;
    max-width: 36vw;
  }
}

body:not(.dark-mode) .diamond-mini-home {
  color: rgba(0, 122, 110, 0.85);
}

.diamond-mini-spacer {
  height: 52px;
}

/* Legal pages (privacy.html, terms.html) */
.legal-page {
  padding: 72px 0 48px;
  min-height: calc(100vh - 120px);
}

.legal-container {
  max-width: 760px;
  margin: 0 auto;
  line-height: 1.7;
}

.legal-container h1 {
  margin-bottom: 0.5rem;
}

.legal-container h2 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.legal-updated {
  opacity: 0.75;
  margin-bottom: 1.5rem;
}

.legal-container ul {
  padding-left: 1.25rem;
  margin: 0.5rem 0 1rem;
}

.legal-container li {
  margin-bottom: 0.5rem;
}

.legal-nav {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
}

body.dark-mode .legal-nav {
  border-top-color: var(--dark-border-color, rgba(255, 255, 255, 0.12));
}

.legal-footer {
  padding: 24px 0;
  text-align: center;
}

.legal-footer .copyright {
  margin: 0;
  opacity: 0.8;
}

body:not(.dark-mode) .diamond-mini-name {
  color: var(--logo-name-color);
}

/* Compact theme toggle on mini-bar pages — pill styled in enhancements.css */
.theme-toggle--mini {
  margin-left: 8px;
}

/* Resource guide pages (resource4.html, resource5.html) */
.content-section {
  padding: 100px 0 64px;
  min-height: 50vh;
}

.resource-content {
  max-width: 820px;
  margin: 0 auto;
  line-height: 1.65;
}

.resource-hero-image img {
  width: 100%;
  max-width: 640px;
  height: auto;
  display: block;
  margin: 0 auto 1.5rem;
  border-radius: 12px;
  object-fit: cover;
}

.related-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 1rem;
}

/* Scroll-reveal cards (site-core.js) */
@media (prefers-reduced-motion: no-preference) {
  .profile-card-animated,
  .project-card-animated,
  .blog-card-animated,
  .resource-card-animated {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.55s ease, transform 0.55s ease;
    will-change: opacity, transform;
  }

  .profile-card-animated.is-revealed,
  .project-card-animated.is-revealed,
  .blog-card-animated.is-revealed,
  .resource-card-animated.is-revealed {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-card-animated,
  .project-card-animated,
  .blog-card-animated,
  .resource-card-animated {
    opacity: 1;
    transform: none;
  }
}

/* Lazy-loaded image skeletons */
.img-skeleton-wrap {
  position: relative;
  display: block;
  overflow: hidden;
  background: linear-gradient(
    110deg,
    rgba(0, 0, 0, 0.06) 8%,
    rgba(0, 0, 0, 0.12) 18%,
    rgba(0, 0, 0, 0.06) 33%
  );
  background-size: 200% 100%;
  animation: imgSkeletonShimmer 1.4s ease-in-out infinite;
  border-radius: var(--border-radius, 8px);
}

body.dark-mode .img-skeleton-wrap {
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0.05) 8%,
    rgba(255, 255, 255, 0.12) 18%,
    rgba(255, 255, 255, 0.05) 33%
  );
  background-size: 200% 100%;
}

.img-skeleton-wrap.is-loaded {
  animation: none;
  background: transparent;
}

.img-skeleton-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

.img-skeleton-wrap img:not(.is-loaded) {
  opacity: 0;
}

.img-skeleton-wrap img.is-loaded {
  opacity: 1;
  transition: opacity 0.35s ease;
}

.project-image.img-skeleton-wrap,
.blog-img.img-skeleton-wrap,
.resource-hero-image.img-skeleton-wrap {
  aspect-ratio: 16 / 9;
  min-height: 160px;
}

@keyframes imgSkeletonShimmer {
  to {
    background-position-x: -200%;
  }
}

@media (min-width: 993px) and (max-width: 1280px) {
  .nav-container {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px 10px;
    max-width: 100%;
  }

  .nav-links .nav-link {
    font-size: 12px;
    padding: 2px 4px;
  }
}

@media (max-width: 1100px) {
  .nav-links {
    gap: 6px;
  }

  .nav-links .nav-link {
    font-size: 12px;
  }
}

/* Cyber glitch title — layers stacked in one grid cell (not 4 lines) */
.logo-cyber-glitch {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  vertical-align: middle;
  font-family: 'Courier New', Courier, monospace;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.15;
  text-transform: uppercase;
}

.logo-cyber-glitch__base,
.logo-cyber-glitch__layer {
  grid-area: 1 / 1;
  align-self: center;
  justify-self: center;
  margin: 0;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  white-space: nowrap;
}

.logo-cyber-glitch__base {
  position: relative;
  z-index: 3;
  color: var(--logo-name-color, var(--brand-teal, #3b6b5e));
  text-shadow:
    0 0 14px var(--logo-name-glow),
    0 0 28px rgba(59, 107, 94, 0.2);
  animation: logo-cyber-glow 2.4s ease-in-out infinite alternate;
}

.logo-cyber-glitch__layer {
  position: relative;
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.logo-cyber-glitch__layer--a {
  z-index: 2;
  color: var(--brand-teal, #3b6b5e);
  opacity: 0.8;
  mix-blend-mode: multiply;
  animation: logo-cyber-shift-a 2.2s infinite steps(1);
}

.logo-cyber-glitch__layer--b {
  z-index: 1;
  color: var(--brand-black, #000);
  opacity: 0.5;
  mix-blend-mode: multiply;
  animation: logo-cyber-shift-b 1.8s infinite steps(1);
}

body.dark-mode .logo-cyber-glitch__layer--b {
  color: var(--brand-white, #fff);
}

.logo-cyber-glitch__layer--scan {
  z-index: 4;
  color: transparent;
  -webkit-text-stroke: 1px rgba(59, 107, 94, 0.45);
  text-stroke: 1px rgba(59, 107, 94, 0.45);
  opacity: 0;
  animation: logo-cyber-scan 3s infinite steps(1);
}

.logo-cyber-glitch--nav {
  font-size: 14px;
  letter-spacing: 1px;
}

.logo-cyber-glitch--hero {
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  letter-spacing: 0.14em;
}

.logo-cyber-glitch.is-glitching .logo-cyber-glitch__base {
  animation: logo-cyber-shake 0.38s steps(4) 1, logo-cyber-glow 2.4s ease-in-out infinite alternate;
}

.logo-cyber-glitch.is-glitching .logo-cyber-glitch__layer--a,
.logo-cyber-glitch.is-glitching .logo-cyber-glitch__layer--b {
  opacity: 1;
}

@keyframes logo-cyber-glow {
  0% {
    text-shadow:
      0 0 12px var(--logo-name-glow),
      0 0 24px rgba(59, 107, 94, 0.15);
  }
  100% {
    text-shadow:
      0 0 18px var(--logo-name-glow),
      0 0 36px rgba(59, 107, 94, 0.28);
  }
}

@keyframes logo-cyber-shake {
  0% { transform: translate(0); }
  20% { transform: translate(-5px, 2px) skewX(-2deg); }
  45% { transform: translate(6px, -2px) skewX(2deg); }
  70% { transform: translate(-4px, -1px); }
  100% { transform: translate(0); }
}

@keyframes logo-cyber-shift-a {
  0% { transform: translate(0); clip-path: inset(5% 0 78% 0); opacity: 0.55; }
  10% { transform: translate(-4px, 1px); clip-path: inset(38% 0 42% 0); opacity: 0.95; }
  22% { transform: translate(3px, -1px); clip-path: inset(68% 0 12% 0); opacity: 0.75; }
  34% { transform: translate(-2px, 2px); clip-path: inset(12% 0 72% 0); opacity: 0.9; }
  50% { transform: translate(5px, 0); clip-path: inset(52% 0 28% 0); opacity: 0.85; }
  66% { transform: translate(-5px, -1px); clip-path: inset(22% 0 58% 0); opacity: 0.95; }
  82% { transform: translate(4px, 2px); clip-path: inset(75% 0 8% 0); opacity: 0.7; }
  100% { transform: translate(0); clip-path: inset(42% 0 38% 0); opacity: 0.55; }
}

@keyframes logo-cyber-shift-b {
  0% { transform: translate(0); clip-path: inset(58% 0 18% 0); opacity: 0.5; }
  12% { transform: translate(4px, -2px); clip-path: inset(15% 0 65% 0); opacity: 0.9; }
  28% { transform: translate(-3px, 1px); clip-path: inset(72% 0 6% 0); opacity: 0.8; }
  42% { transform: translate(5px, 2px); clip-path: inset(28% 0 52% 0); opacity: 0.95; }
  58% { transform: translate(-4px, 0); clip-path: inset(8% 0 78% 0); opacity: 0.85; }
  74% { transform: translate(3px, -2px); clip-path: inset(48% 0 32% 0); opacity: 0.9; }
  88% { transform: translate(-5px, 1px); clip-path: inset(62% 0 22% 0); opacity: 0.75; }
  100% { transform: translate(2px, 0); clip-path: inset(18% 0 62% 0); opacity: 0.5; }
}

@keyframes logo-cyber-scan {
  0%, 91%, 100% { opacity: 0; transform: translate(0); }
  92% { opacity: 0.55; transform: translate(-6px, 0); }
  93% { opacity: 0.35; transform: translate(6px, 0); }
  94% { opacity: 0.2; transform: translate(-3px, 0); }
}

.logo-container .name-reveal.logo-cyber-glitch {
  position: static;
  transform: none;
  opacity: 1;
}

.hero-title-wrap.text-reveal,
.hero-title-wrap .hero-title-reveal {
  overflow: visible;
}

.hero-title-wrap.text-reveal > span.hero-title-reveal {
  display: inline-block;
  overflow: visible;
  transform: none;
}

.hero-title-wrap.text-reveal.active > span.hero-title-reveal {
  transform: none;
}

.hero h1.logo-cyber-glitch {
  margin-bottom: 20px;
  text-shadow: none;
}

.hero-cyber-tagline {
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: 0.06em;
  color: var(--logo-name-color, var(--brand-teal, #3b6b5e));
  text-shadow: 0 0 10px var(--logo-name-glow);
}

@media (prefers-reduced-motion: reduce) {
  .box-outline,
  .p-stroke {
    stroke-dashoffset: 0;
    animation: none !important;
  }

  .box-fill,
  .box-mid,
  .box-inner,
  .p-fill {
    opacity: 1;
    animation: none !important;
  }

  .logo-cyber-glitch__base,
  .logo-cyber-glitch__layer {
    animation: none !important;
  }

  .logo-cyber-glitch__layer {
    display: none;
  }

  .logo-cyber-glitch.is-glitching .logo-cyber-glitch__base {
    transform: none;
  }
}
