/* ─── Fonts ─────────────────────────────────────────────────── */
@font-face {
  font-family: 'ZurichLtXCn';
  src: url('/fonts/ZURCHLXC.TTF') format('truetype');
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: 'LetterGothicStd';
  src: url('/fonts/LetterGothicStd-Bold.otf') format('opentype');
  font-weight: 700;
  font-display: swap;
}

/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Colors */
  --bg:        #f4f2ef;
  --fg:        #1a1a1a;
  --fg-muted:  #888880;
  --accent:    #1a1a1a;
  --divider:   #d8d5d0;
  --overlay:   rgba(26, 26, 26, 0.3);

  /* Typography */
  --font-contact: 'LetterGothicStd', 'Letter Gothic Std', 'Courier New', monospace;

  /* Font sizes */
  --font-size-2xs:      0.55rem;  /* smallest labels, meta headings */
  --font-size-xs:       0.6rem;   /* type/category tags */
  --font-size-sm:       0.65rem;  /* captions, compact nav */
  --font-size-md:       0.75rem;  /* ui text, drawer links */
  --font-size-label:    0.78rem;  /* contact values, home nav */
  --font-size-body:     0.82rem;  /* body copy */
  --font-size-nav:      1rem;     /* main nav, brand */
  --font-size-title-sm: 1.1rem;   /* page titles on mobile */
  --font-size-title-md: 1.4rem;   /* mid-size title on desktop */
  --font-size-title-lg: 1.6rem;   /* page title on desktop */

  /* Letter spacing */
  --tracking-tight:   0.02em;
  --tracking-normal:  0.06em;
  --tracking-wide:    0.08em;
  --tracking-wider:   0.1em;
  --tracking-widest:  0.14em;

  /* Spacing */
  --space-1:  0.25rem;   /*  4px */
  --space-2:  0.5rem;    /*  8px */
  --space-3:  0.75rem;   /* 12px */
  --space-4:  1rem;      /* 16px */
  --space-5:  1.25rem;   /* 20px */
  --space-6:  1.5rem;    /* 24px */
  --space-8:  2rem;      /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */
  --space-16: 4rem;      /* 64px */
  --space-20: 5rem;      /* 80px */
  --space-24: 6rem;      /* 96px */

  /* Easing */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:   cubic-bezier(0.4, 0, 0.2, 1);
  --ease-logo:     cubic-bezier(0.5, 0, 0.5, 1);

  /* Layout */
  --nav-height:          4.4rem;
  --nav-height-expanded: 6.4rem;
  --content-width:       1200px;

  /* Animation timings — JS reads these via getComputedStyle */
  --duration-page-transition: 280ms;
  --duration-nav-transition:  450ms;
  --duration-logo-complete:   1800ms;
  --duration-stagger-step:    120ms;
}

/*
 * Breakpoints (reference — CSS variables cannot be used inside media queries):
 *   600px  — footer: stacked → row
 *   640px  — nav: hamburger → full links; body images: stacked → float
 *   780px  — home layout: stacked → side-by-side
 *   900px  — wider padding
 *   1200px — logo enlargement
 */

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-contact);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.page-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;

  /* page entrance */
  opacity: 0;
  animation: page-in 0.6s var(--ease-out-expo) 0.1s forwards;
}

html.is-leaving .page-wrap {
  animation: page-out 0.25s var(--ease-in-out) forwards;
}

@keyframes page-in {
  to { opacity: 1; }
}

@keyframes page-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ─── Site Navigation ───────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height-expanded);
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
  background: var(--bg);
  transition: height 0.4s var(--ease-out-expo);
}

.site-nav.is-compact {
  height: var(--nav-height);
}

.site-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-8);
}

@media (min-width: 900px) {
  .site-nav__inner {
    padding: 0 var(--space-16);
  }
}

.site-nav__brand {
  text-decoration: none;
  color: var(--fg);
  display: flex;
  align-items: center;
}

.site-nav__brand-logo {
  fill: currentColor;
  height: 4.8rem;
  width: auto;
  transition: height 0.4s var(--ease-out-expo);
}

.site-nav.is-compact .site-nav__brand-logo {
  height: 3.2rem;
}

.site-nav__links {
  display: flex;
  gap: var(--space-8);
  list-style: none;
  align-items: center;
}

.site-nav__links a {
  font-size: var(--font-size-nav);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fg-muted);
  transition: color 0.2s, font-size 0.4s var(--ease-out-expo);
}

.site-nav.is-compact .site-nav__links a {
  font-size: var(--font-size-sm);
}

.site-nav__links a:hover,
.site-nav__links a[aria-current="page"] {
  color: var(--fg);
}

.site-nav__social a {
  display: flex;
  align-items: center;
  color: var(--fg-muted);
  transition: color 0.2s;
}

.site-nav__social a:hover {
  color: var(--fg);
}

.site-nav__social svg {
  width: 1em;
  height: 1em;
}

