html {
  font-family: "Noto Sans JP", system-ui, sans-serif;
  background: #111111;
}

body {
  margin: 0;
  min-height: 100vh;
  animation: fadein 0.5s forwards;
}

@keyframes fadein {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

a {
  color: #ff5050;
}

main {
  width: 80vw;
  max-width: calc(100% - 2rem);
  margin: auto;
  padding: 2rem;
  padding-top: 0;
  font-size: 16px;
  line-height: 1.6;
  color: whitesmoke;

  @media screen and (min-width: 636px) {
    width: 800px;
  }
}

h2 {
  margin-top: 2rem;
  border-bottom: 1px solid #fde5e31a;
}

hr {
  height: 0;
  margin: 0 10%;
  padding: 0;
  border: 0;
  border-top: 1px solid #fde5e31a;
}

code {
  font-family:
    Menlo,
    Monaco,
    Lucida Console,
    Liberation Mono,
    DejaVu Sans Mono,
    Bitstream Vera Sans Mono,
    Courier New,
    monospace;
  background-color: #292929;
  font-size: 0.9em;
  border-radius: 0.375rem;
  padding: 0.125rem 0.25em;
}

pre {
  overflow-x: auto;
  padding: 1rem;
  background-color: #292929;
  border-radius: 0.375rem;

  code {
    padding: 0;
    background: none;
  }
}

img {
  max-width: 100%;
  height: auto;
}

table {
  display: block;
  overflow-x: scroll;
  border-collapse: collapse;

  th,
  td {
    border: 1px solid gray;
    padding: 0.5rem 1rem;
  }

  tr:nth-child(odd) td {
    background: #1d1f22;
  }
}

blockquote {
  color: gray;
  font-style: italic;
  position: relative;
  margin: 1rem 0;
  border-left: 2px solid gray;
  padding-left: 1rem;

  @media screen and (min-width: 636px) {
    margin: 1rem;
  }
}

::-webkit-scrollbar {
  width: 5px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background-color: #d4211175;
  border-radius: 100px;
}

.site-header {
  display: flex;
  justify-content: center;
  background-color: #151515;
  border-bottom: 1px solid hsl(5deg 85% 94% / 10%);

  > nav {
    display: flex;
    flex-direction: column;
    align-items: center;

    @media screen and (min-width: 636px) {
      display: block;
    }
  }
}

.hamburger {
  cursor: pointer;
  width: 40px;
  margin-top: 5px;

  @media screen and (min-width: 636px) {
    display: none;
  }
}

.nav-links {
  width: 100%;
  margin: 0;
  display: none;

  @media screen and (min-width: 636px) {
    margin-left: 5em;
    display: contents;
    width: auto;
  }

  &.expanded {
    display: unset;
  }

  a {
    color: #dedede;
    display: block;
    text-align: center;
    padding: 10px 0;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: bold;

    @media screen and (min-width: 636px) {
      display: inline-block;
      padding: 15px 20px;
    }
  }

  a.current,
  a:hover,
  a:focus {
    color: #ff5050;
  }
}

.site-footer {
  position: sticky;
  top: 100vh;
  display: flex;
  justify-content: center;
  padding: 2rem;
  color: #999;
  background-color: #171717;
}

.tiken {
  vertical-align: middle;
}

.post-cards {
  display: contents;
}

.post-card {
  --accent-gradient: linear-gradient(
    90deg,
    rgb(180, 34, 36) 10%,
    rgba(255, 255, 255, 1) 20%
  );

  list-style: none;
  display: flex;
  margin: 0.5rem;
  padding: 1px;
  background-color: #23262d;
  background-image: none;
  background-size: 400%;
  border-radius: 7px;
  background-position: 100%;
  transition: background-position 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);

  &:is(:hover, :focus-within) {
    background-position: 0;
    background-image: var(--accent-gradient);
  }

  > a {
    width: 100%;
    text-decoration: none;
    line-height: 1.4;
    padding: calc(1.5rem - 1px);
    border-radius: 8px;
    color: white;
    background-color: #23262d;
    opacity: 0.8;
  }

  .pub-date {
    font-size: 0.8em;
  }

  h2 {
    margin: 0;
    font-size: 1.25rem;
    border: none;
  }

  p {
    margin-top: 0.5rem;
    margin-bottom: 0;
  }
}

.post-date {
  color: #aaaaaa;
  font-size: 0.95em;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;

  &::before {
    content: url("/images/date_icon.svg");
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 0.5rem;
  }
}

.tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;

  .tag {
    margin: 0.2em 0.1em;
    padding: 0 1em;
    border: thin solid gray;
    border-radius: 16px;
  }

  .tag:hover {
    background-color: #600000;
    transition: background-color 0.25s;
  }
}

.toc-container {
  display: flex;
  justify-content: center;
}

.toc-nav {
  border: 1px solid gray;
  width: 100%;

  @media screen and (min-width: 636px) {
    width: 60%;
  }
}

