/* 
 * Main Stylesheet
 * Ilya Malyanov Portfolio
 * Clean Swiss-inspired minimalist design
 */

/* ========================= */
/* Base Styles and Variables */
/* ========================= */

:root {
  /* Color Palette */
  --color-primary: #000000;
  --color-secondary: #ff0000;
  --color-background: #ffffff;
  --color-text: #333333;
  --color-text-light: #777777;
  --color-border: #eeeeee;
  --color-highlight: #fffc00;
  
  /* Spacing */
  --space-xxs: 0.25rem;   /* 4px - New tiny spacing */
  --space-xs: 0.5rem;     /* 8px */
  --space-sm: 1rem;       /* 16px */
  --space-md: 2rem;       /* 32px */
  --space-lg: 4rem;       /* 64px */
  --space-xl: 8rem;       /* 128px */
  --space-xxl: 12rem;     /* 192px - New extra large spacing */
  
  /* Intermediate spacing values */
  --space-xs-sm: 0.75rem; /* 12px - Between xs and sm */
  --space-sm-md: 1.5rem;  /* 24px - Between sm and md */
  --space-md-lg: 3rem;    /* 48px - Between md and lg */
  --space-lg-xl: 6rem;    /* 96px - Between lg and xl */
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
  
  /* Border Radius */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 8px;
}

/* Global styles */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin-left: auto; /* Center images horizontally */
  margin-right: auto; /* Center images horizontally */
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--color-secondary);
}

/* Paragraph links - global styling */
p a {
  color: var(--color-text);
  font-weight: 700;
  font-size: 95%;
  text-decoration: none;
  border-bottom: 2px solid #ff0000;
}

p a:hover {
  color: var(--color-text);
  opacity: 0.85;
}

/* List item links - global styling */
li a {
  color: var(--color-text);
  font-weight: 700;
  font-size: 95%;
  text-decoration: none;
  border-bottom: 2px solid #ff0000;
}

li a:hover {
  color: var(--color-text);
  opacity: 0.85;
}

/* Exclude header links from custom styling */
header p a, 
header li a,
.logo a,
.project-navigation a,
.prev-project,
.next-project,
.hero p a,
.lead a {
  color: var(--color-primary);
  font-weight: inherit;
  font-size: inherit;
  text-decoration: none;
  border-bottom: none;
}

/* Separate rule for nav links to allow custom font-weight */
nav a {
  /* Font weight is now handled by more specific selectors */
  color: var(--color-primary);
}

nav a:hover {
  color: var(--color-secondary);
}

/* Override for about section to avoid double underlines */
.about-text p a {
  color: var(--color-text);
  font-size: 95%;
  font-weight: 700;
  border-bottom: 2px solid #ff0000;
  transition: none;
}

.about-text p a:hover {
  color: var(--color-text);
  opacity: 0.85;
  border-bottom-color: #ff0000;
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  font-weight: 800;
  line-height: 1.3;
  color: var(--color-primary);
}

h1 {
  font-size: 3.5rem;
  margin-bottom: var(--space-md);
  font-weight: 700;
}

h2 {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
  font-weight: 700;
}

h3 {
  font-size: 1.75rem;
  margin-bottom: var(--space-sm);
}

p {
  margin-top: 0;
  margin-bottom: var(--space-md);
}

ul, ol {
  margin-top: 0;
  margin-bottom: var(--space-md);
  padding-left: var(--space-md);
}

/* ================== */
/* Layout & Container */
/* ================== */

.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

section {
  padding-top: var(--space-lg);
  padding-bottom: var(--space-lg);
}

/* ====== */
/* Header */
/* ====== */

