/*==VARIABLES==*/

:root[data-theme="light"] {
  --width: 50rem;
  --font-main: system-ui, sans-serif;
  --font-secondary: system-ui, sans-serif;
  --font-scale: 1.25em;
  --background-color: #fdfdfd;
  --heading-color: #222222;
  --text-color: #000000;
  --visited-color: #5a5a5a;
  --code-background-color: #f6f6f6;
  --code-color: #222222;
}

:root[data-theme="dark"] {
  --width: 50rem;
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-secondary: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-scale: 1.25em;
  --background-color: #0D0D0D;
  --heading-color: #f5f5f5;
  --text-color: #f5f5f5;
  --visited-color: #aaaaaa;
  --code-background-color: #222222;
  --code-color: #f5f5f5;
  --dark-border-color: #1a1a1a;
}

/*==BASE==*/

body {
  font-family: var(--font-secondary);
  font-size: var(--font-scale);
  margin: 0 auto;
  padding: 15px;
  max-width: var(--width);
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.7;
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-weight: 450;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background-color: transparent;
  background-image:
    linear-gradient(to right, rgba(0,0,0,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.05) 1px, transparent 1px);
  background-size: 37px 37px;
  background-position: -5px 0px;
}

:root[data-theme="dark"] body::before {
  background-color: #050505;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.05) 1px, transparent 1px);
}

a {
  color: var(--heading-color);
  text-decoration: none;
  cursor: pointer;
}

a:hover {
  text-decoration: none;
}

button {
  border: 0;
  background: inherit;
  color: var(--heading-color);
}

img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  object-fit: contain;
  margin: 0 auto;
}

main img {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

figcaption {
  font-size: 16px;
  text-align: center;
  margin-top: -2px;
}

hr {
  border: 0;
  border-top: 1px dashed;
}

::selection {
  background-color: rgba(228, 163, 32, 0.35);
  color: var(--text-color);
}

/*==TYPOGRAPHY==*/

h1, h2, h3, h4, h5, h6,
strong, b {
  font-family: var(--font-main);
  color: var(--heading-color);
}

main h1 {
  font-size: 2.0rem;
  font-weight: 700;
  margin-bottom: -1rem;
}

main h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: -1rem;
}

main h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.1rem;
}

main h4 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.1rem;
}

.title:not(.header-title),
p.tags {
  display: none !important;
}

code {
  font-family: monospace;
  padding: 2px;
  background-color: var(--code-background-color);
  color: var(--code-color);
  border-radius: 3px;
  word-break: break-all;
}

blockquote {
  position: relative;
  padding-left: 20px;
  font-style: italic;
}

blockquote::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.4em;
  bottom: 0.4em;
  width: 2.5px;
  background-color: #999;
  border-radius: 10px;
}

time {
  display: inline-block;
  padding: 1px 4px;
  border-radius: 4px;
  background-color: #222;
  color: var(--background-color);
  font-size: 11px;
  font-weight: bold;
  border: 1px solid #222;
  margin-bottom: 3.5px;
  margin-right: 6px;
  font-style: normal !important;
}

[data-theme="dark"] time {
  background-color: #EBA708;
  border-color: #EBA708;
}

mark {
  display: inline-block;
  padding: 1px 4px;
  border-radius: 4px;
  background-color: #222;
  color: var(--background-color);
  font-size: 12px;
  font-weight: bold;
  border: 1px solid #222;
}

[data-theme="dark"] mark {
  background-color: #EBA708;
  border-color: #EBA708;
}

:root[data-theme="dark"] {
  scrollbar-color: #EBA708 #EBA708;
}

/*==LAYOUT==*/

.site-header,
main {
  position: relative;
  z-index: 1;
  background-color: var(--background-color);
  border: 1.5px solid rgba(0,0,0,0.12);
  box-shadow: none;
  max-width: var(--width);
  margin-left: auto;
  margin-right: auto;
}

:root[data-theme="dark"] .site-header,
:root[data-theme="dark"] main {
  border: 1.5px solid var(--dark-border-color);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 25px;
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  margin-top: 5px;
}

main {
  padding: 5px 25px 25px 25px;
  border-radius: 0 0 14px 14px;
  margin-bottom: 5px;
}

:root[data-theme="dark"] main {
  background-color: var(--background-color);
}

footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 25px !important;
  text-align: center;
  line-height: 1.0;
  background-color: rgba(253, 253, 253, 0.25);
  border-radius: 0 0 14px 14px;
  max-width: var(--width);
  margin: 0 auto;
}

:root[data-theme="dark"] footer {
  background-color: rgba(13, 13, 13, 0.25);
}

footer p {
  margin: 0;
}

footer span:has(.bear) {
  font-size: 0.7rem !important;
}

footer span:has(.bear) .bear {
  font-size: inherit !important;
}

footer .footer-note mark {
  padding: 1px 2px;
  border-radius: 2px;
  background-color: #EBA708;
  border: 1px solid #EBA708;
}

/*==NAV==*/

.site-header .header-title h1 {
  margin: 0;
  font-size: 1.3rem;
}

.site-header .nav-links a {
  margin-left: 10px;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 600;
  color: var(--heading-color);
  display: inline-block;
  transition: transform 0.2s ease;
}

.site-header .nav-links a:hover {
  transform: scale(1.05);
}

[data-theme="dark"] main strong a,
[data-theme="dark"] main a strong {
  color: #EBA708;
}

[data-theme="dark"] main strong a:hover,
[data-theme="dark"] main a strong:hover {
  text-decoration: none !important;
}

/*==BLOG_POSTS_LIST==*/

ul.blog-posts {
  list-style: none;
  padding: 0;
}

ul.blog-posts li {
  display: flex;
}

