/* Foundations and typography */
:root {
  color-scheme: light dark;
  --bg: light-dark(#f6f5ef, #161d1b);
  --ink: light-dark(#182c28, #f4f3e9);
  --sub: light-dark(#415751, #bdcfc5);
  --accent: light-dark(#245b50, #a7d7bb);
  --panel: light-dark(#e4eae2, #263630);
  --rule: light-dark(#bcc9bd, #50645b);
  --art: light-dark(#d2e6c7, #a6c8a3);
}
:root[data-theme="light"] {
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    17px/1.55 "Avenir Next",
    Avenir,
    Arial,
    sans-serif;
}
a {
  color: inherit;
  text-underline-offset: 5px;
}
a:hover {
  color: var(--accent);
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
header.compact + main .resume-block:target:focus,
header.compact + main:target:focus {
  outline: none;
}
.skip {
  position: absolute;
  left: 8px;
  top: -90px;
  background: var(--bg);
  padding: 10px;
}
.skip:focus {
  top: 8px;
  z-index: 4;
}
.shell {
  max-width: 1160px;
  margin: auto;
  padding: 0 clamp(20px, 5vw, 68px);
}
header,
nav,
.actions,
.cap {
  display: flex;
  align-items: center;
  gap: 24px;
}
header {
  justify-content: space-between;
  padding: 20px 0;
}
.brand {
  font-weight: 750;
  text-decoration: none;
}
.mark {
  display: inline-grid;
  place-items: center;
  background: var(--ink);
  color: var(--bg);
  height: 38px;
  width: 42px;
  margin-right: 8px;
  letter-spacing: -2px;
  font:
    italic bold 21px Georgia,
    serif;
}
nav a,
button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
nav a {
  text-decoration: none;
}
button {
  background: var(--panel);
  color: var(--ink);
  border: 0;
  border-radius: 30px;
  padding: 0 16px;
  font: inherit;
  cursor: pointer;
  gap: 8px;
}
button[hidden] {
  display: none;
}
.dot {
  border: 2px solid currentColor;
  border-radius: 50%;
  height: 16px;
  width: 16px;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}
.hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
  gap: 6%;
  padding: clamp(40px, 7vw, 90px) 0;
}
.hero h1,
h2,
h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1.05;
  margin: 0;
}
.hero h1 {
  font-size: clamp(58px, 7.6vw, 106px);
}
.role {
  color: var(--accent);
  font-weight: 650;
  margin: 14px 0 30px;
}
.lead {
  max-width: 43ch;
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.45;
}
.actions {
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 28px;
}
.primary {
  background: var(--ink);
  color: var(--bg);
  padding: 12px 20px;
  text-decoration: none;
}
.primary:hover {
  color: var(--bg);
  transform: translateY(-2px);
}
.print {
  margin: 0;
  background: var(--art);
  color: #183e34;
  overflow: hidden;
}
.print svg {
  display: block;
  width: 100%;
  height: auto;
}
.cap {
  justify-content: space-between;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 650;
}
.work,
.experience,
.skills,
footer {
  padding: clamp(35px, 6vw, 72px) 0;
}
.work {
  border-block: 1px solid var(--rule);
}
h2 {
  font-size: clamp(35px, 4.6vw, 58px);
  margin-bottom: 28px;
}
.feature {
  background: var(--panel);
  padding: clamp(22px, 4vw, 48px);
  display: grid;
  grid-template-columns: 1fr 1.65fr;
  align-items: center;
  gap: 30px;
}
.figure {
  font:
    normal clamp(60px, 8vw, 100px)/1 Georgia,
    serif;
  letter-spacing: -0.07em;
}
.figure small {
  display: block;
  font:
    16px/1.5 "Avenir Next",
    Arial,
    sans-serif;
  letter-spacing: 0;
  margin-top: 10px;
  color: var(--sub);
}
h3 {
  font-size: clamp(26px, 3vw, 36px);
}
p {
  margin: 12px 0;
}
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6%;
  padding-top: 32px;
}
.pair p,
.feature p {
  max-width: 52ch;
}
.who {
  font-weight: 650;
  color: var(--accent);
  margin: 0 0 8px;
}
.row {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 20px;
  border-top: 1px solid var(--rule);
  padding: 17px 0;
}
.row span {
  color: var(--sub);
}
.skills {
  padding-top: 0;
}
.skills p {
  max-width: 68ch;
}
footer {
  border-top: 1px solid var(--rule);
}
footer h2 {
  margin-bottom: 14px;
}
footer a {
  font-size: clamp(20px, 3vw, 32px);
}
@media (max-width: 700px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .print {
    margin-top: 32px;
    max-width: 440px;
  }
  .feature,
  .pair {
    grid-template-columns: 1fr;
  }
  .pair {
    gap: 24px;
  }
  .row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  nav {
    gap: 12px;
  }
  header {
    align-items: flex-start;
  }
  .brand .word {
    display: none;
  }
  .cap {
    gap: 10px;
  }
  .hero h1 {
    font-size: clamp(47px, 11vw, 72px);
  }
}
@media (prefers-reduced-motion: no-preference) {
  @keyframes settle {
    from {
      transform: translateY(8px);
      opacity: 0.6;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  @keyframes sheet {
    from {
      transform: translateY(10px);
    }
    to {
      transform: translateY(0);
    }
  }
  .hero h1,
  .hero .lead {
    animation: settle 0.55s ease-out both;
  }
  .layer {
    animation: sheet 0.8s ease-out both;
    animation-delay: var(--delay, 0s);
  }
  .primary,
  nav a {
    transition:
      transform 0.18s ease,
      color 0.18s ease;
  }
  .print:hover .folio {
    transform: translateY(-4px);
  }
  .folio {
    transition: transform 0.35s ease;
  }
}
@media (max-width: 380px) {
  header {
    gap: 6px;
  }
  nav {
    gap: 8px;
    font-size: 15px;
  }
  .mark {
    margin-right: 0;
    width: 32px;
  }
  button {
    padding: 0 10px;
  }
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero h1 {
    font-size: 44px;
  }
  .cap {
    flex-wrap: wrap;
  }
}

/* Portfolio palette and headings */
:root {
  --bg: light-dark(#faf8ff, #08070b);
  --ink: light-dark(#20192a, #faf8ff);
  --sub: light-dark(#54475f, #d6cbe2);
  --accent: light-dark(#6727bc, #bd90ff);
  --panel: light-dark(#eee7f7, #231d2c);
  --rule: light-dark(#ccc0d8, #41364b);
}
.hero h1,
h2,
h3 {
  font-family: Arial, sans-serif;
  font-weight: 750;
  letter-spacing: -0.055em;
}
.hero h1 {
  font-size: clamp(50px, 7vw, 94px);
}
.role {
  font-size: clamp(22px, 3vw, 36px);
  line-height: 1.15;
}
.primary {
  background: var(--accent);
  color: var(--bg);
}
.print {
  aspect-ratio: 1.12;
  background: var(--panel);
  display: grid;
  place-items: center;
  align-content: center;
}
.initials {
  font:
    bold clamp(94px, 14vw, 178px)/1 Arial,
    sans-serif;
  letter-spacing: -0.12em;
  padding-right: 0.12em;
  color: var(--accent);
  transform: rotate(-7deg);
}
.cap {
  color: var(--sub);
}
.band {
  background: #6828b5;
  color: white;
  text-align: center;
  padding: 16px;
  font-weight: bold;
  word-spacing: 0.12em;
}
.work {
  border: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .initials {
    animation: settle 0.65s ease-out;
  }
}
@media (max-width: 700px) {
  .hero {
    row-gap: 18px;
  }
  .print {
    margin: 0;
    aspect-ratio: 2.4;
  }
  .initials {
    font-size: 84px;
  }
}

/* Main headings in System, Light, and Dark. */
@font-face {
  font-family: "Engebrechtre";
  src: url("fonts/Engebrechtre-Bold.otf") format("opentype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root:not([data-theme="christmas"]) :is(h1, .resume-block > h2) {
  font-family: "Engebrechtre", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: normal;
}

/* Christmas display headings. */
@font-face {
  font-family: "Wonderia";
  src: url("fonts/Wonderia.otf");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root[data-theme="christmas"] :is(h1, .resume-block > h2) {
  font-family: "Wonderia", Georgia, serif;
  font-weight: 400;
  letter-spacing: normal;
}

/* Device frame and screen */
body {
  min-height: 100svh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 50% 42%, #fcfbff99, transparent 85%),
    light-dark(#aaa7b3, #706c7b);
}
.laptop {
  position: relative;
  width: min(82vw, 1120px, 132svh);
  margin: 30px auto 55px;
  background: #101012;
  border: 2px solid #abaeb4;
  border-radius: 25px 25px 10px 10px;
  padding: 17px 17px 24px;
  box-shadow:
    0 2px 0 #55565c,
    inset 0 0 0 2px #363639;
}
.laptop:before {
  content: "";
  position: absolute;
  top: 5px;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #223142;
  box-shadow: inset 0 0 2px black;
}
.shell {
  background: var(--bg);
  width: 100%;
  height: auto;
  aspect-ratio: 16/10;
  overflow: auto;
  padding: 0 clamp(17px, 3vw, 44px);
  scrollbar-width: thin;
  position: relative;
}
.base {
  position: absolute;
  width: 119%;
  height: auto;
  top: 100%;
  left: -9.5%;
  filter: drop-shadow(0 10px 6px #55545c70);
}
.hero {
  padding: 22px 0 32px;
  grid-template-columns: 1.4fr 0.8fr;
}
.hero h1 {
  font-size: clamp(40px, 5vw, 76px);
}
.role {
  font-size: clamp(20px, 2.1vw, 32px);
  margin: 8px 0 16px;
}
.hero .lead {
  font-size: clamp(17px, 1.5vw, 22px);
}
.print {
  aspect-ratio: 1.2;
}
.work {
  padding-top: 32px;
}
@media (max-width: 700px) {
  .laptop {
    width: 94%;
    padding: 12px 12px 20px;
    border-radius: 14px;
    margin: 12px auto 28px;
  }
  .base {
    width: 106%;
    left: -3%;
  }
  .shell {
    aspect-ratio: auto;
    max-height: 85svh;
  }
  .hero {
    grid-template-columns: 1fr;
  }
  .print {
    display: none;
  }
  .band {
    font-size: 15px;
  }
}

/* Portrait */
.portrait {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}
@media (max-width: 700px) {
  .portrait {
    width: min(48%, 160px);
    justify-self: start;
  }
}

/* Résumé sections and responsive layout */
header {
  flex-wrap: wrap;
  gap: 8px;
}
header nav {
  width: 100%;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: 16px;
}
.brand {
  margin-right: auto;
}
header nav a {
  text-decoration: underline;
}
.hero .lead {
  max-width: 64ch;
  font-size: 18px;
}
.resume-block {
  padding: 40px 0;
  scroll-margin-top: 16px;
}
.resume-block {
  border-top: 1px solid var(--rule);
}
.resume-block h2 {
  font-size: clamp(28px, 4vw, 48px);
}
.resume-block h3 {
  font-size: clamp(22px, 3vw, 32px);
}
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding: 0;
  list-style: none;
}
.skill-tags li {
  margin: 0;
  padding: 0.15em 0.5em;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.875rem;
}
article + article {
  margin-top: 32px;
}
li {
  margin: 8px 0;
  max-width: 75ch;
}
ul {
  padding-left: 1.3em;
}
dt {
  font-weight: bold;
  color: var(--accent);
}
dd {
  margin: 3px 0 19px;
  max-width: 76ch;
}
fieldset {
  border: 0;
  padding: 0;
  max-width: 32em;
}
label {
  display: block;
  margin-bottom: 12px;
}
input,
textarea {
  display: block;
  width: 100%;
  padding: 0.65em;
  font: inherit;
  border: 2px solid var(--sub);
  border-radius: 5px;
  background-color: var(--panel);
  color: var(--ink);
  opacity: 1;
  appearance: none;
}
#contact-me {
  min-height: 90%;
}
@media (prefers-reduced-motion: no-preference) {
  .shell {
    scroll-behavior: smooth;
  }
}
@media (max-width: 1024px) {
  .laptop {
    width: min(92vw, 800px);
    padding: 14px;
    border-radius: 30px;
    margin: 12px auto;
  }
  .base {
    display: none;
  }
  .shell {
    aspect-ratio: auto;
    height: 88svh;
    max-height: none;
    border-radius: 15px;
  }
}
@media (max-width: 600px) {
  .laptop {
    width: min(96vw, 455px);
    padding: 9px;
    border-radius: 38px;
  }
  .laptop:before {
    display: none;
  }
  .shell {
    height: 93svh;
    border-radius: 29px;
    padding: 0 16px;
  }
  .laptop:after {
    content: "";
    position: absolute;
    bottom: 3px;
    left: 38%;
    width: 24%;
    height: 3px;
    border-radius: 4px;
    background: #888;
  }
  .hero {
    grid-template-columns: 1fr;
  }
  .portrait {
    width: 125px;
  }
  nav a {
    min-height: 44px;
  }
  header nav {
    column-gap: 14px;
    font-size: 15px;
  }
}

/* Sticky navigation and theme controls */
header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg);
  align-items: center;
  flex-wrap: nowrap;
  padding: 8px 0;
  gap: 12px;
}
header nav {
  min-width: 0;
  width: auto;
  flex: 1;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 4px;
}
header nav a {
  flex: none;
}
#theme:not([hidden]) {
  display: flex;
  flex: none;
  background: var(--panel);
  border-radius: 24px;
}
#theme button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
}
#theme button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}
#theme svg {
  width: 20px;
  height: 20px;
}
.shell {
  scroll-padding-top: 76px;
}

/* Active section and synchronized color transitions */
@property --screen-color {
  syntax: "<color>";
  inherits: true;
  initial-value: #faf8ff;
}
.shell {
  --screen-color: var(--bg);
  background-color: var(--screen-color);
}
header {
  background-color: var(--screen-color);
}
header nav {
  position: relative;
}
header nav a {
  text-decoration: none;
}
header nav a[aria-current] {
  color: var(--accent);
}
header nav::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 3px;
  height: 3px;
  pointer-events: none;
  background: var(--accent);
  width: var(--line-w, 0px);
  transform: translateX(var(--line-x, 0px));
  border-radius: 3px;
}
@media (prefers-reduced-motion: no-preference) {
  .shell {
    transition: --screen-color 260ms ease-in-out;
  }
  body,
  #theme,
  #theme button,
  .role,
  .who,
  dt,
  .resume-block {
    transition:
      background-color 260ms ease-in-out,
      color 260ms ease-in-out,
      border-color 260ms ease-in-out;
  }
  header nav::after {
    transition:
      transform 220ms ease,
      width 220ms ease;
  }
}

#mobile-menu {
  display: contents;
}
#menu-toggle {
  display: none;
}
header:not(.compact) > h1 {
  display: none;
}
header.compact #menu-toggle:not([hidden]) {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  height: 44px;
  margin-inline-start: auto;
  padding: 0;
  background: transparent;
  color: var(--ink);
  border: none;
  cursor: pointer;
}
header.compact h1 {
  font-size: clamp(26px, 8vw, 40px);
  line-height: 1.1;
  margin: 0;
}
header.compact:has(#menu-toggle:not([hidden])) + main .hero {
  padding-top: 0;
}
header.compact #menu-toggle:not([hidden]) + #mobile-menu {
  display: none;
}
header.compact #menu-toggle[aria-expanded="true"] + #mobile-menu {
  display: grid;
  position: absolute;
  inset: 100% 0 auto;
  max-height: 60svh;
  overflow: auto;
  padding: 8px 12px 16px;
  gap: 12px;
  background: var(--screen-color);
  box-shadow:
    inset 0 -2px color-mix(in srgb, var(--ink) 45%, var(--screen-color)),
    0 6px 12px #0002;
}
header.compact #menu-toggle[aria-expanded="true"] + #mobile-menu nav {
  display: grid;
  gap: 0;
  padding: 0;
  white-space: normal;
}
header.compact #mobile-menu nav::after {
  display: none;
}
header.compact #mobile-menu nav a[aria-current] {
  text-decoration: underline;
}
header.compact #mobile-menu #theme {
  justify-self: start;
}