header {
  padding: 30px 0; /* Increase padding to make header taller */
  background-color: transparent !important;  /* Force transparent on all screen sizes */
  position: relative;
  z-index: 100;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo img {
  max-height: 70px; /* Set logo image height */
  width: auto;
}

.logo a {
  text-decoration: none;
  color: #000;
  font-weight: 600;
  font-size: 1.5rem;
  display: block;
}

/* 3D Face Viewer in Logo */
#face-viewer-container {
  position: relative;
  overflow: visible; /* Prevents model from being cut off */
  background-color: transparent;
  cursor: default; /* Regular cursor instead of grab */
  border-radius: 50%; /* Optional: makes the container circular */
  margin: 0 auto; /* Centers the container */
  opacity: 0; /* Start invisible */
  transition: opacity 0.5s ease; /* Smooth fade in */
}

/* Remove the grab effect */
#face-viewer-container:active {
  /* No special styling when active */
}

/* When model is loaded, fade in */
#face-viewer-container.loaded {
  opacity: 1;
}

/* Make the canvas responsive and transparent */
#face-viewer-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  background-color: transparent !important;
}

/* Simple loading indicator */
.face-viewer-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  z-index: 10;
  font-family: var(--font-sans);
  color: var(--color-text);
  font-weight: normal;
  font-size: 10px;
}

/* Logo specific styling in header */
header .logo #face-viewer-container {
  display: inline-block;
  vertical-align: middle;
}

/* Show original logo while 3D is loading */
header .logo .original-logo {
  display: block;
}

nav ul {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
}

nav li {
  margin-left: var(--space-md);
}

/* =========== */
/* Hero Section */
/* =========== */

.hero {
  padding-top: var(--space-lg);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--color-border);
}

.hero h1 {
  margin-bottom: var(--space-sm);
  font-size: 3.5rem;
  font-weight: 700;
}

.lead {
  font-size: 1.5rem;
  line-height: 1.4;
  margin-bottom: var(--space-sm);
}

.highlight {
  display: inline-block;
  background-color: var(--color-highlight);
  padding: 0.25rem 0.5rem;
  margin-top: var(--space-sm);
  font-weight: 500;
}

/* =============== */
/* Projects Section */
/* =============== */

.projects {
  background-color: #ededed;  /* Gray background for projects section */
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.project-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.project-card a {
  display: block;
  color: var(--color-text);
}

.project-card .project-image {
  position: relative;
  padding-top: 66.66%; /* 3:2 aspect ratio */
  overflow: hidden;
  background-color: #f5f5f5;
}

.project-card .project-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.project-card:hover .project-image img {
  transform: scale(1.05);
}

.project-card h3 {
  padding: var(--space-sm) var(--space-sm) 0;
  margin-bottom: var(--space-xs);
  font-size: 1.25rem;
}

.project-card p {
  padding: 0 var(--space-sm) var(--space-sm);
  margin-bottom: 0;
  color: var(--color-text-light);
  font-size: 0.9rem;
}

/* ============= */
/* About Section */
/* ============= */

.about {
  background-color: white;
  margin: 0;  /* Remove any margin */
  padding: 0; /* Remove any padding */
}

/* About Hero Section with Red Background and 3D Head */
.about-hero {
  background-color: white; /* White background instead of red */
  width: 100%;
  padding: var(--space-sm) 0; /* Much smaller padding */
  margin: 0; /* Remove any margin */
  position: relative;
  overflow: hidden;
}

.about-hero-content {
  max-width: var(--container-width, 1200px);
  margin: 0 auto;
  padding: 0 var(--space-md);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  height: 550px; /* Bigger height */
}

#about-face-viewer-container {
  width: 900px;  /* Much much wider container */
  height: 500px; /* Taller container */
  position: relative;
}

.hero-text {
  position: absolute;
  top: 65%; /* Move text in FACEVIEWER HERO even more down */
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: white;
  pointer-events: none;
  width: 100%;
}

.hero-text h1 {
  color: var(--color-secondary) !important; /* Red color */
  font-size: 5rem;
  margin: 0 0 var(--space-md) 0;
  font-weight: 300;
  line-height: 1.2;
}