ul.blog-posts li span {
  flex: 0 0 140px;
  white-space: nowrap;
  margin-right: 1.5rem;
}

ul.blog-posts li a {
  transition: transform 0.2s ease;
  display: inline-block;
}

ul.blog-posts li a:hover {
  transform: scale(1.05);
}

ul.blog-posts li a:visited {
  color: var(--visited-color);
}

/*==TABLE==*/

table {
  width: 100%;
  border-collapse: collapse;
  margin: 5px 0;
  font-size: 16px;
  color: var(--text-color);
}

table th,
table td {
  border: 1px solid #ccc;
  padding: 5px 8px;
  text-align: left;
}

table th {
  background-color: #f4f4f4;
  color: #000;
  font-weight: bold;
}

table tr:nth-child(even) {
  background-color: #fafafa;
}

@media (prefers-color-scheme: dark), :root[data-theme="dark"] {
  table th,
  table td {
    border: 1px solid #555;
  }

  table th {
    background-color: var(--code-background-color);
    color: var(--code-color);
  }

  table tr:nth-child(even),
  table tr:nth-child(odd) {
    background-color: transparent;
  }
}

/*==CORNER_CHARACTER==*/

#corner-character {
  position: fixed;
  bottom: 0;
  right: 20px;
  width: 120px;
  z-index: 9999;
  cursor: pointer;
  transform-origin: bottom center;
  transition: transform 0.5s cubic-bezier(0.3, 1.5, 0.5, 1);
}

#corner-character.squish {
  animation: squishAnim 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

#corner-character.hold-squish {
  transform: scale(1.12, 0.88);
}

#character-message {
  position: fixed;
  bottom: 140px;
  right: 20px;
  background: white;
  color: black;
  padding: 8px 12px;
  border-radius: 8px;
  display: none;
  z-index: 9999;
  max-width: 200px;
  text-align: center;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/*==NOT_BY_AI_BADGE==*/

.not-by-ai-badge-wrapper {
  display: flex;
  justify-content: center;
  margin: 5px 0 10px 5px;
}

.not-by-ai-badge {
  display: block;
  border-radius: 0 !important;
  padding-bottom: 5px;
}

.not-by-ai-badge img {
  width: auto !important;
  height: auto !important;
  max-width: 115px;
  max-height: 60px;
  object-fit: contain;
  display: block;
  border-radius: 0 !important;
}

/*==CC_ICONS==*/

.cc-icon {
  width: 1em;
  height: 1em;
  border-radius: 0 !important;
}

/*==ANIMATION==*/

@keyframes squishAnim {
  0%   { transform: scale(1, 1); }
  15%  { transform: scale(1.06, 0.94); }
  35%  { transform: scale(0.96, 1.05); }
  55%  { transform: scale(1.04, 0.96); }
  75%  { transform: scale(0.98, 1.02); }
  100% { transform: scale(1, 1); }
}

/*==MOBILE==*/

@media (max-width: 600px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-header .nav-links {
    margin-top: 8px;
  }

  .site-header .nav-links a:first-child {
    margin-left: 0;
  }

  #corner-character,
  #character-message {
    display: none !important;
  }
}

html {
  scroll-behavior: smooth;
}

/*==BIGGER SCREENS==*/

@media (min-width: 1920px) {
  :root[data-theme="light"],
  :root[data-theme="dark"] {
    --font-scale: 1.6em;
    --width: 61rem;
  }

  .site-header .header-title h1 { font-size: 1.7rem; }
  .site-header .nav-links a { font-size: 1.3rem; }
  .upvote-button { font-size: 1.15rem; }

  main h1 { font-size: 2.6rem !important; }
  main h2 { font-size: 2.3rem !important; }
  main h3 { font-size: 2rem !important; }
  main h4 { font-size: 1.6rem !important; }

  figcaption { font-size: 20px; }
  footer { font-size: 1.3rem; }
  time { font-size: 14px; }
  mark { font-size: 15px; }
  table { font-size: 20px; }

  #theme-toggle img { width: 20px !important; height: 20px !important; }

  #corner-character { width: 160px; }
  #character-message {
    font-size: 18px;
    max-width: 260px;
    bottom: 185px;
  }

  .cc-icon { width: 1.1em; height: 1.1em; }
}

@media (min-width: 2560px) {
  :root[data-theme="light"],
  :root[data-theme="dark"] {
    --font-scale: 1.85em;
    --width: 75rem;
  }

  .site-header .header-title h1 { font-size: 2rem; }
  .site-header .nav-links a { font-size: 1.55rem; }
  .upvote-button { font-size: 1.15rem; }

  main h1 { font-size: 3.2rem !important; }
  main h2 { font-size: 3.0rem !important; }
  main h3 { font-size: 2.4rem !important; }
  main h4 { font-size: 1.9rem !important; }

  figcaption { font-size: 24px; }
  footer { font-size: 1.55rem; }
  time { font-size: 17px; }
  mark { font-size: 18px; }
  table { font-size: 24px; }

  #theme-toggle img { width: 26px !important; height: 26px !important; }

  #corner-character { width: 200px; }
  #character-message {
    font-size: 22px;
    max-width: 320px;
    bottom: 230px;
  }

  .not-by-ai-badge img {
    max-width: 150px !important;
    max-height: 55px !important;
  }

  .cc-icon { width: 1.2em; height: 1.2em; }
}

main p a,
main li:not(.blog-posts li) a,
main blockquote a {
  position: relative;
}

main p a::after,
main li:not(.blog-posts li) a::after,
main blockquote a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: #EBA708;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

main p a:hover::after,
main li:not(.blog-posts li) a:hover::after,
main blockquote a:hover::after {
  transform: scaleX(1);
}

main p a:visited,
main li:not(.blog-posts li) a:visited,
main blockquote a:visited {
  text-decoration: none;
}
