/* css/main.css */

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

html {
  scroll-behavior: smooth;
  background-attachment: fixed;
  background-size: cover;
  background-repeat: no-repeat; /* Add this */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  display: flex;
  flex-direction: column;
  min-height: 100vh; /* Changed from 100% to 100vh */
  padding-top: 100px; /* Adjusted padding for potentially taller nav */
  background-color: transparent; /* Body is transparent, HTML has gradient */
}
/* Page Specific Backgrounds (Applied to HTML) */
html.page-home {
  /* White to beige */
  background: linear-gradient(to bottom right, #ffffff, rgba(236, 213, 197, 0.55));
}

html.page-projects {
  /* White to a light blue */
  background: linear-gradient(
    to bottom right,
    #ffffff,
    rgba(173, 216, 230, 0.6),
  );
}

html.page-imprint {
  /* White to a neutral light grey */
  background: linear-gradient(
    to bottom right,
    #ffffff,
    rgba(220, 220, 220, 0.6)
  );
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: #0071e3; /* Apple-like blue */
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  color: #1d1d1f; /* Apple's dark grey */
  margin-bottom: 0.8em;
  line-height: 1.3;
}

h1 {
  font-size: 2.5rem;
  font-weight: 600;
}

h2 {
  font-size: 1.8rem;
  font-weight: 600;
  margin-top: 1.5em;
}

h3 {
  font-size: 1.4rem;
  font-weight: 600;
}

p {
  margin-bottom: 1em;
}

/* === Header Styles === */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  width: calc(100% - 40px);
  max-width: 1200px;
  margin: 20px auto 0 auto;
  background-color: rgba(255, 255, 255, 0.85); /* Slightly more opaque */
  backdrop-filter: blur(15px); /* Increased blur */
  -webkit-backdrop-filter: blur(15px);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06); /* Slightly stronger shadow */
  transition: background-color 0.3s ease, box-shadow 0.3s ease, top 0.3s ease,
    width 0.3s ease, max-width 0.3s ease, border-radius 0.3s ease,
    transform 0.3s ease, bottom 0.3s ease, right 0.3s ease, left 0.3s ease,
    padding 0.3s ease;
  height: 65px; /* Slightly taller */
}

.top-nav .logo {
  flex-shrink: 0;
}

.top-nav .logo img {
  height: 45px;
  display: block;
}

.top-nav .nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 0;
  margin: 0;
  flex-grow: 1;
  justify-content: flex-end;
}

.top-nav .nav-links li {
  padding: 0;
}

.top-nav .nav-links a {
  padding: 8px 15px;
  border-radius: 8px;
  transition: background-color 0.2s ease, color 0.2s ease;
  color: #333;
  font-weight: 500;
  display: block;
  white-space: nowrap;
  text-decoration: none; /* Ensure no underline by default */
}

/* Default Hover - subtle grey */
.top-nav .nav-links a:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: #1d1d1f;
  text-decoration: none;
}

/* Default Active State - slightly darker grey */
.top-nav .nav-links a[aria-selected="true"] {
  background-color: rgba(0, 0, 0, 0.08);
  color: #1d1d1f;
  font-weight: 600;
}

/* Page-Specific Nav Link Hover & Active States */

/* Home Page (Beige) */
html.page-home .top-nav .nav-links a:hover {
  background-color: rgba(210, 180, 140, 0.2); /* Light beige highlight */
  color: #8b4513; /* Darker brown/beige text */
  text-decoration: none;
}
html.page-home .top-nav .nav-links a[aria-selected="true"] {
  background-color: rgba(210, 180, 140, 0.35); /* Stronger beige highlight */
  color: #8b4513;
  font-weight: 600;
}

/* Projects Page (Blue) */
html.page-projects .top-nav .nav-links a:hover {
  background-color: rgba(173, 216, 230, 0.3); /* Light blue highlight */
  color: #005f87; /* Darker blue text */
  text-decoration: none;
}
html.page-projects .top-nav .nav-links a[aria-selected="true"] {
  background-color: rgba(173, 216, 230, 0.5); /* Stronger blue highlight */
  color: #005f87;
  font-weight: 600;
}

/* Imprint Page (Grey) */
html.page-imprint .top-nav .nav-links a:hover {
  background-color: rgba(200, 200, 200, 0.4); /* Light grey highlight */
  color: #333;
  text-decoration: none;
}
html.page-imprint .top-nav .nav-links a[aria-selected="true"] {
  background-color: rgba(180, 180, 180, 0.5); /* Stronger grey highlight */
  color: #1d1d1f;
  font-weight: 600;
}

