 :root {
     /* Layout */
     --pd: clamp(20px, 1vw, 50px);
     --p2: calc(var(--pd) * 2);
     /* --sidebar-width: calc(280px + var(--p2)); */
     --sidebar-width: 20px;


     /* Colors */
     --fg: #ffffff;
     --bg: #18011d;
     --text: white;
     --accent: #c78189;
     --muted: #aaa;
     --card-bg: #eee8e7;
     --card-bg-strong: #dbcecd;
     --purple: darkmagenta;
 }

 .dark {
     --fg: #f2f1ec;
     --bg: #171717;
     --accent: #c78189;
     --muted: #aaaaaa;
     --card-bg: #2d272d;
     --card-bg-strong: #211d21;
 }

 /* Selection */
 ::selection {
     color: var(--fg);
     background-color: var(--purple);
 }

 /* Reset */
 * {
     margin: 0;
     padding: 0;
     box-sizing: border-box;
     color: inherit;
     font-style: inherit;
     line-height: inherit;
 }

 html,
 body {
     width: 100%;
     height: 100%;
     position: relative;

     text-rendering: optimizeLegibility;
     line-height: 1.5;
     font-size: 16px;
     font-weight: 400;
     font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

     color: var(--fg);
     background-color: var(--bg);
 }

 /* Simple helpers */
 .mono {
     font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
         "Courier New", monospace;
 }

 .grey {
     color: var(--muted);
 }

 .gap>*:not(:last-child) {
     margin-bottom: 1.5rem;
 }

 /* Basic elements */
 ul {
     list-style: none;
 }

 article.project ul {
     list-style: disc;
     margin-left: 1.5rem;
     /* indent */
     padding-left: 0;
 }

 a {
     line-height: inherit;
     text-decoration: none;
     color: var(--text);
 }

 a:hover {
     text-decoration-line: underline;
     text-decoration-color: var(--purple);
     text-decoration-thickness: 0.12em;
     text-underline-offset: 0.18em;
     background-color: transparent;
 }

 a.nu {
     text-decoration: none;
 }

 img {
     width: 100%;
     display: block;
     box-sizing: border-box;
 }

 video {
     width: 100%;
     display: block;
     box-sizing: border-box;
 }

 img.cover {
     width: 100%;
     height: 100%;
     object-fit: cover;
 }

 .hover:hover {
     opacity: 0.85;
 }



 .link-with-icon::after {
     content: "";
     display: inline-block;
     width: 0.9em;
     height: 0.9em;
     margin-left: 0.25em;
     /* This is the icon color, can also be currentColor */
     background-color: var(--purple);
     /* Use the SVG as a mask */
     -webkit-mask-image: url("/assets/icons/link_icon.svg");
     mask-image: url("/assets/icons/link_icon.svg");


     -webkit-mask-repeat: no-repeat;
     mask-repeat: no-repeat;

     -webkit-mask-position: center;
     mask-position: center;

     -webkit-mask-size: contain;
     mask-size: contain;
 }

 .back-nav::before {
     content: "";
     display: inline-block;
     width: 0.9em;
     height: 0.9em;
     margin-right: 0.25em;
     /* This is the icon color, can also be currentColor */
     background-color: var(--purple);
     /* Use the SVG as a mask */
     -webkit-mask-image: url("/assets/icons/arrow-left-square.svg");
     mask-image: url("/assets/icons/arrow-left-square.svg");

     -webkit-mask-repeat: no-repeat;
     mask-repeat: no-repeat;

     -webkit-mask-position: center;
     mask-position: center;

     -webkit-mask-size: contain;
     mask-size: contain;
 }


 /* Typography */
 h1,
 h2,
 h3 {
     font-weight: 500;
 }

 h1 {
     font-size: 2.4rem;
 }

 h2 {
     font-size: 1.6rem;
 }

 p+p {
     margin-top: 0.8rem;
 }

 /* Individual project page styling */
 main>article.project p {
     font-size: 1.2rem;
 }

 main>article.project p {
     font-size: 1.2rem;
 }

 main>article.project h2 {
     font-size: 1.8rem;
     /* larger than h2 on listing page */
 }

 main>article.project h3 {
     font-size: 1.4rem;
     /* larger than body text */
 }

 main>article.project ul li {
     font-size: 1.2rem;
 }

 /* Layout: header, main, footer */
 header {
     padding: var(--pd);
 }

 #site-title a {
     font-size: 1.4rem;
     font-weight: 600;
     padding-bottom: 12px;
 }

 header nav {
     display: flex;
     flex-wrap: wrap;
     gap: 1.5rem;
     margin-top: 1.5rem;
 }

 header nav ul {
     display: flex;
     flex-wrap: wrap;
     gap: 1rem;
 }

 main>* {
     max-width: 900px;
 }

 /* allow wider grid */
 main>.works {
     max-width: 1200px;
 }

 main {
     position: relative;
     padding: var(--pd);
     padding-bottom: 20vh;
 }

 main>* {
     max-width: 700px;
 }

 /* Project grid */
 .works {
     margin-top: 2rem;
     display: grid;
     gap: 40px 20px;
     grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
 }

 .project {
     padding-bottom: 1rem;
     border-bottom: 1px solid var(--card-bg);
 }

 .project>*:not(:last-child) {
     margin-bottom: 0.5rem;
 }

 .project-image {
     aspect-ratio: 1.7 / 1;
     margin-bottom: 1.4rem;
     overflow: hidden;
     width: 100%;
 }

 /* Code styling (for markdown inline `code` and ``` fenced blocks) */
 code {
     font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
     font-size: 0.95em;
     background-color: color-mix(in srgb, var(--card-bg) 70%, var(--bg) 30%);
     padding: 0.15em 0.35em;
     border-radius: 4px;
     border: 1px solid color-mix(in srgb, var(--card-bg-strong) 60%, var(--bg) 40%);
 }

 pre {
     margin: 1.5rem 0;
     padding: 1rem 1.25rem;
     border-radius: 8px;
     border: 1px solid color-mix(in srgb, var(--card-bg) 60%, var(--bg) 40%);
     overflow-x: auto;
     font-size: 0.9rem;
     line-height: 1.5;
 }

 pre code {
     background: none;
     border: none;
     padding: 0;
     font-size: 0.95em;
     white-space: pre;
 }

 /* Let the grid stretch wider than the text */
 main>.works {
     max-width: none;
 }

 footer {
     padding: var(--pd);
 }

 .footer-top {
     display: flex;
     align-items: center;
     gap: 1rem;
     margin-bottom: 1.5rem;
 }

 footer nav ul {
     display: flex;
     flex-wrap: wrap;
     gap: 1rem;
     margin-bottom: 1rem;
 }

 /* Theme toggle */
 #theme-toggle {
     width: 1.3rem;
     height: 1.3rem;
     background-color: var(--fg);
     border-radius: 50%;
     cursor: pointer;
 }

 /* Mobile layout */
 @media (width < 1100px) {
     .works {
         grid-template-columns: 1fr;
         gap: 30px 0;
     }

     .project-image {
         width: 100%;
         max-width: 100%;
     }

     main {
         overflow-x: hidden;
     }
 }

 /* Desktop layout */
 @media (width >=1100px) {
     header {
         position: fixed;
         top: 0;
         left: 0;
         width: var(--sidebar-width);
     }

     main {
         margin-left: var(--sidebar-width);
     }

     footer {
         position: fixed;
         left: 0;
         bottom: 0;
         width: var(--sidebar-width);
     }

     header,
     footer {
         padding-inline: var(--pd);
     }
 }