*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --col-index: 320px;
  --fg: #111;
  --fg-dim: #bbb;
  --fg-hover: #555;
  --serif: "Georgia", "Times New Roman", serif;
}

html,
body {
  height: 100%;
  background: #fff;
  color: var(--fg);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
}

/* ── layout ── */
#shell {
  display: flex;
  min-height: 100vh;
}

#col-index {
  width: var(--col-index);
  flex-shrink: 0;
  padding: 3rem 2rem 3rem 2.5rem;
  overflow-y: auto;
}

#col-content {
  flex: 1;
  padding: 3rem 2rem 3rem 2.5rem;
  display: none;
}

#col-content.open {
  display: block;
  border-left: 1px solid #e8e8e8;
}

/* ── index list ── */
#index-list {
  list-style: disc;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

#index-list li {
  line-height: 1;
}

#index-list button {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 0.85rem;
  color: var(--fg);
  letter-spacing: 0.01em;
  transition: color 0.15s;
  text-align: left;
}

#index-list button:hover {
  color: var(--fg-hover);
}

#index-list button.active {
  color: var(--fg-dim);
}

#entry {
  color: var(--fg);
  font-family: var(--serif);
  font-size: 0.85rem;
  white-space: pre-wrap;
}

/* ── mobile ── */
@media (max-width: 640px) {
  #shell {
    flex-direction: column;
  }

  #col-index {
    width: 100%;
  }

  #col-content {
    border-left: none
  }

  /* full-screen mobile mode */
  body.mobile-open #col-index {
    display: none;
  }

  body.mobile-open #col-content {
    display: block;
    min-height: 100vh;
  }

  #back {
    display: inline-block;
    margin-bottom: 1.75rem;
    font-family: var(--serif);
    font-size: 0.7rem;
    color: var(--fg-dim);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    letter-spacing: 0.04em;
  }

  #back:hover {
    color: var(--fg);
  }
}

@media (min-width: 641px) {
  #back {
    display: none;
  }
}
