/* layout.css - Pedram Ghassemi Portfolio Layout, Header Dock, Hero, and Footer */

/* -----------------------------------------
   Containers & Common Sections
   ----------------------------------------- */
.t-section {
  padding: 5.5rem 0;
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--border-color);
}

.t-section--activity,
.t-section--services,
.t-section--recognition {
  background-color: var(--bg-secondary);
}

.t-container {
  width: 100%;
  max-width: 1280px;
  padding: 0 2.5rem;
  margin: 0 auto;
}

/* -----------------------------------------
   Floating Header Dock (Glassmorphism)
   ----------------------------------------- */
.t-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  padding: 1.25rem 1rem 0 1rem;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.t-header.is-hidden {
  opacity: 0 !important;
}

/* Compact state: dock rises closer to top edge and collapses brand name / contact button text */
.t-header.is-compact {
  padding-top: 0.5rem;
}

.t-header.is-compact .t-header__name {
  max-width: 0;
  opacity: 0;
  margin-left: 0;
}

.t-header.is-compact .t-header__contact {
  width: 2.25rem;
  padding: 0;
  border-radius: 50%;
}

.t-header.is-compact .t-header__contact-text {
  max-width: 0;
  opacity: 0;
  margin-left: 0;
}

.t-header.is-compact .t-header__avatar {
  max-width: 0;
  opacity: 0;
  border-color: transparent;
}

.t-header__dock {
  max-width: 1280px;
  margin: 0 auto;
  background-color: var(--bg-dock);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: 100px;
  box-shadow: var(--shadow-glass);
  padding: 0.5rem 1.5rem;
  pointer-events: auto;
}

/* Compact state desktop/tablet: change background to transparent and create two separate pills */
@media (min-width: 641px) {
  .t-header.is-compact .t-header__dock {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
  }

  .t-header.is-compact .t-header__bar {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 1rem;
    height: auto;
  }

  .t-header.is-compact .t-header__brand {
    display: none;
  }

  .t-header.is-compact .t-header__nav {
    background-color: var(--bg-dock);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--border-glass);
    border-radius: 100px;
    padding: 0 1.5rem;
    height: 2.75rem;
    box-shadow: var(--shadow-glass);
    box-sizing: border-box;
    display: flex;
    align-items: center;
  }

  .t-header.is-compact .t-header__actions {
    background-color: var(--bg-dock);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--border-glass);
    border-radius: 100px;
    padding: 0 0.5rem;
    height: 2.75rem;
    box-shadow: var(--shadow-glass);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
}

/* Respect user motion preference */
@media (prefers-reduced-motion: reduce) {
  .t-header,
  .t-header__dock,
  .t-header__name,
  .t-header__contact,
  .t-header__contact-text,
  .t-header__brand,
  .t-header__nav,
  .t-header__actions,
  .t-header__avatar {
    transition: none !important;
  }
}

.t-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 2.75rem;
  transition: gap 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 641px) {
  .t-header__bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 1rem;
  }
  .t-header__brand {
    grid-column: 1;
    justify-self: start;
  }
  .t-header__nav {
    grid-column: 2;
    justify-self: center;
  }
  .t-header__actions {
    grid-column: 3;
    justify-self: end;
  }
}

.t-header__brand {
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: 1.05rem;
  max-width: 15rem;
  opacity: 1;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              margin-right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.t-header__name {
  color: var(--text-main);
  margin-left: 0.75rem;
  display: inline-block;
  max-width: 10rem;
  opacity: 1;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.t-header__avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 5rem;
  transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.t-header__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.t-header__nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.t-header__nav a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
}

.t-header__nav a:hover {
  color: var(--accent-color);
}

.t-header__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.t-header__contact {
  background-color: var(--accent-color);
  color: var(--bg-color);
  height: 2.25rem;
  padding: 0 1.25rem;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 1px solid transparent;
  transition: background-color 0.3s ease,
              border-color 0.3s ease,
              color 0.3s ease,
              transform 0.2s ease,
              box-shadow 0.3s ease;
}

.t-header__contact:hover {
  background-color: transparent;
  color: var(--accent-color);
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.2);
  transform: translateY(-1px);
}

