:root {
  --text-color: #000;
  --base-color: #fff;
  --link-color: #2189ff;

  /* Sky gradient */
  --sky-1: #b8f2a8;
  --sky-2: #72e4b8;
  --sky-3: #38b8d8;
  --sky-4: #2255c4;
  --sky-5: #1e34a0;
  --sky-6: #100b58;

  /* Fog overlay */
  --fog-1: #64d2eb;
  --fog-2: #3787dc;
  --fog-3: #3782d7;
  --fog-4: #1c41aa;
  --fog-1-a: 0.1;
  --fog-2-a: 0.2;
  --fog-3-a: 0.2;
  --fog-4-a: 0.1;

  /* Tree palette */
  --tree-hue-min: 174;
  --tree-hue-max: 216;
  --tree-sat: 58;
  --tree-light-min: 36;
  --tree-light-max: 52;
}

html {
  color: var(--text-color);
  font-family: monospace;
  font-size: 112.5%;
  -webkit-font-smoothing: antialiased;
  background-color: var(--sky-5);
}

/* ── Dark theme (30 % darker + white text) ───────────────────────── */
html.theme-dark {
  transition: color 1s linear;

  --text-color: #fff;
  --base-color: #000;

  --sky-1: #1585a1;
  --sky-2: #126393;
  --sky-3: #171d4d;
  --sky-4: #121d49;
  --sky-5: #0d1e43;
  --sky-6: #141645;

  --fog-1: #2a093b;
  --fog-2: #1c2c59;
  --fog-3: #10807d;
  --fog-4: #4c1a52;
  --fog-1-a: 0.06;
  --fog-2-a: 0.1;
  --fog-3-a: 0.1;
  --fog-4-a: 0.08;

  --tree-hue-min: 206;
  --tree-hue-max: 226;
  --tree-sat: 32;
  --tree-light-min: 10;
  --tree-light-max: 26;
}

/* ── Light theme (bright, misty forest) ──────────────────────────── */
html.theme-light {
  transition: color 1s linear;

  --text-color: #000;
  --base-color: #fff;

  --sky-1: #f0f5eb;
  --sky-2: #dce8d4;
  --sky-3: #c0d8d0;
  --sky-4: #a0c0c8;
  --sky-5: #88aec0;
  --sky-6: #7098b0;

  --fog-1: #d8eee8;
  --fog-2: #c0d8d8;
  --fog-3: #b8d0d0;
  --fog-4: #a0c0c8;
  --fog-1-a: 0.08;
  --fog-2-a: 0.12;
  --fog-3-a: 0.12;
  --fog-4-a: 0.08;

  --tree-hue-min: 110;
  --tree-hue-max: 150;
  --tree-sat: 30;
  --tree-light-min: 38;
  --tree-light-max: 56;
}

body {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  line-height: 1.44444;
}

html,
body {
  padding: 0;
  margin: 0;
}

picture {
  position: relative;
  display: block;
  width: 150px;
  height: 150px;
  margin: 0 0 20px;
  background-color: rgba(255, 255, 255, 0.22);
  transition: background-color 1s linear;
}

picture::before,
picture::after {
  position: absolute;
  top: 0;
  left: 0;
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background-image: url("me.avif");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  opacity: 0.99999;
  visibility: hidden;
  transition:
    opacity 10000s linear,
    visibility 0s;
}

picture::before {
  mix-blend-mode: lighten;
}

picture::after {
  mix-blend-mode: hard-light;
}

html.theme-dark picture {
  background-color: rgba(255, 255, 255, 0);
}

html.theme-dark picture::before {
  visibility: visible;
  opacity: 1;
}

html.theme-dark picture::after {
  transition:
    opacity 0s linear,
    visibility 0s;
}

html.theme-light picture {
  background-color: hsl(151deg 29% 53% / 70%);
}

html.theme-light picture::before {
  transition:
    opacity 0s linear,
    visibility 0s;
}

html.theme-light picture::after {
  visibility: visible;
  opacity: 1;
}

