@font-face {
  font-family: "Shantell Sans";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(shantell-sans.woff2) format("woff2");
}

/* Fallback scaled to Shantell's width so the swap causes no reflow */
@font-face {
  font-family: "Shantell Fallback";
  src:
    local("Arial"), local("Helvetica Neue"), local("Helvetica"),
    local("Roboto"), local("Liberation Sans");
  size-adjust: 111%;
}

:root {
  --ink: #2b2a27;
  --soft: #6c6960;
  --paper: #fbf9f4;
  --line: rgba(43, 42, 39, 0.28);
  --ray: #e3a53e;
  --star: #f1ede2;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ink: #ece8df;
  --soft: #9a958a;
  --paper: #1c1b18;
  --line: rgba(236, 232, 223, 0.28);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Shantell Sans", "Shantell Fallback", system-ui, sans-serif;
  font-weight: 400;
  font-size: 17px;
  line-height: 1.75;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

/* Faint paper grain so the flat fill reads like sketchbook stock */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.2;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

:root[data-theme="dark"] body::before {
  opacity: 0.12;
  mix-blend-mode: screen;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: 0 auto;
  padding: 17vh 28px;
}

a {
  position: relative;
  color: inherit;
  text-decoration: none;
  padding-bottom: 4px;
}

/* Hand-drawn wavy underline, themed via a mask so it follows the ink colour.
   The faint base wave is always there; a darker wave draws in on hover. */
a::before,
a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 5px;
  pointer-events: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='5'%3E%3Cpath d='M0 3 Q3 0 6 3 T12 3' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E")
    repeat-x left center / 12px 5px;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='5'%3E%3Cpath d='M0 3 Q3 0 6 3 T12 3' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E")
    repeat-x left center / 12px 5px;
}

a::before {
  width: 100%;
  background-color: var(--line);
}

a::after {
  width: 0;
  background-color: var(--ink);
  transition: width 0.35s ease;
}

a:hover::after {
  width: 100%;
}

.doodle {
  position: absolute;
  top: 12vh;
  right: -140px;
  height: 188px;
}

.avatar-desktop {
  display: block;
  height: 188px;
  width: auto;
}

.avatar-mobile {
  display: none;
  height: 80px;
  width: auto;
  aspect-ratio: 134 / 215;
  margin-bottom: 20px;
}

/* Dark-mode toggle: sun/moon doodle shown "through" the window frame */
.theme-toggle {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 6px;
  background: none;
  color: inherit;
  line-height: 0;
  cursor: pointer;
  border-radius: 10px;
}

.theme-toggle img {
  display: block;
  width: 38px;
  height: 38px;
  transition: transform 0.2s ease;
}

.theme-toggle:hover img {
  transform: rotate(-6deg) scale(1.08);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--line);
  outline-offset: 4px;
}

/* The sky behind the sun/moon, framed by the window pane: a sunburst by day,
   a scatter of stars by night, cross-fading as the theme flips. */
.theme-toggle .sky {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 76px;
  height: 76px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: -1;
}

/* Daytime: a ring of warm rays around the sun */
.theme-toggle .sky::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 0deg,
    var(--ray) 0deg 3deg,
    transparent 3deg 24deg
  );
  -webkit-mask-image: radial-gradient(
    closest-side,
    transparent 36%,
    #000 44%,
    #000 60%,
    transparent 80%
  );
  mask-image: radial-gradient(
    closest-side,
    transparent 36%,
    #000 44%,
    #000 60%,
    transparent 80%
  );
  opacity: 0.55;
  transition: opacity 0.4s ease;
  animation: sun-breathe 6s ease-in-out infinite;
}

/* Nighttime: a few twinkling stars scattered across the pane */
.theme-toggle .sky::after {
  content: "";
  position: absolute;
  top: 18px;
  left: 8px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--star);
  box-shadow:
    12px -10px 0 0 var(--star),
    50px -4px 0 -0.5px var(--star),
    60px 16px 0 0 var(--star),
    42px 42px 0 -0.5px var(--star),
    2px 28px 0 0.5px var(--star),
    22px 48px 0 -0.5px var(--star),
    54px 36px 0 0 var(--star);
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: twinkle 4s ease-in-out infinite;
}

:root[data-theme="dark"] .theme-toggle .sky::before {
  opacity: 0;
}

:root[data-theme="dark"] .theme-toggle .sky::after {
  opacity: 0.9;
}

@keyframes sun-breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.9;
  }
  50% {
    opacity: 0.4;
  }
}

/* The sky through the window: sun in light mode, moon in dark mode */
.theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}

/* Desktop: centered in the empty window frame above the cat */
.theme-toggle--window {
  position: absolute;
  top: 24%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Mobile: fixed in a convenient corner */
.theme-toggle--corner {
  display: none;
}

@media (max-width: 1040px) {
  .doodle {
    display: none;
  }
  .avatar-mobile {
    display: block;
  }
  .theme-toggle--corner {
    display: block;
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 10;
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .theme-toggle img {
    transition: none;
  }
  .theme-toggle .sky::before,
  .theme-toggle .sky::after {
    animation: none;
  }
  a::after {
    transition: none;
  }
}

.name {
  font-weight: 600;
  font-size: 30px;
  letter-spacing: -0.3px;
  margin: 0 0 26px;
}

.statement {
  font-size: 21px;
  line-height: 1.6;
  max-width: 34ch;
  margin: 0 0 18px;
}

.statement-sub {
  font-size: 18px;
  color: var(--soft);
  max-width: 40ch;
  margin: 0;
}

.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
  margin-top: 40px;
  font-size: 18px;
}

.contact-dot {
  color: var(--soft);
  margin: 0 12px;
}

@media (max-width: 520px) {
  .contact {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .contact-dot {
    display: none;
  }
}