.t-header__contact-text {
  display: inline-block;
  max-width: 100px;
  opacity: 1;
  overflow: hidden;
  white-space: nowrap;
  margin-left: 0.35rem;
}

/* Theme Toggle Button & CV Download Button */
.t-header__theme-btn,
.t-header__cv-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  text-decoration: none;
}

.t-header__theme-btn:hover,
.t-header__cv-btn:hover {
  background-color: var(--badge-bg);
  border-color: var(--text-muted);
  color: var(--text-main);
}

.t-header__theme-btn svg,
.t-header__cv-btn svg {
  width: 1.15rem;
  height: 1.15rem;
}

.t-header__theme-btn #sun-icon {
  display: none;
}

.t-header__theme-btn #moon-icon {
  display: block;
}

:root[data-theme="dark"] .t-header__theme-btn #sun-icon {
  display: block;
}

:root[data-theme="dark"] .t-header__theme-btn #moon-icon {
  display: none;
}

/* Mobile Menu Button */
.t-header__menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  align-items: center;
  justify-content: center;
}

.t-header__menu-icon {
  display: block;
  width: 1.25rem;
  height: 2px;
  background-color: var(--text-main);
  position: relative;
  transition: var(--transition-fast);
}

.t-header__menu-icon::before,
.t-header__menu-icon::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 2px;
  background-color: var(--text-main);
  left: 0;
  transition: var(--transition-fast);
}

.t-header__menu-icon::before { top: -6px; }
.t-header__menu-icon::after { top: 6px; }

/* Expanded Menu Animation */
.t-header__menu-btn[aria-expanded="true"] .t-header__menu-icon {
  background-color: transparent;
}
.t-header__menu-btn[aria-expanded="true"] .t-header__menu-icon::before {
  transform: rotate(45deg);
  top: 0;
}
.t-header__menu-btn[aria-expanded="true"] .t-header__menu-icon::after {
  transform: rotate(-45deg);
  top: 0;
}

/* Mobile Navigation Dropdown */
.t-mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 0.5rem;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden; /* Prevent keyboard tab focusing when closed */
  border-top: 1px solid transparent;
  margin-top: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease,
              visibility 0.35s step-start,
              padding 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              margin-top 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.t-mobile-nav.is-open {
  max-height: 300px;
  opacity: 1;
  visibility: visible;
  transition-property: max-height, opacity, padding, margin-top;
  padding: 1.25rem 0.5rem;
  border-top: 1px solid var(--border-color);
  margin-top: 0.5rem;
}

/* Dynamic Backdrop for Mobile Nav Menu */
.t-mobile-nav__backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90; /* below .t-header z-index: 100 */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.t-mobile-nav__backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.t-mobile-nav a {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-muted);
}

.t-mobile-nav a:hover {
  color: var(--text-main);
}

.t-header__nav a.is-active {
  color: var(--accent-color);
}

.t-mobile-nav a.is-active {
  color: var(--accent-color);
  font-weight: 600;
}

/* -----------------------------------------
   Hero Section
   ----------------------------------------- */
.t-hero {
  padding-top: 13rem;
  padding-bottom: 8rem;
  display: flex;
  justify-content: center;
}

.t-hero__inner {
  width: 100%;
  max-width: 1280px;
  padding: 0 2.5rem;
}

.t-hero__top {
  display: flex;
  flex-direction: column;
  gap: 2.75rem;
}

.t-hero__intro {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.t-avatar {
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--accent-color);
  box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.12);
  flex-shrink: 0;
  background-color: var(--badge-bg);
}

.t-avatar--lg {
  width: 5.5rem;
  height: 5.5rem;
}

.t-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.t-hero__greeting {
  font-size: 1.85rem;
  font-weight: 600;
  font-family: var(--font-sans);
}

