/* ======================
   Global reset
   ====================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

/* ======================
   Root wrapper: sidebar + content
   ====================== */
.site-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ======================
   Sidebar (desktop)
   ====================== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 180px;
  height: 100vh;
  background: #fff;
  color: #333;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  padding: 2rem 1rem;
  z-index: 10;
  line-height: 1;
}

.sidebar-title {
  margin-bottom: 0;
  font-size: 1.5rem;
  text-align: right;
}

.sidebar-nav a {
  color: #333;
  text-decoration: none;
  margin: 0.5rem 0;
  display: block;
  text-align: right;
}

.sidebar-back {
  display: none;
}

/* ======================
   Main content
   ====================== */
.content {
  margin-left: 180px;
  height: 100vh;
  overflow-y: auto;
  padding: 0;
}

/* ======================
   Homepage
   ====================== */
body.home-landing {
  overflow: hidden;
}

body.home-landing .home-image {
  position: absolute;
  top: 0;
  left: 180px;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: 1;
}

body.home-landing .home-image img {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: bottom;
  display: block;
}

/* ======================
   Typography
   ====================== */
h1, h2, h3 {
  margin-top: 0;
}

/* ======================
   Links
   ====================== */
a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ======================
   Works page grid
   ====================== */
body.works-page .content {
  padding: 0;
}

.works-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 40px;
  padding: 40px;
}

.works-gallery .work {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.works-gallery .work img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
  margin-bottom: 10px;
  border-radius: 4px;
}

.works-gallery .work .caption {
  font-size: 0.9rem;
  text-align: center;
  color: #555;
}

/* ======================
   About page
   ====================== */
body.about-page .content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem;
  height: 100vh;
  overflow: hidden;
}

/* ======================
   Blog post page
   ====================== */
.post-content {
  padding: 3rem;
  max-width: 1000px;
}

.post-content h1 {
  margin-bottom: 10px;
  font-size: 2rem;
}

.post-content small {
  display: block;
  margin-bottom: 30px;
  color: #777;
}

.post-content p {
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.post-content h2,
.post-content h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
}

/* ======================
   Blog index page
   ====================== */
body.posts-index {
  overflow: hidden;
}

body.posts-index .content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 3rem;
  margin-left: 180px;
  height: 100vh;
}

body.posts-index .posts-list {
  width: 100%;
  max-width: 760px;
  list-style: none;
}

body.posts-index .posts-list li {
  margin-bottom: 0rem;
}

body.posts-index .post-date {
  color: #777;
  font-size: 0.9rem;
  margin-left: 0.5rem;
}

/* =====================================
   MOBILE / PORTRAIT LAYOUT
   ===================================== */
@media (max-width:768px) {

  .site-wrapper {
    display: block !important;
    min-height: auto !important;
  }

  /* Sidebar becomes mobile top bar by default */
  .sidebar {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    padding: 1rem !important;
    align-items: flex-start !important;
    text-align: left !important;
    border-bottom: 1px solid #eee !important;
    background: #fff !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  .sidebar-nav {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.25rem !important;
  }

  .sidebar-nav a {
    margin: 0 !important;
    padding: 0 !important;
    white-space: nowrap !important;
  }

  .content {
    margin-left: 0 !important;
    padding: 1.5rem !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* ============================
     MOBILE HOMEPAGE FLOATING SIDEBAR
     ============================ */
  body.home-landing .home-image {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    z-index: 1 !important;
  }

  body.home-landing .home-image img {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    height: 100% !important;
    width: auto !important;
    min-width: 100% !important;
    transform: translate(-50%, -50%) !important;
    object-fit: cover !important;
  }

  body.home-landing .sidebar {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: rgba(255,255,255,0.95) !important;
    border-radius: 0 !important;
    padding: 2rem 1.5rem !important;
    width: auto !important;
    max-width: 80% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 0.1rem !important;
    z-index: 10 !important;
  }

  body.home-landing .sidebar-nav {
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
    align-items: center !important;
    text-align: center !important;
  }

  body.home-landing .sidebar-nav a {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.5 !important;
    text-align: center !important;
  }

  body.home-landing .sidebar-title {
    text-align: center !important;
  }

  .works-gallery {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px !important;
    padding: 20px !important;
  }

  /* MOBILE NON-HOME PAGES */
  body:not(.home-landing) .sidebar {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    background: white !important;
    padding: 0.75rem 1.25rem !important;
    border-bottom: 1px solid #ddd !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.35rem !important;
    align-items: center !important;
    text-align: center !important;
    z-index: 5;
  }

  body:not(.home-landing) .sidebar-title {
    margin: 0;
    padding: 0;
    font-size: 1.1rem;
  }

  body:not(.home-landing) .sidebar-back {
    display: block !important;
  }

  body:not(.home-landing) .sidebar-back a {
    font-size: 1.6rem;
    text-decoration: none;
    line-height: 1;
  }

  body:not(.home-landing) .sidebar-nav {
    display: none !important;
  }
}
