/* ------------------------------
　　エントリー
------------------------------ */
.#{$entry-class} {
  overflow: hidden;
  word-break: break-word;
}

/*  テキストユニット
------------------------------ */
.#{$entry-text-unit} {
  @include font-size($entry-font-size-base);
  color: $entry-text-base-color;
  font-weight: $entry-font-weight-normal;
  word-break: break-word;

  /* 共通余白設定 */
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  dl {
    margin-right: ($grid-space / 2);
    margin-left: ($grid-space / 2);
  }

  blockquote {
    margin-right: 0;
    margin-left: 0;
  }

  /* リンク */
  a {
    &:link,
    &:hover,
    &:focus,
    &:active {
      color: $link-color;
      text-decoration: underline;
    }

    &:visited {
      color: $link-color-visited;
    }
  }

  /* 強調 */
  em {
    font-weight: $entry-font-weight-normal;
    font-style: normal;
    border-bottom: dotted 3px $entry-color-point-base;
  }

  /* 重要 */
  strong{
    font-weight: $entry-font-weight-bold;
    font-style: normal;
  }
}

@media screen and (min-width: $breakpoint-md-min) {
  .#{$entry-text-unit} {
    @include font-size($entry-font-size-base-wide-screen);
  }
}

/* 見出し */
.#{$entry-text-unit} {
  h2:not([class]) {
    @include font-size($entry-font-size-title-lg);
    margin-top: $entry-element-margin-top;
    margin-bottom: $entry-element-margin-bottom-md;
    padding: 0 0 0 10px;
    overflow: hidden;
    font-weight: $entry-font-weight-bold;
    line-height: $entry-title-lineheight;
    border-left: 4px solid $entry-color-point-base;
  }

  h3:not([class]) {
    @include font-size($entry-font-size-title-md);
    margin-top: $entry-element-margin-top;
    margin-bottom: $entry-element-margin-bottom-md;
    padding: 10px;
    overflow: hidden;
    font-weight: $entry-font-weight-normal;
    line-height: $entry-title-lineheight;
    background-color: $entry-color-bg-base;
  }

  h4:not([class]) {
    @include font-size($entry-font-size-title-sm);
    margin-top: $entry-element-margin-top;
    margin-bottom: $entry-element-margin-bottom-md;
    overflow: hidden;
    font-weight: $entry-font-weight-normal;
    line-height: $entry-title-lineheight;
  }
}

@media screen and (min-width: $breakpoint-md-min) {
  .#{$entry-text-unit} {
    h2:not([class]) {
      @include font-size($entry-font-size-title-lg-wide-screen);
    }

    h3:not([class]) {
      @include font-size($entry-font-size-title-md-wide-screen);
    }

    h4:not([class]) {
      @include font-size($entry-font-size-title-sm-wide-screen);
    }
  }
}

/* 本文 */
.#{$entry-text-unit} {
  p:not([class]) {
    margin-top: $entry-element-margin-top;
    margin-bottom: $entry-element-margin-bottom-md;
    font-weight: $entry-font-weight-normal;
    line-height: $entry-text-lineheight;
  }
}

/* リスト */
.#{$entry-text-unit} ul {
  margin: $entry-element-margin-top 0 $entry-element-margin-bottom-md 0;
  padding: 0 ($grid-space / 2);

  li {
    position: relative;
    display: block;
    margin: 0 0 $entry-list-li-bottom-space 0;
    padding: 0 0 0 $entry-list-marker-space;
    font-weight: $entry-font-weight-normal;
    line-height: $entry-text-lineheight;

    &::before {
      position: absolute;
      top: .5em;
      left: 12px;
      width: 0px;
      height: 0px;
      border: 3px solid $entry-color-point-base;
      border-radius: 50%;
      content: "";
    }

    ul {
      margin: $entry-list-li-bottom-space 0;
    }
  }
}

/* 番号付きリスト */
.#{$entry-text-unit} ol {
  margin: $entry-element-margin-top 0 $entry-element-margin-bottom-md 0;
  padding: 0 ($grid-space / 2);
  list-style: none;
  counter-reset: ol-counter;

  li {
    position: relative;
    margin: 0 0 $entry-list-li-bottom-space 0;
    padding: 0 0 0 $entry-list-marker-space;
    line-height: $entry-text-lineheight;

    &:before {
      position: absolute;
      top: .4em;
      left: 8px;
      display: inline-block;
      color: $entry-color-point-base;
      line-height: 1;
      content: counter(ol-counter)".";
      counter-increment: ol-counter;
    }

    ol {
      margin-top: $entry-list-li-bottom-space;
    }
  }
}