.arrow-down {
  font-size: 2rem;
  color: var(--color-secondary); /* Red color */
  opacity: 0.8;
  animation: bounce 2s infinite;
  margin-top: var(--space-sm);
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* Responsive sizing for the about hero head */
@media (max-width: 768px) {
  .about-hero {
    padding: var(--space-sm) 0;
  }

  .about-hero-content {
    height: 450px;
  }

  #about-face-viewer-container {
    width: 650px;  /* Much wider on tablet */
    height: 400px; /* Taller on tablet */
  }

  .hero-text h1 {
    font-size: 4rem;
  }
}

@media (max-width: 480px) {
  .about-hero {
    padding: var(--space-xs) 0;
  }

  .about-hero-content {
    height: 400px;
  }

  #about-face-viewer-container {
    width: 450px;  /* Much wider on mobile */
    height: 350px; /* Taller on mobile */
  }

  .hero-text h1 {
    font-size: 3rem;
  }
}

.about-content {
  display: flex;
  gap: var(--space-lg);
}

.about-text {
  flex: 1;
}

.about-header {
  display: flex;
  justify-content: flex-start;
  gap: 20px;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.inline-header {
  display: inline-block;
  margin-top: 0;
  margin-bottom: 0;
}

.inline-header a {
  color: var(--color-text-light);
  transition: color 0.3s ease;
}

.inline-header a:hover {
  color: var(--color-secondary);
}

/* Intro paragraphs should have normal font size for links */
.about-intro p a {
  font-size: inherit;
}

/* About text links are handled by the global link styling */

/* Passion list */
.passion-list, .looking-list, .awards-list {
  list-style: none;
  padding: 0;
}

.passion-list li, .looking-list li {
  margin-bottom: var(--space-xs);
  padding-left: var(--space-sm);
  border-left: 3px solid var(--color-secondary);
}

.awards-list li {
  margin-bottom: var(--space-xs);
  color: var(--color-text-light);
}

/* =============== */
/* Contact Section */
/* =============== */

.contact {
  background-color: var(--color-background);
}

.email-link {
  display: inline-block;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--color-primary);
  text-decoration: none;
}

.email-link:hover {
  color: var(--color-secondary);
}

.social-links {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: var(--space-md);
}