.toc-items {
  padding: 0 1rem;

  @media screen and (min-width: 636px) {
    padding: 0 2rem;
  }
}

.toc-item {
  list-style: none;
}

article :is(h1, h2, h3, h4, h5, h6) > a[href^="#"] {
  color: inherit;
  text-decoration: none;

  &::before {
    display: inline-block;
    content: url("/images/link_icon.svg");
    width: 1.5rem;
    vertical-align: middle;
    margin-right: 0.5rem;
  }
}

.code-block {
  margin: 1rem 0;

  figcaption {
    min-height: 1.5rem;
    padding: 0.25rem 1rem;
    font-size: 0.85em;
    color: #c9d1d9;
    background-color: #1b1f24;
    border-radius: 0.375rem 0.375rem 0 0;
  }

  pre {
    margin: 0;
  }

  figcaption + .code-body pre {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
}

.code-block.terminal figcaption {
  position: relative;
  text-align: center;

  &::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 1rem;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background-color: #8b949e;
    box-shadow:
      1rem 0 #8b949e,
      2rem 0 #8b949e;
    transform: translateY(-50%);
  }
}

.copy-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  padding: 0.4rem;
  color: #c9d1d9;
  background-color: #2d333b;
  border: 1px solid #444c56;
  border-radius: 0.375rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.8s ease-out;

  @media (hover: none) {
    opacity: 1;
  }

  &:hover {
    background-color: #373e47;
  }

  &:focus-visible,
  &.copied {
    opacity: 1;
    transition: none;
  }

  &::after {
    content: "Copied!";
    position: absolute;
    top: 50%;
    right: calc(100% + 0.5rem);
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    white-space: nowrap;
    color: #ffffff;
    background-color: #238636;
    border-radius: 0.375rem;
    transform: translateY(-50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease-out;
  }

  &.copied::after {
    opacity: 1;
    transition-duration: 0.2s;
  }
}

.code-body {
  position: relative;

  &:hover .copy-button {
    opacity: 1;
    transition-duration: 0.2s;
  }
}

pre.line-numbers code {
  counter-reset: line;

  .line::before {
    counter-increment: line;
    content: counter(line);
    display: inline-block;
    width: 2ch;
    margin-right: 1.5ch;
    text-align: right;
    color: #6e7681;
  }
}

pre.shiki .line.highlighted {
  display: inline-block;
  width: calc(100% + 2rem);
  margin: 0 -1rem;
  padding: 0 1rem;
  background-color: #ffffff14;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;

  > a,
  > span[aria-hidden] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    color: #c9d1d9;
    text-decoration: none;
    background-color: #2d333b;
    border: 1px solid #444c56;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
  }

  > a:hover {
    color: #ff5050;
    background-color: #373e47;
  }

  > span[aria-hidden] {
    opacity: 0.4;
  }

  .pagination-status {
    min-width: 3rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
  }
}

.tag-index {
  display: flex;
  flex-wrap: wrap;

  .tag {
    margin: 0.25em;
    padding: 0.5em 1em;
    font-size: 1.15em;
    border: 1px solid #a1a1a1;
    border-radius: 6em;
  }

  .tag:hover {
    background-color: #600000;
    transition: background-color 0.25s;
  }
}

.top-logo {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  justify-content: center;
  margin-top: 2rem;
  font-size: 4rem;
  background-image: linear-gradient(
    90deg,
    rgb(180, 34, 36) 10%,
    rgba(255, 255, 255, 1) 20%
  );
  background-size: 400%;
  background-position: 0%;
  background-clip: text;
  -webkit-text-fill-color: transparent;

  @media screen and (min-width: 636px) {
    flex-direction: row;
  }

  img {
    display: none;
    height: 8rem;

    @media screen and (min-width: 636px) {
      display: inline;
    }
  }
}

.top-image,
.about-icon {
  display: flex;
  justify-content: center;
  margin: 2rem;

  img {
    width: 80vw;
    height: auto;
  }
}

.top-image img {
  @media screen and (min-width: 636px) {
    width: 400px;
  }
}

.about-icon img {
  @media screen and (min-width: 636px) {
    width: 300px;
  }
}

.profile,
.skills {
  text-align: center;

  .skill-icons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
  }

  i {
    font-size: 3rem;
  }
}

.banner {
  display: flex;
  justify-content: center;
  margin: 0.5rem 0;
}

.search[data-pf-theme="dark"] {
  --pf-background: #23262d;
  --pf-hover: #2d3139;
  --pf-border: #444c56;
  --pf-border-focus: #ff5050;
  --pf-outline-focus: #ff5050;
  --pf-mark: #ff5050;
  --pf-input-height: 48px;
  --pf-searchbox-max-width: 100%;
  --pf-searchbox-dropdown-max-height: 60vh;

  margin: 1rem 0;
}
