/* VIVID MASS components — shared across pages */

/* === NAV === */
.site-nav {
  position: sticky;
  top: 0;
  background-color: var(--bg-main);
  z-index: 100;
  padding: var(--nav-pad-y) 0;
  overflow: hidden;
}

.site-nav.bordered {
  border-bottom: none;
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  font-family: var(--font-title);
  font-size: clamp(0.75rem, 1.5vw, 0.95rem);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  line-height: 1.2;
  min-width: 0;
}

.brand-mark-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2em;
  flex-shrink: 0;
}

.brand-mark {
  display: none;
  height: 2em;
  width: auto;
  max-height: 2em;
  object-fit: contain;
  vertical-align: middle;
}

[data-theme="dark"] .brand-mark-dark {
  display: block;
}

[data-theme="light"] .brand-mark-light {
  display: block;
}

.brand-text {
  display: inline;
}

.brand-light {
  font-weight: 300;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0;
}

.nav-divider {
  width: 1px;
  height: 1.25rem;
  background: var(--nav-divider-color);
  margin: 0 0.75rem;
}

.nav-links a,
.nav-links button.theme-toggle {
  font-family: var(--font-title);
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.35rem 0;
}

.nav-links a {
  position: relative;
  z-index: 2;
  background: none;
  display: inline-block;
  color: var(--nav-inactive-text);
  transition: color 0.15s ease, font-weight 0.15s ease;
}

.nav-link-label {
  position: relative;
  z-index: 1;
  display: inline-block;
}

/* Highlight spans divider-to-divider; clipped by .site-nav overflow */
.nav-links a::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: calc(-0.35rem - var(--nav-pad-y));
  left: -0.75rem;
  right: -0.75rem;
  height: calc(100% + 0.7rem + var(--nav-pad-y) * 2);
  background: transparent;
  pointer-events: none;
  transition: background-color 0.15s ease;
}

.nav-links a:hover,
.nav-links a.active {
  font-weight: 700;
}

.nav-links a:hover::before,
.nav-links a.active::before {
  background-color: var(--nav-hover-bg);
}

.nav-links a.active::before {
  background-color: var(--nav-active-bg);
}

.nav-links a:hover:not(.active) .nav-link-label {
  color: var(--nav-hover-text);
}

/* Halftone on active text only — em-scaled dot matrix, not the pill background */
.nav-links a.active .nav-link-label {
  color: transparent;
  -webkit-text-fill-color: transparent;
  background-image:
    radial-gradient(circle at 50% 50%, var(--nav-active-text) 0.038em, transparent calc(0.038em + 0.012em)),
    radial-gradient(circle at 50% 50%, var(--nav-active-text) 0.022em, transparent calc(0.022em + 0.01em));
  background-size: 0.13em 0.13em, 0.13em 0.13em;
  background-position: 0 0, 0.065em 0.065em;
  -webkit-background-clip: text;
  background-clip: text;
  animation: nav-link-halftone-glow 2.4s ease-in-out infinite;
}

@keyframes nav-link-halftone-glow {
  0%, 100% {
    filter:
      drop-shadow(0 0 0.04em var(--nav-active-text))
      drop-shadow(0 0 0.09em var(--nav-active-text));
  }
  50% {
    filter:
      drop-shadow(0 0 0.06em var(--nav-active-text))
      drop-shadow(0 0 0.14em var(--nav-active-text));
  }
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  margin-right: 0.25rem;
}

/* === HERO === */
.hero {
  position: relative;
  min-height: var(--hero-min-height);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  border-bottom: none;
  background-color: var(--bg-main);
}

.hero-bg {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--page-inset-x);
  right: var(--page-inset-x);
  width: auto;
  background-color: var(--bg-secondary);
  background-position: center center;
  background-repeat: no-repeat;
}

.hero-bg:not([style*="background-image"]) {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}

.hero-bg[style*="background-image"] {
  background-size: cover;
  background-position: center center;
}

.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    rgba(2, 1, 1, 0.88) 0%,
    rgba(2, 1, 1, 0.62) 42%,
    rgba(2, 1, 1, 0.4) 100%
  );
}

.hero-sidebar {
  position: absolute;
  left: calc(var(--page-inset-x) + 5px);
  top: 0;
  height: 100%;
  width: 1.25rem;
  padding: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  text-align: center;
  transform: rotate(180deg);
  transform-origin: center center;
  font-family: var(--font-title);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--light-grey);
  white-space: nowrap;
  z-index: 2;
  background: transparent;
}

.hero-sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--black);
}

.hero-sidebar-brand {
  color: var(--orange);
}

.hero-deco {
  display: none;
}

.hero-content {
  position: absolute;
  z-index: 2;
  left: var(--page-inset-x);
  right: var(--page-inset-x);
  top: 0;
  bottom: 0;
  padding: 1rem 2rem 3rem 2.75rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
}

