/* Site-specific extensions on top of ce-theme.css */

html {
  scroll-behavior: smooth;
}

.ce-topnav {
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--ce-surface) 84%, transparent);
}

.ce-topnav .ce-nav-item {
  width: auto;
  padding: 8px 14px;
  text-decoration: none;
}

.ce-topnav .ce-nav-item:hover {
  text-decoration: none;
}

.ce-topnav-brand {
  text-decoration: none;
  color: inherit;
}

.ce-topnav-brand:hover {
  text-decoration: none;
}

@media (max-width: 1040px) {
  .ce-topnav-links {
    display: none;
  }
}

.ce-main a.ce-btn:hover,
.ce-main a.ce-nav-item:hover {
  text-decoration: none;
}

/* Portrait in profile card */
.ce-portrait {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  flex: none;
}

.ce-portrait-lg {
  width: min(100%, 200px);
  border-radius: 18px;
  object-fit: cover;
  aspect-ratio: 4 / 5;
  display: block;
}

.ce-hero-aside {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 1024px) {
  .ce-hero-aside {
    justify-content: flex-start;
    padding-top: 1.25rem;
  }
}

/* Project detail rows */
.ce-detail-row {
  font-size: 13.5px;
  color: var(--ce-text-2);
  line-height: 1.65;
}

.ce-detail-row + .ce-detail-row {
  margin-top: 0.65rem;
}

.ce-detail-row strong {
  color: var(--ce-text);
  font-weight: 600;
}

/* Career timeline */
.timeline {
  position: relative;
  padding-left: 1.35rem;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 0.25rem;
  bottom: 0.25rem;
  left: 0.2rem;
  width: 1px;
  background: var(--ce-border);
}

.timeline-item {
  position: relative;
  padding: 0 0 1.5rem 1.1rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.45rem;
  top: 0.24rem;
  width: 0.68rem;
  height: 0.68rem;
  border-radius: 50%;
  border: 2px solid var(--ce-primary-ink);
  background: var(--ce-surface);
}

.timeline-period {
  font-family: var(--ce-font-sans);
  font-size: 13px;
  letter-spacing: 0.01em;
  color: var(--ce-primary-ink);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.timeline-item h3 {
  line-height: 1.35;
  margin-bottom: 0.35rem;
}

.timeline-company {
  font-size: 13.5px;
  color: var(--ce-text-3);
  margin-bottom: 0.55rem;
}

.career-highlights {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
  font-size: 13.5px;
  color: var(--ce-text-2);
}

.career-highlights li + li {
  margin-top: 0.45rem;
}

.career-highlights li::marker {
  color: var(--ce-primary-ink);
}

/* Methodology chevron flow */
.ce-method-chevron {
  display: flex;
  align-items: stretch;
  --ce-chevron-tip: 22px;
  --ce-chevron-overlap: 16px;
}

.ce-method-step {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  padding: 1.25rem 1.35rem 1.25rem calc(1.35rem + var(--ce-chevron-tip) * 0.45);
  background: var(--ce-surface-2);
  clip-path: polygon(
    0% 0%,
    calc(100% - var(--ce-chevron-tip)) 0%,
    100% 50%,
    calc(100% - var(--ce-chevron-tip)) 100%,
    0% 100%,
    var(--ce-chevron-tip) 50%
  );
  margin-left: calc(-1 * var(--ce-chevron-overlap));
  z-index: 1;
  transition: filter 0.2s var(--ce-ease), transform 0.2s var(--ce-ease);
}

.ce-method-step--first,
.ce-method-step--solo {
  margin-left: 0;
  padding-left: 1.25rem;
  clip-path: polygon(
    0% 0%,
    calc(100% - var(--ce-chevron-tip)) 0%,
    100% 50%,
    calc(100% - var(--ce-chevron-tip)) 100%,
    0% 100%
  );
}

.ce-method-step--last:not(.ce-method-step--first):not(.ce-method-step--solo) {
  padding-right: 1.25rem;
  clip-path: polygon(
    0% 0%,
    100% 0%,
    100% 100%,
    0% 100%,
    var(--ce-chevron-tip) 50%
  );
}

.ce-method-step--solo {
  clip-path: none;
  border-radius: var(--ce-r);
  border: 1px solid var(--ce-border);
}

.ce-method-step:nth-child(1) {
  z-index: 1;
  background: var(--ce-surface-2);
}

.ce-method-step:nth-child(2) {
  z-index: 2;
  background: color-mix(in srgb, var(--ce-primary-soft) 40%, var(--ce-surface-2));
}

.ce-method-step:nth-child(3) {
  z-index: 3;
  background: color-mix(in srgb, var(--ce-primary-soft) 65%, var(--ce-surface-2));
}

.ce-method-step:nth-child(4) {
  z-index: 4;
}

.ce-method-step:nth-child(5) {
  z-index: 5;
}

.ce-method-term {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.35;
}

.ce-method-desc {
  font-size: 13px;
  margin-top: 0.5rem;
  color: var(--ce-text-2);
  line-height: 1.55;
}

@media (max-width: 820px) {
  .ce-method-chevron {
    flex-direction: column;
    gap: 0.65rem;
  }

  .ce-method-step,
  .ce-method-step--first,
  .ce-method-step--last {
    margin-left: 0;
    clip-path: none;
    padding: 1.15rem 1.25rem;
    border: 1px solid var(--ce-border);
    border-radius: var(--ce-r);
    z-index: auto !important;
  }
}

/* Legal page */
.legal-main {
  flex: 1;
  overflow-y: auto;
}

.legal-container {
  max-width: 860px;
}

.legal-section + .legal-section {
  margin-top: 1.75rem;
}

.legal-section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.65rem;
}

