/* Moods: every colour on the site comes from these tokens */
:root {
  --ground: #fff6e6;
  --ink: #4a2b1d;
  --c1: #ffc93c;
  --c2: #ff7aa2;
  --c3: #5ec8f2;
  --c4: #3ec28f;
  --field: var(--c1);
  --card: #fffdf8;
  --on: #2b1d2e;   /* text on bright colour, same in every mood */
  --line: #2b1d2e; /* outlines of drawings */
  --radius: 999px;
  --margin: clamp(16px, 4vw, 48px);
  --ease: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}
:root[data-mood="sweet"] {
  --ground: #fff0f4; --ink: #5a1f38;
  --c1: #ff8fb1; --c2: #ffc93c; --c3: #7fd6f0; --c4: #ffb38a;
  --card: #fffafb;
}
:root[data-mood="chill"] {
  --ground: #eef7ff; --ink: #15344d;
  --c1: #6cc7f2; --c2: #ffd166; --c3: #ff9fb8; --c4: #5fd3a8;
  --card: #fbfdff;
}
:root[data-mood="fresh"] {
  --ground: #edfbf2; --ink: #143a2b;
  --c1: #46c98f; --c2: #ff8a65; --c3: #ffd166; --c4: #6cc7f2;
  --card: #fbfffc;
}
:root[data-mood="sleepy"] {
  --ground: #1d1934; --ink: #fff3df;
  --c1: #ffd166; --c2: #ff8fb1; --c3: #6cc7f2; --c4: #5fd3a8;
  --field: #2c2652; --card: #2c2652;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }
/* clip, not hidden: the tilted marquee is wider than the screen, and iOS Safari ignores overflow on body alone */
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  background: var(--ground);
  color: var(--ink);
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 19px;
  line-height: 1.55;
  overflow-x: clip;
  transition: background-color .5s, color .5s;
}
::selection { background: var(--c2); color: var(--on); }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; border-radius: 8px; }
.swapping *, .swapping body { transition: none !important; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* Nav */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px var(--margin);
}
.logo { font-weight: 700; font-size: 42px; text-decoration: none; letter-spacing: -0.02em; }
.logo span { display: inline-block; transition: transform .4s var(--ease); }
.logo:hover span { transform: rotate(-14deg) scale(1.2); }
.nav ul { display: flex; gap: 28px; list-style: none; padding: 0; }
.nav ul a { text-decoration: none; font-weight: 500; }
.nav ul a:hover, .nav ul a[aria-current] { text-decoration: underline wavy var(--c2); text-underline-offset: 6px; }
/* Phone menu button: two bars that turn into a cross */
.menu-toggle {
  display: none; position: relative; width: 52px; height: 52px; flex: none;
  border-radius: 50%; border: 3px solid var(--ink); background: transparent; cursor: pointer;
  transition: transform .3s var(--ease), background-color .2s;
}
.menu-toggle:active { transform: scale(.92); }
.menu-toggle i {
  position: absolute; left: 12px; right: 12px; height: 3px; border-radius: 3px; background: var(--ink);
  transition: transform .35s var(--ease), top .35s var(--ease), background-color .2s;
}
.menu-toggle i:first-child { top: 16px; }
.menu-toggle i:last-child { top: 26px; }
.nav.open .menu-toggle { background: var(--ink); }
.nav.open .menu-toggle i { top: 21px; background: var(--ground); }
.nav.open .menu-toggle i:first-child { transform: rotate(45deg); }
.nav.open .menu-toggle i:last-child { transform: rotate(-45deg); }
@keyframes menu-in { from { opacity: 0; transform: translateY(14px) rotate(-3deg); } }

.btn {
  display: inline-block; background: var(--ink); color: var(--ground);
  padding: 14px 28px; border-radius: var(--radius);
  text-decoration: none; border: 0; font: inherit; font-weight: 600; cursor: pointer;
  transition: transform .3s var(--ease), background-color .2s, color .2s;
}
.btn:hover { transform: translateY(-3px) rotate(-2deg); background: var(--c2); color: var(--on); }
.btn:active { transform: scale(.95); }