.t-hero__pitch {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.t-hero__tagline {
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.t-hero__subtitle {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 720px;
}

.t-btn-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

.t-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.t-btn-icon {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  stroke: currentColor;
}

.t-btn--primary {
  background-color: var(--accent-color);
  color: var(--bg-color);
  border: 1px solid var(--accent-color);
}

.t-btn--primary:hover {
  background-color: transparent;
  color: var(--accent-color);
  border-color: var(--accent-color);
  box-shadow: 0 8px 24px -6px rgba(var(--accent-rgb), 0.25);
  transform: translateY(-1px);
}

.t-btn--secondary {
  background-color: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.t-btn--secondary:hover {
  background-color: var(--badge-bg);
  border-color: var(--accent-color);
  color: var(--accent-color);
  transform: translateY(-1px);
}

/* -----------------------------------------
   Footer
   ----------------------------------------- */
.t-footer {
  border-top: 1px solid var(--border-color);
  padding: 3rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.t-footer__nav {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.t-footer__nav a:hover {
  color: var(--accent-color);
  text-decoration: none;
}

/* -----------------------------------------
   Layout-Specific Media Queries
   ----------------------------------------- */
@media (min-width: 1100px) {
  .t-hero__tagline {
    font-size: var(--text-3xl);
  }
}

@media (max-width: 900px) {
  .t-hero__tagline {
    font-size: var(--text-xl);
  }
  .t-exp-role {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .t-header__nav {
    gap: 1rem;
  }
}

@media (max-width: 900px) and (min-width: 641px) {
  /* Collapse brand name and contact text on tablets to prevent header crowding */
  .t-header__name {
    max-width: 0;
    opacity: 0;
    margin-left: 0;
  }
  .t-header__contact {
    width: 2.25rem;
    padding: 0;
    border-radius: 50%;
  }
  .t-header__contact-text {
    max-width: 0;
    opacity: 0;
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .t-container {
    padding: 0 1.25rem; /* Reduce left/right padding to reclaim space */
  }
  /* Ensure brand name and avatar are always visible on mobile */
  .t-header__name {
    max-width: 10rem;
    opacity: 1;
    margin-left: 0.5rem;
  }
  .t-header__avatar {
    max-width: 2.25rem;
    opacity: 1;
    border-color: var(--border-color);
  }
  .t-header__nav {
    display: none; /* Hide default nav */
  }
  .t-header__menu-btn {
    display: flex; /* Show hamburger button */
  }
  .t-header__contact {
    display: none; /* Hide contact button on mobile to prevent dock crowding */
  }
  /* Keep brand avatar and name visible in compact mode on mobile */
  .t-header.is-compact .t-header__avatar {
    max-width: 1.75rem;
    opacity: 1;
    border-color: var(--border-color);
    width: 1.75rem;
    height: 1.75rem;
  }
  .t-header.is-compact .t-header__name {
    max-width: 10rem;
    opacity: 1;
    margin-left: 0.5rem;
  }
  .t-header__dock {
    border-radius: 20px;
    padding: 0.5rem 1rem;
  }
  .t-hero {
    padding-top: 10rem;
    padding-bottom: 5.5rem;
  }
  .t-hero__top {
    gap: 2rem;
  }
  .t-hero__intro {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .t-avatar--lg {
    width: 4.5rem;
    height: 4.5rem;
  }
  .t-hero__greeting {
    font-size: 1.75rem;
  }
  .t-hero__pitch {
    gap: 1.25rem;
  }
  .t-hero__tagline {
    font-size: 1.5rem;
  }
  .t-hero__subtitle {
    font-size: 1rem;
  }
  .t-btn-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0.75rem;
    margin-top: 1.5rem;
  }
  .t-btn {
    display: flex;
    width: 100%;
  }
  
  /* Prevent footer links overflow on small mobile displays */
  .t-footer__nav {
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
  }
}

/* Prevent mobile navigation states leaking to desktop on resize */
@media (min-width: 641px) {
  .t-mobile-nav {
    display: none !important;
  }
}