/* 定義リスト */
.#{$entry-text-unit} dl {
  margin-top: $entry-element-margin-top;
  margin-bottom: $entry-element-margin-bottom-lg;
  padding: $entry-dl-space 0;
  line-height: $entry-text-lineheight;
  border-top: $entry-dl-border;
  border-bottom: $entry-dl-border;

  dt {
    position: relative;
    margin: 0 0 5px 0;
    padding-left: $entry-dt-border-space + $entry-dt-border-width;
    font-weight: $entry-font-weight-bold;
    
    &::before {
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      border-left: $entry-dt-border-width solid $entry-color-point-base;
      content: "";
    }
  }

  dd {
    margin-left: 0;
    padding-left: $entry-dt-border-width + $entry-dt-border-space;

    & + dt {
      margin-top: $entry-dl-space;
      padding-top: $entry-dl-space;
      border-top: $entry-dl-border;
      &::before {
        top: $entry-dl-space;
      }
    }
  }
}

/* 引用 */
[class*=column-quote] blockquote,
.#{$entry-text-unit} blockquote {
  box-sizing: border-box;
  width: 100%;
  margin-top: $entry-element-margin-top;
  margin-bottom: $entry-element-margin-bottom-lg;
  padding: 30px!important; /* acms-adminの上書き */
  line-height: $entry-text-lineheight;
  background: $entry-color-bg-base;
  border-left: 4px solid $entry-color-point-base;
}

/* ソースコード */
.#{$entry-text-unit} pre {
  box-sizing: border-box;
  width: 100%;
  margin: $entry-element-margin-top 0 $entry-element-margin-bottom-lg 0;

  ol {
    margin: 0;
    padding: 0 0 0 2em;
    list-style: decimal;

    li {
      margin: 0 0 3px 0;
      padding-left: 12px;
      line-height: 1.7;

      &::before {
        content: none;
      }
    }
  }
}

/*  テーブルユニット
/*  テキストユニットのテーブル
------------------------------ */
.#{$entry-text-unit} table,
[class^=column-table-] table {
  width: calc(100% - $grid-space);
  margin: 0 ($grid-space / 2) $entry-element-margin-bottom-lg;
  border: 0 solid $entry-color-border-base;
  border-right-width: 1px;
  border-bottom-width: 1px;
  border-collapse: collapse;
}

.#{$entry-text-unit} th,
[class^=column-table-] th,
.#{$entry-text-unit} td,
[class^=column-table-] td {
  display: block;
  padding: 5px 10px;
  @include font-size($entry-font-size-base);
  line-height: $entry-text-lineheight;
  border: 0 solid $entry-color-border-base;
  border-top-width: 1px;
  border-left-width: 1px;
}

.#{$entry-text-unit} th,
[class^=column-table-] th{
  font-weight: $entry-font-weight-bold;
  background-color: $entry-color-bg-base;

  &:not([align]) {
    text-align: left;
  }
}

/* テーブルユニット */
[class^=column-table-] .entry-container {
  margin-bottom: $entry-element-margin-bottom-lg;
  overflow-x: auto;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch;

  /* entry-containerで余白を保つため打ち消し */
  table {
    width: 100%;
    margin-right: 0;
    margin-bottom: 0;
    margin-left: 0;
  }
}

/* テキストユニットでのテーブル */
/* entry-containerで余白を保つため打ち消し */
.#{$entry-text-unit} .entry-container table {
  width: 100%;
  margin-right: 0;
  margin-left: 0;
}

/* スクロールするテーブル */
[class^=column-table-],
.#{$entry-text-unit} {
  .acms-table-scrollable,
  .js-table-unit-scroll-hint {
    th,
    td {
      display: table-cell;
      white-space: nowrap;
    }
  }
}

@media screen and (min-width: $breakpoint-md-min) {
  .#{$entry-text-unit} th,
  [class^=column-table-] th,
  .#{$entry-text-unit} td,
  [class^=column-table-] td {
    display: table-cell;
    @include font-size($entry-font-size-base-wide-screen);
  }
}

/*  エントリー内要素
------------------------------ */
/* キャプション */
.#{$entry-class} {
  [class*="column-media"] {
    .caption {
      @include font-size(13);
      line-height: 1.4;
    }
  }
}