.hamburger-menu {
  display: none;
  cursor: pointer;
  padding: 10px;
  order: 3;
}

.hamburger-menu div {
  width: 25px;
  height: 3px;
  background-color: #333;
  margin: 5px 0;
  transition: 0.4s;
}

/* Scrolled state for 'scroll to top' button */
.top-nav.scrolled {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  justify-content: center;
  align-items: center;
  padding: 0;
  position: fixed;
  top: auto;
  bottom: 30px;
  left: auto;
  right: 30px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  background-color: rgba(255, 255, 255, 0.9);
  transform: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.top-nav.scrolled .logo,
.top-nav.scrolled .nav-links,
.top-nav.scrolled .hamburger-menu {
  display: none;
}

.top-nav.scrolled::after {
  content: "↑";
  font-weight: bold;
  display: block;
  font-size: 24px;
  color: #333;
}

/* --- Main Content Area --- */
.content-container {
  max-width: 1100px;
  margin: 20px auto 40px auto; /* Adjusted top margin */
  padding: 0 20px;
  flex-grow: 1;
  width: 100%;
  display: block; /* Ensure it's a block element by default */
}

/* General content block styling - Modern Look */
.content-block {
  background-color: rgba(255, 255, 255, 0.9); /* Default solid white-ish */
  padding: 35px; /* Increased padding */
  border-radius: 18px; /* Slightly larger radius */
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.06); /* Softer, slightly larger shadow */
  margin-bottom: 30px;
  backdrop-filter: blur(6px); /* Subtle blur behind blocks */
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(0, 0, 0, 0.05); /* Very subtle border */
}

/* --- Projects Showcase Specific --- */
.projects-showcase h1 {
  text-align: center;
  margin-bottom: 40px;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.loading-placeholder {
  text-align: center;
  color: #666;
  grid-column: 1 / -1; /* Span all columns */
  padding: 40px 0;
}

/* --- Project Card - Modern Look --- */
.project-card {
  background-color: rgba(255, 255, 255, 0.9); /* Match content block */
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.06); /* Match content block */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.05); /* Match content block */
}

.project-card:hover {
  transform: translateY(-6px); /* Slightly more lift */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.project-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  /* border-bottom: 1px solid #eee; Removed border */
}

.project-card-content {
  padding: 25px; /* Increased padding */
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.project-card h2 {
  font-size: 1.4rem;
  margin-top: 0;
  margin-bottom: 8px;
}

.project-card p {
  font-size: 1rem;
  color: #555;
  flex-grow: 1;
  margin-bottom: 15px;
}

.project-tags {
  margin-top: auto;
  padding-top: 10px;
}

.project-tags .tag {
  display: inline-block;
  background-color: #eee;
  color: #555;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  margin-right: 5px;
  margin-bottom: 5px;
}

/* --- Index Page Specific Sections --- */
.profile-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background-color: rgba(255, 255, 255, 0.9); /* Explicitly keep this solid */
  padding: 40px 20px;
  border-radius: 18px; /* Match content block */
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.06); /* Match content block */
  margin-bottom: 30px;
  border: 1px solid rgba(0, 0, 0, 0.05); /* Match content block */
}

.profile-image-container {
  margin-bottom: 20px;
}

.profile-image {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.profile-details {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
}

.profile-details h1 {
  margin-bottom: 10px;
  font-size: 2.2rem;
}

#typing {
  border-right: 3px solid #313131;
  padding-right: 5px;
  animation: blink 1.1s step-end infinite;
  display: inline-block;
  min-height: 1.3em;
}

@keyframes blink {
  50% {
    border-color: transparent;
  }
}

.profile-location p {
  margin: 0;
  color: #555;
  font-size: 1.1rem;
}

.social-links-container {
  margin-top: 25px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 15px;
}

.mail-wrapper {
  display: flex;
}

.social-links {
  display: flex;
  gap: 15px;
}

/* --- Social Button - Width Auto --- */
.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  height: 45px;
  width: 45px; /* Fixed initial width */
  padding: 0;
  color: #333;
  border-radius: 10px;
  box-shadow: 0px 5px 8px rgba(0, 0, 0, 0.08);
  background: white;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
  overflow: hidden;
  border: 1px solid #eee;
  position: relative;
  flex-shrink: 0;
}