.legal-section p {
  font-size: 14px;
  color: var(--ce-text-2);
  line-height: 1.75;
}

.legal-section p + p {
  margin-top: 0.5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--ce-text-2);
  text-decoration: none;
  margin-bottom: 1.25rem;
}

.back-link:hover {
  color: var(--ce-primary-ink);
  text-decoration: none;
}

.updated-label {
  margin-top: 1.5rem;
  font-family: var(--ce-font-mono);
  font-size: 12px;
  color: var(--ce-text-3);
}

/* Internal service cards */
.service-card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.service-card-link:hover {
  text-decoration: none;
}

.service-link {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ce-primary-ink);
  font-weight: 600;
  font-size: 13.5px;
}

/* vCard modal (CE modal system) */
.vcard-modal .ce-modal {
  max-width: 400px;
  padding: 0;
  overflow: hidden;
}

.vcard-card {
  display: flex;
  flex-direction: column;
}

.vcard-card__head {
  background: var(--ce-primary);
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vcard-card__name {
  color: var(--ce-on-primary);
  font-family: var(--ce-font-display);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.15;
}

.vcard-card__org {
  color: var(--ce-on-primary);
  font-size: 1.05rem;
  font-weight: 600;
}

.vcard-card__role {
  color: color-mix(in srgb, var(--ce-on-primary) 75%, transparent);
  font-size: 0.85rem;
}

.vcard-card__contacts {
  list-style: none;
  margin: 0;
  padding: 16px 22px 4px;
  display: grid;
  gap: 2px;
}

.vcard-card__contacts li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 0;
  font-size: 0.86rem;
}

.vcard-card__contacts a {
  color: var(--ce-text);
  text-decoration: none;
}

.vcard-card__contacts a:hover {
  color: var(--ce-primary-ink);
}

.vcard-card__contacts svg {
  flex: none;
  width: 16px;
  height: 16px;
}

.vcard-card__qr {
  padding: 12px 22px 24px;
  border-top: 1px solid var(--ce-border);
  margin-top: 8px;
}

.vcard-card__qr-link {
  display: block;
}

.vcard-card__qr-link img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
}

/* Card host (card.c-ego.net) */
.card-body .ce-bg {
  display: block;
}

.card-shell {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

/* Legacy :target fallback for vcard hash links */
.vcard-modal:target {
  opacity: 1;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
