/* 汎用 */
:root {
  --nav-color: white;
  --nav-background-color: #16423C;
  --sub-read-background-color: #E9EFEC;
  --menu-background-color: #6A9C89;
  --read-background-color: #C4DAD2;
}

.spacer {
  width: 1rem;
  height: 1rem;
}
#cover {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;

  &.show {
    display: block;
  }
}
.small {
  font-size: 0.8rem;
}

/* body */
body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100dvh;
}

/* プログレスバーを画面保護とスピナーに変更 */
.turbo-progress-bar {
  position: fixed;
  width: 100vw !important;
  height: 100vh;
  top: 0;
  left: 0;
  background-color: white;
  opacity: 0.8 !important;
}
.turbo-progress-bar::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 10rem;
  height: 10rem;
  margin: auto;
  background-color: white;
  background-image: url("/assets/bars-rotate-fade-fca9fd3d.svg");
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.8;
}

/* ヘッダー */
header {
  --left-width: 100%;
  /* --left-width: 6rem; */
  --right-width: 6rem;
  --transition: .2s;

  width: 100%;
  height: 2rem;

  nav ul {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--nav-color);
    background-color: var(--nav-background-color);
    font-weight: bold;

    .icon {
      display: flex;
      justify-content: center;
      align-items: center;

      img {
        width: 2rem;
        height: 2rem;
        filter: invert(94%) sepia(42%) saturate(2%) hue-rotate(234deg) brightness(112%) contrast(100%); /* svgの色設定 */
      }
    }

    .feed-title-container {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      flex: 1;
      justify-content: center;

      .sort-toggle {
        color: var(--nav-color);
        text-decoration: none;
        font-size: 0.8rem;
        padding: 0.2rem 0.5rem;
        border: 1px solid var(--nav-color);
        border-radius: 4px;
        transition: background-color 0.2s;

        &:hover {
          background-color: rgba(255, 255, 255, 0.2);
        }
      }
    }
  }

  #sidebar-left,
  #sidebar-right {
    position: fixed;
    top: 2rem;
    z-index: 20;
    height: calc(100dvh - 2rem);
    overflow-y: scroll;

    ul {
      display: flex;
      flex-direction: column;
      align-items: start;

      li {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: clip;
      }
    }
  }
  #sidebar-left {
    width: var(--left-width);
    left: calc(var(--left-width) * -1);
    transition: left var(--transition);

    &.show {
      left: 0;
      transition: left var(--transition);
    }
  }
  #sidebar-right {
    width: var(--right-width);
    right: calc(var(--right-width) * -1);
    transition: right var(--transition);

    &.show {
      right: 0;
      transition: right var(--transition);
    }
  }
}

#entries {
  flex: 1;
  overflow: scroll;

  .no-unread {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 2rem;
    text-align: center;
    font-size: 1.2rem;
    color: #666;
  }

  .entry {
    display: flex;
    flex-direction: column;
    /* flex-direction: row; */
    border-bottom: black 1px solid;

    &.read {
      background-color: var(--read-background-color);

      .title .datetime {
        background-color: var(--read-background-color);
      }
    }

    a {
      text-decoration: none;

      &.link {
        font-weight: bold;
        color: blue;
      }
    }

    .entry-title {
      display: flex;
      flex-direction: row;
    }

    .star-container {
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 0.2rem;
      border-right: 1px solid black;
      min-width: 2rem;
      width: 2rem;
    }

    .star {
      display: inline-block;
      padding: 0;
    }

    .title {
      flex: 1;
      display: inline-block;
      padding: 0.2rem;
      overflow: hidden;
      height: 3.4rem;
      position: relative;
      cursor: pointer;

      .title-text {
        font-weight: bold;
      }

      .datetime {
        padding: 0 0.5rem;
        position: absolute;
        float: right;
        bottom: 0;
        right: 0;
        background-color: white;
        font-size: 0.8rem;
        font-weight: bold;
        line-height: 1.5rem;
      }
    }

    .summary {
      display: inline;
      background-color: white;
      border-top: 1px solid black;

      div {
        padding: 0.2rem;
      }

      a {
        color: blue;
      }

      cite {
        float: left;

        img {
          padding-right: 1rem;
          float: left;
        }

        a {
          display: none;
        }
      }

      .menu {
        width: 100%;
        color: white;
        background-color: var(--menu-background-color);
        font-weight: bold;
      }
    }

    .fold {
      display: none;
    }
  }

}

/* フッター */
footer {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 2rem;
  color: var(--nav-color);
  background-color: var(--nav-background-color);
}

/* フラッシュメッセージ（notice / alert）を上部に浮かせて中央固定表示 */
.notice,
.alert {
  position: fixed;
  top: calc(2rem + 0.5rem); /* ヘッダー高 (2rem) の下に少し余白 */
  left: 50%;
  transform: translateX(-50%);
  z-index: 40; /* sidebar (z-index:20) より前面に表示 */
  display: block;
  margin: 0; /* 固定表示のため中央マージンは不要 */
  padding: 0.5rem 1rem;
  max-width: 90%;
  width: auto;
  text-align: center;
  border-radius: 6px;
  box-sizing: border-box;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  /* フェードアウトは位置を変えずに行う（in-place） */
  transition: opacity 0.18s ease;
}

/* クリック・タップで閉じるアニメーション用 */
.notice,
.alert {
  cursor: pointer;
}

.notice.dismissed,
.alert.dismissed {
  opacity: 0;
  transform: translateX(-50%);
  pointer-events: none;
}

.notice {
  background-color: #e9f7ef; /* 優しい緑系 */
  color: #1b5e3a;
  border: 1px solid rgba(27,94,58,0.12);
}

.alert {
  background-color: #fff2f2; /* 優しい赤系 */
  color: #7a1212;
  border: 1px solid rgba(122,18,18,0.12);
}
