html {
  font-size: 16px;
}

@media (max-width: 600px) {
  html {
    font-size: 14px;
  }
}

body {
  background-color: #f9f6ee;
  color: #2c2c2c;
  font-family: 'EB Garamond', serif;
  line-height: 1.8;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

a {
  color: #4a3b2c;
  text-decoration: none;
}

a:hover {
  color: #6a4e2f;
  text-decoration: underline;
}

a:visited {
  color: #5b3e2b;
}

.title-block {
  max-width: 960px;
  margin: 2rem auto 0 auto;
  text-align: center;
  padding: 0 2rem;
}

.page-content {
  display: flex;
  justify-content: center;
  gap: 2rem;
  max-width: 1440px;
  width: 100%;
  padding: 2rem 4rem;
  box-sizing: border-box;
}

.cont-list {
  width: 300px;
  flex-shrink: 0;
  background: #f8f4eb;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid #e0dccc;
  position: sticky;
  top: 2rem;
  height: fit-content;
}

.cont-index li {
  margin-bottom: 1.5rem;
}

.cont-index li button {
  background: none;
  border: none;
  font-size: 0.85rem;
  color: #7a766f;
  margin-left: 0.6rem;
  cursor: pointer;
  font-style: italic;
  padding: 0;
}

.cont-index li button:hover {
  text-decoration: underline;
}

.cont-display {
  max-width: 850px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  background: #fffdf9; /* light velvet background */
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid #e0dccc;
}

.preview {
  margin-top: 0.3rem;
  font-size: 0.9rem;
  color: #7a766f;
  font-style: italic;
}

/* === Mobile Styles === */
@media (max-width: 768px) {
  .page-content {
    flex-direction: column;
    padding: 1rem;
  }

  .cont-list {
    width: 100%;
  }

  .cont-display {
    margin-top: 2rem;
    padding: 1rem;
    font-size: 1rem;
    line-height: 1.6;
    background: #fffdf9; /* repeat velvet background for mobile */
  }

  .desktop-only {
    display: none !important;
  }

  #drawer-toggle {
    display: block;
    background-color: #f8f4eb;
    color: #4a3b2c;
    font-family: 'EB Garamond', serif;
    font-size: 1.1rem;
    border: 1px solid #e0dccc;
    padding: 0.75rem 1.2rem;
    margin: 1rem auto;
    border-radius: 12px;
    cursor: pointer;
  }

  .drawer {
    position: fixed;
    top: 0;
    left: -100%;
    z-index: 100;
    background: #f8f4eb;
    width: 80%;
    max-width: 300px;
     border-right: none !important;
    height: 100%;
    overflow-y: auto;
    padding: 1.5rem;
      transition: left 0.3s ease;
    box-sizing: border-box;
  }

  .drawer.open {
    left: 0;
  }

  .drawer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(44, 44, 44, 0.4);
    z-index: 99;
  }

  .drawer-overlay.active {
    display: block;
  }

  .drawer .cont-index {
    padding-left: 0;
    margin-left: 0;
    list-style-position: inside;
  }

  .drawer .cont-index li a {
    display: block;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.5;
  }
}
@media (max-width: 768px) {
  .drawer .cont-index {
    margin-top: 0; /* remove unexpected spacing */
    padding-top: 0.5rem; /* reduce top air gap */
  }

  .drawer .cont-index li:first-child .menu-section {
    padding-top: 1.5rem; /* increase tappable space */
  }
}

/* Mobile title resizing */
@media (max-width: 600px) {
  .title-block h1,
  .title-block h2 {
    all: unset;
    display: block;
    text-align: center;
    color: #2c2c2c;
  }

  .title-block h1 {
    font-family: 'IM Fell English SC', serif;
    font-size: 1.6rem;
    line-height: 1.2;
    letter-spacing: 0.04em;
    margin-bottom: 0.3rem;
  }

  .title-block h1::after {
    margin-top: 0.3rem;
  }

  .title-block h2 {
    font-family: 'EB Garamond', serif;
    font-size: 1rem;
    font-style: italic;
    max-width: 90%;
    margin: 0 auto;
    line-height: 1.4;
  }
}

/* Extra small screens: optionally hide h2 */
@media (max-width: 420px) {
  .title-block h2 {
    font-size: 0.85rem;
    line-height: 1.3;
    font-style: italic;
    max-width: 90%;
    margin: 0 auto;
    color: #7a766f;
  }
}


/* === Hide drawer on desktop === */
@media (min-width: 769px) {
  .drawer,
  .drawer-overlay,
  #drawer-toggle {
    display: none !important;
  }
}
/* Show/hide intro text based on device */
/* By default, show only desktop version */
.desktop-intro {
  display: block;
}

.mobile-intro {
  display: none;
}

/* On mobile: flip visibility */
@media screen and (max-width: 768px) {
  .desktop-intro {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
  }

  .mobile-intro {
    display: block !important;
    visibility: visible !important;
    font-style: italic;
    color: #7a766f;
    font-size: 1rem;
    text-align: center;
    margin-top: 1rem;
  }
}

