@import url(https://fonts.bunny.net/css?family=inter:400,400i,700,700i|jetbrains+mono:500,500i,800,800i|playwrite+hr|playwrite+hu);
@import url('https://lalten.github.io/lmweb/style/latinmodern-mono.css');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --text: #29303A;
  --boxtitle: #FCE8C8;
  --bg: #F3E0C0;
  --accent: #C54E2E;
  --secondary: #FCE8C8;
  --tertiary: #C54E2E;

  --header-font: 'JetBrains Mono', Courier New, Courier, monospace;
  --body-font: 'Inter', system-ui, -apple-system, sans-serif;
  --cursive-i: 'Playwrite HR', cursive;
  --cursive: 'Playwrite HU', cursive;
  --typewriter: 'Latin Modern Mono', monospace;

  --border-main: 1px solid var(--accent);
  --border-thick: 3px solid var(--accent);
  --border-dotted: 1px dotted var(--accent);
  --padding-vsm: 0.6rem;
  --padding-sm: 0.95rem;
  --padding-md: 1.25rem;
  --padding-lg: 1.5rem;
  --radius: 4px;
}

html:has(#theme-checkbox:checked) {
  --text: #ccc6c2;
  --boxtitle: #1A141A;
  --bg: #1A141A;
  --accent: #6A84B5;
  --secondary: #1C151B;
  --tertiary: #6A84B5;
}

body {
  height: 100vh;
  font-size: 16px;
  font-family: var(--body-font);
  color: var(--text);
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 40' width='80' height='40'%3E%3Cpath fill='%23C54E2E' fill-opacity='0.05' d='M0 40a19.96 19.96 0 0 1 5.9-14.11 20.17 20.17 0 0 1 19.44-5.2A20 20 0 0 1 20.2 40H0zM65.32.75A20.02 20.02 0 0 1 40.8 25.26 20.02 20.02 0 0 1 65.32.76zM.07 0h20.1l-.08.07A20.02 20.02 0 0 1 .75 5.25 20.08 20.08 0 0 1 .07 0zm1.94 40h2.53l4.26-4.24v-9.78A17.96 17.96 0 0 0 2 40zm5.38 0h9.8a17.98 17.98 0 0 0 6.67-16.42L7.4 40zm3.43-15.42v9.17l11.62-11.59c-3.97-.5-8.08.3-11.62 2.42zm32.86-.78A18 18 0 0 0 63.85 3.63L43.68 23.8zm7.2-19.17v9.15L62.43 2.22c-3.96-.5-8.05.3-11.57 2.4zm-3.49 2.72c-4.1 4.1-5.81 9.69-5.13 15.03l6.61-6.6V6.02c-.51.41-1 .85-1.48 1.33zM17.18 0H7.42L3.64 3.78A18 18 0 0 0 17.18 0zM2.08 0c-.01.8.04 1.58.14 2.37L4.59 0H2.07z'%3E%3C/path%3E%3C/svg%3E") fixed;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  height: auto;
  display: inline-block;
  vertical-align: middle;
}

a {
  color: var(--accent);
  text-decoration: underline;
}

a:hover {
  text-decoration: none;
}

h1,
h2,
h3 {
  font-family: var(--header-font);
  text-transform: uppercase;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
  padding-bottom: var(--padding-vsm);
}

p:last-of-type,
p:last-child {
  padding-bottom: 0;
}

/* https://css-tricks.com/fluid-superscripts-and-subscripts/ */
sup,
sub {
  font-size: calc(0.5em + 4px);
  vertical-align: baseline;
  position: relative;
  top: calc(-0.5 * 0.83 * 2 * (1em - 4px));
  /* Simplified top: calc(-0.83em + 3.32px) */
}

ol,
ul {
  list-style: none;
}

blockquote {
    max-width: 75%;
    margin: 0 auto;
    padding: var(--padding-vsm) var(--padding-vsm);
    border-top: var(--border-dotted);
    border-bottom: var(--border-dotted);
}

blockquote:has(cite) {
    padding-bottom: var(--padding-vsm);
}

blockquote cite {
    display: block;
    font-size: 0.85em;
    text-align: right;
    padding-top: var(--padding-vsm);
}

.heading-corner {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin: 20px 0;
    display: inline-block;
    position: relative;
    padding: 15px 25px;
}

.heading-corner::before,
.heading-corner::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border: 1px dotted #0075c1;
}

.heading-corner::before {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
}

.heading-corner::after {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
}

main {
  position: relative;
  max-width: 55rem;
  width: 100%;
  margin: 0 auto;
  padding: var(--padding-lg);
  display: flex;
  flex-direction: column;
  gap: var(--padding-lg);
  flex-grow: 1;
}