/* Hero */
.hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: center;
  padding: 40px var(--margin) 120px; min-height: calc(100svh - 84px);
}
.hero h1 {
  font-size: clamp(64px, 9.5vw, 156px); line-height: .92; letter-spacing: -0.02em; font-weight: 700;
}
.hero h1 .wave { display: inline-block; transform-origin: 70% 80%; animation: wave 2.4s infinite; }
@keyframes wave { 0%,60%,100% { transform: rotate(0) } 10%,30% { transform: rotate(14deg) } 20%,40% { transform: rotate(-8deg) } }
.hero p.lead { font-size: clamp(21px, 2vw, 26px); max-width: 30ch; margin: 36px 0 32px; }

/* Mood picker */
.mood { margin-top: 40px; }
.mood-label { font-weight: 600; margin-bottom: 12px; }
.mood-row { display: flex; gap: 10px; flex-wrap: wrap; }
.mood button {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 18px 9px 10px; border-radius: var(--radius);
  border: 3px solid var(--ink); background: transparent; color: var(--ink);
  font: inherit; font-size: 17px; font-weight: 500; cursor: pointer;
  transition: transform .3s var(--ease), background-color .2s, color .2s;
}
.mood button i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); }
.mood button:hover { transform: translateY(-3px) rotate(-3deg); }
.mood button:active { transform: scale(.94); }
.mood button[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.mood-status { margin-top: 14px; min-height: 1.6em; }

/* Small mood picker in the footer */
.mood-mini { display: flex; align-items: center; gap: 10px; }
.mood-mini span { font-weight: 500; margin-right: 4px; }
.mood-mini button {
  width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--ground); cursor: pointer;
  transition: transform .3s var(--ease);
}
.mood-mini button:hover { transform: scale(1.2) rotate(10deg); }
.mood-mini button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--ground); }