.social-btn:hover {
  width: auto; /* Let width be determined by content */
  min-width: 45px;
  box-shadow: 0px 8px 12px rgba(0, 0, 0, 0.1);
}

.social-btn a {
  display: flex;
  align-items: center;
  width: auto; /* Allow link to determine width */
  height: 100%;
  text-decoration: none;
  color: inherit;
  padding: 0 12px; /* Padding inside the link */
  overflow: hidden;
}

.social-btn svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.social-btn span {
  display: inline-block;
  white-space: nowrap;
  margin-left: 0; /* Start hidden */
  opacity: 0;
  max-width: 0;
  transition: opacity 0.2s ease-in-out 0.1s,
    max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1) 0.05s,
    margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1) 0.05s;
  vertical-align: middle;
  font-weight: 500;
  overflow: hidden;
}

.social-btn:hover span {
  opacity: 1;
  max-width: 100px; /* Adjust based on longest text if needed */
  margin-left: 10px; /* Add space only when text appears */
}
/* --- End Social Button --- */

/* SVG Fill Colors */
#linkedin svg {
  fill: #0e76a8;
}
#github svg {
  fill: #333;
}
#email svg {
  stroke: #db4437;
  stroke-width: 1.5;
  fill: none;
}

/* Glass effect ONLY for about-me on home page */
html.page-home .about-me-section {
  background-color: rgba(255, 255, 255, 0.65); /* More transparent */
  /* backdrop-filter and border are inherited from .content-block */
}

.about-me-section h2 {
  text-align: center;
}

.timeline-section h2,
.skills-section h2 {
  text-align: center;
  margin-bottom: 30px;
}

.imprint-section h1,
.imprint-section h2,
.imprint-section h3 {
  margin-top: 1.5em;
}
.imprint-section h1:first-of-type {
  margin-top: 0;
}
.imprint-section hr {
  border: 0;
  height: 1px;
  background-color: #e5e5e5;
  margin: 40px 0;
}

/* --- Footer --- */
.site-footer {
  text-align: center;
  padding: 25px 20px;
  margin-top: 40px;
  color: #666;
  font-size: 0.9rem;
  border-top: 1px solid #e5e5e5;
  background-color: #f9f9f9;
}

.site-footer p {
  margin-bottom: 0.5em;
}

