/* Base */
* { box-sizing: border-box; }

html { font-size: 18px; scrollbar-gutter: stable; }

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  margin: 2rem 0;
}

header h1,
header h2 { margin-bottom: 0.6rem; }

/* Layout widths */
nav,
main,
footer,
.commentbox,
#disqus_thread {
  width: 90%;
  max-width: 42rem;
  padding: 1rem;
}

/* Navbar */

/* Nav icons scale with root size and viewport */
nav ol a img {
  width: clamp(1.5rem, 4vw, 2.5rem);
  height: auto;
}

nav a:hover,
nav a:focus { opacity: 1; } /* prevent global dim on hover */

nav ol {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.25rem, 2vw, 1rem);
  list-style: none;
  padding: 0;
  margin: 0;
}

nav ol .push-right { margin-left: auto; }

nav li { list-style: none; padding: 0; margin: 0; }

nav li a {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}

/* Icon slide + darken only the icon */
nav li .icon img {
  padding-top: 6px;
  transition: transform 0.3s ease, filter 0.3s ease;
}
nav li:hover .icon img { filter: brightness(0.6) contrast(1.1); }

nav li .label {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  color: var( --pagination-color);
  font-size: clamp(0.6rem, 2vw, 0.8rem);
}
nav li:hover .label {
  opacity: 1;
  transform: translateY(0);
}

/* Main */
main { line-height: 1.6rem; }

main img {
  display: block;
  margin: 1rem auto;
  max-width: 100%;
}

/* Lists */
#latest_posts {
  list-style: none;
  font-size: 1.2rem;
  padding: 0;
}

/* Code blocks */
pre { overflow: auto; }

/* Pagination */
#pagination {
  display: flex;
  justify-content: space-between;
}

.pagectrl {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pagenext { margin-left: auto; }
.pageprev { margin-right: 1rem; }
.pagectrl p { margin: 0; }

/* Footer */
footer {
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
}

footer p,
footer address,
footer aside {
  margin: 0.1rem;
}

footer address { font-style: normal; }

footer aside {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.lastupdate::after { content: " • "; }

/* Footer back-to-top (arrow) */
footer .back-to-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

footer .back-to-top .icon img {
  width: clamp(1.25rem, 3vw, 2.25rem); /* was 1.5–3rem */
  height: auto;
  transition: transform 0.3s ease, filter 0.3s ease;
}

footer .back-to-top:hover .icon img { filter: brightness(0.6) contrast(1.1); }

footer .back-to-top .label {
  font-size: clamp(0.6rem, 2vw, 0.8rem);
  margin-top: 0.3rem;
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 0;
  transform: translateY(10px);
  color: var(--pagination-color);
}

footer .back-to-top:hover .label {
  opacity: 1;
  transform: translateY(0);
}

footer .back-to-top:hover,
footer .back-to-top:focus { opacity: 1; }

/* Unified motion amplitude for icon lift */
nav li:hover .icon,
footer .back-to-top:hover .icon {
  transform: translateY(-0.35rem);
}

/* Iframes */
iframe {
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
}

/* Tags */
.tagList {
  list-style: none;
  padding-left: 0;
  padding: 0.25rem 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tagList a { font-size: 1.5rem; }

.tagList li {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.tagged { margin-top: 3rem; }
tagged h2 { font-size: 2rem; }
