/* ===== OVERLAY ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  /* block-level scroll container – NOT flex, so the box can't be shrunk to 0
   height by Firefox's flex min-height:auto behavior */
  overflow-y: auto;
  text-align: center;
}

.modal-overlay::after {
  /* vertical-centering helper that doesn't constrain the box height */
  content: "";
  display: inline-block;
  height: 100%;
  vertical-align: middle;
}

/* Legacy .open class (email modal) */
.modal-overlay.open {
  opacity: 1 !important;
  pointer-events: auto;
}

/* MicroModal: outermost wrapper is hidden by default */
[aria-hidden="true"]>.modal-overlay {
  opacity: 0;
  pointer-events: none;
}

/* MicroModal: when wrapper gets .is-open, show the overlay */
.is-open>.modal-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* MicroModal: show the box inside */
.is-open>.modal-overlay .modal-box {
  opacity: 1;
  transform: translateY(0) scale(1);
}


/* ===== MODAL BOX (light card) ===== */
.modal-box {
  display: inline-block;
  vertical-align: middle;
  text-align: left;
  position: relative;
  width: calc(100% - 48px);
  max-width: 480px;
  margin: 24px 0;
  background: #ffffff;
  color: #2d2d2d;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 28px;
  padding: 40px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04);
  opacity: 0;
  transform: translateY(24px) scale(0.96);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease;
}

.modal-overlay.open .modal-box {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ===== CLOSE BUTTON ===== */
.modal-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid transparent;
  color: #3a3a3a;
  opacity: 0.75;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: opacity .3s, color .3s, background .4s ease, border-color .4s ease,
    transform .45s cubic-bezier(.34, 1.56, .64, 1), box-shadow .4s ease;
}


.modal-close svg {
  width: 18px;
  height: 18px;
  transition: transform .5s cubic-bezier(.34, 1.56, .64, 1);
}

.modal-close:hover {
  opacity: 1;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, #f5f5f5);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transform: rotate(90deg) scale(1.08);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent), 0 4px 18px rgba(0, 0, 0, 0.10);
}

.modal-close:hover svg {
  transform: rotate(90deg);
}

.modal-close:active {
  transform: rotate(90deg) scale(0.88);
}

/* on the detail modals, tint the close ring to the project color when present */
.modal-box.detail .modal-close:hover {
  color: var(--pd-tint, var(--accent));
  background: color-mix(in srgb, var(--pd-tint, var(--accent)) 10%, #f5f5f5);
  border-color: color-mix(in srgb, var(--pd-tint, var(--accent)) 45%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pd-tint, var(--accent)) 14%, transparent), 0 4px 18px rgba(0, 0, 0, 0.12);
}

/* ===== MODAL TITLE & SUBTITLE ===== */
.modal-title {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #1a1a1a;
}


.modal-sub {
  opacity: 0.6;
  margin-bottom: 32px;
  font-weight: 600;
  color: #444;
}

/* ===== CONTACT FORM ===== */
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: opacity 0.3s;
}

.modal-form input,
.modal-form textarea {
  width: 100%;
  background: #f7f7f8;
  border: 1px solid rgba(0, 0, 0, 0.10);
  color: #1a1a1a;
  font-weight: 600;
  padding: 16px 18px;
  border-radius: 14px;
  transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
  outline: none;
}

.modal-form textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

.modal-form input::placeholder,
.modal-form textarea::placeholder {
  color: #999;
  opacity: 1;
}

.modal-form input:focus,
.modal-form textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent);
}

/* ===== SUBMIT BUTTON ===== */
.modal-submit {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(100deg, var(--accent), var(--grad-end));
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  border: none;
  font-weight: 600;
  padding: 14px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 25%, transparent);
  transition: transform 0.3s, box-shadow 0.3s;
}

.modal-submit:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 35%, transparent);
}

.modal-submit svg {
  width: 18px;
  height: 18px;
  color: #fff;
}

/* ===== SUCCESS MESSAGE ===== */
.modal-success {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 0 20px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.modal-success.show {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

.success-icon {
  width: 72px;
  height: 72px;
  color: var(--accent);
  margin-bottom: 24px;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 30%, transparent));
}

/* ===== DETAIL MODALS (About + Project) ===== */
.modal-box.detail {
  max-width: 720px;
  max-width: 85vw;
  min-width: 40vw;
  width: fit-content;
  max-height: 85vh;
  padding: 0;
  overflow: hidden;
  display: inline-flex;
  flex-direction: column;
}

.modal-box.detail.about-detail {
  overflow: visible;
}

.modal-box.detail .modal-close {
  z-index: 5;
  background: rgba(0, 0, 0, 0.05);
  opacity: 0.7;
}

/* ===== PROJECT DETAIL: sticky header + scrollable body ===== */
.pd-header {
  flex: none;
  padding: 30px clamp(28px, 4vw, 44px) 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.pd-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.ulModal {
  list-style: disc;
  padding-left: 20px;
  margin: 12px 0;
  font-size: 1rem;
  line-height: 1.7;
  color: #3d3d3d;
}

.ulModal li {
  margin-bottom: 4px;
}


.pd-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}


.pd-kicker {
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--pd-tint, var(--accent));
  font-weight: 600;
}


.pd-year {
  font-weight: 600;
  opacity: 0.45;
  color: #666;
}

.pd-title {
  font-weight: 600;
  font-size: 2rem;
  line-height: 1.1;
  color: #1a1a1a;
  margin-bottom: 14px;
}


.pd-desc {
  font-weight: 600;
  line-height: 1.7;
  color: #555;
  margin-bottom: 20px;
}

.pd-outcome {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 600;
  color: #333;
  padding-top: 18px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}


.pd-outcome .o-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--pd-tint, var(--accent));
  box-shadow: 0 0 10px var(--pd-tint, var(--accent));
}

.pd-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 11px 20px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  background: var(--pd-tint, var(--accent));
  box-shadow: 0 6px 20px color-mix(in srgb, var(--pd-tint, var(--accent)) 30%, transparent);
  transition: transform .25s ease, box-shadow .25s ease;
}

.pd-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--pd-tint, var(--accent)) 45%, transparent);
}

.pd-link svg {
  width: 16px;
  height: 16px;
}

/* ===== ABOUT DETAIL BODY ===== */
.ad-body {
  display: block !important;
  padding: 44px clamp(30px, 4vw, 48px);
  min-height: 200px;
}

.ad-kicker {
  display: inline-block;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 14px;
}


.ad-title {
  font-weight: 600;
  font-size: 2rem;
  line-height: 1.1;
  color: #1a1a1a;
  margin-bottom: 18px;
}


.ad-para {
  font-weight: 600;
  line-height: 1.75;
  opacity: 0.78;
  color: #333;
  margin-bottom: 16px;
}


.ad-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.ad-tag {
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  background: #f2f2f3;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #333;
  opacity: 0.9;
}