/* ============================
   Reset & Base Setup
============================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px; /* 1rem = 16px */
}

body {
  font-family: Arial, Helvetica, sans-serif;
  min-height: 100vh;
  padding: 1.25rem 1.25rem 1.25rem 15rem; /* top right bottom left */
  color: white;
}

/* ============================
   Page Backgrounds
============================ */
body.home {
  background-color: #370808;
  background-image: url('images/webp/BG.webp');
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  background-attachment: fixed; /* parallax effect */
  color: white;
}

body:not(.home) {
  background-color: #370808;
  color: white;
}

/* ============================
   Top Title / Logo
============================ */
.top-title {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  margin: 0;
  padding: 0;
  z-index: 1000;
}

.top-title a {
  display: inline-block;
  text-decoration: none;
  color: white;
}

.logo {
  width: 200px;
  height: auto;
  filter: invert(1) brightness(200%);
  display: block;
}

/* ============================
   Layout
============================ */
.main-container {
  display: flex;
  gap: 1.25rem; /* space between sidebar and content */
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 11rem;
  left: 1.25rem;
  width: 12.5rem; /* 200px */
  display: flex;
  flex-direction: column;
  gap: 0.9375rem;
}

.sidebar a {
  color: white;
  text-decoration: none;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.sidebar a:hover { text-decoration: underline; }
.sidebar a:active { font-weight: bold; }

/* Content */
.content {
  flex: 1;
  padding-top: 0rem;
}

.content p {
  font-size: 1rem;
  line-height: 1.6;
  color: white;
  margin-bottom: 1rem;
}

/* ============================
   Desktop Styles
============================ */
@media (min-width: 769px) {

/* Profile Page — Desktop */
body.profile .profile-container {
  display: flex;
  flex-direction: row;
  align-items: flex-end; /* bottom align photo + text */
  gap: 1rem;             /* spacing between image and text */
  width: 100%;
}

body.profile .profile-photo-wrapper {
  display: block;
}

body.profile .profile-photo {
  max-width: 18.75rem; /* 300px */
  width: 100%;
  height: auto;
  margin: 0;
}

/* TEXT TO THE RIGHT OF THE IMAGE, RIGHT-ALIGNED */
body.profile .profile-text {
  flex: 1;                    /* take remaining horizontal space */
  display: block;
  text-align: right;  /* push text fully to the right */
}

body.profile .profile-text p {
  text-align: left;  /* align text to the right */
  margin: 0;
  line-height: 1.6;
  padding-right: 1rem; /* optional: right spacing */
}


  /* Images */
  .main-photo {
    max-width: 62.5rem; /* 1000px */
    width: 100%;
    margin-top: -5rem;  /* adjust for background image */
    margin-bottom: 1.25rem;
  }

  .profile-photo {
    max-width: 18.75rem; /* 300px */
    width: 100%;
  }

  /* Work Gallery */
  .work-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-top: 0; /* removed extra top margin */
  }

  .work-gallery a {
    display: block;
    width: 31.25rem;
    height: 31.25rem;
  }

  .work-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* Individual Work Page */
  .work-first {
    display: flex;            
    gap: 1.25rem;             
    align-items: flex-end;    /* bottom-align text with image */
    margin-bottom: 1.25rem;
  }

  .work-first .work-image {
    width: 31.25rem;
    max-width: 100%;
    flex-shrink: 1;
    height: auto;
    display: block;
  }

  .work-first .work-text {
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* bottom-align text with image */
    max-width: calc(100% - 31.25rem - 1.25rem);
    min-width: 10rem;
    height: 100%; /*delete?*/
    box-sizing: border-box;
  }

  .work-first .work-text p {
    margin: 0 0 1rem 0;
  }

  .work-first .work-text p:last-child {
    margin-bottom: 0;
  }

  .work-additional-images {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
  }

  .work-additional-images .work-image {
    width: 100%;       /* take full width of container */
    max-width: 31.25rem;   /* ensure it doesn't overflow */
    height: auto;      /* preserve aspect ratio */
    object-fit: cover; /* crop if needed */
    display: block;
  }
}

/* ============================
   Mobile Styles (max-width: 768px)
============================ */
@media (max-width: 768px) {

  /* Base adjustments */
  html { font-size: 14px; }

  body {
    padding: 6rem 0 1rem 0;
    margin: 0;
    width: 100%;
    overflow-x: hidden;
  }

  body.home {
    background-attachment: scroll;
  }

  /* Top logo/title */
  .logo { width: 6rem; }
  .top-title { font-size: 2rem; }
  h1,h2,h3,h4,h5,h6 { font-size: 1rem; }

  /* Sidebar */
  .sidebar {
    top: 6.2rem;
    width: 10rem;
    gap: 0.5rem;
  }

  .sidebar a {
    font-size: 1rem;
    color: inherit;
    text-decoration: none;
    -webkit-text-size-adjust: 100%;
    transition: all 0.3s ease;
  }

  .sidebar a:active,
  .sidebar a:focus {
    font-weight: bold;
    color: inherit;
    outline: none;
  }

  .sidebar a:hover { text-decoration: underline; }

  /* General paragraph styles */
  p {
    font-size: 1rem;
    line-height: 1.6;
    word-wrap: break-word;
  }

  /* ============================
     Profile Page Mobile Fix
  ============================ */

  body.profile .content {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
    margin: 0;
  }

  body.profile .profile-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
  }

  body.profile .profile-photo-wrapper {
    width: 100%;
    display: flex;
    justify-content: flex-end; /* push photo to right */
  }

  body.profile .profile-photo {
    max-width: 50%;
    height: auto;
    display: block;
    margin: 0;
  }

  body.profile .profile-text p {
    width: 100%;
    text-align: right; /* right-align text */
    padding-right: 1rem;
    margin: 0;
    line-height: 1.6;
  }

  /* ============================
     Work Gallery Mobile (unchanged)
  ============================ */
  .work-gallery {
    flex-direction: column;
    gap: 0.5rem;
    margin: 0 auto;
    padding: 0 0.5rem;
  }

  .work-gallery a {
    width: 100%;
    height: auto;
  }

  .work-gallery img,
  .work-image {
    width: 100%;
    max-width: 100%;
    height: auto;
  }

  /* ============================
     Individual Work Page Mobile (unchanged)
  ============================ */
  .main-container {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
  }

  .content {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .work-first {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .work-first .work-image-container,
  .work-first .work-image {
    width: calc(100% - 10rem); /* leave 10rem on left */
    max-width: calc(100% - 10rem);
    min-width: calc(100vw - 10rem);
    height: auto;
    display: block;
    margin-left: auto;  /* push to right edge */
    margin-right: 0;
  }

  .work-first .work-text {
    width: 100vw;
    max-width: 100vw;
    padding: 0 0.75rem;
    margin: 0;
    box-sizing: border-box;
  }

  .work-first .work-text p {
    margin: 0 0 1rem 0;
  }

  .work-additional-images {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    padding: 0 0.75rem;
    margin: 0;
    box-sizing: border-box;
  }

  .work-additional-images .work-image {
    width: 100%;
    max-width: 100vw;
    height: auto;
    display: block;
  }

  .main-photo { margin-top: 0; }
}