.social-link {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.social-icon {
  font-size: 1.3em;
  line-height: 1;
  font-weight: 400;
}

.social-text {
  font-size: 0.95em;
}

.link-separator {
  color: var(--color-text-light);
  font-weight: normal;
  margin: 0 4px;
}

/* ====== */
/* Footer */
/* ====== */

footer {
  padding: var(--space-xs) 0; /* Reduced from var(--space-md) to minimize gap */
  background-color: transparent;
  text-align: right;
  margin-top: 0; 
}

footer p {
  margin-bottom: 2rem;
  font-size: 0.8rem; 
}

/* ================== */
/* Responsive Styles */
/* ================== */

@media (max-width: 768px) {
    .desktop-nav {
        display: none;
    }

    .mobile-nav-toggle {
        display: flex;
    }

    /* Make header sticky on tablets and mobile */
    header {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1000;
        background-color: transparent !important;  /* Fully transparent - uses page background */
    }

    /* Add padding to body to push content below fixed header */
    body {
        padding-top: 110px;  /* Space for fixed header */
    }

    /* 3D face viewer adjustments for tablet */
    header .logo #face-viewer-container {
        /* Size is controlled in JS via FACE_VIEWER_CONFIG */
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .lead {
        font-size: 1.1rem;
    }

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

    .about-content {
        flex-direction: column;
    }

    .mobile-nav {
        display: block;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    /* 3D face viewer adjustments for mobile */
    header .logo #face-viewer-container {
        /* Size is controlled in JS via FACE_VIEWER_CONFIG */
    }
    
    header .container {
        flex-wrap: wrap;
    }
    
    .project-grid {
        grid-template-columns: 1fr;
    }
    
    nav {
        margin-top: 1rem;
        width: 100%;
    }
    
    nav ul {
        justify-content: space-between;
    }
    
    nav li {
        margin-left: 0;
    }
    
    .social-links {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .mobile-nav {
        width: 100%;
    }
}

/* Mobile Navigation - New Implementation */
/* ==================================== */

/* Hide mobile elements on desktop */
@media (min-width: 769px) {
  .hamburger-menu {
    display: none;
  }
  
  .mobile-nav-overlay {
    display: none;
  }
}

/* Show mobile navigation on mobile devices */
@media (max-width: 768px) {
  /* Hide desktop navigation completely */
  .desktop-nav {
    display: none !important;
  }
  
  /* Adjust header container for mobile */
  header .container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 0 var(--space-sm);
  }
  
  /* Position hamburger menu at right side instead of left */
  .hamburger-menu {
    display: flex !important; /* Force display */
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 20px;
    cursor: pointer;
    z-index: 1100; /* Higher than the overlay to stay on top */
    position: absolute;
    right: var(--space-md); /* Position on right side instead of left */
    left: auto; /* Remove left positioning */
    top: 50%;
    transform: translateY(-50%);
  }
  
  /* Center logo in the header */
  .logo {
    margin: 0 auto;
  }
  
  /* Make sure the logo size is appropriate for mobile */
  .logo img {
    max-height: 50px;
  }
  
  /* Make sure the hamburger menu lines are visible */
  .hamburger-menu span {
    display: block;
    height: 3px;  /* Thicker lines for better visibility */
    width: 100%;
    background-color: var(--color-primary);  /* Default color, will be overridden by JS */
    transition: all 0.3s ease;
  }
  
  /* Critical styles for the active hamburger state (X icon) */
  .hamburger-menu.active {
    position: fixed !important;
    right: var(--space-md) !important;
    left: auto !important;
    top: 30px !important;
    z-index: 10000 !important; /* Higher than mobile overlay (1050) to be above everything */
  }
  
  /* X transformation - use absolute positioning */
  .hamburger-menu.active {
    height: 24px; /* Make the container a bit taller for the X */
    display: block; /* Changed from flex to block */
  }
  
  .hamburger-menu.active span {
    position: absolute;
    top: 50%;
    left: 0;
    margin-top: -1.5px; /* Half the height to center perfectly */
    /* Color will be set by JavaScript using nav-text-color meta tag */
  }
  
  .hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg);
  }
  
  .hamburger-menu.active span:nth-child(2) {
    opacity: 0;
  }
  
  .hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg);
  }
  
  /* Mobile Navigation Overlay */
  .mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: white; /* Fully opaque white */
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 0; /* Remove any padding */
    padding-left: 0; /* Remove any padding */
    padding-right: 0; /* Remove any padding */
    padding-bottom: 0; /* Remove any padding */
    margin: 0; /* Remove any margin */
    /* The actual border will be set by JavaScript */
    /* This ensures we don't have duplicate borders */
    box-sizing: border-box;
  }

  /* Mobile Navigation Close Button (X icon) */
  .mobile-nav-close {
    position: fixed;
    top: 30px; /* Same as hamburger menu position */
    right: var(--space-md); /* Same as hamburger menu position */
    width: 24px;
    height: 24px;
    cursor: pointer;
    z-index: 1051; /* Higher than overlay */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .mobile-nav-close span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: #000; /* Will be overridden by JavaScript */
    position: absolute;
    transition: all 0.3s ease;
  }

  .mobile-nav-close span:nth-child(1) {
    transform: rotate(45deg);
  }

  .mobile-nav-close span:nth-child(2) {
    opacity: 0; /* Hide middle line for X */
  }

  .mobile-nav-close span:nth-child(3) {
    transform: rotate(-45deg);
  }
  
  /* Remove the close button styles */
  
  /* Remove the duplicate frame */
  .mobile-nav-overlay::before {
    content: none;
    display: none;
  }
  
  .mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
  }
  
  .mobile-nav-content {
    width: 100%;
    text-align: center;
    padding: 0 var(--space-md);
  }
  
  .mobile-nav-overlay nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0; /* Remove gap for adding borders */
  }
  
  .mobile-nav-overlay nav li {
    margin: 0;
    border-bottom: 1px solid var(--color-border, #eeeeee); /* Add separator line */
  }
  
  .mobile-nav-overlay nav li:last-child {
    border-bottom: none; /* Remove border from last item */
  }
  
  .mobile-nav-overlay nav a {
    display: block;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--color-primary);
    text-decoration: none;
    padding: var(--space-md) 0; /* More vertical padding */
    border-bottom: none; /* Remove any border */
  }
  
  /* Reset any styling that might interfere */
  .mobile-nav-overlay nav li a {
    font-weight: 500 !important;
    border-bottom: none !important;
    font-size: 1.5rem !important;
  }
  
  /* Prevent scrolling when menu is open */
  body.no-scroll {
    overflow: hidden;
    touch-action: none;
    -ms-touch-action: none;
    overscroll-behavior: none;
    position: fixed;
    width: 100%;
    /* The top property will be set dynamically by JavaScript */
  }
}