/* ─── Hamburger button ──────────────────────────────────────── */
/* Hidden by default; shown only on mobile (< 640px) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 0.3125rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  margin-right: calc(var(--space-2) * -1);
  flex-shrink: 0;
}

.nav-toggle span {
  display: block;
  width: 1.125rem;
  height: 1px;
  background: var(--fg);
  transition: transform 0.25s var(--ease-in-out), opacity 0.25s;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ─── Mobile: switch to hamburger (< 640px) ─────────────────── */
@media (max-width: 639px) {
  .site-nav__links {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }
}

/* ─── Nav drawer ────────────────────────────────────────────── */
.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 75vw;
  max-width: 280px;
  height: 100%;
  background: var(--bg);
  border-right: 1px solid var(--divider);
  transform: translateX(-100%);
  transition: transform 0.35s var(--ease-out-expo);
  z-index: 200;
  padding: var(--nav-height) 0 var(--space-8);
  display: flex;
  flex-direction: column;
}

.nav-drawer.is-open {
  transform: translateX(0);
}

.nav-drawer__nav {
  display: flex;
  flex-direction: column;
  padding: var(--space-4) 0;
}

.nav-drawer__link {
  font-size: var(--font-size-md);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fg-muted);
  padding: 0.9rem var(--space-8);
  border-bottom: 1px solid var(--divider);
  transition: color 0.2s, background 0.2s;
}

.nav-drawer__link:first-child {
  border-top: 1px solid var(--divider);
}

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

.nav-drawer__contact {
  margin-top: auto;
  padding: var(--space-6) var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border-top: 1px solid var(--divider);
}

.nav-drawer__contact-link {
  font-size: var(--font-size-sm);
  letter-spacing: var(--tracking-wide);
  text-decoration: none;
  color: var(--fg-muted);
  transition: color 0.2s;
}

.nav-drawer__contact-link:hover {
  color: var(--fg);
}

/* ─── Overlay ───────────────────────────────────────────────── */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 199;
}

.nav-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ─── Layout ────────────────────────────────────────────────── */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-12);
  padding: var(--space-12) var(--space-8);
  min-height: 100dvh;
}

/* ─── Logo ──────────────────────────────────────────────────── */
.logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

#ec-logo {
  width: 180px;
  height: auto;
  overflow: visible; /* SVG polygons extend past the viewBox boundary */
}

/* Polygons — drawn via stroke animation (pure CSS).
 * stroke-dasharray values match each polygon's total path length:
 *   poly1: 430 (outer bracket, 9 vertices)
 *   poly2: 192, poly3: 191 (inner brackets, 6 vertices each)
 * To recalculate: select the <polygon> in devtools → el.getTotalLength() */
.logo-poly {
  fill: none;
  stroke: var(--fg);
  stroke-width: 1;
  stroke-linejoin: miter;
}

#poly1 {
  stroke-dasharray: 430;
  stroke-dashoffset: 430;
  animation: logo-draw 0.9s 0.1s var(--ease-logo) forwards,
             logo-fill 0.4s 1.2s ease forwards;
}
#poly2 {
  stroke-dasharray: 192;
  stroke-dashoffset: 192;
  animation: logo-draw 0.6s 0.5s var(--ease-logo) forwards,
             logo-fill 0.4s 1.2s ease forwards;
}
#poly3 {
  stroke-dasharray: 191;
  stroke-dashoffset: 191;
  animation: logo-draw 0.6s 0.7s var(--ease-logo) forwards,
             logo-fill 0.4s 1.2s ease forwards;
}

/* Text in SVG */
.logo-text {
  fill: var(--fg);
  opacity: 0;
  animation: logo-text-in 0.6s 1.5s ease forwards;
}

/* ─── Keyframes ─────────────────────────────────────────────── */
@keyframes logo-draw {
  to { stroke-dashoffset: 0; }
}
@keyframes logo-fill {
  to { fill: var(--fg); stroke: none; }
}
@keyframes logo-text-in {
  to { opacity: 1; }
}

/* ─── Contact ───────────────────────────────────────────────── */
.contact-wrap {
  width: 100%;
  max-width: 310px;
}

.contact-list {
  list-style: none;
}

.contact-item {
  border-bottom: 1px solid var(--divider);
  border-top: 1px solid var(--divider);
  margin-top: -1px;

  /* entrance animation state */
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.6s var(--ease-out-expo),
    transform 0.6s var(--ease-out-expo);
}

.contact-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.contact-link {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  text-decoration: none;
}

.contact-link:hover .contact-value,
.contact-link--group:hover .contact-value {
  color: var(--fg-muted);
  transition: color 0.2s;
}

.contact-link:hover .contact-icon,
.contact-link--group:hover .contact-icon {
  color: var(--fg);
}

.phone-link {
  color: inherit;
  text-decoration: none;
}

.phone-link:hover {
  color: var(--fg-muted);
}

.contact-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--fg-muted);
  transition: color 0.2s;
}

.contact-icon svg {
  width: 1em;
  height: 1em;
}