.hero-label {
  font-family: var(--font-title);
  font-size: 0.85rem;
  color: var(--orange);
  margin: 0 0 4rem;
  letter-spacing: 0.02em;
}

.hero-headline {
  font-size: clamp(2.5rem, 5.5vw, 4.5rem);
  line-height: 1.05;
  color: var(--hero-text);
  margin: 0 0 2rem;
  max-width: 14ch;
}

.hero-tagline {
  font-family: var(--font-title);
  font-size: clamp(1rem, 2vw, 1.35rem);
  color: var(--orange);
  line-height: 1.45;
  max-width: 22ch;
}

/* === SECTION HEADERS === */
.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 3.5rem 0 1.5rem;
  font-family: var(--font-title);
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--section-accent);
  letter-spacing: 0.04em;
}

.section-header-start,
.section-header-end {
  flex-shrink: 0;
  white-space: nowrap;
}

.section-header-rule {
  flex: 1;
  height: 1px;
  min-width: 1.5rem;
  background-color: var(--section-accent);
  opacity: 0.55;
  align-self: center;
}

.section-header-end {
  color: var(--section-accent);
}

.section-header-end:hover {
  text-decoration: underline;
}

/* === PROJECTS === */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--border-color);
}

.project-card {
  background-color: var(--bg-card);
  color: var(--text-on-card);
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  padding: 1rem 1rem 2.75rem;
  min-height: 300px;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  z-index: 1;
}

.project-card-header {
  font-family: var(--font-title);
  font-size: 0.85rem;
  margin-bottom: 0.1rem;
  line-height: 1.3;
}

.project-card-header .id {
  font-weight: 700;
  margin-right: 0.35rem;
}

.project-card-category {
  font-size: 0.7rem;
  color: var(--text-on-card-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.project-card-image {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  margin: 0.25rem 0 0.5rem;
  padding: 0.5rem;
}

.project-card-image img {
  max-height: 180px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

.project-card-image img.is-broken {
  display: none;
}

.project-card-image img.is-broken + .project-card-placeholder {
  display: block;
}

.project-card-placeholder {
  width: 80%;
  height: 120px;
  background: rgba(0, 0, 0, 0.06);
  border: 1px dashed rgba(0, 0, 0, 0.15);
  display: none;
}

.project-card-image .project-card-placeholder:only-child {
  display: block;
}

.project-card-year {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  font-family: var(--font-title);
  font-size: 0.85rem;
}

.project-card-plus {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  color: var(--orange);
  font-family: var(--font-title);
  font-size: 1.1rem;
}

/* === PROCESS === */
.process-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
  align-items: stretch;
}

.bio-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.bio-copy {
  font-size: 0.95rem;
  line-height: 1.65;
  flex: 1;
}

.bio-copy p + p {
  margin-top: 1rem;
}

.bio-photo {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
  background: var(--bg-input);
}

.bio-photo-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    var(--bg-input);
  background-size: 16px 16px, 16px 16px, auto;
  border: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.iframe-container {
  width: 100%;
  min-height: 475px;
  height: auto;
  border: none;
  background: transparent;
}

.iframe-container iframe {
  width: 100%;
  height: 475px;
  min-height: 475px;
  border: none;
  display: block;
  vertical-align: top;
}

/* === CONTACT === */
.contact-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  align-items: start;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--border-color);
}

.service-card {
  aspect-ratio: 1;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  gap: 0.75rem;
}

.service-card--embed {
  padding: 0;
  gap: 0;
  overflow: hidden;
  cursor: pointer;
}

.service-embed {
  width: 100%;
  height: 100%;
  min-height: 0;
  line-height: 0;
}

.service-card--embed iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: transparent;
  vertical-align: top;
}

.contact-form h3 {
  margin-bottom: 1.4rem;
  font-size: 0.96rem;
  font-family: var(--font-title);
  font-weight: 700;
}

/* Schematic / blueprint form (mockup) */
.schematic-form {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(0.6rem, 1.7vw, 0.95rem);
  min-height: clamp(300px, 43vw, 400px);
  padding-right: clamp(0.15rem, 0.8vw, 0.4rem);
}

.schematic-wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}

.schematic-wires path {
  stroke: var(--border-color);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  fill: none;
}

.schematic-field {
  position: relative;
  z-index: 1;
  padding: 0 clamp(1.25rem, 12vw, 6rem);
  min-height: clamp(3.2rem, 9vw, 4.2rem);
  display: flex;
  align-items: stretch;
}

.schematic-field-message {
  min-height: clamp(5.7rem, 15vw, 7.4rem);
}

.schematic-field::before {
  content: none;
}

.schematic-input-box {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: clamp(0.35rem, 1.2vw, 0.75rem);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  min-height: inherit;
  overflow: hidden;
}