/* Joy */
.hero-art { position: relative; aspect-ratio: 1; width: 100%; max-width: 560px; justify-self: center; cursor: pointer; }
.joy { width: 100%; height: 100%; overflow: visible; display: block; }
.f1 { fill: var(--c1); } .f2 { fill: var(--c2); }
.f3 { fill: var(--c3); } .f4 { fill: var(--c4); }
.f1, .f2, .f3, .f4 { transition: fill .5s; }
.g { fill: #fffdf8; }
.ol { stroke: var(--line); stroke-width: 5; stroke-linejoin: round; stroke-linecap: round; }
.joy .hair { fill: #5a3424; }
.joy .skin { fill: #ffd9c0; }
.dark { fill: var(--line); }
.stroke { fill: none; stroke: var(--line); stroke-width: 6; stroke-linecap: round; }
.joy-body { transform-box: fill-box; transform-origin: 50% 100%; animation: bob 4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-1.5deg); } }
.ponytail { transform-box: view-box; transform-origin: 268px 130px; animation: sway 3s ease-in-out infinite; }
@keyframes sway { 50% { transform: rotate(5deg); } }
.hero-art.yay .ponytail { animation: swish .7s var(--ease); }
@keyframes swish { 40% { transform: rotate(-12deg); } }

.eyes-open ellipse { transform-box: fill-box; transform-origin: center; animation: blink 4.2s infinite; }
@keyframes blink { 0%,92%,100% { transform: scaleY(1) } 95% { transform: scaleY(.08) } }
/* Joy smiles wide every few seconds: open eyes + small smile swap for happy eyes + big smile */
.eyes-open, .m-small { animation: calm 6s infinite; }
.eyes-happy, .m-big { animation: grin 6s infinite; }
@keyframes calm { 0%,56%,92%,100% { opacity: 1 } 60%,88% { opacity: 0 } }
@keyframes grin { 0%,56%,92%,100% { opacity: 0 } 60%,88% { opacity: 1 } }
.hero-art:hover .eyes-open, .hero-art:hover .m-small, .hero-art.yay .eyes-open, .hero-art.yay .m-small { animation: none; opacity: 0; }
.hero-art:hover .eyes-happy, .hero-art:hover .m-big, .hero-art.yay .eyes-happy, .hero-art.yay .m-big { animation: none; opacity: 1; }
.hero-art.yay .joy-body { animation: hop .7s var(--ease); }
@keyframes hop { 40% { transform: translateY(-28px) rotate(4deg); } }
.eyes-sleep, .zzz { display: none; }
:root[data-mood="sleepy"] .eyes-open, :root[data-mood="sleepy"] .eyes-happy, :root[data-mood="sleepy"] .m-big { display: none; }
:root[data-mood="sleepy"] .m-small { animation: none; opacity: 1; }
:root[data-mood="sleepy"] .eyes-sleep { display: inline; }
:root[data-mood="sleepy"] .zzz { display: inline; }
.zzz text { font-family: "Fredoka", sans-serif; font-weight: 700; fill: var(--c3); animation: drift 3s ease-in-out infinite; }
.zzz text:nth-child(2) { animation-delay: -1s; } .zzz text:nth-child(3) { animation-delay: -2s; }
@keyframes drift { 0% { opacity: 0; transform: translate(0, 10px); } 50% { opacity: 1; } 100% { opacity: 0; transform: translate(14px, -24px); } }

.float { animation: float 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.float.b { animation-delay: -1.5s; animation-duration: 6s; }
.float.c { animation-delay: -3s; animation-duration: 4.5s; }
@keyframes float { 50% { transform: translateY(-14px) rotate(10deg); } }

/* Marquee */
.marquee { background: var(--ink); color: var(--ground); overflow: hidden; padding: 22px 0; transform: rotate(-2deg); margin: 0 -20px; transition: background-color .5s, color .5s; }
.marquee div { display: flex; gap: 48px; width: max-content; animation: slide 24s linear infinite; font-size: clamp(30px, 4vw, 54px); font-weight: 700; white-space: nowrap; }
.marquee span::after { content: "✺"; margin-left: 48px; color: var(--c1); }
@keyframes slide { to { transform: translateX(-50%); } }

section { padding: 160px var(--margin); }
h2 { font-size: clamp(46px, 6vw, 96px); line-height: .95; letter-spacing: -0.02em; font-weight: 700; margin-bottom: 48px; }

/* About */
.about { display: grid; grid-template-columns: 1fr 1fr; gap: 48px 64px; align-items: start; }
.about h2 { grid-column: 1 / -1; margin-bottom: 0; }
.about p { font-size: 22px; max-width: 34ch; }
.about p + p { margin-top: 20px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fact {
  padding: 28px; border-radius: 32px; font-weight: 500; color: var(--on);
  transition: transform .35s var(--ease), background-color .5s;
}
.fact:hover { transform: rotate(-3deg) scale(1.03); }
.fact strong { display: block; font-size: 60px; line-height: 1; font-weight: 700; margin-bottom: 8px; }
.fact:nth-child(1) { background: var(--c1); }
.fact:nth-child(2) { background: var(--c3); border-radius: 32px 32px 32px 4px; }
.fact:nth-child(3) { background: var(--c4); border-radius: 4px 32px 32px 32px; }
.fact:nth-child(4) { background: var(--c2); }

/* Work */
.work { background: var(--field); border-radius: 60px 60px 0 0; transition: background-color .5s; }
/* align-items: start lets each card hug its content instead of stretching to the row */
.projects { display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px; align-items: start; }
.project {
  background: var(--card); border-radius: 36px; padding: 28px; text-decoration: none;
  display: flex; flex-direction: column; gap: 14px;
  transition: transform .4s var(--ease), background-color .5s;
}
.project:hover { transform: translateY(-8px) rotate(-1.5deg); }
.project:nth-child(1) { grid-column: span 7; }
.project:nth-child(2) { grid-column: span 5; margin-top: 80px; }
.project:nth-child(3) { grid-column: span 5; }
.project:nth-child(4) { grid-column: span 7; margin-top: 80px; }
.project .thumb { aspect-ratio: 16/10; border-radius: 24px; overflow: hidden; }
.project .thumb svg { width: 100%; height: 100%; display: block; }
.project h3 { font-size: 34px; line-height: 1.05; font-weight: 600; }
.project p { max-width: 42ch; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; }.tags span { background: var(--ink); color: var(--ground); padding: 4px 14px; border-radius: var(--radius); font-size: 15px; font-weight: 500; }

/* Writing: post list used on Home and on the Blog page */
.writing { background: var(--ground); border-radius: 60px 60px 0 0; margin-top: -60px; position: relative; transition: background-color .5s; }
.writing-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 48px; }
.writing-head h2 { margin-bottom: 0; }
.posts { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.post-row {
  display: grid; grid-template-columns: 112px 1fr 60px; gap: 32px; align-items: center;
  padding: 24px 32px 24px 24px; border-radius: 40px; background: var(--card);
  text-decoration: none;
  transition: transform .4s var(--ease), background-color .3s, color .3s;
}
.post-row:hover { transform: translateX(8px) rotate(-.6deg); background: var(--c1); color: var(--on); }
.post-date {
  width: 112px; height: 112px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: var(--c2); color: var(--on); line-height: 1; font-weight: 500; font-size: 17px;
  transform: rotate(-6deg); transition: transform .4s var(--ease), background-color .5s;
}
.post-date b { display: block; font-size: 44px; font-weight: 700; margin-bottom: 4px; }
.posts li:nth-child(3n+2) .post-date { background: var(--c3); transform: rotate(5deg); }
.posts li:nth-child(3n+3) .post-date { background: var(--c4); transform: rotate(-3deg); }
.post-row:hover .post-date { transform: rotate(8deg) scale(1.06); }
.post-row h3 { font-size: clamp(26px, 2.6vw, 36px); line-height: 1.08; font-weight: 600; margin-bottom: 8px; }
.post-row p { max-width: 60ch; }
.post-row .meta { margin-top: 10px; font-size: 16px; font-weight: 500; }
.post-arrow {
  width: 60px; height: 60px; border-radius: 50%; border: 3px solid currentColor;
  display: grid; place-content: center; font-size: 26px; font-weight: 600;
  transition: transform .4s var(--ease);
}
.post-row:hover .post-arrow { transform: rotate(-45deg); }
.posts li[hidden] { display: none; }

/* Blog page */
.blog-hero {
  margin: 8px var(--margin) 0; padding: 72px clamp(24px, 5vw, 72px);
  background: var(--field); color: var(--ink); border-radius: 60px;
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center;
  transition: background-color .5s;
}
:root:not([data-mood="sleepy"]) .blog-hero { color: var(--on); }
.blog-hero h1 { font-size: clamp(64px, 9vw, 150px); line-height: .92; letter-spacing: -0.02em; font-weight: 700; }
.blog-hero p { font-size: clamp(21px, 2vw, 26px); max-width: 32ch; margin-top: 28px; }
.blog-hero svg { width: 100%; max-width: 380px; justify-self: center; overflow: visible; }
.blog-list { padding-top: 120px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 40px; }
.filters button {
  padding: 10px 22px; border-radius: var(--radius); border: 3px solid var(--ink);
  background: transparent; color: var(--ink); font: inherit; font-weight: 500; cursor: pointer;
  transition: transform .3s var(--ease), background-color .2s, color .2s;
}
.filters button:hover { transform: translateY(-3px) rotate(-2deg); }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--ground); }

/* A single post */
.post { padding: 40px var(--margin) 160px; }
.post-inner { max-width: 760px; margin: 0 auto; }
.back { display: inline-block; font-weight: 600; text-decoration: none; margin-bottom: 40px; transition: transform .3s var(--ease); }
.back:hover { transform: translateX(-6px); text-decoration: underline wavy var(--c2); text-underline-offset: 6px; }
.post h1 { font-size: clamp(48px, 6.4vw, 92px); line-height: .98; letter-spacing: -0.02em; font-weight: 700; }
.post-lead { font-size: clamp(22px, 2.2vw, 28px); margin-top: 28px; }
.post-meta { margin-top: 20px; font-weight: 500; font-size: 17px; }
.post-figure { margin: 56px 0; border-radius: 40px; overflow: hidden; aspect-ratio: 16/9; }
.post-figure svg { width: 100%; height: 100%; display: block; }
.post-body { font-size: 21px; line-height: 1.7; }
.post-body > * + * { margin-top: 24px; }
.post-body h2 { font-size: clamp(30px, 3.4vw, 42px); line-height: 1.05; margin: 64px 0 0; }
.post-body ul, .post-body ol { padding-left: 1.3em; }
.post-body li + li { margin-top: 10px; }
.post-body li::marker { color: var(--c2); font-weight: 700; }
.post-body blockquote {
  font-size: clamp(24px, 2.6vw, 32px); line-height: 1.3; font-weight: 500;
  background: var(--c1); color: var(--on); padding: 32px 36px; border-radius: 8px 40px 40px 40px;
  margin: 48px 0; transition: background-color .5s;
}
.post-body .prompt {
  background: var(--card); padding: 20px 26px; border-radius: 28px 28px 28px 6px;
  font-weight: 500; font-size: 19px; line-height: 1.55; transition: background-color .5s;
}
.post-body .prompt + .prompt { margin-top: 12px; }
.zones { display: grid; gap: 14px; }
.zone { padding: 26px 30px; border-radius: 32px; color: #2b1d2e; }
.zone h3 { font-size: 26px; font-weight: 700; line-height: 1.1; margin-bottom: 8px; }
.zone p { font-size: 19px; line-height: 1.55; }
/* fixed traffic-light colours: their meaning must not change with the mood */
.zone-green { background: #46c98f; }
.zone-yellow { background: #ffc93c; }
.zone-red { background: #ff7a6b; }
.post-body .post-sources { margin-top: 56px; font-size: 16px; line-height: 1.55; }
.post-end {
  margin-top: 80px; padding: 40px; border-radius: 40px; background: var(--card);
  display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap;
  transition: background-color .5s;
}
.post-end p { font-size: 24px; font-weight: 600; }

/* Contact */
.contact { text-align: center; }
.contact h2 { margin-bottom: 24px; }
.contact p { font-size: 22px; margin: 0 auto 40px; max-width: 36ch; }
.socials { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: 32px; }
.socials a { padding: 12px 22px; border: 3px solid var(--ink); border-radius: var(--radius); text-decoration: none; font-weight: 600; transition: transform .3s var(--ease), background-color .2s, color .2s; }
.socials a:hover { background: var(--c1); color: var(--on); transform: rotate(3deg); }

footer { padding: 32px var(--margin); background: var(--ink); color: var(--ground); transition: background-color .5s, color .5s; }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; font-size: 16px; }

/* Reveal */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s, transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

@media (max-width: 860px) {
  .nav { position: relative; gap: 12px; }
  .logo { margin-right: auto; }
  .nav nav { order: 3; }
  .nav > .btn { padding: 12px 20px; }
  .menu-toggle { display: block; }
  .nav ul {
    position: absolute; top: calc(100% - 4px); left: var(--margin); right: var(--margin); z-index: 50;
    flex-direction: column; gap: 2px; padding: 18px 28px;
    background: var(--ink); color: var(--ground); border-radius: 32px;
    opacity: 0; visibility: hidden; transform: translateY(-12px) scale(.97); transform-origin: top right;
    transition: opacity .2s, transform .3s var(--ease), visibility 0s .3s;
  }
  .nav.open ul { opacity: 1; visibility: visible; transform: none; transition: opacity .2s, transform .35s var(--ease); }
  .nav ul a { display: block; padding: 8px 0; font-size: 34px; font-weight: 600; line-height: 1.2; }
  .nav.open ul li { animation: menu-in .4s var(--ease) both; }
  .nav.open ul li:nth-child(2) { animation-delay: .05s; }
  .nav.open ul li:nth-child(3) { animation-delay: .1s; }
  .nav.open ul li:nth-child(4) { animation-delay: .15s; }
  /* without script the links simply show in a row under the logo */
  .no-js .nav { flex-wrap: wrap; }
  .no-js .menu-toggle { display: none; }
  .no-js .nav nav { flex-basis: 100%; }
  .no-js .nav ul { position: static; opacity: 1; visibility: visible; transform: none; flex-direction: row; flex-wrap: wrap; gap: 8px 20px; padding: 0; background: none; color: inherit; }
  .no-js .nav ul a { font-size: 19px; padding: 0; }
  .hero, .about, .blog-hero { grid-template-columns: 1fr; }
  .hero { min-height: auto; padding-bottom: 80px; }
  .hero-art { max-width: 360px; order: -1; }
  section { padding: 100px var(--margin); }
  .projects { grid-template-columns: 1fr; }
  .project:nth-child(n) { grid-column: auto; margin-top: 0; }
  .work, .writing { border-radius: 36px 36px 0 0; }
  .writing { margin-top: -36px; }
  .blog-hero { border-radius: 36px; padding: 48px 24px; }
  .blog-hero svg { max-width: 240px; }
  .blog-list { padding-top: 72px; }
  .post-row { grid-template-columns: 72px 1fr; gap: 18px; padding: 20px; border-radius: 32px; }
  .post-date { width: 72px; height: 72px; font-size: 14px; }
  .post-date b { font-size: 28px; }
  .post-arrow { display: none; }
  .post-figure { border-radius: 28px; margin: 40px 0; }
  .post-body { font-size: 19px; }
  .post-end { padding: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .eyes-happy, .m-big { opacity: 0; }
}