.contact-value {
  font-size: var(--font-size-label);
  letter-spacing: 0.04em;
  line-height: 1.6;
  color: var(--fg);
}

.contact-item:last-child .contact-value {
  font-size: 0.68rem; /* address — slightly smaller than contact values */
}

/* ─── Home Navigation ───────────────────────────────────────── */
.home-nav {
  display: flex;
  flex-direction: column;
  margin-bottom: -1px;
}

.home-nav__link {
  padding: var(--space-3) 0;
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
  margin-bottom: -1px;
  font-size: var(--font-size-label);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fg-muted);

  /* entrance animation state */
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.6s var(--ease-out-expo),
    transform 0.6s var(--ease-out-expo),
    color 0.2s;
}

.home-nav__link.visible {
  opacity: 1;
  transform: translateY(0);
}

.home-nav__link:last-child {
  border-bottom: none;
}

.home-nav__link:hover {
  color: var(--fg);
}

/* ─── Desktop layout ────────────────────────────────────────── */
@media (min-width: 780px) {
  .page {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8rem;
    padding: var(--space-16);
    min-height: calc(100dvh - var(--nav-height));
  }

  .logo-wrap {
    flex-shrink: 0;
  }

  #ec-logo {
    width: 220px;
  }
}

@media (min-width: 1200px) {
  #ec-logo {
    width: 260px;
  }
}

/* ─── About / Generic Single ────────────────────────────────── */
.page-single {
  flex: 1;
  padding: var(--space-12) var(--space-8) var(--space-20);
  max-width: var(--content-width);
  margin: 0 auto;
  width: 100%;
}

.page-single__title {
  font-size: var(--font-size-title-sm);
  font-weight: 400;
  letter-spacing: var(--tracking-normal);
  text-transform: uppercase;
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--divider);
  margin-bottom: var(--space-10);
}

@media (min-width: 600px) {
  .page-single__title {
    font-size: var(--font-size-title-lg);
  }
}

.page-single__body {
  font-size: var(--font-size-body);
  line-height: 1.85;
  letter-spacing: var(--tracking-tight);
}

.page-single__body h2 {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-top: var(--space-10);
  margin-bottom: var(--space-3);
}

.page-single__body h3 {
  font-size: var(--font-size-label);
  font-weight: 700;
  letter-spacing: var(--tracking-normal);
  color: var(--fg);
  margin-top: var(--space-8);
  margin-bottom: var(--space-2);
}

/* ─── About: team members ───────────────────────────────────── */
.team {
  margin-top: var(--space-10);
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.team-member {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

.team-member__photo {
  margin: 0;
}

.team-member__photo img {
  display: block;
  width: 100%;
  height: auto;
}

.page-single__body .team-member__name {
  font-size: var(--font-size-title-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-normal);
  color: var(--fg);
  margin: 0 0 var(--space-3);
}

.team-member__body > p:first-of-type {
  margin-top: 0;
}

@media (min-width: 720px) {
  .team-member {
    grid-template-columns: 42% 1fr;
    gap: var(--space-12);
    align-items: start;
  }
}

.page-single__body p + p {
  margin-top: var(--space-4);
}

@media (min-width: 900px) {
  .page-single {
    padding: var(--space-16) var(--space-16) var(--space-24);
  }
}

/* ─── Contact page ──────────────────────────────────────────── */
.contact-page {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-10);
  margin-top: var(--space-4);
}

.contact-info {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.contact-info__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--divider);
}

.contact-info__label {
  font-size: var(--font-size-2xs);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--fg-muted);
}

.contact-info__value,
.contact-info__value a {
  font-size: var(--font-size-body);
  letter-spacing: var(--tracking-tight);
  line-height: 1.6;
  color: var(--fg);
  text-decoration: none;
  transition: color 0.2s;
}

.contact-info__value a:hover {
  color: var(--fg-muted);
}

.contact-info__value address {
  font-style: normal;
}

.contact-info__value a + a {
  display: block;
}

.contact-page__map {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--divider);
  overflow: hidden;
}

.contact-page__map iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (min-width: 720px) {
  .contact-page {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: var(--space-12);
    align-items: start;
  }

  .contact-page__map {
    aspect-ratio: 1 / 1;
  }
}

/* ─── Footer ────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--divider);
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
  max-width: var(--content-width);
  margin: 0 auto;
  width: 100%;
  padding: var(--space-12) var(--space-8);
}

.site-footer__col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.site-footer__label {
  font-size: var(--font-size-2xs);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: var(--space-1);
}

.site-footer__link {
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  line-height: 1.7;
  text-decoration: none;
  color: var(--fg);
  transition: color 0.2s;
}

.site-footer__link:hover {
  color: var(--fg-muted);
}

@media (min-width: 600px) {
  .site-footer__inner {
    flex-direction: row;
    gap: var(--space-24);
  }
}

@media (min-width: 900px) {
  .site-footer__inner {
    padding: var(--space-12) var(--space-16);
  }
}
