/* 1. Use a more-intuitive box-sizing model */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 2. Remove default margin */
* {
  margin: 0;
}

body {
  /* 3. Add accessible line-height */
  line-height: 1.5;
  /* 4. Improve text rendering */
  -webkit-font-smoothing: antialiased;
}

/* 5. Improve media defaults */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

/* 6. Inherit fonts for form controls */
input,
button,
textarea,
select {
  font: inherit;
}

/* 7. Avoid text overflows */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* 8. Improve line wrapping */
p {
  text-wrap: pretty;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}

/* 9. Create a root stacking context */
#root,
#__next {
  isolation: isolate;
}


/* App styles */
:root {
  font-family: Inter, sans-serif;
  font-feature-settings: 'liga' 1, 'calt' 1;
  /* fix for Chrome */
  font-size: 0.9em;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: 1rem;

  a {
    color: inherit;
  }
}

a {
  text-decoration: none;
  color:  blue;
}

details { 
  & > summary::before {
    content: "→";
  }

  &[open] > summary::before {
    content: "↓";
  }

  summary {
    cursor: pointer;
    display: inline-block;
    user-select: none;
    list-style: none;
  }
}

header {
  border-bottom: thin solid rgb(239, 239, 239);
  padding-bottom: calc(1.5rem - 1px);
  display: flex;
  justify-content: space-between;

  details {
    text-align: end;
   
    &::details-content {
      padding-left: 1rem;
    }
  }
}

.content {
  padding: 1rem;
  max-width: 80rem;
  margin: 0 auto;
  container-type: inline-size;
}

nav {
  > * {
    margin-bottom: 1.5rem;
  }

  h2 {
    line-height: 2;
  }

  ul li {
    margin-bottom: .5rem;
  }

  .tag {
    margin: .5rem .5rem .5rem 0;
    display: inline-block;
    
    &.active {
      text-decoration: underline;
      text-decoration-color: blue;
    }
  }

  .open-all {
    color: blue;
    cursor: pointer;
  }
}

main {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: 2rem;
  
  nav {
    border-bottom: thin solid rgb(239, 239, 239);
  }

  @container (min-width: 50rem) {
    grid-template-columns: 1fr 2fr;

    nav {
      border-bottom: none;
    }
  }
}

article {
  border-bottom: 1px solid rgb(239, 239, 239);
  padding: .3rem 0;
  
  .header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    line-break: loose;

    .link-a {
      /* font-weight: 500; */
    }
  
    .edit-a {
      color: lightgray;
    }
  
    .protocol {
      color: inherit;
      display: none;
    }
  
    .host {
      color: inherit;
    }
  
    .pathname,
    .search,
    .hash {
      opacity: .4;
    }
  }

  .description {
    font-size: 0.9em;
    color: gray;
    padding-left: 2rem;
    position: relative;
    
    .timeline {
      text-align: end;
      float: right;
    }

    &::after {
      content: " ";
      clear: both;
      display: block;
    }
  }
}


.timeline {
  display: flex;
  width: 10rem;
  /* padding-left: 1rem; */
  /* float: right; */
  height: 1.4em;
  flex-direction: column;
  justify-content: center;

  --bg-color: rgb(242, 242, 242);
  --visit-color: rgb(178, 178, 178);

  .chart {
    display: flex;
    justify-content: flex-start;
    align-items: baseline;
    background-color: var(--bg-color);
    border-radius: 2px;
  
    span {
      display: block;
      flex-grow: 1;
      height: 2px;
    }
  
    span:not([data-count="0"]) {
      background-color: var(--visit-color);
    }
  
    span:not([data-count="0"]):last-of-type {
      background-color: var(--visit-color);
    }
  
    span[data-count="0"]+span:not([data-count="0"]),
    span:not([data-count="0"]):first-of-type {
      border-top-left-radius: 2px;
      border-bottom-left-radius: 2px;
    }
  
    span:not([data-count="0"]):has(+ span[data-count="0"]),
    span:not([data-count="0"]):last-of-type {
      border-top-right-radius: 2px;
      border-bottom-right-radius: 2px;
    }
  }
}