@media (max-width: 768px) {
  .drawer .cont-list {
    border: none !important;
  }
}
.scroll-frame {
  max-height: 70vh;
  overflow-y: scroll;
  padding-right: 0.5rem;
  margin-top: 1rem;
  scrollbar-width: thin; /* forces narrow scrollbar */
  scrollbar-color: rgba(93, 84, 70, 0.3) #f8f4eb; /* thumb & track */
}


.scroll-frame::-webkit-scrollbar {
  width: 8px;
  display: block !important;
}

.scroll-frame::-webkit-scrollbar-track {
  background: #f8f4eb;
  border-radius: 6px;
}

.scroll-frame::-webkit-scrollbar-thumb {
  background-color: rgba(93, 84, 70, 0.3);
  border-radius: 6px;
  border: 2px solid #f8f4eb;
}
@media (max-width: 768px) {
  .scroll-frame {
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }
}
.collapsible {
  background-color: transparent;
  color: #333;
  font-weight: bold;
  font-size: 1.1rem;
  padding: 10px 5px;
  width: 100%;
  border: none;
  text-align: left;
  outline: none;
  cursor: pointer;
  border-bottom: 1px solid #ccc;
}



.content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  padding-left: 1rem;
  display: flex;
  flex-direction: column;
}

.content a {
  padding: 6px 0;
  font-size: 0.95rem;
  color: #555;
  text-decoration: none;
}

.content a:hover {
  text-decoration: underline;
}
.cont-index {
  list-style: none;
  padding: 0;
  margin: 0;
}

.menu-section {
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid #e0ddd6;
  cursor: pointer;
  font-weight: normal;
}

/* Optional: subtle hover effect */
.menu-section:hover {
  color: #444;
}

/* Hide the submenu initially if needed */
.sub-menu.hidden {
  display: none;
}


.sub-menu {
  display: block; /* or 'none' if you want them collapsed by default */
  list-style-type: none;
  padding-left: 0;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.sub-menu li {
  margin-bottom: 1rem;
}

.sub-menu a {
  text-decoration: none;
  font-family: 'EB Garamond', serif;
  font-size: 1rem;
  color: #4a3b2c;
  display: block;
}

.sub-menu a:visited {
  color: #5b3e2b;
}

.sub-menu a:hover {
  color: #6a4e2f;
  text-decoration: underline;
}

.sub-menu .preview {
  margin-top: 0.3rem;
  font-size: 0.9rem;
  color: #7a766f;
  font-style: italic;
}

.collapsible {
  cursor: pointer;
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

@media (max-width: 768px) {
  .drawer .sub-menu {
    display: none;
  }
}
@media (max-width: 768px) {
  .drawer {
    overflow-y: scroll; /* force scroll, prevent jiggle */
    -webkit-overflow-scrolling: touch; /* smooth iOS scroll */
    overscroll-behavior: contain; /* stops body rubber band */
    scrollbar-width: none; /* hide scrollbar Firefox */
  }

  .drawer::-webkit-scrollbar {
    width: 0; /* hide scrollbar Safari/Chrome */
    background: transparent;
  }

  html,
  body {
    overflow-x: hidden;
    position: relative;
  }
}
@media (max-width: 768px) {
  .drawer {
    overflow-y: auto;
    overflow-x: hidden; /* prevent left-right wiggle */
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .drawer .cont-index,
  .drawer .cont-index li,
  .drawer .cont-index li a {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
    box-sizing: border-box;
  }

  html, body {
    overflow-x: hidden;
    position: relative;
  }
}
@media (max-width: 768px) {
  .menu-section {
    display: block;
    width: 100%;
    padding: 1rem;
    box-sizing: border-box;
    font-weight: normal;
    font-size: 1.1rem;
    border-bottom: 1px solid #e0ddd6;
    min-height: 48px; /* Big enough for thumb taps */
  }

  .menu-section::before {
    content: '';
    display: inline-block;
    width: 1.2rem; /* extend tappable zone */
  }
}
@media (max-width: 768px) {
  .drawer .sub-menu {
    display: none; /* initial collapsed state */
  }

  .drawer .sub-menu.hidden {
    display: none !important;
  }

  .drawer .sub-menu:not(.hidden) {
    display: block !important;
  }
}
@media (max-width: 768px) {
  .drawer .menu-section {
    font-weight: bold;
  }
}

.sidebar-item.active-section > .menu-section {
  background-color: #4a3b2c !important;  /* koyu kahverengi */
  color: #f9f6f1 !important;             /* açık arka plan rengi */
  font-weight: bold;
  padding: 0.5rem;
  border-radius: 4px;
  max-width: 95%; /* Add this line */
  display: inline-block; /* Makes the width shrink to fit content */
}

@media (max-width: 768px) {
  .sub-menu li {
    padding-right: 1rem;
  }

  .sub-menu .preview {
    padding-right: 1rem;
  }
}