main {
  position: fixed;
  padding: 30px 30px 104px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.activated main {
  position: relative;
}

.greeting {
  margin: 0 0 0.35rem;
  font-size: 1.125rem;
  line-height: 1.2;
  font-weight: normal;
}

h1 {
  margin: 0 0 1rem;
  font-size: 1.8em;
  line-height: 1.2;
  font-weight: bold;
}

@media (min-width: 768px) {
  h1 {
    font-size: 2.5em;
  }
}

p {
  max-width: 708px;
  margin: 0 0 20px;
  font-size: 1rem;
  line-height: 1.55rem;
}

.intro span {
  white-space: nowrap;
}

a {
  position: relative;
  display: inline-block;
  margin: 0.75em 20px 0;
  line-height: 0em;
  padding-bottom: 0.5em;
  color: currentColor;
  text-decoration: none;
  background-color: var(--link-color);
  font-weight: bold;
}

a::before,
a::after {
  display: block;
  position: absolute;
  bottom: -1em;
  padding-top: 1.5em;
  padding-bottom: 1.5em;
}

a::before {
  content: "[";
  left: -20px;
  right: 0;
}

a::after {
  content: "]";
  left: 100%;
  width: 20px;
  text-align: right;
}

a + a {
  margin-left: 0;
}

.links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.link-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.link-item + .link-item {
  margin-top: 1.5rem;
}

.link-item__desc {
  margin: 0;
  padding: 10px 0 0 20px;
  max-width: 708px;
}

@media (min-width: 440px) {
  .links {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .link-item {
    flex-direction: row;
  }

  .link-item + .link-item {
    margin-top: 0;
  }

  .link-item__desc {
    padding: 0 0 0 30px;
  }

  .link-item__desc::before {
    float: left;
    content: "—";
    width: 30px;
    margin: 0;
    flex: 0 0 30px;
    margin: 0 0 0 -30px;
    text-align: center;
  }

  .links > a + a,
  .links > .link-item + .link-item,
  .links > a + .link-item,
  .links > .link-item + a {
    margin-left: 30px;
  }
}

.link-group + .link-group {
  margin-top: 1.5rem;
}

.link-group__title {
  margin: 0 0 1rem;
  font-size: inherit;
  font-weight: bold;
}

.activated main {
  opacity: 1;
  pointer-events: auto;
}

aside {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ── Theme toggle ────────────────────────────────────────────────── */
.theme-toggle {
  position: absolute;
  top: 30px;
  right: 30px;
  z-index: 10;
  display: flex;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  font-size: 0.9rem;
  line-height: 1;
  transition: opacity 0.4s;
}

.theme-toggle input {
  position: absolute;
  z-index: -1;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.theme-toggle__track {
  position: relative;
  width: 40px;
  height: 22px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 11px;
  transition: background 0.3s;
}

.theme-toggle__btn {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--base-color);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.3s;
  text-align: center;
  overflow: hidden;
}

.theme-toggle__btn::before {
  position: absolute;
  content: "☀";
  top: 50%;
  left: 50%;
  width: 1em;
  height: 1em;
  line-height: 1em;
  text-align: center;
  margin: -0.5em 0 0 -0.5em;
}

@supports (-webkit-text-size-adjust: none) and (font: -apple-system-body) {
  .theme-toggle__btn::before {
    margin: -0.3em 0 0 -0.5em;
  }
}

.theme-toggle input:checked ~ .theme-toggle__track {
  background: rgba(0, 0, 0, 0.18);
}

.theme-toggle input:checked ~ .theme-toggle__track .theme-toggle__btn {
  transform: translateX(18px);
}

.btn {
  position: fixed;
  bottom: 30px;
  left: 50%;
  width: 120px;
  height: 44px;
  margin: 0 0 0 -60px;
  padding: 0 0 0 44px;
  font-size: 16px;
  line-height: 34px;
  background-color: #ef6a00;
  color: currentColor;
  border: none;
  border-radius: 22px;
  cursor: pointer;
  font-weight: bold;
  text-align: left;
  user-select: none;
  background-color: hsl(from var(--base-color) h s l / 0.18);
  background-image: radial-gradient(
    circle closest-side at 50% 50%,
    var(--base-color) min(96%, 10em),
    transparent
  );
  background-position: 11px center;
  background-size: 22px 22px;
  background-repeat: no-repeat;
  opacity: 0;
  visibility: hidden;
  filter: blur(10px);
  transition:
    filter 0.3s 1s linear,
    opacity 0.3s 1s linear,
    visibility 0.3s 1s linear,
    background-color 1s linear;
  overflow: hidden;
}

.loaded .btn {
  opacity: 1;
  visibility: visible;
  filter: blur(0);
}

.btn::before,
.btn::after {
  position: absolute;
  top: 50%;
  content: "";
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.3s;
}

.btn::before {
  left: 16px;
  width: 12px;
  height: 2px;
  margin: -1px 0 0;
}

.btn::after {
  left: 21px;
  width: 2px;
  height: 12px;
  margin: -6px 0 0;
}

.activated .btn {
  position: absolute;
}

.activated .btn::before,
.activated .btn::after {
  transform: rotate(45deg);
}