/* Adjustments for very small screens */
@media (max-width: 480px) {
  .mobile-nav-overlay nav a {
    font-size: 1.25rem;
  }

  header {
    padding: 20px 0;
    position: fixed !important;  /* Make header sticky on mobile */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: transparent !important;  /* Fully transparent - uses page background */
  }

  /* Add padding to body to push content below fixed header */
  body {
    padding-top: 90px;  /* Space for fixed header on mobile */
  }

  /* Make logo bigger on mobile */
  header .logo #face-viewer-container {
    /* Size is now controlled in JS at 70px */
  }
}

/* Desktop Navigation */
.desktop-nav {
    display: block;
}

/* Make these selectors very specific to ensure they take priority */
.desktop-nav ul li a {
  font-weight: 600 !important; /* Force this to override any other styles */
  color: var(--color-primary);
  text-decoration: none;
}

.mobile-nav ul li a {
  font-weight: 600 !important; /* Force this to override any other styles */
  color: var(--color-primary);
  text-decoration: none;
  font-size: 1.2rem;
  display: block;
  padding: 8px 0;
}

/* Keep the existing hover behavior */
.desktop-nav ul li a:hover,
.mobile-nav ul li a:hover {
  color: var(--color-secondary);
}

/* Home Page Styles */
.home-page {
  background-color: #ededed !important;  /* Gray background for entire home page - force override */
}

/* Make sure body itself uses gray on home page */
body.home-page {
  background-color: #ededed !important;  /* Override default white background */
}

/* Keep footer white on home page */
.home-page footer {
  background-color: white !important;  /* White background for footer */
}

.home-page .border-top,
.home-page .border-right,
.home-page .border-bottom,
.home-page .border-left {
  position: fixed;
  z-index: 1020;
  background-color: var(--color-border, #e3e5e8) !important;
  visibility: visible !important;
  display: block !important;
  opacity: 1 !important;
}

.home-page .border-top {
  top: 0;
  left: 0;
  width: 100%;
  height: 15px !important;
}

.home-page .border-right {
  top: 0;
  right: 0;
  width: 15px !important;
  height: 100%;
}

.home-page .border-bottom {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 15px !important;
}

.home-page .border-left {
  top: 0;
  left: 0;
  width: 15px !important;
  height: 100%;
}

/* Hide borders on mobile devices */
@media (max-width: 480px) {
  .home-page .border-top,
  .home-page .border-right,
  .home-page .border-bottom,
  .home-page .border-left {
    display: none !important;
    visibility: hidden !important;
  }
} 