/* Wrap the introduction around its portrait in compact navigation mode. */
header.compact + main .hero {
  grid-template-columns: minmax(0, 1fr);
}
.hero .lead:has(> .portrait) {
  display: flow-root;
  max-width: none;
}
.lead > .portrait {
  float: right;
  width: 32%;
  margin: 0 0 0.4em 0.75em;
}

/* Christmas palette */
:root[data-theme="christmas"] {
  color-scheme: dark;
  --bg: #102c25;
  --ink: #fff5df;
  --sub: #d5e2cf;
  --accent: #f2ce80;
  --panel: #26483e;
  --rule: #577568;
}
:root[data-theme="christmas"] body {
  background-color: #862536;
}
:root[data-theme="christmas"] #theme button[aria-pressed="true"] {
  background: #932e42;
  color: #fff5df;
}

/* Christmas headings and Santa hat */
[data-theme="christmas"] :is(.resume-block > h2, h1) {
  color: #ff0000;
}
[data-theme="christmas"] :is(.role, h3, .who, dt) {
  color: #00ff00;
}
.santa-hat {
  display: none;
}
[data-theme="christmas"] .santa-hat {
  display: block;
  position: absolute;
  right: max(calc(-7% - 8px), calc(50% - 50vw));
  top: 0;
  width: clamp(95px, 16vw, 208px);
  /* Seat the middle of the sloped white brim on the top bezel. */
  transform: translateY(calc(-65% + 4px));
  z-index: 4;
  pointer-events: none;
  filter: drop-shadow(0 3px 2px #290c163e);
}
[data-theme="christmas"] #theme {
  margin-right: clamp(8px, 2vw, 26px);
}
@media (max-width: 600px) {
  [data-theme="christmas"] .santa-hat {
    right: -2vw;
  }
  [data-theme="christmas"] #theme {
    margin-right: 0;
  }
  [data-theme="christmas"] header {
    padding-top: 26px;
  }
}