.schematic-input-box label {
  flex: 0 0 clamp(4rem, 26%, 5.25rem);
  margin: 0;
  padding-left: clamp(0.65rem, 1.6vw, 0.95rem);
  font-family: var(--font-title);
  font-size: clamp(0.64rem, 1.55vw, 0.74rem);
  letter-spacing: 0.035em;
  white-space: nowrap;
  color: var(--text-primary);
  pointer-events: none;
}

.schematic-field-message .schematic-input-box {
  align-items: flex-start;
  min-height: clamp(5.1rem, 14.5vw, 7rem);
}

.schematic-field-message .schematic-input-box label {
  padding-top: clamp(0.65rem, 1.6vw, 0.85rem);
}

.schematic-input-edit {
  flex: 1 1 auto;
  min-width: 0;
  align-self: stretch;
  display: flex;
  position: relative;
  background: transparent;
  transition: background-color 1s ease;
}

.schematic-input-edit:hover,
.schematic-input-edit:focus-within {
  background: var(--schematic-edit-active-bg);
  transition-duration: 0.5s;
}

.schematic-input-edit:focus-within::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: var(--orange);
  animation: schematic-blink 1s step-end infinite;
  pointer-events: none;
}

.schematic-input-edit:focus-within:has(:is(input, textarea):not(:placeholder-shown))::before,
.schematic-input-edit:focus-within:has(:is(input, textarea):not(:empty))::before {
  display: none;
}

@keyframes schematic-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.schematic-input-edit input,
.schematic-input-edit textarea {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: inherit;
  padding: clamp(0.45rem, 1.2vw, 0.65rem) clamp(0.55rem, 1.5vw, 0.75rem) clamp(0.45rem, 1.2vw, 0.65rem) 0;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: clamp(0.78rem, 1.8vw, 0.9rem);
  resize: none;
  caret-color: var(--orange);
}

.schematic-input-edit:hover input,
.schematic-input-edit:hover textarea,
.schematic-input-edit:focus-within input,
.schematic-input-edit:focus-within textarea {
  color: var(--schematic-edit-active-text);
}

.schematic-input-edit textarea {
  line-height: 1.45;
  padding-top: clamp(0.65rem, 1.6vw, 0.85rem);
}

.schematic-form .form-actions {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  margin-top: 0;
  padding-right: clamp(1.25rem, 12vw, 6rem);
}

.btn-send {
  background: var(--btn-send-bg);
  color: var(--btn-send-text);
  padding: 0.72rem 2rem;
  border: none;
  cursor: pointer;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  min-width: clamp(7.8rem, 48%, 10rem);
  text-align: center;
}

.btn-send:hover {
  opacity: 0.85;
}

.form-status {
  font-size: 0.85rem;
  margin-top: 0.75rem;
  color: var(--orange);
}

/* === MODAL === */
#project-modal {
  margin: auto;
  width: 92vw;
  max-width: 1100px;
  height: 88vh;
  background-color: var(--bg-main);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 2rem;
  position: relative;
}

#project-modal::backdrop {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.75rem;
  cursor: pointer;
  line-height: 1;
  z-index: 2;
}

.modal-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.modal-meta {
  margin-bottom: 0.5rem;
}

#modal-category {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.slideshow-area {
  flex: 1;
  background: var(--bg-card);
  margin: 1rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 200px;
  overflow: hidden;
}

.slideshow-area img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.slideshow-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  width: 2.5rem;
  height: 2.5rem;
  cursor: pointer;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slideshow-nav.prev { left: 0.5rem; }
.slideshow-nav.next { right: 0.5rem; }

.slideshow-counter {
  position: absolute;
  bottom: 0.5rem;
  right: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-on-card-muted);
}

.slideshow-empty {
  color: var(--text-on-card-muted);
  font-size: 0.9rem;
}

/* === FOOTER === */
.site-footer {
  padding: 2rem 0;
  margin-top: 4rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .nav-links a span.nav-num { display: none; }

  .hero-sidebar { display: none; }
  .hero-content {
    left: var(--page-inset-x);
    right: var(--page-inset-x);
    padding: 1rem 1.25rem 2rem 1.25rem;
  }
  .hero-label { margin-bottom: 2.5rem; }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .process-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .schematic-form {
    padding-right: 0.5rem;
    min-height: 260px;
  }

  .schematic-field {
    padding: 0 clamp(0.85rem, 5vw, 1.75rem);
    min-height: clamp(2.85rem, 12vw, 3.4rem);
  }

  .schematic-field-message {
    min-height: clamp(5rem, 22vw, 6.5rem);
  }

  .schematic-input-box label {
    flex-basis: clamp(3.6rem, 22vw, 4.5rem);
    padding-left: clamp(0.5rem, 2vw, 0.75rem);
    font-size: clamp(0.58rem, 2.8vw, 0.68rem);
  }

  .schematic-form .form-actions {
    padding-right: clamp(0.85rem, 5vw, 1.75rem);
  }

  .nav-divider { margin: 0 0.35rem; }
}