/* --- Modal Styles --- */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.modal-content {
  background-color: #fff;
  margin: auto;
  padding: 30px;
  border-radius: 16px;
  width: 90%;
  max-width: 650px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  position: relative;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.modal.show .modal-content {
  transform: scale(1);
}

.close-button {
  color: #aaa;
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.close-button:hover,
.close-button:focus {
  color: #333;
  text-decoration: none;
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.8rem;
}

.modal-content img {
  width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: contain;
  border-radius: 12px;
  margin-bottom: 20px;
  background-color: #f8f8f8;
}

.modal-content p {
  margin-bottom: 15px;
  color: #555;
  font-size: 1.1rem;
}

.modal-content pre {
  background-color: #f5f5f5;
  padding: 15px;
  border-radius: 8px;
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 0.95rem;
  color: #333;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin-bottom: 25px;
  max-height: 200px;
  overflow-y: auto;
}

.modal-link-button {
  display: inline-block;
  background-color: #0071e3;
  color: #fff;
  padding: 12px 25px;
  border-radius: 8px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.modal-link-button:hover {
  background-color: #005bb5;
  text-decoration: none;
}

/* --- Responsive Adjustments --- */
@media (max-width: 800px) {
  body {
    padding-top: 80px;
  }

  h1 {
    font-size: 2rem;
  }
  h2 {
    font-size: 1.6rem;
  }
  h3 {
    font-size: 1.3rem;
  }

  .top-nav {
    width: calc(100% - 30px);
    margin: 15px auto 0 auto;
    padding: 10px 15px;
    height: 60px; /* Adjust height for mobile */
  }

  .top-nav .logo img {
    height: 40px;
  }

  .top-nav .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    width: 220px;
    padding: 10px 0;
    margin: 0;
    border: 1px solid #eee;
  }

  .top-nav .nav-links.active {
    display: flex;
  }

  .top-nav .nav-links li {
    width: 100%;
    text-align: left;
  }

  .top-nav .nav-links a {
    display: block;
    padding: 12px 20px;
    width: 100%;
    border-radius: 0;
    text-align: left;
  }

  /* Mobile nav hover/active states - inherit page-specific colors */
  /* Example override if needed: */
  /*
  html.page-home .top-nav .nav-links.active a:hover,
  html.page-home .top-nav .nav-links.active a[aria-selected="true"] {
      background-color: rgba(210, 180, 140, 0.15);
      color: #8b4513;
  }
  html.page-projects .top-nav .nav-links.active a:hover,
  html.page-projects .top-nav .nav-links.active a[aria-selected="true"] {
      background-color: rgba(173, 216, 230, 0.2);
      color: #005f87;
  }
  html.page-imprint .top-nav .nav-links.active a:hover,
  html.page-imprint .top-nav .nav-links.active a[aria-selected="true"] {
      background-color: rgba(200, 200, 200, 0.3);
      color: #333;
  }
  */

  .hamburger-menu {
    display: block;
  }

  .hamburger-menu.active div:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }
  .hamburger-menu.active div:nth-child(2) {
    opacity: 0;
  }
  .hamburger-menu.active div:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  .top-nav.scrolled {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
  }
  .top-nav.scrolled::after {
    font-size: 20px;
  }

  .content-container {
    padding: 0 15px;
    margin-top: 15px;
  }

  .content-block,
  .profile-section {
    padding: 25px; /* Adjust padding for mobile */
  }

  .projects-showcase h1 {
    font-size: 2rem;
    margin-bottom: 30px;
  }

  .projects-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .project-card img {
    height: 180px;
  }

  .profile-section {
    padding: 30px 15px;
  }
  .profile-image {
    width: 120px;
    height: 120px;
  }
  .profile-details h1 {
    font-size: 1.8rem;
  }

  .modal-content {
    padding: 20px;
    max-height: 80vh;
    width: 95%;
  }
  .modal-content h2 {
    font-size: 1.5rem;
  }
}

/* Smaller mobile adjustments */
@media (max-width: 480px) {
  body {
    font-size: 15px; /* Adjust base font size */
  }
  h1 {
    font-size: 1.8rem;
  }
  h2 {
    font-size: 1.4rem;
  }
  h3 {
    font-size: 1.2rem;
  }

  .content-block,
  .profile-section,
  .project-card-content {
    padding: 20px; /* Reduce padding */
  }

  .projects-showcase h1 {
    font-size: 1.8rem;
  }
  .project-card h2 {
    font-size: 1.2rem;
  }
  .project-card p {
    font-size: 0.95rem;
  }
  .profile-details h1 {
    font-size: 1.6rem;
  }
  .profile-location p {
    font-size: 1rem;
  }
  .social-btn {
    height: 40px;
    width: 40px;
  }
  .social-btn:hover {
    width: auto; /* Keep auto width */
  }
  .social-btn:hover span {
    max-width: 80px; /* Adjust text max width */
  }
}

/* --- Desktop Layout Adjustments --- */
@media (min-width: 1024px) {
  body {
    padding-top: 100px;
    font-size: 17px; /* Base desktop font size */
  }

  /* Home Page Grid */
  html.page-home main.content-container { /* Target container only on home page */
    display: grid;
    grid-template-columns: 1fr 1fr; /* Define two equal columns */
    gap: 30px; /* Define gap between grid items */
    align-items: stretch; /* Default: Make items fill the height of their row */
  }

  html.page-home main.content-container > .profile-section {
    grid-column: 1 / 2; /* Place in the first column */
    margin-bottom: 0; /* Remove default margin when in grid */
  }

  html.page-home main.content-container > .about-me-section {
    grid-column: 2 / 3; /* Place in the second column */
    margin-bottom: 0; /* Remove default margin when in grid */
  }

  html.page-home main.content-container > .timeline-section,
  html.page-home main.content-container > .skills-section {
    grid-column: 1 / -1; /* Make these span both columns */
  }

  /* Center single-column content on other pages */
  html:not(.page-home) main.content-container > *:first-child {
    /* Target the first main block on non-home pages */
    max-width: 900px; /* Adjust max-width as needed */
    margin-left: auto;
    margin-right: auto;
  }

  /* Adjust project grid columns for better spacing on desktop */
  html.page-projects .projects-grid {
    grid-template-columns: repeat(
      auto-fit,
      minmax(320px, 1fr)
    ); /* Keep auto-fit */
  }
}

/* Very large screens */
@media (min-width: 1400px) {
  body {
    font-size: 18px; /* Slightly larger font */
  }
  .content-container {
    max-width: 1200px; /* Increase max width */
  }
  html:not(.page-home) main.content-container > *:first-child {
    max-width: 1000px; /* Increase max width for centered content */
  }
}