footer {
  font-size: var(--padding-sm);
  font-family: var(--header-font);
  text-transform: uppercase;
  font-weight: 700;
  background: var(--secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--padding-sm) var(--padding-lg);
  border-top: var(--border-main);
  width: 100%;
}

/* ==== Utilities  ==== */
.no-underline {
  text-decoration: none;
}

.mono {
  font-family: var(--header-font);
  font-size: inherit;
}

.typewriter {
  font-family: var(--typewriter);
}

.center {
  text-align: center;
}

.pixelated {
  image-rendering: pixelated;
}

.smtext {
  font-size: 0.9rem;
}

.flex {
  display: flex;
  flex-wrap: wrap;
  gap: var(--padding-lg);
  width: 100%;
}

.flex-start {
  align-items: flex-start;
}

.flex-item {
  flex: 1 1 15rem;
}

.flex-item-unequal {
  flex: 1 1 10rem;
}

.flex-grow-full {
  flex: 1 1 100%;
}

.flex-column {
  display: flex;
  flex-direction: column;
  gap: var(--padding-lg);
  flex: 1 1 15rem;
}

.flex-item-large {
  flex: 1.8 1 25rem;
}

.text-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
  width: 100%;
}

.text-col {
  flex: 1.5 1 12rem;
}

.align-start {
  align-items: flex-start;
}

.scroll-container {
  max-height: 14rem;
  overflow-y: auto;
  padding-right: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  justify-content: center;
}

.imgscroll-container {
  max-height: 15rem;
  overflow-y: auto;
  padding-right: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  justify-content: center;
}

hr.dotted {
  border: none;
  border-top: var(--border-dotted);
  margin: var(--padding-vsm) 0 var(--padding-vsm) 0;
  width: 100%;
}

/* ==== Header  ==== */
header {
  font-family: var(--header-font);
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--padding-lg) 0 0 0;
  gap: 0.75rem;
  position: relative;
}

header h1 a {
  font-size: 1.8rem;
  text-decoration: none;
  text-transform: lowercase;
}

header h1 a:hover {
  text-decoration: underline;
}

nav {
  width: 100%;
  font-weight: 700;
  text-transform: uppercase;
}

nav ul {
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  gap: 0.75rem;
}

nav>ul>li {
  position: relative;
}

nav a {
  display: block;
  background-color: var(--secondary);
  padding: 0.5rem;
  border: var(--border-main);
  border-bottom: var(--border-thick);
  border-radius: var(--radius) var(--radius) 0 0;
  text-decoration: none;
}

nav a:hover {
  background: var(--accent);
  color: var(--bg);
}

nav a:active {
  transform: translateY(1px);
}

.dropdown {
  display: none;
  position: absolute;
  top: 94%;
  left: 0;
  background-color: var(--bg);
  border: var(--border-main);
  border-bottom: var(--border-thick);
  padding: 0;
  z-index: 200;
}

.dropdown li {
  width: 100%;
  display: block;
}

nav .dropdown a {
  border: none;
  border-bottom: var(--border-dotted);
  border-radius: 0;
}

nav .dropdown li:last-child a {
  border-bottom: none;
}

nav>ul>li:hover .dropdown,
nav>ul>li:focus-within .dropdown {
  display: block;
}

/* ==== Toggle Dark/Light  ==== */
.theme-toggle {
  display: none;
}

.theme-btn {
  color: var(--accent);
  position: absolute;
  top: 0;
  right: 0;
  border: none;
  font-family: var(--header-font);
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  font-size: 1.5rem;
  user-select: none;
  transition: background 0.2s ease, transform 0.1s ease;
  z-index: 300;
}

.theme-btn:active {
  transform: translateY(1px);
}

.theme-btn .sun-icon {
  display: none;
}

.theme-btn .moon-icon {
  display: inline;
}

#theme-checkbox:checked~.theme-btn .sun-icon {
  display: inline !important;
}

#theme-checkbox:checked~.theme-btn .moon-icon {
  display: none !important;
}

/* ==== Media Containers  ==== */
.bordered-box .img-box {
  margin: calc(var(--padding-md) * -1) calc(var(--padding-md) * -1) var(--padding-md) calc(var(--padding-md) * -1);
  border-bottom: var(--border-main);
  overflow: hidden;
}

.bordered-box .img-box img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.bordered-box .img-box:first-child {
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}

.banner {
  width: 100%;
  border: var(--border-main);
  border-bottom: var(--border-thick);
  overflow: hidden;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}

.banner img {
  width: 100%;
  height: auto;
  display: block;
}

.img-inline {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

/* ==== Bordered Boxes  ==== */
.bordered-box {
  padding: var(--padding-md);
  background-color: var(--secondary);
  border: var(--border-main);
  border-bottom: var(--border-thick);
  margin-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  position: relative;
}

.bordered-box ul {
  font-family: var(--header-font);
  font-size: 0.9rem;
  line-height: 1.5;
  display: grid;
}

.bordered-box ul li::before {
  content: "⨳";
  color: var(--accent);
  padding-right: 5px;
}

.bordered-box a:hover {
  text-decoration: none;
}

.box-title {
  position: relative;
  font-family: var(--header-font);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  margin: calc(var(--padding-md) * -1 - 1px) calc(var(--padding-md) * -1 - 1px) var(--padding-md) calc(var(--padding-md) * -1 - 1px);
  padding: calc(var(--padding-vsm) + 1px) var(--padding-sm) var(--padding-vsm) var(--padding-sm);
  background: var(--tertiary);
  color: var(--boxtitle);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: inset 0 2px 0 0 rgba(255, 255, 255, 0.4),
    inset 0 -2px 0 0 rgba(0, 0, 0, 0.25);
}

.box-alone {
  display: flex;
  align-items: center;
  justify-content: center;
}

.box-alone .box-title {
  margin: 0;
  border: 0;
  background: transparent;
  padding: 0;
}

/* ==== Tooltips  ==== */
.tooltip {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted var(--accent);
  display: inline-block;
}

.tooltip .tooltip-text {
  visibility: hidden;
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  padding: var(--padding-sm);
  background-color: var(--boxtitle);
  color: var(--text);
  font-family: var(--body-font);
  font-size: 0.85rem;
  text-align: justify;
  line-height: 1.4;
  border-radius: var(--radius);
  border: var(--border-main);
  border-bottom: var(--border-thick);
  z-index: 10;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 0.95;
}

.tooltip-text::selection {
  background-color: var(--accent);
  color: var(--secondary);
}

/* ==== Peekaboo & Clipart  ==== */
.popup {
  position: relative;
}

.peekaboo {
  position: absolute;
  bottom: 100%;
  left: 50%;
  pointer-events: none;
  z-index: 250;
  opacity: 0;
  margin-bottom: -5px;
  width: 75px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  transform: translateX(-50%) translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.sliding-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}

.popup:hover .peekaboo {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.lick-clipart {
  position: absolute;
  top: -25px;
  left: auto;
  right: 5px;
  width: 90px;
  height: auto;
  z-index: 100;
  pointer-events: none;
}

.chunk-clipart {
  position: absolute;
  top: 10%;
  transform: translateY(-50%);
  right: 90%;
  width: 150px;
  height: auto;
  z-index: 100;
  pointer-events: none;
}

/* ==== https://gekiyaku.org/lovedove/lovedove.css  ==== */
a.clique:link,
a.clique:visited {
  font-family: var(--cursive-i);
  font-size: 0.85rem;
  text-transform: lowercase;
  text-decoration: none;
}

a.clique:hover,
a.clique:active {
  color: #ffc664;
  text-shadow: 1px 1px 0 var(--accent);
}

.clique img:hover {
  filter: drop-shadow(1px 1px 0 #ffc664);
}

/* ==== Media Queries  ==== */
@media (prefers-color-scheme: dark) {
  :root {
    --text: #ccc6c2;
    --boxtitle: #1A141A;
    --bg: #1A141A;
    --accent: #6A84B5;
    --secondary: #1C151B;
    --tertiary: #6A84B5;
  }
}

@media (max-width: 740px) {
  body {
    font-size: 14px;
  }

  .chunk-clipart {
    position: absolute;
    top: 40% !important;
    right: 85% !important;
    width: 90px !important;
  }

  .lick-clipart {
    top: -15px;
    left: auto;
    right: 10px;
    width: 70px;
  }

  header h1 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-align: center;
    width: 100%;
  }

  pre {
    white-space: pre-wrap;
    overflow-x: auto;
    font-size: 0.85rem;
  }

  .tooltip .tooltip-text {
    width: 240px;
    left: 50%;
    transform: translateX(-50%);
  }
}

@media (max-width: 480px) {
  main {
    padding: var(--padding-md);
    gap: var(--padding-md);
  }

  nav ul {
    gap: 0.4rem;
  }

  nav a {
    font-size: 0.85rem;
    padding: 0.4rem 0.5rem;
  }

  .flex-item,
  .flex-item-unequal,
  .flex-column,
  .text-col {
    flex: 1 1 100% !important;
    position: relative;
  }

  footer {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
    padding: var(--padding-md);
  }
}